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
136b1cac
Commit
136b1cac
authored
10 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
pp
parent
a2ebfefb
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Geo/MElement.h
+8
-4
8 additions, 4 deletions
Geo/MElement.h
Geo/MVertex.cpp
+17
-25
17 additions, 25 deletions
Geo/MVertex.cpp
Geo/MVertex.h
+13
-16
13 additions, 16 deletions
Geo/MVertex.h
Geo/MVertexRTree.h
+3
-3
3 additions, 3 deletions
Geo/MVertexRTree.h
with
41 additions
and
48 deletions
Geo/MElement.h
+
8
−
4
View file @
136b1cac
...
@@ -141,21 +141,24 @@ class MElement
...
@@ -141,21 +141,24 @@ class MElement
// get an edge representation for drawing
// get an edge representation for drawing
virtual
int
getNumEdgesRep
(
bool
curved
)
=
0
;
virtual
int
getNumEdgesRep
(
bool
curved
)
=
0
;
virtual
void
getEdgeRep
(
bool
curved
,
int
num
,
double
*
x
,
double
*
y
,
double
*
z
,
SVector3
*
n
)
=
0
;
virtual
void
getEdgeRep
(
bool
curved
,
int
num
,
double
*
x
,
double
*
y
,
double
*
z
,
SVector3
*
n
)
=
0
;
// get the faces
// get the faces
virtual
int
getNumFaces
()
=
0
;
virtual
int
getNumFaces
()
=
0
;
virtual
MFace
getFace
(
int
num
)
=
0
;
virtual
MFace
getFace
(
int
num
)
=
0
;
// give an MFace as input and get its local number, sign and rotation
// give an MFace as input and get its local number, sign and rotation
virtual
void
getFaceInfo
(
const
MFace
&
face
,
int
&
ithFace
,
int
&
sign
,
int
&
rot
)
const
virtual
void
getFaceInfo
(
const
MFace
&
face
,
int
&
ithFace
,
int
&
sign
,
int
&
rot
)
const
{
{
Msg
::
Error
(
"Face information not available for this element"
);
Msg
::
Error
(
"Face information not available for this element"
);
}
}
// get a face representation for drawing
// get a face representation for drawing
virtual
int
getNumFacesRep
(
bool
curved
)
=
0
;
virtual
int
getNumFacesRep
(
bool
curved
)
=
0
;
virtual
void
getFaceRep
(
bool
curved
,
int
num
,
double
*
x
,
double
*
y
,
double
*
z
,
SVector3
*
n
)
=
0
;
virtual
void
getFaceRep
(
bool
curved
,
int
num
,
double
*
x
,
double
*
y
,
double
*
z
,
SVector3
*
n
)
=
0
;
// get all the vertices on a edge or a face
// get all the vertices on a edge or a face
virtual
void
getEdgeVertices
(
const
int
num
,
std
::
vector
<
MVertex
*>
&
v
)
const
virtual
void
getEdgeVertices
(
const
int
num
,
std
::
vector
<
MVertex
*>
&
v
)
const
...
@@ -173,6 +176,7 @@ class MElement
...
@@ -173,6 +176,7 @@ class MElement
virtual
int
getNumChildren
()
const
{
return
0
;
}
virtual
int
getNumChildren
()
const
{
return
0
;
}
virtual
MElement
*
getChild
(
int
i
)
const
{
return
NULL
;
}
virtual
MElement
*
getChild
(
int
i
)
const
{
return
NULL
;
}
virtual
bool
ownsParent
()
const
{
return
false
;
}
virtual
bool
ownsParent
()
const
{
return
false
;
}
// get base element in case of MSubElement
// get base element in case of MSubElement
virtual
const
MElement
*
getBaseElement
()
const
{
return
this
;
}
virtual
const
MElement
*
getBaseElement
()
const
{
return
this
;
}
virtual
MElement
*
getBaseElement
()
{
return
this
;
}
virtual
MElement
*
getBaseElement
()
{
return
this
;
}
...
@@ -188,7 +192,7 @@ class MElement
...
@@ -188,7 +192,7 @@ class MElement
virtual
double
maxEdge
();
virtual
double
maxEdge
();
virtual
double
minEdge
();
virtual
double
minEdge
();
//
M
ax. distance between curved and straight element among all high-order nodes
//
m
ax. distance between curved and straight element among all high-order nodes
double
maxDistToStraight
()
const
;
double
maxDistToStraight
()
const
;
// get the quality measures
// get the quality measures
...
...
This diff is collapsed.
Click to expand it.
Geo/MVertex.cpp
+
17
−
25
View file @
136b1cac
...
@@ -14,24 +14,6 @@
...
@@ -14,24 +14,6 @@
#include
"GmshMessage.h"
#include
"GmshMessage.h"
#include
"StringUtils.h"
#include
"StringUtils.h"
double
MVertexLessThanLexicographic
::
tolerance
=
1.e-6
;
bool
MVertexLessThanLexicographic
::
operator
()(
const
MVertex
*
v1
,
const
MVertex
*
v2
)
const
{
if
(
v1
->
x
()
-
v2
->
x
()
>
tolerance
)
return
true
;
if
(
v1
->
x
()
-
v2
->
x
()
<
-
tolerance
)
return
false
;
if
(
v1
->
y
()
-
v2
->
y
()
>
tolerance
)
return
true
;
if
(
v1
->
y
()
-
v2
->
y
()
<
-
tolerance
)
return
false
;
if
(
v1
->
z
()
-
v2
->
z
()
>
tolerance
)
return
true
;
return
false
;
}
bool
MVertexLessThanNum
::
operator
()(
const
MVertex
*
v1
,
const
MVertex
*
v2
)
const
{
if
(
v1
->
getNum
()
<
v2
->
getNum
())
return
true
;
return
false
;
}
double
angle3Vertices
(
const
MVertex
*
p1
,
const
MVertex
*
p2
,
const
MVertex
*
p3
)
double
angle3Vertices
(
const
MVertex
*
p1
,
const
MVertex
*
p2
,
const
MVertex
*
p3
)
{
{
SVector3
a
(
p1
->
x
()
-
p2
->
x
(),
p1
->
y
()
-
p2
->
y
(),
p1
->
z
()
-
p2
->
z
());
SVector3
a
(
p1
->
x
()
-
p2
->
x
(),
p1
->
y
()
-
p2
->
y
(),
p1
->
z
()
-
p2
->
z
());
...
@@ -349,13 +331,24 @@ void MVertex::writeSU2(FILE *fp, int dim, double scalingFactor)
...
@@ -349,13 +331,24 @@ void MVertex::writeSU2(FILE *fp, int dim, double scalingFactor)
z
()
*
scalingFactor
,
_index
-
1
);
z
()
*
scalingFactor
,
_index
-
1
);
}
}
std
::
set
<
MVertex
*
,
MVertexLessThanLexicographic
>::
iterator
bool
MVertexLessThanNum
::
operator
()(
const
MVertex
*
v1
,
const
MVertex
*
v2
)
const
MVertex
::
linearSearch
(
std
::
set
<
MVertex
*
,
MVertexLessThanLexicographic
>
&
pos
)
{
if
(
v1
->
getNum
()
<
v2
->
getNum
())
return
true
;
return
false
;
}
double
MVertexLessThanLexicographic
::
tolerance
=
1.e-6
;
bool
MVertexLessThanLexicographic
::
operator
()(
const
MVertex
*
v1
,
const
MVertex
*
v2
)
const
{
{
for
(
std
::
set
<
MVertex
*
,
MVertexLessThanLexicographic
>::
iterator
it
=
pos
.
begin
();
// you should not use this unless you know what you are doing; to create
it
!=
pos
.
end
();
++
it
)
// unique vertices, use MVertexRTree
if
(
distance
(
*
it
)
<
MVertexLessThanLexicographic
::
tolerance
)
return
it
;
if
(
v1
->
x
()
-
v2
->
x
()
>
tolerance
)
return
true
;
return
pos
.
end
();
if
(
v1
->
x
()
-
v2
->
x
()
<
-
tolerance
)
return
false
;
if
(
v1
->
y
()
-
v2
->
y
()
>
tolerance
)
return
true
;
if
(
v1
->
y
()
-
v2
->
y
()
<
-
tolerance
)
return
false
;
if
(
v1
->
z
()
-
v2
->
z
()
>
tolerance
)
return
true
;
return
false
;
}
}
static
void
getAllParameters
(
MVertex
*
v
,
GFace
*
gf
,
std
::
vector
<
SPoint2
>
&
params
)
static
void
getAllParameters
(
MVertex
*
v
,
GFace
*
gf
,
std
::
vector
<
SPoint2
>
&
params
)
...
@@ -375,7 +368,6 @@ static void getAllParameters(MVertex *v, GFace *gf, std::vector<SPoint2> ¶ms
...
@@ -375,7 +368,6 @@ static void getAllParameters(MVertex *v, GFace *gf, std::vector<SPoint2> ¶ms
for
(
std
::
list
<
GEdge
*>::
iterator
it
=
ed
.
begin
();
it
!=
ed
.
end
();
it
++
){
for
(
std
::
list
<
GEdge
*>::
iterator
it
=
ed
.
begin
();
it
!=
ed
.
end
();
it
++
){
if
((
*
it
)
->
isSeam
(
gf
))
{
if
((
*
it
)
->
isSeam
(
gf
))
{
Range
<
double
>
range
=
(
*
it
)
->
parBounds
(
0
);
Range
<
double
>
range
=
(
*
it
)
->
parBounds
(
0
);
// printf("%d %d %d\n",gv->tag(),(*it)->getBeginVertex()->tag(),(*it)->getEndVertex()->tag());
if
(
gv
==
(
*
it
)
->
getBeginVertex
()){
if
(
gv
==
(
*
it
)
->
getBeginVertex
()){
params
.
push_back
((
*
it
)
->
reparamOnFace
(
gf
,
range
.
low
(),
-
1
));
params
.
push_back
((
*
it
)
->
reparamOnFace
(
gf
,
range
.
low
(),
-
1
));
params
.
push_back
((
*
it
)
->
reparamOnFace
(
gf
,
range
.
low
(),
1
));
params
.
push_back
((
*
it
)
->
reparamOnFace
(
gf
,
range
.
low
(),
1
));
...
...
This diff is collapsed.
Click to expand it.
Geo/MVertex.h
+
13
−
16
View file @
136b1cac
...
@@ -18,17 +18,6 @@ class GEdge;
...
@@ -18,17 +18,6 @@ class GEdge;
class
GFace
;
class
GFace
;
class
MVertex
;
class
MVertex
;
class
MVertexLessThanLexicographic
{
public:
static
double
tolerance
;
bool
operator
()(
const
MVertex
*
v1
,
const
MVertex
*
v2
)
const
;
};
class
MVertexLessThanNum
{
public:
bool
operator
()(
const
MVertex
*
v1
,
const
MVertex
*
v2
)
const
;
};
// A mesh vertex.
// A mesh vertex.
class
MVertex
{
class
MVertex
{
protected:
protected:
...
@@ -99,10 +88,6 @@ class MVertex{
...
@@ -99,10 +88,6 @@ class MVertex{
return
sqrt
(
dx
*
dx
+
dy
*
dy
+
dz
*
dz
);
return
sqrt
(
dx
*
dx
+
dy
*
dy
+
dz
*
dz
);
}
}
// linear coordinate search for the vertex in a set
std
::
set
<
MVertex
*
,
MVertexLessThanLexicographic
>::
iterator
linearSearch
(
std
::
set
<
MVertex
*
,
MVertexLessThanLexicographic
>
&
pos
);
// IO routines
// IO routines
void
writeMSH
(
FILE
*
fp
,
bool
binary
=
false
,
bool
saveParametric
=
false
,
void
writeMSH
(
FILE
*
fp
,
bool
binary
=
false
,
bool
saveParametric
=
false
,
double
scalingFactor
=
1.0
);
double
scalingFactor
=
1.0
);
...
@@ -159,6 +144,17 @@ class MFaceVertex : public MVertex{
...
@@ -159,6 +144,17 @@ class MFaceVertex : public MVertex{
}
}
};
};
class
MVertexLessThanLexicographic
{
public:
static
double
tolerance
;
bool
operator
()(
const
MVertex
*
v1
,
const
MVertex
*
v2
)
const
;
};
class
MVertexLessThanNum
{
public:
bool
operator
()(
const
MVertex
*
v1
,
const
MVertex
*
v2
)
const
;
};
bool
reparamMeshEdgeOnFace
(
MVertex
*
v1
,
MVertex
*
v2
,
GFace
*
gf
,
bool
reparamMeshEdgeOnFace
(
MVertex
*
v1
,
MVertex
*
v2
,
GFace
*
gf
,
SPoint2
&
param1
,
SPoint2
&
param2
);
SPoint2
&
param1
,
SPoint2
&
param2
);
bool
reparamMeshVertexOnFace
(
MVertex
*
v
,
const
GFace
*
gf
,
SPoint2
&
param
,
bool
reparamMeshVertexOnFace
(
MVertex
*
v
,
const
GFace
*
gf
,
SPoint2
&
param
,
...
@@ -167,7 +163,8 @@ bool reparamMeshVertexOnEdge(MVertex *v, const GEdge *ge, double ¶m);
...
@@ -167,7 +163,8 @@ bool reparamMeshVertexOnEdge(MVertex *v, const GEdge *ge, double ¶m);
double
angle3Vertices
(
const
MVertex
*
p1
,
const
MVertex
*
p2
,
const
MVertex
*
p3
);
double
angle3Vertices
(
const
MVertex
*
p1
,
const
MVertex
*
p2
,
const
MVertex
*
p3
);
inline
double
distance
(
MVertex
*
v1
,
MVertex
*
v2
){
inline
double
distance
(
MVertex
*
v1
,
MVertex
*
v2
)
{
const
double
dx
=
v1
->
x
()
-
v2
->
x
();
const
double
dx
=
v1
->
x
()
-
v2
->
x
();
const
double
dy
=
v1
->
y
()
-
v2
->
y
();
const
double
dy
=
v1
->
y
()
-
v2
->
y
();
const
double
dz
=
v1
->
z
()
-
v2
->
z
();
const
double
dz
=
v1
->
z
()
-
v2
->
z
();
...
...
This diff is collapsed.
Click to expand it.
Geo/MVertexRTree.h
+
3
−
3
View file @
136b1cac
...
@@ -21,7 +21,7 @@ class MVertexRTree{
...
@@ -21,7 +21,7 @@ class MVertexRTree{
{
{
MVertex
**
out
=
static_cast
<
MVertex
**>
(
ctx
);
MVertex
**
out
=
static_cast
<
MVertex
**>
(
ctx
);
*
out
=
v
;
*
out
=
v
;
return
false
;
return
false
;
// we're done searching
}
}
public
:
public
:
MVertexRTree
(
double
tolerance
=
1.e-8
)
MVertexRTree
(
double
tolerance
=
1.e-8
)
...
@@ -48,14 +48,14 @@ class MVertexRTree{
...
@@ -48,14 +48,14 @@ class MVertexRTree{
"mesh with tolerance %g"
,
v
->
getNum
(),
"mesh with tolerance %g"
,
v
->
getNum
(),
v
->
x
(),
v
->
y
(),
v
->
z
(),
_tol
);
v
->
x
(),
v
->
y
(),
v
->
z
(),
_tol
);
}
}
return
1
;
return
1
;
// one vertex not inserted
}
}
int
insert
(
std
::
vector
<
MVertex
*>
&
v
,
bool
warnIfExists
=
false
)
int
insert
(
std
::
vector
<
MVertex
*>
&
v
,
bool
warnIfExists
=
false
)
{
{
int
num
=
0
;
int
num
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
v
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
v
.
size
();
i
++
)
num
+=
insert
(
v
[
i
],
warnIfExists
);
num
+=
insert
(
v
[
i
],
warnIfExists
);
return
num
;
return
num
;
// number of vertices not inserted
}
}
MVertex
*
find
(
double
x
,
double
y
,
double
z
)
MVertex
*
find
(
double
x
,
double
y
,
double
z
)
{
{
...
...
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