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
b1761f57
Commit
b1761f57
authored
16 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
better getMeshvertices for jf
parent
63432861
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Geo/GModel.cpp
+26
-54
26 additions, 54 deletions
Geo/GModel.cpp
Geo/GModel.h
+5
-5
5 additions, 5 deletions
Geo/GModel.h
Geo/GModelIO_Mesh.cpp
+10
-34
10 additions, 34 deletions
Geo/GModelIO_Mesh.cpp
with
41 additions
and
93 deletions
Geo/GModel.cpp
+
26
−
54
View file @
b1761f57
// $Id: GModel.cpp,v 1.8
5
2008-04-22 1
2:41:18 remacl
e Exp $
// $Id: GModel.cpp,v 1.8
6
2008-04-22 1
6:14:34 geuzain
e Exp $
//
//
// Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
// Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
//
//
...
@@ -465,6 +465,31 @@ MVertex *GModel::getMeshVertexByTag(int n)
...
@@ -465,6 +465,31 @@ MVertex *GModel::getMeshVertexByTag(int n)
return
_vertexMapCache
[
n
];
return
_vertexMapCache
[
n
];
}
}
void
GModel
::
getMeshVertices
(
int
number
,
int
dim
,
std
::
vector
<
MVertex
*>
&
v
)
{
v
.
clear
();
std
::
map
<
int
,
std
::
vector
<
GEntity
*>
>
groups
[
4
];
getPhysicalGroups
(
groups
);
std
::
map
<
int
,
std
::
vector
<
GEntity
*>
>::
const_iterator
it
=
groups
[
dim
].
find
(
number
);
if
(
it
==
groups
[
dim
].
end
())
return
;
const
std
::
vector
<
GEntity
*>
&
entities
=
it
->
second
;
std
::
set
<
MVertex
*>
sv
;
for
(
unsigned
int
i
=
0
;
i
<
entities
.
size
();
i
++
){
if
(
dim
==
0
){
GVertex
*
g
=
(
GVertex
*
)
entities
[
i
];
sv
.
insert
(
g
->
mesh_vertices
[
0
]);
}
else
{
for
(
int
j
=
0
;
j
<
entities
[
i
]
->
getNumMeshElements
();
j
++
){
MElement
*
e
=
entities
[
i
]
->
getMeshElement
(
j
);
for
(
int
k
=
0
;
k
<
e
->
getNumVertices
();
k
++
)
sv
.
insert
(
e
->
getVertex
(
k
));
}
}
}
v
.
insert
(
v
.
begin
(),
sv
.
begin
(),
sv
.
end
());
}
template
<
class
T
>
template
<
class
T
>
static
void
removeInvisible
(
std
::
vector
<
T
*>
&
elements
,
bool
all
)
static
void
removeInvisible
(
std
::
vector
<
T
*>
&
elements
,
bool
all
)
{
{
...
@@ -790,56 +815,3 @@ void GModel::_associateEntityWithMeshVertices()
...
@@ -790,56 +815,3 @@ void GModel::_associateEntityWithMeshVertices()
}
}
}
}
void
get_mesh_vertices
(
GVertex
*
g
,
std
::
set
<
MVertex
*>
&
sv
)
{
sv
.
insert
(
g
->
mesh_vertices
[
0
]);
}
void
get_mesh_vertices
(
GEdge
*
g
,
std
::
set
<
MVertex
*>
&
sv
)
{
sv
.
insert
(
g
->
mesh_vertices
.
begin
(),
g
->
mesh_vertices
.
end
());
sv
.
insert
(
g
->
getBeginVertex
()
->
mesh_vertices
[
0
]);
sv
.
insert
(
g
->
getEndVertex
()
->
mesh_vertices
[
0
]);
}
void
get_mesh_vertices
(
GFace
*
g
,
std
::
set
<
MVertex
*>
&
sv
)
{
sv
.
insert
(
g
->
mesh_vertices
.
begin
(),
g
->
mesh_vertices
.
end
());
std
::
list
<
GEdge
*>
l
=
g
->
edges
();
for
(
std
::
list
<
GEdge
*>::
iterator
it
=
l
.
begin
();
it
!=
l
.
end
();
++
it
)
get_mesh_vertices
(
*
it
,
sv
);
}
void
get_mesh_vertices
(
GRegion
*
g
,
std
::
set
<
MVertex
*>
&
sv
)
{
sv
.
insert
(
g
->
mesh_vertices
.
begin
(),
g
->
mesh_vertices
.
end
());
std
::
list
<
GFace
*>
l
=
g
->
faces
();
for
(
std
::
list
<
GFace
*>::
iterator
it
=
l
.
begin
();
it
!=
l
.
end
();
++
it
)
get_mesh_vertices
(
*
it
,
sv
);
}
void
GModel
::
getMeshVertices
(
int
number
,
int
dim
,
std
::
vector
<
MVertex
*>
&
v
)
{
v
.
clear
();
std
::
map
<
int
,
std
::
vector
<
GEntity
*>
>
groups
[
4
];
getPhysicalGroups
(
groups
);
std
::
map
<
int
,
std
::
vector
<
GEntity
*>
>::
const_iterator
it
=
groups
[
dim
].
find
(
number
);
if
(
it
==
groups
[
dim
].
end
())
return
;
const
std
::
vector
<
GEntity
*>
&
entities
=
it
->
second
;
std
::
set
<
MVertex
*>
sv
;
for
(
int
i
=
0
;
i
<
entities
.
size
();
i
++
){
switch
(
dim
){
case
0
:
get_mesh_vertices
((
GVertex
*
)
entities
[
i
],
sv
);
break
;
case
1
:
get_mesh_vertices
((
GEdge
*
)
entities
[
i
],
sv
);
break
;
case
2
:
get_mesh_vertices
((
GFace
*
)
entities
[
i
],
sv
);
break
;
case
3
:
get_mesh_vertices
((
GRegion
*
)
entities
[
i
],
sv
);
break
;
default:
throw
;
}
}
v
.
insert
(
v
.
begin
(),
sv
.
begin
(),
sv
.
end
());
}
This diff is collapsed.
Click to expand it.
Geo/GModel.h
+
5
−
5
View file @
b1761f57
...
@@ -166,13 +166,9 @@ class GModel
...
@@ -166,13 +166,9 @@ class GModel
// Associate a name with a physical number (returns new id if number==0)
// Associate a name with a physical number (returns new id if number==0)
int
setPhysicalName
(
std
::
string
name
,
int
number
=
0
);
int
setPhysicalName
(
std
::
string
name
,
int
number
=
0
);
//
create a new physical name and return the automatic associated number
//
Get the name (if any) of a given physical group
std
::
string
getPhysicalName
(
int
number
);
std
::
string
getPhysicalName
(
int
number
);
// get all the mesh vertices associated to a given physical group
void
getMeshVertices
(
int
number
,
int
dim
,
std
::
vector
<
MVertex
*>
&
);
// void getMeshVertices (std::string &name, std::vector<MVertex*> &);
// The bounding box
// The bounding box
SBoundingBox3d
bounds
();
SBoundingBox3d
bounds
();
...
@@ -188,6 +184,10 @@ class GModel
...
@@ -188,6 +184,10 @@ class GModel
// Access a mesh vertex by tag, using the vertex cache
// Access a mesh vertex by tag, using the vertex cache
MVertex
*
getMeshVertexByTag
(
int
n
);
MVertex
*
getMeshVertexByTag
(
int
n
);
// get all the mesh vertices associated with the physical group
// "number" of dimension "dim"
void
getMeshVertices
(
int
number
,
int
dim
,
std
::
vector
<
MVertex
*>
&
);
// index all the (used) mesh vertices in a continuous sequence
// index all the (used) mesh vertices in a continuous sequence
int
indexMeshVertices
(
bool
all
);
int
indexMeshVertices
(
bool
all
);
...
...
This diff is collapsed.
Click to expand it.
Geo/GModelIO_Mesh.cpp
+
10
−
34
View file @
b1761f57
// $Id: GModelIO_Mesh.cpp,v 1.5
0
2008-04-
0
2 1
7:21
:3
3
geuzaine Exp $
// $Id: GModelIO_Mesh.cpp,v 1.5
1
2008-04-
2
2 1
6:14
:3
4
geuzaine Exp $
//
//
// Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
// Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
//
//
...
@@ -1349,41 +1349,17 @@ int GModel::writeUNV(const std::string &name, bool saveAll, bool saveGroupsOfNod
...
@@ -1349,41 +1349,17 @@ int GModel::writeUNV(const std::string &name, bool saveAll, bool saveGroupsOfNod
for
(
std
::
map
<
int
,
std
::
vector
<
GEntity
*>
>::
iterator
it
=
groups
[
dim
].
begin
();
for
(
std
::
map
<
int
,
std
::
vector
<
GEntity
*>
>::
iterator
it
=
groups
[
dim
].
begin
();
it
!=
groups
[
dim
].
end
();
it
++
){
it
!=
groups
[
dim
].
end
();
it
++
){
std
::
set
<
MVertex
*>
nodes
;
std
::
set
<
MVertex
*>
nodes
;
for
(
unsigned
int
i
=
0
;
i
<
it
->
second
.
size
();
i
++
){
std
::
vector
<
GEntity
*>
&
entities
=
it
->
second
;
if
(
dim
==
1
){
for
(
unsigned
int
i
=
0
;
i
<
entities
.
size
();
i
++
){
GEdge
*
ge
=
(
GEdge
*
)
it
->
second
[
i
];
for
(
int
j
=
0
;
j
<
entities
[
i
]
->
getNumMeshElements
();
j
++
){
for
(
unsigned
int
j
=
0
;
j
<
ge
->
lines
.
size
();
j
++
)
MElement
*
e
=
entities
[
i
]
->
getMeshElement
(
j
);
for
(
int
k
=
0
;
k
<
ge
->
lines
[
j
]
->
getNumVertices
();
k
++
)
for
(
int
k
=
0
;
k
<
e
->
getNumVertices
();
k
++
)
nodes
.
insert
(
ge
->
lines
[
j
]
->
getVertex
(
k
));
nodes
.
insert
(
e
->
getVertex
(
k
));
}
}
else
if
(
dim
==
2
){
}
GFace
*
gf
=
(
GFace
*
)
it
->
second
[
i
];
for
(
unsigned
int
j
=
0
;
j
<
gf
->
triangles
.
size
();
j
++
)
for
(
int
k
=
0
;
k
<
gf
->
triangles
[
j
]
->
getNumVertices
();
k
++
)
nodes
.
insert
(
gf
->
triangles
[
j
]
->
getVertex
(
k
));
for
(
unsigned
int
j
=
0
;
j
<
gf
->
quadrangles
.
size
();
j
++
)
for
(
int
k
=
0
;
k
<
gf
->
quadrangles
[
j
]
->
getNumVertices
();
k
++
)
nodes
.
insert
(
gf
->
quadrangles
[
j
]
->
getVertex
(
k
));
}
else
if
(
dim
==
3
){
GRegion
*
gr
=
(
GRegion
*
)
it
->
second
[
i
];
for
(
unsigned
int
j
=
0
;
j
<
gr
->
tetrahedra
.
size
();
j
++
)
for
(
int
k
=
0
;
k
<
gr
->
tetrahedra
[
j
]
->
getNumVertices
();
k
++
)
nodes
.
insert
(
gr
->
tetrahedra
[
j
]
->
getVertex
(
k
));
for
(
unsigned
int
j
=
0
;
j
<
gr
->
hexahedra
.
size
();
j
++
)
for
(
int
k
=
0
;
k
<
gr
->
hexahedra
[
j
]
->
getNumVertices
();
k
++
)
nodes
.
insert
(
gr
->
hexahedra
[
j
]
->
getVertex
(
k
));
for
(
unsigned
int
j
=
0
;
j
<
gr
->
prisms
.
size
();
j
++
)
for
(
int
k
=
0
;
k
<
gr
->
prisms
[
j
]
->
getNumVertices
();
k
++
)
nodes
.
insert
(
gr
->
prisms
[
j
]
->
getVertex
(
k
));
for
(
unsigned
int
j
=
0
;
j
<
gr
->
pyramids
.
size
();
j
++
)
for
(
int
k
=
0
;
k
<
gr
->
pyramids
[
j
]
->
getNumVertices
();
k
++
)
nodes
.
insert
(
gr
->
pyramids
[
j
]
->
getVertex
(
k
));
}
}
fprintf
(
fp
,
"%10d%10d%10d%10d%10d%10d%10d%10d
\n
"
,
fprintf
(
fp
,
"%10d%10d%10d%10d%10d%10d%10d%10d
\n
"
,
gr
,
0
,
0
,
0
,
0
,
0
,
0
,
(
int
)
nodes
.
size
());
gr
,
0
,
0
,
0
,
0
,
0
,
0
,
(
int
)
nodes
.
size
());
fprintf
(
fp
,
"PERM
E
NENT GROUP%d
\n
"
,
gr
++
);
fprintf
(
fp
,
"PERM
A
NENT GROUP%d
\n
"
,
gr
++
);
int
row
=
0
;
int
row
=
0
;
for
(
std
::
set
<
MVertex
*>::
iterator
it2
=
nodes
.
begin
();
it2
!=
nodes
.
end
();
it2
++
){
for
(
std
::
set
<
MVertex
*>::
iterator
it2
=
nodes
.
begin
();
it2
!=
nodes
.
end
();
it2
++
){
if
(
row
==
2
)
{
if
(
row
==
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