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
e4dd176c
Commit
e4dd176c
authored
8 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
speed up triangle edge/face rep
parent
1ef74ab5
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
Geo/MTetrahedron.cpp
+6
-6
6 additions, 6 deletions
Geo/MTetrahedron.cpp
Geo/MTriangle.cpp
+49
-18
49 additions, 18 deletions
Geo/MTriangle.cpp
Geo/MTriangle.h
+2
-9
2 additions, 9 deletions
Geo/MTriangle.h
with
57 additions
and
33 deletions
Geo/MTetrahedron.cpp
+
6
−
6
View file @
e4dd176c
...
...
@@ -21,13 +21,13 @@ void MTetrahedron::getEdgeRep(bool curved, int num, double *x, double *y, double
SVector3
*
n
)
{
// don't use MElement::_getEdgeRep: it's slow due to the creation of MFaces
MVertex
*
v0
=
getVertex
(
edges_tetra
(
num
,
0
)
)
;
MVertex
*
v1
=
getVertex
(
edges_tetra
(
num
,
1
)
)
;
MVertex
*
v0
=
_v
[
edges_tetra
(
num
,
0
)
]
;
MVertex
*
v1
=
_v
[
edges_tetra
(
num
,
1
)
]
;
x
[
0
]
=
v0
->
x
();
y
[
0
]
=
v0
->
y
();
z
[
0
]
=
v0
->
z
();
x
[
1
]
=
v1
->
x
();
y
[
1
]
=
v1
->
y
();
z
[
1
]
=
v1
->
z
();
if
(
CTX
::
instance
()
->
mesh
.
lightLines
>
1
){
static
const
int
vv
[
6
]
=
{
2
,
0
,
1
,
1
,
0
,
2
};
MVertex
*
v2
=
getVertex
(
vv
[
num
]
)
;
MVertex
*
v2
=
_v
[
vv
[
num
]
]
;
SVector3
t1
(
x
[
1
]
-
x
[
0
],
y
[
1
]
-
y
[
0
],
z
[
1
]
-
z
[
0
]);
SVector3
t2
(
v2
->
x
()
-
x
[
0
],
v2
->
y
()
-
y
[
0
],
v2
->
z
()
-
z
[
0
]);
SVector3
normal
=
crossprod
(
t1
,
t2
);
...
...
@@ -43,9 +43,9 @@ void MTetrahedron::getFaceRep(bool curved, int num, double *x, double *y, double
SVector3
*
n
)
{
// don't use MElement::_getFaceRep: it's slow due to the creation of MFaces
MVertex
*
v0
=
getVertex
(
faces_tetra
(
num
,
0
)
)
;
MVertex
*
v1
=
getVertex
(
faces_tetra
(
num
,
1
)
)
;
MVertex
*
v2
=
getVertex
(
faces_tetra
(
num
,
2
)
)
;
MVertex
*
v0
=
_v
[
faces_tetra
(
num
,
0
)
]
;
MVertex
*
v1
=
_v
[
faces_tetra
(
num
,
1
)
]
;
MVertex
*
v2
=
_v
[
faces_tetra
(
num
,
2
)
]
;
x
[
0
]
=
v0
->
x
();
x
[
1
]
=
v1
->
x
();
x
[
2
]
=
v2
->
x
();
y
[
0
]
=
v0
->
y
();
y
[
1
]
=
v1
->
y
();
y
[
2
]
=
v2
->
y
();
z
[
0
]
=
v0
->
z
();
z
[
1
]
=
v1
->
z
();
z
[
2
]
=
v2
->
z
();
...
...
This diff is collapsed.
Click to expand it.
Geo/MTriangle.cpp
+
49
−
18
View file @
e4dd176c
...
...
@@ -17,6 +17,42 @@
#define SQU(a) ((a)*(a))
void
MTriangle
::
getEdgeRep
(
bool
curved
,
int
num
,
double
*
x
,
double
*
y
,
double
*
z
,
SVector3
*
n
)
{
// don't use MElement::_getEdgeRep: it's slow due to the creation of MFace
MVertex
*
v0
=
_v
[
edges_tri
(
num
,
0
)];
MVertex
*
v1
=
_v
[
edges_tri
(
num
,
1
)];
x
[
0
]
=
v0
->
x
();
y
[
0
]
=
v0
->
y
();
z
[
0
]
=
v0
->
z
();
x
[
1
]
=
v1
->
x
();
y
[
1
]
=
v1
->
y
();
z
[
1
]
=
v1
->
z
();
if
(
CTX
::
instance
()
->
mesh
.
lightLines
>
1
){
static
const
int
vv
[
3
]
=
{
2
,
0
,
1
};
MVertex
*
v2
=
_v
[
vv
[
num
]];
SVector3
t1
(
x
[
1
]
-
x
[
0
],
y
[
1
]
-
y
[
0
],
z
[
1
]
-
z
[
0
]);
SVector3
t2
(
v2
->
x
()
-
x
[
0
],
v2
->
y
()
-
y
[
0
],
v2
->
z
()
-
z
[
0
]);
SVector3
normal
=
crossprod
(
t1
,
t2
);
normal
.
normalize
();
n
[
0
]
=
n
[
1
]
=
normal
;
}
else
{
n
[
0
]
=
n
[
1
]
=
SVector3
(
0.
,
0.
,
1.
);
}
}
void
MTriangle
::
getFaceRep
(
bool
curved
,
int
num
,
double
*
x
,
double
*
y
,
double
*
z
,
SVector3
*
n
)
{
// don't use MElement::_getFaceRep: it's slow due to the creation of MFaces
x
[
0
]
=
_v
[
0
]
->
x
();
x
[
1
]
=
_v
[
1
]
->
x
();
x
[
2
]
=
_v
[
2
]
->
x
();
y
[
0
]
=
_v
[
0
]
->
y
();
y
[
1
]
=
_v
[
1
]
->
y
();
y
[
2
]
=
_v
[
2
]
->
y
();
z
[
0
]
=
_v
[
0
]
->
z
();
z
[
1
]
=
_v
[
1
]
->
z
();
z
[
2
]
=
_v
[
2
]
->
z
();
SVector3
t1
(
x
[
1
]
-
x
[
0
],
y
[
1
]
-
y
[
0
],
z
[
1
]
-
z
[
0
]);
SVector3
t2
(
x
[
2
]
-
x
[
0
],
y
[
2
]
-
y
[
0
],
z
[
2
]
-
z
[
0
]);
SVector3
normal
=
crossprod
(
t1
,
t2
);
normal
.
normalize
();
for
(
int
i
=
0
;
i
<
3
;
i
++
)
n
[
i
]
=
normal
;
}
SPoint3
MTriangle
::
circumcenter
()
{
double
p1
[
3
]
=
{
_v
[
0
]
->
x
(),
_v
[
0
]
->
y
(),
_v
[
0
]
->
z
()};
...
...
@@ -250,6 +286,7 @@ void MTriangleN::getFaceRep(bool curved, int num,
if
(
curved
)
_myGetFaceRep
(
this
,
num
,
x
,
y
,
z
,
n
,
CTX
::
instance
()
->
mesh
.
numSubEdges
);
else
MTriangle
::
getFaceRep
(
false
,
num
,
x
,
y
,
z
,
n
);
}
void
MTriangle6
::
getFaceRep
(
bool
curved
,
int
num
,
double
*
x
,
double
*
y
,
double
*
z
,
SVector3
*
n
)
{
...
...
@@ -263,8 +300,8 @@ void MTriangle::getIntegrationPoints(int pOrder, int *npts, IntPt **pts)
*
pts
=
getGQTPts
(
pOrder
);
}
void
MTriangle
::
reorient
(
int
rot
,
bool
swap
)
{
void
MTriangle
::
reorient
(
int
rot
,
bool
swap
)
{
if
(
rot
==
0
&&
!
swap
)
return
;
MVertex
*
tmp
[
3
];
...
...
@@ -275,8 +312,8 @@ void MTriangle::reorient(int rot,bool swap) {
#include
"HighOrder.h"
void
MTriangle6
::
reorient
(
int
rot
,
bool
swap
)
{
void
MTriangle6
::
reorient
(
int
rot
,
bool
swap
)
{
if
(
rot
==
0
&&
!
swap
)
return
;
MTriangle
::
reorient
(
rot
,
swap
);
...
...
@@ -286,8 +323,8 @@ void MTriangle6::reorient(int rot, bool swap) {
else
for
(
int
i
=
0
;
i
<
3
;
i
++
)
_vs
[
i
]
=
tmp
[(
3
-
rot
+
i
)
%
3
];
}
void
MTriangleN
::
reorient
(
int
rot
,
bool
swap
)
{
void
MTriangleN
::
reorient
(
int
rot
,
bool
swap
)
{
if
(
rot
==
0
&&
!
swap
)
return
;
MTriangle
::
reorient
(
rot
,
swap
);
...
...
@@ -297,7 +334,6 @@ void MTriangleN::reorient(int rot, bool swap) {
int
nbEdge
=
order
-
1
;
unsigned
int
idx
=
0
;
if
(
swap
)
{
for
(
int
iEdge
=
0
;
iEdge
<
3
;
iEdge
++
)
{
int
edgeIdx
=
((
5
-
iEdge
+
rot
)
%
3
)
*
nbEdge
;
...
...
@@ -324,8 +360,3 @@ void MTriangleN::reorient(int rot, bool swap) {
}
_vs
=
tmp
;
}
This diff is collapsed.
Click to expand it.
Geo/MTriangle.h
+
2
−
9
View file @
e4dd176c
...
...
@@ -87,11 +87,7 @@ class MTriangle : public MElement {
Msg
::
Error
(
"Could not get edge information for triangle %d"
,
getNum
());
}
virtual
int
getNumEdgesRep
(
bool
curved
){
return
3
;
}
virtual
void
getEdgeRep
(
bool
curved
,
int
num
,
double
*
x
,
double
*
y
,
double
*
z
,
SVector3
*
n
)
{
MEdge
e
(
getEdge
(
num
));
_getEdgeRep
(
e
.
getVertex
(
0
),
e
.
getVertex
(
1
),
x
,
y
,
z
,
n
,
0
);
}
virtual
void
getEdgeRep
(
bool
curved
,
int
num
,
double
*
x
,
double
*
y
,
double
*
z
,
SVector3
*
n
);
virtual
void
getEdgeVertices
(
const
int
num
,
std
::
vector
<
MVertex
*>
&
v
)
const
{
v
.
resize
(
2
);
...
...
@@ -103,10 +99,7 @@ class MTriangle : public MElement {
return
MFace
(
_v
[
0
],
_v
[
1
],
_v
[
2
]);
}
virtual
int
getNumFacesRep
(
bool
curved
){
return
1
;
}
virtual
void
getFaceRep
(
bool
curved
,
int
num
,
double
*
x
,
double
*
y
,
double
*
z
,
SVector3
*
n
)
{
_getFaceRep
(
_v
[
0
],
_v
[
1
],
_v
[
2
],
x
,
y
,
z
,
n
);
}
virtual
void
getFaceRep
(
bool
curved
,
int
num
,
double
*
x
,
double
*
y
,
double
*
z
,
SVector3
*
n
);
virtual
void
getFaceVertices
(
const
int
num
,
std
::
vector
<
MVertex
*>
&
v
)
const
{
v
.
resize
(
3
);
...
...
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