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
15b1202c
Commit
15b1202c
authored
17 years ago
by
Laurent Van Migroet
Browse files
Options
Downloads
Patches
Plain Diff
Fix Const iterator for msvc 2003 .net
parent
310420e1
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Geo/GModel.cpp
+42
-41
42 additions, 41 deletions
Geo/GModel.cpp
Geo/GModel.h
+14
-14
14 additions, 14 deletions
Geo/GModel.h
with
56 additions
and
55 deletions
Geo/GModel.cpp
+
42
−
41
View file @
15b1202c
// $Id: GModel.cpp,v 1.5
6
2008-0
1-22 16
:5
7
:3
6 geuzaine
Exp $
// $Id: GModel.cpp,v 1.5
7
2008-0
2-06 09
:5
0
:3
7 miegroet
Exp $
//
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
//
...
...
@@ -16,7 +16,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA.
//
//
// Please report all bugs and problems to <gmsh@geuz.org>.
#include
"GModel.h"
...
...
@@ -45,7 +45,7 @@ GModel::GModel(std::string name)
}
GModel
::~
GModel
()
{
{
std
::
vector
<
GModel
*>::
iterator
it
=
std
::
find
(
list
.
begin
(),
list
.
end
(),
this
);
if
(
it
!=
list
.
end
())
list
.
erase
(
it
);
deleteGEOInternals
();
...
...
@@ -54,7 +54,7 @@ GModel::~GModel()
}
GModel
*
GModel
::
current
()
{
{
if
(
list
.
empty
()){
Msg
(
GERROR
,
"No model available"
);
return
0
;
...
...
@@ -104,7 +104,7 @@ void GModel::destroy()
GRegion
*
GModel
::
regionByTag
(
int
n
)
const
{
GEntity
tmp
((
GModel
*
)
this
,
n
);
rite
r
it
=
regions
.
find
((
GRegion
*
)
&
tmp
);
std
::
set
<
GRegion
*
,
GEntityLessThan
>::
const_iterato
r
it
=
regions
.
find
((
GRegion
*
)
&
tmp
);
if
(
it
!=
regions
.
end
())
return
*
it
;
else
...
...
@@ -114,7 +114,7 @@ GRegion *GModel::regionByTag(int n) const
GFace
*
GModel
::
faceByTag
(
int
n
)
const
{
GEntity
tmp
((
GModel
*
)
this
,
n
);
fite
r
it
=
faces
.
find
((
GFace
*
)
&
tmp
);
std
::
set
<
GFace
*
,
GEntityLessThan
>::
const_iterato
r
it
=
faces
.
find
((
GFace
*
)
&
tmp
);
if
(
it
!=
faces
.
end
())
return
*
it
;
else
...
...
@@ -124,7 +124,7 @@ GFace *GModel::faceByTag(int n) const
GEdge
*
GModel
::
edgeByTag
(
int
n
)
const
{
GEntity
tmp
((
GModel
*
)
this
,
n
);
eiter
it
=
edges
.
find
((
GEdge
*
)
&
tmp
);
std
::
set
<
GEdge
*
,
GEntityLessThan
>::
const_iterator
it
=
edges
.
find
((
GEdge
*
)
&
tmp
);
if
(
it
!=
edges
.
end
())
return
*
it
;
else
...
...
@@ -134,35 +134,36 @@ GEdge *GModel::edgeByTag(int n) const
GVertex
*
GModel
::
vertexByTag
(
int
n
)
const
{
GEntity
tmp
((
GModel
*
)
this
,
n
);
viter
it
=
vertices
.
find
((
GVertex
*
)
&
tmp
);
std
::
set
<
GVertex
*
,
GEntityLessThan
>::
const_iterator
it
=
vertices
.
find
((
GVertex
*
)
&
tmp
);
if
(
it
!=
vertices
.
end
())
return
*
it
;
else
return
0
;
}
void
GModel
::
remove
(
GRegion
*
r
)
{
void
GModel
::
remove
(
GRegion
*
r
)
{
riter
it
=
std
::
find
(
firstRegion
(),
lastRegion
(),
r
);
if
(
it
!=
regions
.
end
())
regions
.
erase
(
it
);
if
(
it
!=
(
riter
)
regions
.
end
())
regions
.
erase
(
it
);
}
void
GModel
::
remove
(
GFace
*
f
)
{
void
GModel
::
remove
(
GFace
*
f
)
{
fiter
it
=
std
::
find
(
firstFace
(),
lastFace
(),
f
);
if
(
it
!=
faces
.
end
())
faces
.
erase
(
it
);
}
void
GModel
::
remove
(
GEdge
*
e
)
{
void
GModel
::
remove
(
GEdge
*
e
)
{
eiter
it
=
std
::
find
(
firstEdge
(),
lastEdge
(),
e
);
if
(
it
!=
edges
.
end
())
edges
.
erase
(
it
);
}
void
GModel
::
remove
(
GVertex
*
v
)
void
GModel
::
remove
(
GVertex
*
v
)
{
viter
it
=
std
::
find
(
firstVertex
(),
lastVertex
(),
v
);
if
(
it
!=
vertices
.
end
())
vertices
.
erase
(
it
);
if
(
it
!=
vertices
.
end
())
vertices
.
erase
(
it
);
}
template
<
class
T
>
...
...
@@ -170,7 +171,7 @@ static void removeInvisible(std::vector<T*> &elements, bool all)
{
std
::
vector
<
T
*>
tmp
;
for
(
unsigned
int
i
=
0
;
i
<
elements
.
size
();
i
++
){
if
(
all
||
!
elements
[
i
]
->
getVisibility
())
if
(
all
||
!
elements
[
i
]
->
getVisibility
())
delete
elements
[
i
];
else
tmp
.
push_back
(
elements
[
i
]);
...
...
@@ -182,7 +183,7 @@ static void removeInvisible(std::vector<T*> &elements, bool all)
void
GModel
::
removeInvisibleElements
()
{
for
(
riter
it
=
firstRegion
();
it
!=
lastRegion
();
++
it
){
bool
all
=
!
(
*
it
)
->
getVisibility
();
bool
all
=
!
(
*
it
)
->
getVisibility
();
removeInvisible
((
*
it
)
->
tetrahedra
,
all
);
removeInvisible
((
*
it
)
->
hexahedra
,
all
);
removeInvisible
((
*
it
)
->
prisms
,
all
);
...
...
@@ -190,13 +191,13 @@ void GModel::removeInvisibleElements()
(
*
it
)
->
deleteVertexArrays
();
}
for
(
fiter
it
=
firstFace
();
it
!=
lastFace
();
++
it
){
bool
all
=
!
(
*
it
)
->
getVisibility
();
bool
all
=
!
(
*
it
)
->
getVisibility
();
removeInvisible
((
*
it
)
->
triangles
,
all
);
removeInvisible
((
*
it
)
->
quadrangles
,
all
);
(
*
it
)
->
deleteVertexArrays
();
}
for
(
eiter
it
=
firstEdge
();
it
!=
lastEdge
();
++
it
){
bool
all
=
!
(
*
it
)
->
getVisibility
();
bool
all
=
!
(
*
it
)
->
getVisibility
();
removeInvisible
((
*
it
)
->
lines
,
all
);
(
*
it
)
->
deleteVertexArrays
();
}
...
...
@@ -239,23 +240,23 @@ int GModel::renumberMeshVertices(bool saveAll)
// tag all mesh vertices with -1 (negative vertices will not be
// saved)
for
(
viter
it
=
firstVertex
();
it
!=
lastVertex
();
++
it
)
for
(
unsigned
int
i
=
0
;
i
<
(
*
it
)
->
mesh_vertices
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
(
*
it
)
->
mesh_vertices
.
size
();
i
++
)
(
*
it
)
->
mesh_vertices
[
i
]
->
setNum
(
-
1
);
for
(
eiter
it
=
firstEdge
();
it
!=
lastEdge
();
++
it
)
for
(
unsigned
int
i
=
0
;
i
<
(
*
it
)
->
mesh_vertices
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
(
*
it
)
->
mesh_vertices
.
size
();
i
++
)
(
*
it
)
->
mesh_vertices
[
i
]
->
setNum
(
-
1
);
for
(
fiter
it
=
firstFace
();
it
!=
lastFace
();
++
it
)
for
(
unsigned
int
i
=
0
;
i
<
(
*
it
)
->
mesh_vertices
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
(
*
it
)
->
mesh_vertices
.
size
();
i
++
)
(
*
it
)
->
mesh_vertices
[
i
]
->
setNum
(
-
1
);
for
(
riter
it
=
firstRegion
();
it
!=
lastRegion
();
++
it
)
for
(
unsigned
int
i
=
0
;
i
<
(
*
it
)
->
mesh_vertices
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
(
*
it
)
->
mesh_vertices
.
size
();
i
++
)
(
*
it
)
->
mesh_vertices
[
i
]
->
setNum
(
-
1
);
// tag all mesh vertices belonging to elements that need to be saved
// with 0
for
(
viter
it
=
firstVertex
();
it
!=
lastVertex
();
++
it
)
if
(
saveAll
||
(
*
it
)
->
physicals
.
size
()){
for
(
unsigned
int
i
=
0
;
i
<
(
*
it
)
->
mesh_vertices
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
(
*
it
)
->
mesh_vertices
.
size
();
i
++
)
(
*
it
)
->
mesh_vertices
[
i
]
->
setNum
(
0
);
}
for
(
eiter
it
=
firstEdge
();
it
!=
lastEdge
();
++
it
)
...
...
@@ -288,23 +289,23 @@ int GModel::renumberMeshVertices(bool saveAll)
for
(
int
j
=
0
;
j
<
(
*
it
)
->
pyramids
[
i
]
->
getNumVertices
();
j
++
)
(
*
it
)
->
pyramids
[
i
]
->
getVertex
(
j
)
->
setNum
(
0
);
}
// renumber all the mesh vertices tagged with 0
int
numVertices
=
0
;
for
(
viter
it
=
firstVertex
();
it
!=
lastVertex
();
++
it
)
for
(
unsigned
int
i
=
0
;
i
<
(
*
it
)
->
mesh_vertices
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
(
*
it
)
->
mesh_vertices
.
size
();
i
++
)
if
(
!
(
*
it
)
->
mesh_vertices
[
i
]
->
getNum
())
(
*
it
)
->
mesh_vertices
[
i
]
->
setNum
(
++
numVertices
);
for
(
eiter
it
=
firstEdge
();
it
!=
lastEdge
();
++
it
)
for
(
unsigned
int
i
=
0
;
i
<
(
*
it
)
->
mesh_vertices
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
(
*
it
)
->
mesh_vertices
.
size
();
i
++
)
if
(
!
(
*
it
)
->
mesh_vertices
[
i
]
->
getNum
())
(
*
it
)
->
mesh_vertices
[
i
]
->
setNum
(
++
numVertices
);
for
(
fiter
it
=
firstFace
();
it
!=
lastFace
();
++
it
)
for
(
unsigned
int
i
=
0
;
i
<
(
*
it
)
->
mesh_vertices
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
(
*
it
)
->
mesh_vertices
.
size
();
i
++
)
if
(
!
(
*
it
)
->
mesh_vertices
[
i
]
->
getNum
())
(
*
it
)
->
mesh_vertices
[
i
]
->
setNum
(
++
numVertices
);
for
(
riter
it
=
firstRegion
();
it
!=
lastRegion
();
++
it
)
for
(
unsigned
int
i
=
0
;
i
<
(
*
it
)
->
mesh_vertices
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
(
*
it
)
->
mesh_vertices
.
size
();
i
++
)
if
(
!
(
*
it
)
->
mesh_vertices
[
i
]
->
getNum
())
(
*
it
)
->
mesh_vertices
[
i
]
->
setNum
(
++
numVertices
);
...
...
@@ -457,14 +458,14 @@ SBoundingBox3d GModel::bounds()
int
GModel
::
getMeshStatus
(
bool
countDiscrete
)
{
for
(
riter
it
=
firstRegion
();
it
!=
lastRegion
();
++
it
)
if
((
countDiscrete
||
(
*
it
)
->
geomType
()
!=
GEntity
::
DiscreteVolume
)
&&
((
*
it
)
->
tetrahedra
.
size
()
||
(
*
it
)
->
hexahedra
.
size
()
||
if
((
countDiscrete
||
(
*
it
)
->
geomType
()
!=
GEntity
::
DiscreteVolume
)
&&
((
*
it
)
->
tetrahedra
.
size
()
||
(
*
it
)
->
hexahedra
.
size
()
||
(
*
it
)
->
prisms
.
size
()
||
(
*
it
)
->
pyramids
.
size
()))
return
3
;
for
(
fiter
it
=
firstFace
();
it
!=
lastFace
();
++
it
)
if
((
countDiscrete
||
(
*
it
)
->
geomType
()
!=
GEntity
::
DiscreteSurface
)
&&
if
((
countDiscrete
||
(
*
it
)
->
geomType
()
!=
GEntity
::
DiscreteSurface
)
&&
((
*
it
)
->
triangles
.
size
()
||
(
*
it
)
->
quadrangles
.
size
()))
return
2
;
for
(
eiter
it
=
firstEdge
();
it
!=
lastEdge
();
++
it
)
if
((
countDiscrete
||
(
*
it
)
->
geomType
()
!=
GEntity
::
DiscreteCurve
)
&&
if
((
countDiscrete
||
(
*
it
)
->
geomType
()
!=
GEntity
::
DiscreteCurve
)
&&
(
*
it
)
->
lines
.
size
())
return
1
;
for
(
viter
it
=
firstVertex
();
it
!=
lastVertex
();
++
it
)
if
((
*
it
)
->
mesh_vertices
.
size
())
return
0
;
...
...
@@ -536,7 +537,7 @@ static int checkVertices(std::vector<MVertex*> &vertices,
pos
.
insert
(
v
);
}
else
{
Msg
(
INFO
,
"Vertices %d and %d have identical position (%g, %g, %g)"
,
Msg
(
INFO
,
"Vertices %d and %d have identical position (%g, %g, %g)"
,
(
*
it
)
->
getNum
(),
v
->
getNum
(),
v
->
x
(),
v
->
y
(),
v
->
z
());
num
++
;
}
...
...
@@ -561,16 +562,16 @@ static int checkElements(int tag,
char
temp2
[
256
];
sprintf
(
temp
,
"Elements %d tag %d("
,(
*
it
)
->
getNum
(),
tag
);
for
(
int
i
=
0
;
i
<
(
*
it
)
->
getNumVertices
();
i
++
){
sprintf
(
temp2
,
"%d "
,(
*
it
)
->
getVertex
(
i
)
->
getNum
());
sprintf
(
temp2
,
"%d "
,(
*
it
)
->
getVertex
(
i
)
->
getNum
());
strcat
(
temp
,
temp2
);
}
sprintf
(
temp2
,
") and %d("
,
e
->
getNum
());
strcat
(
temp
,
temp2
);
for
(
int
i
=
0
;
i
<
e
->
getNumVertices
();
i
++
){
sprintf
(
temp2
,
"%d "
,
e
->
getVertex
(
i
)
->
getNum
());
sprintf
(
temp2
,
"%d "
,
e
->
getVertex
(
i
)
->
getNum
());
strcat
(
temp
,
temp2
);
}
sprintf
(
temp2
,
")have identical barycenter"
);
sprintf
(
temp2
,
")have identical barycenter"
);
strcat
(
temp
,
temp2
);
Msg
(
INFO
,
"%s"
,
temp
);
num
++
;
...
...
@@ -592,7 +593,7 @@ void GModel::checkMeshCoherence()
// check for duplicate mesh vertices
{
double
old_tol
=
MVertexLessThanLexicographic
::
tolerance
;
double
old_tol
=
MVertexLessThanLexicographic
::
tolerance
;
MVertexLessThanLexicographic
::
tolerance
=
tol
;
std
::
set
<
MVertex
*
,
MVertexLessThanLexicographic
>
pos
;
int
num
=
0
;
...
...
@@ -610,7 +611,7 @@ void GModel::checkMeshCoherence()
// check for duplicate elements
{
double
old_tol
=
MElementLessThanLexicographic
::
tolerance
;
double
old_tol
=
MElementLessThanLexicographic
::
tolerance
;
MElementLessThanLexicographic
::
tolerance
=
tol
;
std
::
set
<
MElement
*
,
MElementLessThanLexicographic
>
pos
;
int
num
=
0
;
...
...
This diff is collapsed.
Click to expand it.
Geo/GModel.h
+
14
−
14
View file @
15b1202c
...
...
@@ -17,7 +17,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA.
//
//
// Please report all bugs and problems to <gmsh@geuz.org>.
#include
<algorithm>
...
...
@@ -34,7 +34,7 @@ class OCC_Internals;
class
smooth_normals
;
// A geometric model. The model is a "not yet" non-manifold B-Rep.
class
GModel
class
GModel
{
private:
void
createGEOInternals
();
...
...
@@ -60,19 +60,19 @@ class GModel
public
:
GModel
(
std
::
string
name
=
""
);
virtual
~
GModel
();
// the static list of all loaded models
static
std
::
vector
<
GModel
*>
list
;
// returns the current model
static
GModel
*
current
();
typedef
std
::
set
<
GRegion
*
,
GEntityLessThan
>::
const_
iterator
riter
;
typedef
std
::
set
<
GFace
*
,
GEntityLessThan
>::
const_
iterator
fiter
;
typedef
std
::
set
<
GEdge
*
,
GEntityLessThan
>::
const_
iterator
eiter
;
typedef
std
::
set
<
GVertex
*
,
GEntityLessThan
>::
const_
iterator
viter
;
typedef
std
::
map
<
int
,
std
::
string
>::
const_
iterator
piter
;
typedef
std
::
set
<
GRegion
*
,
GEntityLessThan
>::
iterator
riter
;
typedef
std
::
set
<
GFace
*
,
GEntityLessThan
>::
iterator
fiter
;
typedef
std
::
set
<
GEdge
*
,
GEntityLessThan
>::
iterator
eiter
;
typedef
std
::
set
<
GVertex
*
,
GEntityLessThan
>::
iterator
viter
;
typedef
std
::
map
<
int
,
std
::
string
>::
iterator
piter
;
// Deletes everything in a GModel
// Deletes everything in a GModel
void
destroy
();
// Returns the geometric tolerance for the entire model.
...
...
@@ -196,7 +196,7 @@ class GModel
bool
saveAll
=
false
,
double
scalingFactor
=
1.0
);
// Mesh statistics (as Gmsh post-processing views)
int
writePOS
(
const
std
::
string
&
name
,
bool
printElementary
,
int
writePOS
(
const
std
::
string
&
name
,
bool
printElementary
,
bool
printElementNumber
,
bool
printGamma
,
bool
printEta
,
bool
printRho
,
bool
saveAll
=
false
,
double
scalingFactor
=
1.0
);
...
...
@@ -207,17 +207,17 @@ class GModel
// Inventor/VRML format
int
readVRML
(
const
std
::
string
&
name
);
int
writeVRML
(
const
std
::
string
&
name
,
int
writeVRML
(
const
std
::
string
&
name
,
bool
saveAll
=
false
,
double
scalingFactor
=
1.0
);
// I-deas universal mesh format
int
readUNV
(
const
std
::
string
&
name
);
int
writeUNV
(
const
std
::
string
&
name
,
bool
saveAll
=
false
,
int
writeUNV
(
const
std
::
string
&
name
,
bool
saveAll
=
false
,
bool
saveGroupsOfNodes
=
false
,
double
scalingFactor
=
1.0
);
// Medit (INRIA) mesh format
int
readMESH
(
const
std
::
string
&
name
);
int
writeMESH
(
const
std
::
string
&
name
,
int
writeMESH
(
const
std
::
string
&
name
,
bool
saveAll
=
false
,
double
scalingFactor
=
1.0
);
// Nastran Bulk Data File format
...
...
@@ -227,7 +227,7 @@ class GModel
// Plot3D structured mesh format
int
readP3D
(
const
std
::
string
&
name
);
int
writeP3D
(
const
std
::
string
&
name
,
int
writeP3D
(
const
std
::
string
&
name
,
bool
saveAll
=
false
,
double
scalingFactor
=
1.0
);
// CFD General Notation System files
...
...
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