Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
iwr
amdis
Commits
4354cab8
Commit
4354cab8
authored
Jan 07, 2011
by
Thomas Witkowski
Browse files
Fixed some more periodic BC problems in 3D. Should work now correctly.
parent
dfeb9e9e
Changes
4
Hide whitespace changes
Inline
Side-by-side
AMDiS/src/parallel/ElementObjectData.cc
View file @
4354cab8
...
...
@@ -152,6 +152,9 @@ namespace AMDiS {
serialize
(
out
,
it
->
second
);
}
SerUtil
::
serialize
(
out
,
periodicVertices
);
SerUtil
::
serialize
(
out
,
periodicEdges
);
SerUtil
::
serialize
(
out
,
periodicFaces
);
}
...
...
@@ -257,6 +260,10 @@ namespace AMDiS {
deserialize
(
in
,
data
);
faceInRank
[
face
]
=
data
;
}
SerUtil
::
deserialize
(
in
,
periodicVertices
);
SerUtil
::
deserialize
(
in
,
periodicEdges
);
SerUtil
::
deserialize
(
in
,
periodicFaces
);
}
...
...
AMDiS/src/parallel/ElementObjectData.h
View file @
4354cab8
...
...
@@ -34,6 +34,15 @@
namespace
AMDiS
{
using
namespace
std
;
template
<
typename
T
>
struct
PerBoundMap
{
typedef
map
<
pair
<
T
,
T
>
,
BoundaryType
>
type
;
typedef
typename
type
::
iterator
iterator
;
};
struct
ElementObjectData
{
ElementObjectData
(
int
a
=
-
1
,
int
b
=
0
,
BoundaryType
c
=
INTERIOR
)
:
elIndex
(
a
),
...
...
@@ -48,7 +57,7 @@ namespace AMDiS {
BoundaryType
boundaryType
;
void
serialize
(
std
::
ostream
&
out
)
const
void
serialize
(
ostream
&
out
)
const
{
SerUtil
::
serialize
(
out
,
elIndex
);
SerUtil
::
serialize
(
out
,
ithObject
);
...
...
@@ -56,7 +65,7 @@ namespace AMDiS {
}
void
deserialize
(
std
::
istream
&
in
)
void
deserialize
(
istream
&
in
)
{
SerUtil
::
deserialize
(
in
,
elIndex
);
SerUtil
::
deserialize
(
in
,
ithObject
);
...
...
@@ -90,7 +99,6 @@ namespace AMDiS {
void
addVertex
(
Element
*
el
,
int
ith
,
BoundaryType
bound
=
INTERIOR
)
{
// DegreeOfFreedom vertex = el->getObject<DegreeOfFreedom>(ith);
DegreeOfFreedom
vertex
=
el
->
getDof
(
ith
,
0
);
int
elIndex
=
el
->
getIndex
();
ElementObjectData
elObj
(
elIndex
,
ith
,
bound
);
...
...
@@ -102,7 +110,6 @@ namespace AMDiS {
void
addEdge
(
Element
*
el
,
int
ith
,
BoundaryType
bound
=
INTERIOR
)
{
// DofEdge edge = el->getObject<DofEdge>(ith);
DofEdge
edge
=
el
->
getEdge
(
ith
);
int
elIndex
=
el
->
getIndex
();
ElementObjectData
elObj
(
elIndex
,
ith
,
bound
);
...
...
@@ -114,7 +121,6 @@ namespace AMDiS {
void
addFace
(
Element
*
el
,
int
ith
,
BoundaryType
bound
=
INTERIOR
)
{
// DofFace face = el->getObject<DofFace>(ith);
DofFace
face
=
el
->
getFace
(
ith
);
int
elIndex
=
el
->
getIndex
();
ElementObjectData
elObj
(
elIndex
,
ith
,
bound
);
...
...
@@ -136,8 +142,23 @@ namespace AMDiS {
addFace
(
el
,
i
);
}
void
addPeriodicVertex
(
pair
<
DegreeOfFreedom
,
DegreeOfFreedom
>
perVertex
,
BoundaryType
bType
)
{
periodicVertices
[
perVertex
]
=
bType
;
}
void
addPeriodicEdge
(
pair
<
DofEdge
,
DofEdge
>
perEdge
,
BoundaryType
bType
)
{
periodicEdges
[
perEdge
]
=
bType
;
}
void
addPeriodicFace
(
pair
<
DofFace
,
DofFace
>
perFace
,
BoundaryType
bType
)
{
periodicFaces
[
perFace
]
=
bType
;
}
void
createRankData
(
std
::
map
<
int
,
int
>&
macroElementRankMap
);
void
createRankData
(
map
<
int
,
int
>&
macroElementRankMap
);
bool
iterate
(
GeoIndex
pos
)
...
...
@@ -200,7 +221,7 @@ namespace AMDiS {
}
std
::
map
<
int
,
ElementObjectData
>&
getIterateData
()
map
<
int
,
ElementObjectData
>&
getIterateData
()
{
switch
(
iterGeoPos
)
{
case
VERTEX
:
...
...
@@ -274,33 +295,33 @@ namespace AMDiS {
}
std
::
vector
<
ElementObjectData
>&
getElements
(
DegreeOfFreedom
vertex
)
vector
<
ElementObjectData
>&
getElements
(
DegreeOfFreedom
vertex
)
{
return
vertexElements
[
vertex
];
}
std
::
vector
<
ElementObjectData
>&
getElements
(
DofEdge
edge
)
vector
<
ElementObjectData
>&
getElements
(
DofEdge
edge
)
{
return
edgeElements
[
edge
];
}
std
::
vector
<
ElementObjectData
>&
getElements
(
DofFace
face
)
vector
<
ElementObjectData
>&
getElements
(
DofFace
face
)
{
return
faceElements
[
face
];
}
std
::
map
<
int
,
ElementObjectData
>&
getElementsInRank
(
DegreeOfFreedom
vertex
)
map
<
int
,
ElementObjectData
>&
getElementsInRank
(
DegreeOfFreedom
vertex
)
{
return
vertexInRank
[
vertex
];
}
std
::
map
<
int
,
ElementObjectData
>&
getElementsInRank
(
DofEdge
edge
)
map
<
int
,
ElementObjectData
>&
getElementsInRank
(
DofEdge
edge
)
{
return
edgeInRank
[
edge
];
}
std
::
map
<
int
,
ElementObjectData
>&
getElementsInRank
(
DofFace
face
)
map
<
int
,
ElementObjectData
>&
getElementsInRank
(
DofFace
face
)
{
return
faceInRank
[
face
];
}
...
...
@@ -320,45 +341,50 @@ namespace AMDiS {
return
faceLocalMap
[
data
];
}
void
serialize
(
std
::
ostream
&
out
);
void
serialize
(
ostream
&
out
);
void
deserialize
(
std
::
istream
&
in
);
void
deserialize
(
istream
&
in
);
private:
void
serialize
(
std
::
ostream
&
out
,
std
::
vector
<
ElementObjectData
>&
elVec
);
void
serialize
(
ostream
&
out
,
vector
<
ElementObjectData
>&
elVec
);
void
deserialize
(
std
::
istream
&
in
,
std
::
vector
<
ElementObjectData
>&
elVec
);
void
deserialize
(
istream
&
in
,
vector
<
ElementObjectData
>&
elVec
);
void
serialize
(
std
::
ostream
&
out
,
std
::
map
<
int
,
ElementObjectData
>&
data
);
void
serialize
(
ostream
&
out
,
map
<
int
,
ElementObjectData
>&
data
);
void
deserialize
(
std
::
istream
&
in
,
std
::
map
<
int
,
ElementObjectData
>&
data
);
void
deserialize
(
istream
&
in
,
map
<
int
,
ElementObjectData
>&
data
);
private:
std
::
map
<
DegreeOfFreedom
,
std
::
vector
<
ElementObjectData
>
>
vertexElements
;
std
::
map
<
DofEdge
,
std
::
vector
<
ElementObjectData
>
>
edgeElements
;
std
::
map
<
DofFace
,
std
::
vector
<
ElementObjectData
>
>
faceElements
;
map
<
DegreeOfFreedom
,
vector
<
ElementObjectData
>
>
vertexElements
;
map
<
DofEdge
,
vector
<
ElementObjectData
>
>
edgeElements
;
map
<
DofFace
,
vector
<
ElementObjectData
>
>
faceElements
;
std
::
map
<
ElementObjectData
,
DegreeOfFreedom
>
vertexLocalMap
;
std
::
map
<
ElementObjectData
,
DofEdge
>
edgeLocalMap
;
std
::
map
<
ElementObjectData
,
DofFace
>
faceLocalMap
;
map
<
ElementObjectData
,
DegreeOfFreedom
>
vertexLocalMap
;
map
<
ElementObjectData
,
DofEdge
>
edgeLocalMap
;
map
<
ElementObjectData
,
DofFace
>
faceLocalMap
;
std
::
map
<
DegreeOfFreedom
,
int
>
vertexOwner
;
std
::
map
<
DofEdge
,
int
>
edgeOwner
;
std
::
map
<
DofFace
,
int
>
faceOwner
;
map
<
DegreeOfFreedom
,
int
>
vertexOwner
;
map
<
DofEdge
,
int
>
edgeOwner
;
map
<
DofFace
,
int
>
faceOwner
;
std
::
map
<
DegreeOfFreedom
,
std
::
map
<
int
,
ElementObjectData
>
>
vertexInRank
;
std
::
map
<
DofEdge
,
std
::
map
<
int
,
ElementObjectData
>
>
edgeInRank
;
std
::
map
<
DofFace
,
std
::
map
<
int
,
ElementObjectData
>
>
faceInRank
;
map
<
DegreeOfFreedom
,
map
<
int
,
ElementObjectData
>
>
vertexInRank
;
map
<
DofEdge
,
map
<
int
,
ElementObjectData
>
>
edgeInRank
;
map
<
DofFace
,
map
<
int
,
ElementObjectData
>
>
faceInRank
;
std
::
map
<
DegreeOfFreedom
,
std
::
map
<
int
,
ElementObjectData
>
>::
iterator
vertexIter
;
std
::
map
<
DofEdge
,
std
::
map
<
int
,
ElementObjectData
>
>::
iterator
edgeIter
;
std
::
map
<
DofFace
,
std
::
map
<
int
,
ElementObjectData
>
>::
iterator
faceIter
;
map
<
DegreeOfFreedom
,
map
<
int
,
ElementObjectData
>
>::
iterator
vertexIter
;
map
<
DofEdge
,
map
<
int
,
ElementObjectData
>
>::
iterator
edgeIter
;
map
<
DofFace
,
map
<
int
,
ElementObjectData
>
>::
iterator
faceIter
;
GeoIndex
iterGeoPos
;
public:
// The following three data structures store periodic DOFs, edges and faces.
PerBoundMap
<
DegreeOfFreedom
>::
type
periodicVertices
;
PerBoundMap
<
DofEdge
>::
type
periodicEdges
;
PerBoundMap
<
DofFace
>::
type
periodicFaces
;
};
}
...
...
AMDiS/src/parallel/MeshDistributor.cc
View file @
4354cab8
...
...
@@ -1323,13 +1323,11 @@ namespace AMDiS {
DofEdge
edge2
=
neigh
->
getEdge
(
elInfo
->
getOppVertex
(
i
));
BoundaryType
boundaryType
=
elInfo
->
getBoundary
(
EDGE
,
i
);
periodicEdges
[
std
::
make_pair
(
edge1
,
edge2
)]
=
boundaryType
;
elObjects
.
addPeriodicEdge
(
std
::
make_pair
(
edge1
,
edge2
),
boundaryType
);
periodicEdgeAssoc
[
edge1
].
insert
(
edge2
);
periodicVertices
[
std
::
make_pair
(
edge1
.
first
,
edge2
.
first
)]
=
boundaryType
;
periodicVertices
[
std
::
make_pair
(
edge1
.
second
,
edge2
.
second
)]
=
boundaryType
;
elObjects
.
addPeriodicVertex
(
std
::
make_pair
(
edge1
.
first
,
edge2
.
first
),
boundaryType
);
elObjects
.
addPeriodicVertex
(
std
::
make_pair
(
edge1
.
second
,
edge2
.
second
),
boundaryType
);
periodicDofAssoc
[
edge1
.
first
].
insert
(
boundaryType
);
periodicDofAssoc
[
edge1
.
second
].
insert
(
boundaryType
);
...
...
@@ -1348,11 +1346,11 @@ namespace AMDiS {
DofFace
face2
=
neigh
->
getFace
(
elInfo
->
getOppVertex
(
i
));
BoundaryType
boundaryType
=
elInfo
->
getBoundary
(
FACE
,
i
);
p
eriodicFace
s
[
std
::
make_pair
(
face1
,
face2
)
]
=
elInfo
->
getBoundary
(
i
);
elObjects
.
addP
eriodicFace
(
std
::
make_pair
(
face1
,
face2
)
,
elInfo
->
getBoundary
(
i
)
)
;
p
eriodicVert
ices
[
std
::
make_pair
(
face1
.
get
<
0
>
(),
face2
.
get
<
0
>
())
]
=
boundaryType
;
p
eriodicVert
ices
[
std
::
make_pair
(
face1
.
get
<
1
>
(),
face2
.
get
<
1
>
())
]
=
boundaryType
;
p
eriodicVert
ices
[
std
::
make_pair
(
face1
.
get
<
2
>
(),
face2
.
get
<
2
>
())
]
=
boundaryType
;
elObjects
.
addP
eriodicVert
ex
(
std
::
make_pair
(
face1
.
get
<
0
>
(),
face2
.
get
<
0
>
())
,
boundaryType
)
;
elObjects
.
addP
eriodicVert
ex
(
std
::
make_pair
(
face1
.
get
<
1
>
(),
face2
.
get
<
1
>
())
,
boundaryType
)
;
elObjects
.
addP
eriodicVert
ex
(
std
::
make_pair
(
face1
.
get
<
2
>
(),
face2
.
get
<
2
>
())
,
boundaryType
)
;
periodicDofAssoc
[
face1
.
get
<
0
>
()].
insert
(
boundaryType
);
periodicDofAssoc
[
face1
.
get
<
1
>
()].
insert
(
boundaryType
);
...
...
@@ -1371,9 +1369,10 @@ namespace AMDiS {
DofEdge
neighEdge2
=
std
::
make_pair
(
face2
.
get
<
0
>
(),
face2
.
get
<
2
>
());
DofEdge
neighEdge3
=
std
::
make_pair
(
face2
.
get
<
1
>
(),
face2
.
get
<
2
>
());
periodicEdges
[
std
::
make_pair
(
elEdge1
,
neighEdge1
)]
=
boundaryType
;
periodicEdges
[
std
::
make_pair
(
elEdge2
,
neighEdge2
)]
=
boundaryType
;
periodicEdges
[
std
::
make_pair
(
elEdge3
,
neighEdge3
)]
=
boundaryType
;
elObjects
.
addPeriodicEdge
(
std
::
make_pair
(
elEdge1
,
neighEdge1
),
boundaryType
);
elObjects
.
addPeriodicEdge
(
std
::
make_pair
(
elEdge2
,
neighEdge2
),
boundaryType
);
elObjects
.
addPeriodicEdge
(
std
::
make_pair
(
elEdge3
,
neighEdge3
),
boundaryType
);
periodicEdgeAssoc
[
elEdge1
].
insert
(
neighEdge1
);
periodicEdgeAssoc
[
elEdge2
].
insert
(
neighEdge2
);
...
...
@@ -1394,7 +1393,7 @@ namespace AMDiS {
// === Search for interectly connected vertices in periodic boundaries. ===
if
(
periodicVertices
.
size
()
>
0
)
{
if
(
elObjects
.
periodicVertices
.
size
()
>
0
)
{
// === Search for an unsed boundary index. ===
...
...
@@ -1412,42 +1411,100 @@ namespace AMDiS {
// === Get all vertex DOFs that have multiple periodic associations. ===
std
::
map
<
int
,
std
::
vector
<
DegreeOfFreedom
>
>
mult
iple
PeriodicDof
;
std
::
vector
<
DegreeOfFreedom
>
mult
PeriodicDof2
,
mult
PeriodicDof
3
;
for
(
std
::
map
<
DegreeOfFreedom
,
std
::
set
<
BoundaryType
>
>::
iterator
it
=
periodicDofAssoc
.
begin
();
it
!=
periodicDofAssoc
.
end
();
++
it
)
{
TEST_EXIT_DBG
((
mesh
->
getDim
()
==
2
&&
it
->
second
.
size
()
<=
2
)
||
(
mesh
->
getDim
()
==
3
&&
it
->
second
.
size
()
<=
3
))
(
"Should not happen!
\n
"
);
multiplePeriodicDof
[
it
->
second
.
size
()].
push_back
(
it
->
first
);
if
(
it
->
second
.
size
()
==
2
)
multPeriodicDof2
.
push_back
(
it
->
first
);
if
(
it
->
second
.
size
()
==
3
)
multPeriodicDof3
.
push_back
(
it
->
first
);
}
if
(
mesh
->
getDim
()
==
2
)
{
TEST_EXIT_DBG
(
multPeriodicDof2
.
size
()
==
0
||
multPeriodicDof2
.
size
()
==
4
)
(
"Should not happen (%d)!
\n
"
,
multPeriodicDof2
.
size
());
TEST_EXIT_DBG
(
multPeriodicDof3
.
size
()
==
0
)(
"Should not happen!
\n
"
);
}
if
(
mesh
->
getDim
()
==
3
)
{
TEST_EXIT_DBG
(
multPeriodicDof3
.
size
()
==
0
||
multPeriodicDof3
.
size
()
==
8
)
(
"Should not happen (%d)!
\n
"
,
multPeriodicDof3
.
size
());
}
if
(
mesh
->
getDim
()
==
2
)
TEST_EXIT_DBG
(
multiplePeriodicDof
[
2
].
size
()
==
0
||
multiplePeriodicDof
[
2
].
size
()
==
4
)
(
"Should not happen (%d)!
\n
"
,
multiplePeriodicDof
[
2
].
size
());
if
(
mesh
->
getDim
()
==
3
)
TEST_EXIT_DBG
(
multiplePeriodicDof
[
3
].
size
()
==
0
||
multiplePeriodicDof
[
3
].
size
()
==
8
)
(
"Should not happen (%d)!
\n
"
,
multiplePeriodicDof
[
3
].
size
());
if
(
multPeriodicDof2
.
size
()
>
0
)
{
for
(
unsigned
int
i
=
0
;
i
<
multPeriodicDof2
.
size
();
i
++
)
{
DegreeOfFreedom
dof0
=
multPeriodicDof2
[
i
];
if
(
dof0
==
-
1
)
continue
;
DegreeOfFreedom
dof1
=
-
1
;
DegreeOfFreedom
dof2
=
-
1
;
BoundaryType
type0
=
*
(
periodicDofAssoc
[
dof0
].
begin
());
BoundaryType
type1
=
*
(
++
(
periodicDofAssoc
[
dof0
].
begin
()));
for
(
PerBoundMap
<
DegreeOfFreedom
>::
iterator
it
=
elObjects
.
periodicVertices
.
begin
();
it
!=
elObjects
.
periodicVertices
.
end
();
++
it
)
{
if
(
it
->
first
.
first
==
dof0
&&
it
->
second
==
type0
)
dof1
=
it
->
first
.
second
;
if
(
it
->
first
.
first
==
dof0
&&
it
->
second
==
type1
)
dof2
=
it
->
first
.
second
;
if
(
dof1
!=
-
1
&&
dof2
!=
-
1
)
break
;
}
TEST_EXIT_DBG
(
dof1
!=
-
1
&&
dof2
!=
-
1
)(
"Should not happen!
\n
"
);
DegreeOfFreedom
dof3
=
-
1
;
for
(
PerBoundMap
<
DegreeOfFreedom
>::
iterator
it
=
elObjects
.
periodicVertices
.
begin
();
it
!=
elObjects
.
periodicVertices
.
end
();
++
it
)
{
if
(
it
->
first
.
first
==
dof1
&&
it
->
second
==
type1
)
{
dof3
=
it
->
first
.
second
;
TEST_EXIT_DBG
(
elObjects
.
periodicVertices
[
std
::
make_pair
(
dof2
,
dof3
)]
==
type0
)
(
"Should not happen!
\n
"
);
for
(
int
k
=
2
;
k
<=
3
;
k
++
)
{
int
nMultiplePeriodicDofs
=
multiplePeriodicDof
[
k
].
size
();
for
(
int
i
=
0
;
i
<
nMultiplePeriodicDofs
;
i
++
)
{
for
(
int
j
=
i
+
1
;
j
<
nMultiplePeriodicDofs
;
j
++
)
{
break
;
}
}
TEST_EXIT_DBG
(
dof3
!=
-
1
)(
"Should not happen!
\n
"
);
TEST_EXIT_DBG
(
elObjects
.
periodicVertices
.
count
(
std
::
make_pair
(
dof0
,
dof3
))
==
0
)
(
"Should not happen!
\n
"
);
TEST_EXIT_DBG
(
elObjects
.
periodicVertices
.
count
(
std
::
make_pair
(
dof3
,
dof0
))
==
0
)
(
"Should not happen!
\n
"
);
elObjects
.
periodicVertices
[
std
::
make_pair
(
dof0
,
dof3
)]
=
newPeriodicBoundaryType
;
elObjects
.
periodicVertices
[
std
::
make_pair
(
dof3
,
dof0
)]
=
newPeriodicBoundaryType
;
for
(
unsigned
int
j
=
i
+
1
;
j
<
multPeriodicDof2
.
size
();
j
++
)
if
(
multPeriodicDof2
[
j
]
==
dof3
)
multPeriodicDof2
[
j
]
=
-
1
;
}
}
if
(
multPeriodicDof3
.
size
()
>
0
)
{
int
nMultPeriodicDofs
=
multPeriodicDof3
.
size
();
for
(
int
i
=
0
;
i
<
nMultPeriodicDofs
;
i
++
)
{
for
(
int
j
=
i
+
1
;
j
<
nMultPeriodicDofs
;
j
++
)
{
std
::
pair
<
DegreeOfFreedom
,
DegreeOfFreedom
>
perDofs0
=
std
::
make_pair
(
mult
iple
PeriodicDof
[
k
]
[
i
],
mult
iple
PeriodicDof
[
k
]
[
j
]);
std
::
make_pair
(
multPeriodicDof
3
[
i
],
multPeriodicDof
3
[
j
]);
std
::
pair
<
DegreeOfFreedom
,
DegreeOfFreedom
>
perDofs1
=
std
::
make_pair
(
mult
iple
PeriodicDof
[
k
]
[
j
],
mult
iple
PeriodicDof
[
k
]
[
i
]);
std
::
make_pair
(
multPeriodicDof
3
[
j
],
multPeriodicDof
3
[
i
]);
if
(
periodicVertices
.
count
(
perDofs0
)
==
0
)
{
TEST_EXIT_DBG
(
periodicVertices
.
count
(
perDofs1
)
==
0
)
if
(
elObjects
.
periodicVertices
.
count
(
perDofs0
)
==
0
)
{
TEST_EXIT_DBG
(
elObjects
.
periodicVertices
.
count
(
perDofs1
)
==
0
)
(
"Should not happen!
\n
"
);
periodicVertices
[
perDofs0
]
=
newPeriodicBoundaryType
;
periodicVertices
[
perDofs1
]
=
newPeriodicBoundaryType
;
elObjects
.
periodicVertices
[
perDofs0
]
=
newPeriodicBoundaryType
;
elObjects
.
periodicVertices
[
perDofs1
]
=
newPeriodicBoundaryType
;
newPeriodicBoundaryType
--
;
mesh
->
getPeriodicAssociations
()[
newPeriodicBoundaryType
]
=
new
VertexVector
(
feSpace
->
getAdmin
(),
""
);
...
...
@@ -1470,8 +1527,8 @@ namespace AMDiS {
std
::
pair
<
DofEdge
,
DofEdge
>
perEdge1
=
std
::
make_pair
(
perEdge0
.
second
,
perEdge0
.
first
);
periodicEdges
[
perEdge0
]
=
newPeriodicBoundaryType
;
periodicEdges
[
perEdge1
]
=
newPeriodicBoundaryType
;
elObjects
.
periodicEdges
[
perEdge0
]
=
newPeriodicBoundaryType
;
elObjects
.
periodicEdges
[
perEdge1
]
=
newPeriodicBoundaryType
;
newPeriodicBoundaryType
--
;
mesh
->
getPeriodicAssociations
()[
newPeriodicBoundaryType
]
=
new
VertexVector
(
feSpace
->
getAdmin
(),
""
);
...
...
@@ -1484,31 +1541,31 @@ namespace AMDiS {
// === there must be a mapping B -> A with the same boundary type. ===
#if (DEBUG != 0)
for
(
std
::
map
<
std
::
pair
<
DegreeOfFreedom
,
DegreeOfFreedom
>
,
BoundaryType
>::
iterator
it
=
periodicVertices
.
begin
();
it
!=
periodicVertices
.
end
();
++
it
)
{
for
(
PerBoundMap
<
DegreeOfFreedom
>::
iterator
it
=
elObjects
.
periodicVertices
.
begin
();
it
!=
elObjects
.
periodicVertices
.
end
();
++
it
)
{
std
::
pair
<
DegreeOfFreedom
,
DegreeOfFreedom
>
testVertex
=
std
::
make_pair
(
it
->
first
.
second
,
it
->
first
.
first
);
TEST_EXIT_DBG
(
periodicVertices
.
count
(
testVertex
)
==
1
)(
"Should not happen!
\n
"
);
TEST_EXIT_DBG
(
periodicVertices
[
testVertex
]
==
it
->
second
)(
"Should not happen!
\n
"
);
TEST_EXIT_DBG
(
elObjects
.
periodicVertices
.
count
(
testVertex
)
==
1
)(
"Should not happen!
\n
"
);
TEST_EXIT_DBG
(
elObjects
.
periodicVertices
[
testVertex
]
==
it
->
second
)(
"Should not happen!
\n
"
);
}
for
(
std
::
map
<
std
::
pair
<
DofEdge
,
DofEdge
>
,
BoundaryTyp
e
>::
iterator
it
=
periodicEdges
.
begin
();
it
!=
periodicEdges
.
end
();
++
it
)
{
for
(
PerBoundMap
<
DofEdg
e
>::
iterator
it
=
elObjects
.
periodicEdges
.
begin
();
it
!=
elObjects
.
periodicEdges
.
end
();
++
it
)
{
std
::
pair
<
DofEdge
,
DofEdge
>
testEdge
=
std
::
make_pair
(
it
->
first
.
second
,
it
->
first
.
first
);
TEST_EXIT_DBG
(
periodicEdges
.
count
(
testEdge
)
==
1
)(
"Should not happen!
\n
"
);
TEST_EXIT_DBG
(
periodicEdges
[
testEdge
]
==
it
->
second
)(
"Should not happen!
\n
"
);
TEST_EXIT_DBG
(
elObjects
.
periodicEdges
.
count
(
testEdge
)
==
1
)(
"Should not happen!
\n
"
);
TEST_EXIT_DBG
(
elObjects
.
periodicEdges
[
testEdge
]
==
it
->
second
)(
"Should not happen!
\n
"
);
}
for
(
std
::
map
<
std
::
pair
<
DofFace
,
DofFace
>
,
BoundaryTyp
e
>::
iterator
it
=
periodicFaces
.
begin
();
it
!=
periodicFaces
.
end
();
++
it
)
{
for
(
PerBoundMap
<
DofFac
e
>::
iterator
it
=
elObjects
.
periodicFaces
.
begin
();
it
!=
elObjects
.
periodicFaces
.
end
();
++
it
)
{
std
::
pair
<
DofFace
,
DofFace
>
testFace
=
std
::
make_pair
(
it
->
first
.
second
,
it
->
first
.
first
);
TEST_EXIT_DBG
(
periodicFaces
.
count
(
testFace
)
==
1
)(
"Should not happen!
\n
"
);
TEST_EXIT_DBG
(
periodicFaces
[
testFace
]
==
it
->
second
)(
"Should not happen!
\n
"
);
TEST_EXIT_DBG
(
elObjects
.
periodicFaces
.
count
(
testFace
)
==
1
)(
"Should not happen!
\n
"
);
TEST_EXIT_DBG
(
elObjects
.
periodicFaces
[
testFace
]
==
it
->
second
)(
"Should not happen!
\n
"
);
}
#endif
...
...
@@ -1613,8 +1670,8 @@ namespace AMDiS {
// === Create periodic boundary data structure. ===
for
(
std
::
map
<
std
::
pair
<
DegreeOfFreedom
,
DegreeOfFreedom
>
,
BoundaryType
>::
iterator
it
=
periodicVertices
.
begin
();
it
!=
periodicVertices
.
end
();
++
it
)
{
for
(
PerBoundMap
<
DegreeOfFreedom
>::
iterator
it
=
elObjects
.
periodicVertices
.
begin
();
it
!=
elObjects
.
periodicVertices
.
end
();
++
it
)
{
if
(
elObjects
.
isInRank
(
it
->
first
.
first
,
mpiRank
)
==
false
)
continue
;
...
...
@@ -1622,10 +1679,10 @@ namespace AMDiS {
mesh
->
getDofIndexCoords
(
it
->
first
.
first
,
feSpace
,
c0
);
mesh
->
getDofIndexCoords
(
it
->
first
.
second
,
feSpace
,
c1
);
MSG
(
"CREATE BOUNDARY FOR DOF MAP: %d (%.3f %.3f %.3f)<-> %d (%.3f %.3f %.3f)
\n
"
,
it
->
first
.
first
,
c0
[
0
],
c0
[
1
],
c0
[
2
],
it
->
first
.
second
,
c1
[
0
],
c1
[
1
],
c1
[
2
]);
//
MSG("CREATE BOUNDARY FOR DOF MAP: %d (%.3f %.3f %.3f)<-> %d (%.3f %.3f %.3f)\n", it->first.first,
//
c0[0], c0[1], c0[2], it->first.second, c1[0], c1[1], c1[2]);
ElementObjectData
&
perDofEl0
=
elObjects
.
getElementsInRank
(
it
->
first
.
first
)[
mpiRank
];
MSG
(
"DATA: %d %d %d
\n
"
,
perDofEl0
.
elIndex
,
VERTEX
,
perDofEl0
.
ithObject
);
//
MSG("DATA: %d %d %d\n", perDofEl0.elIndex, VERTEX, perDofEl0.ithObject);
for
(
std
::
map
<
int
,
ElementObjectData
>::
iterator
elIt
=
elObjects
.
getElementsInRank
(
it
->
first
.
second
).
begin
();
elIt
!=
elObjects
.
getElementsInRank
(
it
->
first
.
second
).
end
();
++
elIt
)
{
...
...
@@ -1654,8 +1711,8 @@ namespace AMDiS {
}
for
(
std
::
map
<
std
::
pair
<
DofEdge
,
DofEdge
>
,
BoundaryTyp
e
>::
iterator
it
=
periodicEdges
.
begin
();
it
!=
periodicEdges
.
end
();
++
it
)
{
for
(
PerBoundMap
<
DofEdg
e
>::
iterator
it
=
elObjects
.
periodicEdges
.
begin
();
it
!=
elObjects
.
periodicEdges
.
end
();
++
it
)
{
if
(
elObjects
.
isInRank
(
it
->
first
.
first
,
mpiRank
)
==
false
)
continue
;
...
...
@@ -1693,8 +1750,8 @@ namespace AMDiS {
}
for
(
std
::
map
<
std
::
pair
<
DofFace
,
DofFace
>
,
BoundaryTyp
e
>::
iterator
it
=
periodicFaces
.
begin
();
it
!=
periodicFaces
.
end
();
++
it
)
{
for
(
PerBoundMap
<
DofFac
e
>::
iterator
it
=
elObjects
.
periodicFaces
.
begin
();
it
!=
elObjects
.
periodicFaces
.
end
();
++
it
)
{
if
(
elObjects
.
isInRank
(
it
->
first
.
first
,
mpiRank
)
==
false
)
continue
;
...
...
@@ -2191,8 +2248,7 @@ namespace AMDiS {
WorldVector
<
double
>
c
;
mesh
->
getDofIndexCoords
(
it
->
first
,
feSpace
,
c
);
int
nAssoc
=
it
->
second
.
size
();
TEST_EXIT_DBG
(
nAssoc
==
1
||
nAssoc
==
3
||
(
mesh
->
getDim
()
==
3
&&
(
nAssoc
==
7
||
nAssoc
==
11
)))
TEST_EXIT_DBG
(
nAssoc
==
1
||
nAssoc
==
3
||
(
mesh
->
getDim
()
==
3
&&
nAssoc
==
7
))
(
"Should not happen! DOF %d (%e %e %e) has %d periodic associations!
\n
"
,
it
->
first
,
c
[
0
],
c
[
1
],
(
mesh
->
getDim
()
==
2
?
0.0
:
c
[
2
]),
nAssoc
);
}
...
...
@@ -2247,10 +2303,6 @@ namespace AMDiS {
elObjects
.
serialize
(
out
);
SerUtil
::
serialize
(
out
,
periodicVertices
);
SerUtil
::
serialize
(
out
,
periodicEdges
);
SerUtil
::
serialize
(
out
,
periodicFaces
);
myIntBoundary
.
serialize
(
out
);
otherIntBoundary
.
serialize
(
out
);
periodicBoundary
.
serialize
(
out
);
...
...
@@ -2311,10 +2363,6 @@ namespace AMDiS {
elObjects
.
deserialize
(
in
);
SerUtil
::
deserialize
(
in
,
periodicVertices
);
SerUtil
::
deserialize
(
in
,
periodicEdges
);
SerUtil
::
deserialize
(
in
,
periodicFaces
);
myIntBoundary
.
deserialize
(
in
,
elIndexMap
);
otherIntBoundary
.
deserialize
(
in
,
elIndexMap
);
periodicBoundary
.
deserialize
(
in
,
elIndexMap
);
...
...
AMDiS/src/parallel/MeshDistributor.h
View file @
4354cab8
...
...
@@ -40,6 +40,8 @@
#include
"AMDiS_fwd.h"
namespace
AMDiS
{
using
namespace
std
;
class
ParMetisPartitioner
;
...
...
@@ -47,36 +49,36 @@ namespace AMDiS {
{
protected:
/// Defines a mapping type from DOFs to rank numbers.
typedef
std
::
map
<
const
DegreeOfFreedom
*
,
int
>
DofToRank
;
typedef
map
<
const
DegreeOfFreedom
*
,
int
>
DofToRank
;
/// Defines a mapping type from DOFs to a set of rank numbers.
typedef
std
::
map
<
const
DegreeOfFreedom
*
,
std
::
set
<
int
>
>
DofToPartitions
;
typedef
map
<
const
DegreeOfFreedom
*
,
std
::
set
<
int
>
>
DofToPartitions
;
/// Defines a mapping type from rank numbers to sets of DOFs.
typedef
std
::
map
<
int
,
DofContainer
>
RankToDofContainer
;
typedef
map
<
int
,
DofContainer
>
RankToDofContainer
;
/// Defines a mapping type from DOF indices to DOF indices.
typedef
std
::
map
<
DegreeOfFreedom
,
DegreeOfFreedom
>
DofMapping
;
typedef
map
<
DegreeOfFreedom
,
DegreeOfFreedom
>
DofMapping
;
/// Defines a mapping type from DOFs to boolean values.
typedef
std
::
map
<
const
DegreeOfFreedom
*
,
bool
>
DofToBool
;
typedef
map
<
const
DegreeOfFreedom
*
,
bool
>
DofToBool
;
/// Defines a mapping type from DOF indices to boolean values.
typedef
std
::
map
<
DegreeOfFreedom
,
bool
>
DofIndexToBool
;
typedef
map
<
DegreeOfFreedom
,
bool
>
DofIndexToBool
;
/// Forward type (it maps rank numbers to the interior boundary objects).
typedef
InteriorBoundary
::
RankToBoundMap
RankToBoundMap
;
typedef
std
::
map
<
const
DegreeOfFreedom
*
,
DegreeOfFreedom
>
DofIndexMap
;
typedef
map
<
const
DegreeOfFreedom
*
,
DegreeOfFreedom
>
DofIndexMap
;
/// Mapps a boundar type, i.e., a boundary identifier index, to a periodic
/// dof mapping.
typedef
std
::
map
<
BoundaryType
,
DofMapping
>
PeriodicDofMap
;
typedef
std
::
vector
<
MeshStructure
>
MeshCodeVec
;
typedef
map
<
BoundaryType
,
DofMapping
>
PeriodicDofMap
;