Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
6658e548
Commit
6658e548
authored
16 years ago
by
Koen Hillewaert
Browse files
Options
Downloads
Patches
Plain Diff
use intermediate incomplete mapping for internal faces as well (may have curved edges)
parent
e8546926
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Mesh/HighOrder.cpp
+134
-38
134 additions, 38 deletions
Mesh/HighOrder.cpp
with
134 additions
and
38 deletions
Mesh/HighOrder.cpp
+
134
−
38
View file @
6658e548
...
@@ -396,7 +396,8 @@ void getFaceVertices(GFace *gf,
...
@@ -396,7 +396,8 @@ void getFaceVertices(GFace *gf,
MElement
*
ele
,
MElement
*
ele
,
std
::
vector
<
MVertex
*>
&
vf
,
std
::
vector
<
MVertex
*>
&
vf
,
faceContainer
&
faceVertices
,
faceContainer
&
faceVertices
,
bool
linear
,
int
nPts
=
1
){
bool
linear
,
int
nPts
=
1
)
{
Double_Matrix
points
;
Double_Matrix
points
;
int
start
=
0
;
int
start
=
0
;
...
@@ -454,11 +455,21 @@ void getFaceVertices(GFace *gf,
...
@@ -454,11 +455,21 @@ void getFaceVertices(GFace *gf,
v
=
new
MVertex
(
pc
.
x
(),
pc
.
y
(),
pc
.
z
(),
gf
);
v
=
new
MVertex
(
pc
.
x
(),
pc
.
y
(),
pc
.
z
(),
gf
);
}
}
else
{
else
{
// SPoint3 pos;
// incomplete->pnt(t1,t2,0.,pos);
// double X(pos.x());
// double Y(pos.y());
// double Z(pos.z());
double
X
(
0
),
Y
(
0
),
Z
(
0
),
GUESS
[
2
]
=
{
0
,
0
};
double
X
(
0
),
Y
(
0
),
Z
(
0
),
GUESS
[
2
]
=
{
0
,
0
};
for
(
int
j
=
0
;
j
<
incomplete
->
getNumVertices
();
j
++
){
for
(
int
j
=
0
;
j
<
incomplete
->
getNumVertices
();
j
++
){
double
sf
;
incomplete
->
getShapeFunction
(
j
,
t1
,
t2
,
0
,
sf
);
double
sf
;
incomplete
->
getShapeFunction
(
j
,
t1
,
t2
,
0
,
sf
);
MVertex
*
vt
=
incomplete
->
getVertex
(
j
);
MVertex
*
vt
=
incomplete
->
getVertex
(
j
);
X
+=
sf
*
vt
->
x
();
X
+=
sf
*
vt
->
x
();
Y
+=
sf
*
vt
->
y
();
Y
+=
sf
*
vt
->
y
();
Z
+=
sf
*
vt
->
z
();
Z
+=
sf
*
vt
->
z
();
...
@@ -526,6 +537,7 @@ void getFaceVertices(GFace *gf,
...
@@ -526,6 +537,7 @@ void getFaceVertices(GFace *gf,
void
getFaceVertices
(
GFace
*
gf
,
MElement
*
ele
,
std
::
vector
<
MVertex
*>
&
vf
,
void
getFaceVertices
(
GFace
*
gf
,
MElement
*
ele
,
std
::
vector
<
MVertex
*>
&
vf
,
faceContainer
&
faceVertices
,
bool
linear
,
int
nPts
=
1
)
faceContainer
&
faceVertices
,
bool
linear
,
int
nPts
=
1
)
{
{
Double_Matrix
points
;
Double_Matrix
points
;
int
start
=
0
;
int
start
=
0
;
...
@@ -648,7 +660,7 @@ void reorientTrianglePoints(std::vector<MVertex*>& vtcs,int orientation,bool swa
...
@@ -648,7 +660,7 @@ void reorientTrianglePoints(std::vector<MVertex*>& vtcs,int orientation,bool swa
// for (int i=0;i<3;i++) tmp[(i+orientation)%3] = vtcs[i];
// for (int i=0;i<3;i++) tmp[(i+orientation)%3] = vtcs[i];
for
(
int
i
=
0
;
i
<
3
;
i
++
)
tmp
[
i
]
=
vtcs
[
(
i
+
orientation
)
%
3
];
for
(
int
i
=
0
;
i
<
3
;
i
++
)
tmp
[(
i
+
orientation
)
%
3
]
=
vtcs
[
i
]
;
// normal swap
// normal swap
...
@@ -669,9 +681,34 @@ void reorientTrianglePoints(std::vector<MVertex*>& vtcs,int orientation,bool swa
...
@@ -669,9 +681,34 @@ void reorientTrianglePoints(std::vector<MVertex*>& vtcs,int orientation,bool swa
// KH: check face orientation wrt element ...
// KH: check face orientation wrt element ...
void
getFaceVertices
(
GRegion
*
gr
,
MElement
*
ele
,
std
::
vector
<
MVertex
*>
&
vf
,
void
getFaceVertices
(
GRegion
*
gr
,
MElement
*
ele
,
std
::
vector
<
MVertex
*>
&
vf
,
faceContainer
&
faceVertices
,
bool
linear
,
int
nPts
=
1
)
faceContainer
&
faceVertices
,
edgeContainer
&
edgeVertices
,
bool
linear
,
int
nPts
=
1
)
{
{
Double_Matrix
points
;
int
start
=
0
;
switch
(
nPts
){
case
2
:
points
=
gmshFunctionSpaces
::
find
(
MSH_TRI_10
).
points
;
start
=
9
;
break
;
case
3
:
points
=
gmshFunctionSpaces
::
find
(
MSH_TRI_15
).
points
;
start
=
12
;
break
;
case
4
:
points
=
gmshFunctionSpaces
::
find
(
MSH_TRI_21
).
points
;
start
=
15
;
break
;
default
:
// do nothing (e.g. for quad faces)
break
;
}
for
(
int
i
=
0
;
i
<
ele
->
getNumFaces
();
i
++
){
for
(
int
i
=
0
;
i
<
ele
->
getNumFaces
();
i
++
){
MFace
face
=
ele
->
getFace
(
i
);
MFace
face
=
ele
->
getFace
(
i
);
// std::vector<MVertex*> p;
// std::vector<MVertex*> p;
...
@@ -696,31 +733,83 @@ void getFaceVertices(GRegion *gr, MElement *ele, std::vector<MVertex*> &vf,
...
@@ -696,31 +733,83 @@ void getFaceVertices(GRegion *gr, MElement *ele, std::vector<MVertex*> &vf,
vf
.
insert
(
vf
.
end
(),
vtcs
.
begin
(),
vtcs
.
end
());
vf
.
insert
(
vf
.
end
(),
vtcs
.
begin
(),
vtcs
.
end
());
}
}
else
{
else
{
std
::
vector
<
MVertex
*>&
vtcs
=
faceVertices
[
face
];
std
::
vector
<
MVertex
*>&
vtcs
=
faceVertices
[
face
];
if
(
face
.
getNumVertices
()
==
3
){
// triangles
if
(
face
.
getNumVertices
()
==
3
){
// triangles
for
(
int
j
=
0
;
j
<
nPts
;
j
++
){
for
(
int
k
=
0
;
k
<
nPts
-
j
-
1
;
k
++
){
// KH: inverted direction to stick with triangle vertex numbering
//
// 2
// | \
// 0 - 1
//
// double t1 = (double)(j + 1) / (nPts + 1);
// double t2 = (double)(k + 1) / (nPts + 1);
double
t1
=
(
double
)(
k
+
1
)
/
(
nPts
+
1
);
double
t2
=
(
double
)(
j
+
1
)
/
(
nPts
+
1
);
SPoint3
pc
=
face
.
interpolate
(
t1
,
t2
);
// construct incomplete element to take into account curved edges on surface boundaries
MVertex
*
v
=
new
MVertex
(
pc
.
x
(),
pc
.
y
(),
pc
.
z
(),
gr
);
// faceVertices[p].push_back(v);
std
::
vector
<
MVertex
*>
hoEdgeNodes
;
vtcs
.
push_back
(
v
);
gr
->
mesh_vertices
.
push_back
(
v
);
for
(
int
i
=
0
;
i
<
3
;
i
++
)
{
vf
.
push_back
(
v
);
MVertex
*
v0
=
face
.
getVertex
(
i
);
MVertex
*
v1
=
face
.
getVertex
((
i
+
1
)
%
3
);
edgeContainer
::
iterator
eIter
=
edgeVertices
.
find
(
std
::
pair
<
MVertex
*
,
MVertex
*>
(
std
::
min
(
v0
,
v1
),
std
::
max
(
v0
,
v1
)));
if
(
eIter
==
edgeVertices
.
end
())
{
printf
(
"Could not find ho nodes for an edge"
);
}
}
if
(
v0
==
eIter
->
first
.
first
)
hoEdgeNodes
.
insert
(
hoEdgeNodes
.
end
(),
eIter
->
second
.
begin
(),
eIter
->
second
.
end
());
else
hoEdgeNodes
.
insert
(
hoEdgeNodes
.
end
(),
eIter
->
second
.
rbegin
(),
eIter
->
second
.
rend
());
}
}
MTriangleN
incomplete
(
face
.
getVertex
(
0
),
face
.
getVertex
(
1
),
face
.
getVertex
(
2
),
hoEdgeNodes
,
nPts
+
1
);
double
X
(
0
),
Y
(
0
),
Z
(
0
);
for
(
int
k
=
start
;
k
<
points
.
size1
();
k
++
)
{
double
t1
=
points
(
k
,
0
);
double
t2
=
points
(
k
,
1
);
for
(
int
j
=
0
;
j
<
incomplete
.
getNumVertices
();
j
++
){
double
sf
;
incomplete
.
getShapeFunction
(
j
,
t1
,
t2
,
0
,
sf
);
MVertex
*
vt
=
incomplete
.
getVertex
(
j
);
X
+=
sf
*
vt
->
x
();
Y
+=
sf
*
vt
->
y
();
Z
+=
sf
*
vt
->
z
();
}
MVertex
*
v
=
new
MVertex
(
X
,
Y
,
Z
,
gr
);
// SPoint3 pc = face.interpolate(t1, t2);
// MVertex *v = new MVertex(pc.x(), pc.y(), pc.z(), gr);
// faceVertices[p].push_back(v);
vtcs
.
push_back
(
v
);
gr
->
mesh_vertices
.
push_back
(
v
);
vf
.
push_back
(
v
);
}
// for(int j = 0; j < nPts; j++){
// for(int k = 0 ; k < nPts - j - 1; k++){
// // KH: inverted direction to stick with triangle vertex numbering
// // is not consistent with function space definitions for p>4
// //
// // 2
// // | \
// // 0 - 1
// //
// // double t1 = (double)(j + 1) / (nPts + 1);
// // double t2 = (double)(k + 1) / (nPts + 1);
// double t1 = (double)(k + 1) / (nPts + 1);
// double t2 = (double)(j + 1) / (nPts + 1);
// SPoint3 pc = face.interpolate(t1, t2);
// MVertex *v = new MVertex(pc.x(), pc.y(), pc.z(), gr);
// // faceVertices[p].push_back(v);
// vtcs.push_back(v);
// gr->mesh_vertices.push_back(v);
// vf.push_back(v);
// }
// }
}
}
else
if
(
face
.
getNumVertices
()
==
4
){
// quadrangles
else
if
(
face
.
getNumVertices
()
==
4
){
// quadrangles
for
(
int
j
=
0
;
j
<
nPts
;
j
++
){
for
(
int
j
=
0
;
j
<
nPts
;
j
++
){
...
@@ -771,15 +860,22 @@ void getRegionVertices(GRegion *gr,
...
@@ -771,15 +860,22 @@ void getRegionVertices(GRegion *gr,
const
double
t1
=
points
(
k
,
0
);
const
double
t1
=
points
(
k
,
0
);
const
double
t2
=
points
(
k
,
1
);
const
double
t2
=
points
(
k
,
1
);
const
double
t3
=
points
(
k
,
2
);
const
double
t3
=
points
(
k
,
2
);
double
X
(
0
),
Y
(
0
),
Z
(
0
);
for
(
int
j
=
0
;
j
<
incomplete
->
getNumVertices
();
j
++
){
SPoint3
pos
;
double
sf
;
incomplete
->
getShapeFunction
(
j
,
t1
,
t2
,
t3
,
sf
);
incomplete
->
pnt
(
t1
,
t2
,
t3
,
pos
);
MVertex
*
vt
=
incomplete
->
getVertex
(
j
);
X
+=
sf
*
vt
->
x
();
v
=
new
MVertex
(
pos
.
x
(),
pos
.
y
(),
pos
.
z
(),
gr
);
Y
+=
sf
*
vt
->
y
();
Z
+=
sf
*
vt
->
z
();
// double X(0),Y(0),Z(0);
}
// for (int j=0; j<incomplete->getNumVertices(); j++){
v
=
new
MVertex
(
X
,
Y
,
Z
,
gr
);
// double sf ; incomplete->getShapeFunction(j,t1,t2,t3,sf);
// MVertex *vt = incomplete->getVertex(j);
// X += sf * vt->x();
// Y += sf * vt->y();
// Z += sf * vt->z();
// }
//
// v = new MVertex(X,Y,Z, gr);
gr
->
mesh_vertices
.
push_back
(
v
);
gr
->
mesh_vertices
.
push_back
(
v
);
vr
.
push_back
(
v
);
vr
.
push_back
(
v
);
}
}
...
@@ -880,12 +976,12 @@ void setHighOrder(GRegion *gr, edgeContainer &edgeVertices,
...
@@ -880,12 +976,12 @@ void setHighOrder(GRegion *gr, edgeContainer &edgeVertices,
t
->
getVertex
(
3
),
ve
[
0
],
ve
[
1
],
ve
[
2
],
ve
[
3
],
ve
[
4
],
ve
[
5
]));
t
->
getVertex
(
3
),
ve
[
0
],
ve
[
1
],
ve
[
2
],
ve
[
3
],
ve
[
4
],
ve
[
5
]));
}
}
else
{
else
{
getFaceVertices
(
gr
,
t
,
vf
,
faceVertices
,
linear
,
nPts
);
getFaceVertices
(
gr
,
t
,
vf
,
faceVertices
,
edgeVertices
,
linear
,
nPts
);
ve
.
insert
(
ve
.
end
(),
vf
.
begin
(),
vf
.
end
());
ve
.
insert
(
ve
.
end
(),
vf
.
begin
(),
vf
.
end
());
MTetrahedronN
incpl
(
t
->
getVertex
(
0
),
t
->
getVertex
(
1
),
t
->
getVertex
(
2
),
t
->
getVertex
(
3
),
MTetrahedronN
incpl
(
t
->
getVertex
(
0
),
t
->
getVertex
(
1
),
t
->
getVertex
(
2
),
t
->
getVertex
(
3
),
ve
,
nPts
+
1
);
ve
,
nPts
+
1
);
getRegionVertices
(
gr
,
&
incpl
,
t
,
vr
,
linear
,
nPts
);
//
getRegionVertices(gr, &incpl, t, vr, linear, nPts);
ve
.
insert
(
ve
.
end
(),
vr
.
begin
(),
vr
.
end
());
//
ve.insert(ve.end(), vr.begin(), vr.end());
tetrahedra2
.
push_back
tetrahedra2
.
push_back
(
new
MTetrahedronN
(
t
->
getVertex
(
0
),
t
->
getVertex
(
1
),
t
->
getVertex
(
2
),
t
->
getVertex
(
3
),
(
new
MTetrahedronN
(
t
->
getVertex
(
0
),
t
->
getVertex
(
1
),
t
->
getVertex
(
2
),
t
->
getVertex
(
3
),
ve
,
nPts
+
1
));
ve
,
nPts
+
1
));
...
@@ -908,7 +1004,7 @@ void setHighOrder(GRegion *gr, edgeContainer &edgeVertices,
...
@@ -908,7 +1004,7 @@ void setHighOrder(GRegion *gr, edgeContainer &edgeVertices,
ve
[
11
]));
ve
[
11
]));
}
}
else
{
else
{
getFaceVertices
(
gr
,
h
,
vf
,
faceVertices
,
linear
,
nPts
);
getFaceVertices
(
gr
,
h
,
vf
,
faceVertices
,
edgeVertices
,
linear
,
nPts
);
SPoint3
pc
=
h
->
barycenter
();
SPoint3
pc
=
h
->
barycenter
();
MVertex
*
v
=
new
MVertex
(
pc
.
x
(),
pc
.
y
(),
pc
.
z
(),
gr
);
MVertex
*
v
=
new
MVertex
(
pc
.
x
(),
pc
.
y
(),
pc
.
z
(),
gr
);
gr
->
mesh_vertices
.
push_back
(
v
);
gr
->
mesh_vertices
.
push_back
(
v
);
...
@@ -935,7 +1031,7 @@ void setHighOrder(GRegion *gr, edgeContainer &edgeVertices,
...
@@ -935,7 +1031,7 @@ void setHighOrder(GRegion *gr, edgeContainer &edgeVertices,
ve
[
0
],
ve
[
1
],
ve
[
2
],
ve
[
3
],
ve
[
4
],
ve
[
5
],
ve
[
6
],
ve
[
7
],
ve
[
8
]));
ve
[
0
],
ve
[
1
],
ve
[
2
],
ve
[
3
],
ve
[
4
],
ve
[
5
],
ve
[
6
],
ve
[
7
],
ve
[
8
]));
}
}
else
{
else
{
getFaceVertices
(
gr
,
p
,
vf
,
faceVertices
,
linear
,
nPts
);
getFaceVertices
(
gr
,
p
,
vf
,
faceVertices
,
edgeVertices
,
linear
,
nPts
);
prisms2
.
push_back
prisms2
.
push_back
(
new
MPrism18
(
p
->
getVertex
(
0
),
p
->
getVertex
(
1
),
p
->
getVertex
(
2
),
(
new
MPrism18
(
p
->
getVertex
(
0
),
p
->
getVertex
(
1
),
p
->
getVertex
(
2
),
p
->
getVertex
(
3
),
p
->
getVertex
(
4
),
p
->
getVertex
(
5
),
p
->
getVertex
(
3
),
p
->
getVertex
(
4
),
p
->
getVertex
(
5
),
...
@@ -958,7 +1054,7 @@ void setHighOrder(GRegion *gr, edgeContainer &edgeVertices,
...
@@ -958,7 +1054,7 @@ void setHighOrder(GRegion *gr, edgeContainer &edgeVertices,
ve
[
3
],
ve
[
4
],
ve
[
5
],
ve
[
6
],
ve
[
7
]));
ve
[
3
],
ve
[
4
],
ve
[
5
],
ve
[
6
],
ve
[
7
]));
}
}
else
{
else
{
getFaceVertices
(
gr
,
p
,
vf
,
faceVertices
,
linear
,
nPts
);
getFaceVertices
(
gr
,
p
,
vf
,
faceVertices
,
edgeVertices
,
linear
,
nPts
);
pyramids2
.
push_back
pyramids2
.
push_back
(
new
MPyramid14
(
p
->
getVertex
(
0
),
p
->
getVertex
(
1
),
p
->
getVertex
(
2
),
(
new
MPyramid14
(
p
->
getVertex
(
0
),
p
->
getVertex
(
1
),
p
->
getVertex
(
2
),
p
->
getVertex
(
3
),
p
->
getVertex
(
4
),
ve
[
0
],
ve
[
1
],
ve
[
2
],
p
->
getVertex
(
3
),
p
->
getVertex
(
4
),
ve
[
0
],
ve
[
1
],
ve
[
2
],
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment