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
8a68a48e
Commit
8a68a48e
authored
15 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
ghost cells, take two
parent
850a1bdc
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Fltk/pluginWindow.cpp
+1
-1
1 addition, 1 deletion
Fltk/pluginWindow.cpp
Mesh/meshPartition.cpp
+44
-24
44 additions, 24 deletions
Mesh/meshPartition.cpp
with
45 additions
and
25 deletions
Fltk/pluginWindow.cpp
+
1
−
1
View file @
8a68a48e
...
@@ -267,7 +267,7 @@ void pluginWindow::_createDialogBox(GMSH_Plugin *p, int x, int y,
...
@@ -267,7 +267,7 @@ void pluginWindow::_createDialogBox(GMSH_Plugin *p, int x, int y,
Fl_Group
*
g
=
new
Fl_Group
(
x
,
y
+
BH
,
width
,
height
-
BH
,
"Help"
);
Fl_Group
*
g
=
new
Fl_Group
(
x
,
y
+
BH
,
width
,
height
-
BH
,
"Help"
);
Fl_Browser
*
o
=
new
Fl_Browser
Fl_Browser
*
o
=
new
Fl_Browser
(
x
+
WB
,
y
+
WB
+
BH
,
width
-
2
*
WB
,
height
-
2
*
WB
-
BH
);
(
x
+
WB
,
y
+
WB
+
BH
,
width
-
2
*
WB
,
height
-
2
*
WB
-
2
*
BH
);
o
->
add
(
" "
);
o
->
add
(
" "
);
add_multiline_in_browser
(
o
,
"@c@b@."
,
p
->
getName
().
c_str
(),
false
);
add_multiline_in_browser
(
o
,
"@c@b@."
,
p
->
getName
().
c_str
(),
false
);
o
->
add
(
" "
);
o
->
add
(
" "
);
...
...
This diff is collapsed.
Click to expand it.
Mesh/meshPartition.cpp
+
44
−
24
View file @
8a68a48e
...
@@ -959,8 +959,8 @@ static void addGhostCells(GEntity *ge,
...
@@ -959,8 +959,8 @@ static void addGhostCells(GEntity *ge,
std
::
multimap
<
MVertex
*
,
MElement
*>
&
vertexToElement
,
std
::
multimap
<
MVertex
*
,
MElement
*>
&
vertexToElement
,
std
::
multimap
<
MElement
*
,
short
>
&
ghosts
)
std
::
multimap
<
MElement
*
,
short
>
&
ghosts
)
{
{
// get all the nodes on the partition boundary (
there are not s
tore
d
// get all the nodes on the partition boundary (
we need
to
re
compute
//
so we need to recompute them
)
//
them, as they are not owned by the entity
)
std
::
set
<
MVertex
*>
verts
;
std
::
set
<
MVertex
*>
verts
;
for
(
unsigned
int
i
=
0
;
i
<
ge
->
getNumMeshElements
();
i
++
){
for
(
unsigned
int
i
=
0
;
i
<
ge
->
getNumMeshElements
();
i
++
){
MElement
*
e
=
ge
->
getMeshElement
(
i
);
MElement
*
e
=
ge
->
getMeshElement
(
i
);
...
@@ -968,32 +968,41 @@ static void addGhostCells(GEntity *ge,
...
@@ -968,32 +968,41 @@ static void addGhostCells(GEntity *ge,
verts
.
insert
(
e
->
getVertex
(
j
));
verts
.
insert
(
e
->
getVertex
(
j
));
}
}
// get all the elements
in
touch
ing
the
interfac
e nodes
// get all the elements
that
touch the
s
e nodes
for
(
std
::
set
<
MVertex
*>::
iterator
it
=
verts
.
begin
();
it
!=
verts
.
end
();
it
++
){
for
(
std
::
set
<
MVertex
*>::
iterator
it
=
verts
.
begin
();
it
!=
verts
.
end
();
it
++
){
MVertex
*
v
=
*
it
;
std
::
pair
<
std
::
multimap
<
MVertex
*
,
MElement
*>::
iterator
,
std
::
pair
<
std
::
multimap
<
MVertex
*
,
MElement
*>::
iterator
,
std
::
multimap
<
MVertex
*
,
MElement
*>::
iterator
>
itp
=
std
::
multimap
<
MVertex
*
,
MElement
*>::
iterator
>
pve
=
vertexToElement
.
equal_range
(
v
);
vertexToElement
.
equal_range
(
*
it
);
// get all partitions
s
ha
ring
this node
// get all
the
partitions
t
ha
t touch
this node
std
::
set
<
short
>
parts
;
std
::
set
<
short
>
parts
;
for
(
std
::
multimap
<
MVertex
*
,
MElement
*>::
iterator
ite
=
itp
.
first
;
for
(
std
::
multimap
<
MVertex
*
,
MElement
*>::
iterator
ite
=
pve
.
first
;
ite
!=
itp
.
second
;
ite
++
)
ite
!=
pve
.
second
;
ite
++
)
parts
.
insert
(
ite
->
second
->
getPartition
());
parts
.
insert
(
ite
->
second
->
getPartition
());
// update partition info for each element touching the node
// update
the
partition info for each element touching the node
for
(
std
::
multimap
<
MVertex
*
,
MElement
*>::
iterator
ite
=
itp
.
first
;
for
(
std
::
multimap
<
MVertex
*
,
MElement
*>::
iterator
ite
=
pve
.
first
;
ite
!=
itp
.
second
;
ite
++
){
ite
!=
pve
.
second
;
ite
++
){
MElement
*
e
=
ite
->
second
;
MElement
*
e
=
ite
->
second
;
for
(
std
::
set
<
short
>::
iterator
its
=
parts
.
begin
();
its
!=
parts
.
end
();
its
++
)
std
::
pair
<
std
::
multimap
<
MElement
*
,
short
>::
iterator
,
if
(
*
its
!=
e
->
getPartition
())
std
::
multimap
<
MElement
*
,
short
>::
iterator
>
peg
=
ghosts
.
insert
(
std
::
pair
<
MElement
*
,
short
>
(
e
,
*
its
));
ghosts
.
equal_range
(
e
);
for
(
std
::
set
<
short
>::
iterator
its
=
parts
.
begin
();
its
!=
parts
.
end
();
its
++
){
short
partition
=
*
its
;
bool
skip
=
false
;
// insert the partition in the ghost map if 1) it's not
// already there and 2) it's not the same as the partition the
// element actually belongs to
for
(
std
::
multimap
<
MElement
*
,
short
>::
iterator
itg
=
peg
.
first
;
itg
!=
peg
.
second
;
itg
++
){
if
(
partition
==
itg
->
second
){
skip
=
true
;
break
;
}
}
if
(
!
skip
&&
partition
!=
e
->
getPartition
())
ghosts
.
insert
(
std
::
pair
<
MElement
*
,
short
>
(
e
,
partition
));
}
}
}
}
}
#if 1
for
(
std
::
multimap
<
MElement
*
,
short
>::
iterator
it
=
ghosts
.
begin
();
it
!=
ghosts
.
end
();
it
++
)
printf
(
"ele %d (part %d) ghost %d
\n
"
,
it
->
first
->
getNum
(),
it
->
first
->
getPartition
(),
it
->
second
);
#endif
}
}
int
CreatePartitionBoundaries
(
GModel
*
model
,
bool
createGhostCells
)
int
CreatePartitionBoundaries
(
GModel
*
model
,
bool
createGhostCells
)
...
@@ -1008,7 +1017,7 @@ int CreatePartitionBoundaries(GModel *model, bool createGhostCells)
...
@@ -1008,7 +1017,7 @@ int CreatePartitionBoundaries(GModel *model, bool createGhostCells)
std
::
multimap
<
MEdge
,
MElement
*
,
Less_Edge
>
edgeToElement
;
std
::
multimap
<
MEdge
,
MElement
*
,
Less_Edge
>
edgeToElement
;
std
::
multimap
<
MVertex
*
,
MElement
*>
vertexToElement
;
std
::
multimap
<
MVertex
*
,
MElement
*>
vertexToElement
;
//
assign
partition faces
//
create
partition faces
if
(
meshDim
==
3
){
if
(
meshDim
==
3
){
for
(
GModel
::
riter
it
=
model
->
firstRegion
();
it
!=
model
->
lastRegion
();
++
it
){
for
(
GModel
::
riter
it
=
model
->
firstRegion
();
it
!=
model
->
lastRegion
();
++
it
){
fillit_
(
faceToElement
,
(
*
it
)
->
tetrahedra
.
begin
(),
(
*
it
)
->
tetrahedra
.
end
());
fillit_
(
faceToElement
,
(
*
it
)
->
tetrahedra
.
begin
(),
(
*
it
)
->
tetrahedra
.
end
());
...
@@ -1031,7 +1040,7 @@ int CreatePartitionBoundaries(GModel *model, bool createGhostCells)
...
@@ -1031,7 +1040,7 @@ int CreatePartitionBoundaries(GModel *model, bool createGhostCells)
}
}
}
}
//
assign
partition edges
//
create
partition edges
if
(
meshDim
>
1
){
if
(
meshDim
>
1
){
if
(
meshDim
==
2
){
if
(
meshDim
==
2
){
for
(
GModel
::
fiter
it
=
model
->
firstFace
();
it
!=
model
->
lastFace
();
++
it
){
for
(
GModel
::
fiter
it
=
model
->
firstFace
();
it
!=
model
->
lastFace
();
++
it
){
...
@@ -1064,7 +1073,7 @@ int CreatePartitionBoundaries(GModel *model, bool createGhostCells)
...
@@ -1064,7 +1073,7 @@ int CreatePartitionBoundaries(GModel *model, bool createGhostCells)
//splitBoundaryEdges(model,pedges);
//splitBoundaryEdges(model,pedges);
}
}
//
mak
e partition vertices
//
creat
e partition vertices
if
(
meshDim
>
1
){
if
(
meshDim
>
1
){
if
(
meshDim
==
2
){
if
(
meshDim
==
2
){
for
(
GModel
::
fiter
it
=
model
->
firstFace
();
it
!=
model
->
lastFace
();
++
it
){
for
(
GModel
::
fiter
it
=
model
->
firstFace
();
it
!=
model
->
lastFace
();
++
it
){
...
@@ -1095,6 +1104,8 @@ int CreatePartitionBoundaries(GModel *model, bool createGhostCells)
...
@@ -1095,6 +1104,8 @@ int CreatePartitionBoundaries(GModel *model, bool createGhostCells)
}
}
}
}
// create vertex-based ghost cells (i.e., elements that touch the
// partition boundaries by at least one vertex)
if
(
createGhostCells
){
if
(
createGhostCells
){
std
::
multimap
<
MElement
*
,
short
>
&
ghosts
(
model
->
getGhostCells
());
std
::
multimap
<
MElement
*
,
short
>
&
ghosts
(
model
->
getGhostCells
());
ghosts
.
clear
();
ghosts
.
clear
();
...
@@ -1106,6 +1117,15 @@ int CreatePartitionBoundaries(GModel *model, bool createGhostCells)
...
@@ -1106,6 +1117,15 @@ int CreatePartitionBoundaries(GModel *model, bool createGhostCells)
for
(
std
::
set
<
partitionFace
*
,
Less_partitionFace
>::
iterator
it
=
pfaces
.
begin
();
for
(
std
::
set
<
partitionFace
*
,
Less_partitionFace
>::
iterator
it
=
pfaces
.
begin
();
it
!=
pfaces
.
end
();
it
++
)
it
!=
pfaces
.
end
();
it
++
)
addGhostCells
(
*
it
,
vertexToElement
,
ghosts
);
addGhostCells
(
*
it
,
vertexToElement
,
ghosts
);
#if 1
FILE
*
fp
=
fopen
(
"ghosts.pos"
,
"w"
);
fprintf
(
fp
,
"View
\"
ghosts
\"
{
\n
"
);
for
(
std
::
multimap
<
MElement
*
,
short
>::
iterator
it
=
ghosts
.
begin
();
it
!=
ghosts
.
end
();
it
++
)
it
->
first
->
writePOS
(
fp
,
false
,
true
,
false
,
false
,
false
,
false
);
fprintf
(
fp
,
"};
\n
"
);
fclose
(
fp
);
#endif
}
}
return
1
;
return
1
;
...
...
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