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
075e818f
Commit
075e818f
authored
16 years ago
by
Jean-François Remacle
Browse files
Options
Downloads
Patches
Plain Diff
Add the ability to get all the vertices from a physical group
parent
ef1464bd
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
+58
-1
58 additions, 1 deletion
Geo/GModel.cpp
Geo/GModel.h
+4
-0
4 additions, 0 deletions
Geo/GModel.h
with
62 additions
and
1 deletion
Geo/GModel.cpp
+
58
−
1
View file @
075e818f
// $Id: GModel.cpp,v 1.8
4
2008-04-
15 19:02:32 geuzain
e Exp $
// $Id: GModel.cpp,v 1.8
5
2008-04-
22 12:41:18 remacl
e Exp $
//
// Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
//
...
...
@@ -325,6 +325,9 @@ int GModel::getMaxPhysicalNumber()
return
num
;
}
int
GModel
::
setPhysicalName
(
std
::
string
name
,
int
number
)
{
// check if the name is already used
...
...
@@ -786,3 +789,57 @@ void GModel::_associateEntityWithMeshVertices()
(
*
it
)
->
mesh_vertices
[
0
]
->
setEntity
(
*
it
);
}
}
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
+
4
−
0
View file @
075e818f
...
...
@@ -169,6 +169,10 @@ class GModel
// create a new physical name and return the automatic associated 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
SBoundingBox3d
bounds
();
...
...
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