Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Backofen, Rainer
amdis
Commits
30c34028
Commit
30c34028
authored
Jun 28, 2012
by
Thomas Witkowski
Browse files
Work on bla.
parent
4fd8802b
Changes
5
Show whitespace changes
Inline
Side-by-side
AMDiS/src/parallel/ElementObjectDatabase.cc
View file @
30c34028
...
@@ -42,8 +42,11 @@ namespace AMDiS {
...
@@ -42,8 +42,11 @@ namespace AMDiS {
elInfo
=
stack
.
traverseNext
(
elInfo
);
elInfo
=
stack
.
traverseNext
(
elInfo
);
}
}
// Create periodic data, if there are periodic boundary conditions.
// Handle periodic boudaries
if
(
removePeriodicBoundary
==
false
)
createPeriodicData
();
createPeriodicData
();
else
removePeriodicData
();
// Create data about the reverse modes of neighbouring elements.
// Create data about the reverse modes of neighbouring elements.
createReverseModeData
();
createReverseModeData
();
...
@@ -99,24 +102,6 @@ namespace AMDiS {
...
@@ -99,24 +102,6 @@ namespace AMDiS {
DofEdge
edge1
=
neigh
->
getEdge
(
elInfo
->
getOppVertex
(
i
));
DofEdge
edge1
=
neigh
->
getEdge
(
elInfo
->
getOppVertex
(
i
));
BoundaryType
boundaryType
=
elInfo
->
getBoundary
(
EDGE
,
i
);
BoundaryType
boundaryType
=
elInfo
->
getBoundary
(
EDGE
,
i
);
if
(
removePeriodicBoundary
)
{
ElementObjectData
elObjEdge
(
el
->
getIndex
(),
i
);
edgeElements
[
edge1
].
push_back
(
elObjEdge
);
edgeLocalMap
[
elObjEdge
]
=
edge1
;
#if 0
ElementObjectData elObjVertex0(el->getIndex(),
el->getVertexOfEdge(i, 0));
vertexElements[edge1.first].push_back(elObjVertex0);
vertexLocalMap[elObjVertex0] = edge1.first;
ElementObjectData elObjVertex1(el->getIndex(),
el->getVertexOfEdge(i, 1));
vertexElements[edge1.second].push_back(elObjVertex1);
vertexLocalMap[elObjVertex1] = edge1.first;
#endif
}
else
{
// Add the periodic edge.
// Add the periodic edge.
periodicEdges
[
make_pair
(
edge0
,
edge1
)]
=
boundaryType
;
periodicEdges
[
make_pair
(
edge0
,
edge1
)]
=
boundaryType
;
periodicEdgeAssoc
[
edge0
].
insert
(
edge1
);
periodicEdgeAssoc
[
edge0
].
insert
(
edge1
);
...
@@ -134,7 +119,6 @@ namespace AMDiS {
...
@@ -134,7 +119,6 @@ namespace AMDiS {
(
"Should not happen!
\n
"
);
(
"Should not happen!
\n
"
);
}
}
}
}
}
break
;
break
;
case
3
:
case
3
:
for
(
int
i
=
0
;
i
<
el
->
getGeo
(
FACE
);
i
++
)
{
for
(
int
i
=
0
;
i
<
el
->
getGeo
(
FACE
);
i
++
)
{
...
@@ -148,9 +132,6 @@ namespace AMDiS {
...
@@ -148,9 +132,6 @@ namespace AMDiS {
DofFace
face1
=
neigh
->
getFace
(
elInfo
->
getOppVertex
(
i
));
DofFace
face1
=
neigh
->
getFace
(
elInfo
->
getOppVertex
(
i
));
BoundaryType
boundaryType
=
elInfo
->
getBoundary
(
FACE
,
i
);
BoundaryType
boundaryType
=
elInfo
->
getBoundary
(
FACE
,
i
);
TEST_EXIT
(
removePeriodicBoundary
==
false
)
(
"Not yet implemented for 3D!
\n
"
);
// Add the periodic face.
// Add the periodic face.
periodicFaces
[
make_pair
(
face0
,
face1
)]
=
elInfo
->
getBoundary
(
i
);
periodicFaces
[
make_pair
(
face0
,
face1
)]
=
elInfo
->
getBoundary
(
i
);
...
@@ -197,6 +178,46 @@ namespace AMDiS {
...
@@ -197,6 +178,46 @@ namespace AMDiS {
}
}
}
}
void
ElementObjectDatabase
::
addVertex
(
Element
*
el
,
int
ith
)
{
DegreeOfFreedom
vertex
=
el
->
getDof
(
ith
,
0
);
int
elIndex
=
el
->
getIndex
();
ElementObjectData
elObj
(
elIndex
,
ith
);
if
(
elIndex
==
53
&&
ith
==
0
)
MSG
(
"A: 53/0 ON DOF %d
\n
"
,
vertex
);
if
(
elIndex
==
229
&&
ith
==
0
)
MSG
(
"A: 229/0 ON DOF %d
\n
"
,
vertex
);
vertexElements
[
vertex
].
push_back
(
elObj
);
vertexLocalMap
[
elObj
]
=
vertex
;
}
void
ElementObjectDatabase
::
addEdge
(
Element
*
el
,
int
ith
)
{
FUNCNAME
(
"ElementObjectDatabase::addEdge()"
);
DofEdge
edge
=
el
->
getEdge
(
ith
);
int
elIndex
=
el
->
getIndex
();
ElementObjectData
elObj
(
elIndex
,
ith
);
edgeElements
[
edge
].
push_back
(
elObj
);
edgeLocalMap
[
elObj
]
=
edge
;
}
void
ElementObjectDatabase
::
addFace
(
Element
*
el
,
int
ith
)
{
DofFace
face
=
el
->
getFace
(
ith
);
int
elIndex
=
el
->
getIndex
();
ElementObjectData
elObj
(
elIndex
,
ith
);
faceElements
[
face
].
push_back
(
elObj
);
faceLocalMap
[
elObj
]
=
face
;
}
void
ElementObjectDatabase
::
createPeriodicData
()
void
ElementObjectDatabase
::
createPeriodicData
()
{
{
...
@@ -391,6 +412,10 @@ namespace AMDiS {
...
@@ -391,6 +412,10 @@ namespace AMDiS {
}
}
void
ElementObjectDatabase
::
removePeriodicData
()
{
}
BoundaryType
ElementObjectDatabase
::
getNewBoundaryType
()
BoundaryType
ElementObjectDatabase
::
getNewBoundaryType
()
{
{
FUNCNAME
(
"ElementObjectDatabase::getNewBoundaryType()"
);
FUNCNAME
(
"ElementObjectDatabase::getNewBoundaryType()"
);
...
...
AMDiS/src/parallel/ElementObjectDatabase.h
View file @
30c34028
...
@@ -51,7 +51,8 @@ namespace AMDiS {
...
@@ -51,7 +51,8 @@ namespace AMDiS {
struct
ElementObjectData
{
struct
ElementObjectData
{
ElementObjectData
(
int
a
=
-
1
,
int
b
=
0
)
ElementObjectData
(
int
a
=
-
1
,
int
b
=
0
)
:
elIndex
(
a
),
:
elIndex
(
a
),
ithObject
(
b
)
ithObject
(
b
),
mappedOnPeriodicBoundary
(
false
)
{}
{}
/// Index of the element this object is part of.
/// Index of the element this object is part of.
...
@@ -60,11 +61,16 @@ namespace AMDiS {
...
@@ -60,11 +61,16 @@ namespace AMDiS {
/// Index of the object within the element.
/// Index of the object within the element.
int
ithObject
;
int
ithObject
;
/// If true, the element does not exists in mesh but is due to a mapping
/// on a periodic boundary.
bool
mappedOnPeriodicBoundary
;
/// Write this element object to disk.
/// Write this element object to disk.
void
serialize
(
ostream
&
out
)
const
void
serialize
(
ostream
&
out
)
const
{
{
SerUtil
::
serialize
(
out
,
elIndex
);
SerUtil
::
serialize
(
out
,
elIndex
);
SerUtil
::
serialize
(
out
,
ithObject
);
SerUtil
::
serialize
(
out
,
ithObject
);
SerUtil
::
serialize
(
out
,
mappedOnPeriodicBoundary
);
}
}
/// Read this element object from disk.
/// Read this element object from disk.
...
@@ -72,6 +78,7 @@ namespace AMDiS {
...
@@ -72,6 +78,7 @@ namespace AMDiS {
{
{
SerUtil
::
deserialize
(
in
,
elIndex
);
SerUtil
::
deserialize
(
in
,
elIndex
);
SerUtil
::
deserialize
(
in
,
ithObject
);
SerUtil
::
deserialize
(
in
,
ithObject
);
SerUtil
::
deserialize
(
in
,
mappedOnPeriodicBoundary
);
}
}
/// Compare this element object with another one.
/// Compare this element object with another one.
...
@@ -426,37 +433,13 @@ namespace AMDiS {
...
@@ -426,37 +433,13 @@ namespace AMDiS {
void
addElement
(
ElInfo
*
elInfo
);
void
addElement
(
ElInfo
*
elInfo
);
/// Adds the i-th DOF vertex of an element to the object database.
/// Adds the i-th DOF vertex of an element to the object database.
void
addVertex
(
Element
*
el
,
int
ith
)
void
addVertex
(
Element
*
el
,
int
ith
);
{
DegreeOfFreedom
vertex
=
el
->
getDof
(
ith
,
0
);
int
elIndex
=
el
->
getIndex
();
ElementObjectData
elObj
(
elIndex
,
ith
);
vertexElements
[
vertex
].
push_back
(
elObj
);
vertexLocalMap
[
elObj
]
=
vertex
;
}
/// Adds the i-th edge of an element to the object database.
/// Adds the i-th edge of an element to the object database.
void
addEdge
(
Element
*
el
,
int
ith
)
void
addEdge
(
Element
*
el
,
int
ith
);
{
DofEdge
edge
=
el
->
getEdge
(
ith
);
int
elIndex
=
el
->
getIndex
();
ElementObjectData
elObj
(
elIndex
,
ith
);
edgeElements
[
edge
].
push_back
(
elObj
);
edgeLocalMap
[
elObj
]
=
edge
;
}
/// Adds the i-th face of an element to the object database.
/// Adds the i-th face of an element to the object database.
void
addFace
(
Element
*
el
,
int
ith
)
void
addFace
(
Element
*
el
,
int
ith
);
{
DofFace
face
=
el
->
getFace
(
ith
);
int
elIndex
=
el
->
getIndex
();
ElementObjectData
elObj
(
elIndex
,
ith
);
faceElements
[
face
].
push_back
(
elObj
);
faceLocalMap
[
elObj
]
=
face
;
}
/** \brief
/** \brief
* Creates final data of the periodic boundaries. Must be called after all
* Creates final data of the periodic boundaries. Must be called after all
...
@@ -469,6 +452,7 @@ namespace AMDiS {
...
@@ -469,6 +452,7 @@ namespace AMDiS {
*/
*/
void
createPeriodicData
();
void
createPeriodicData
();
void
removePeriodicData
();
/// Creates on all boundaries the reverse mode flag.
/// Creates on all boundaries the reverse mode flag.
void
createReverseModeData
();
void
createReverseModeData
();
...
...
AMDiS/src/parallel/InteriorBoundary.cc
View file @
30c34028
...
@@ -48,6 +48,8 @@ namespace AMDiS {
...
@@ -48,6 +48,8 @@ namespace AMDiS {
for
(
int
geoPos
=
0
;
geoPos
<
mesh
->
getDim
();
geoPos
++
)
{
for
(
int
geoPos
=
0
;
geoPos
<
mesh
->
getDim
();
geoPos
++
)
{
GeoIndex
geoIndex
=
INDEX_OF_DIM
(
geoPos
,
mesh
->
getDim
());
GeoIndex
geoIndex
=
INDEX_OF_DIM
(
geoPos
,
mesh
->
getDim
());
MSG
(
"---> start with geo index = %d
\n
"
,
geoIndex
);
while
(
elObjDb
.
iterate
(
geoIndex
))
{
while
(
elObjDb
.
iterate
(
geoIndex
))
{
map
<
int
,
ElementObjectData
>&
objData
=
elObjDb
.
getIterateData
();
map
<
int
,
ElementObjectData
>&
objData
=
elObjDb
.
getIterateData
();
...
@@ -75,6 +77,9 @@ namespace AMDiS {
...
@@ -75,6 +77,9 @@ namespace AMDiS {
int
owner
=
elObjDb
.
getIterateOwner
(
level
);
int
owner
=
elObjDb
.
getIterateOwner
(
level
);
ElementObjectData
&
rankBoundEl
=
objData
[
globalMpiRank
];
ElementObjectData
&
rankBoundEl
=
objData
[
globalMpiRank
];
if
(
rankBoundEl
.
mappedOnPeriodicBoundary
)
continue
;
AtomicBoundary
bound
;
AtomicBoundary
bound
;
bound
.
maxLevel
=
elObjDb
.
getIterateMaxLevel
();
bound
.
maxLevel
=
elObjDb
.
getIterateMaxLevel
();
bound
.
rankObj
.
el
=
elObjDb
.
getElementPtr
(
rankBoundEl
.
elIndex
);
bound
.
rankObj
.
el
=
elObjDb
.
getElementPtr
(
rankBoundEl
.
elIndex
);
...
@@ -83,6 +88,7 @@ namespace AMDiS {
...
@@ -83,6 +88,7 @@ namespace AMDiS {
bound
.
rankObj
.
subObj
=
geoIndex
;
bound
.
rankObj
.
subObj
=
geoIndex
;
bound
.
rankObj
.
ithObj
=
rankBoundEl
.
ithObject
;
bound
.
rankObj
.
ithObj
=
rankBoundEl
.
ithObject
;
if
(
geoIndex
==
FACE
)
{
if
(
geoIndex
==
FACE
)
{
for
(
int
edgeNo
=
0
;
edgeNo
<
3
;
edgeNo
++
)
{
for
(
int
edgeNo
=
0
;
edgeNo
<
3
;
edgeNo
++
)
{
int
edgeOfFace
=
int
edgeOfFace
=
...
@@ -126,6 +132,12 @@ namespace AMDiS {
...
@@ -126,6 +132,12 @@ namespace AMDiS {
ElementObjectData
&
ownerBoundEl
=
objData
[
owner
];
ElementObjectData
&
ownerBoundEl
=
objData
[
owner
];
if
(
rankBoundEl
.
elIndex
==
53
&&
geoIndex
==
1
&&
rankBoundEl
.
ithObject
==
0
)
{
MSG
(
"OWNER: %d %d
\n
"
,
owner
,
ownerBoundEl
);
}
bound
.
neighObj
.
el
=
elObjDb
.
getElementPtr
(
ownerBoundEl
.
elIndex
);
bound
.
neighObj
.
el
=
elObjDb
.
getElementPtr
(
ownerBoundEl
.
elIndex
);
bound
.
neighObj
.
elIndex
=
ownerBoundEl
.
elIndex
;
bound
.
neighObj
.
elIndex
=
ownerBoundEl
.
elIndex
;
bound
.
neighObj
.
elType
=
-
1
;
bound
.
neighObj
.
elType
=
-
1
;
...
...
AMDiS/src/parallel/MeshDistributor.cc
View file @
30c34028
...
@@ -1558,15 +1558,11 @@ namespace AMDiS {
...
@@ -1558,15 +1558,11 @@ namespace AMDiS {
elObjDb
.
updateRankData
();
elObjDb
.
updateRankData
();
intBoundary
.
create
(
levelData
,
0
,
elObjDb
);
intBoundary
.
create
(
levelData
,
0
,
elObjDb
);
#if (DEBUG != 0)
ParallelDebug
::
printBoundaryInfo
(
intBoundary
);
ParallelDebug
::
printBoundaryInfo
(
intBoundary
);
#endif
if
(
levelData
.
getLevelNumber
()
>
1
)
{
if
(
levelData
.
getLevelNumber
()
>
1
)
{
intBoundarySd
.
create
(
levelData
,
1
,
elObjDb
);
intBoundarySd
.
create
(
levelData
,
1
,
elObjDb
);
#if (DEBUG != 0)
ParallelDebug
::
printBoundaryInfo
(
intBoundarySd
,
0
,
true
);
ParallelDebug
::
printBoundaryInfo
(
intBoundarySd
,
0
,
true
);
#endif
}
}
}
}
...
@@ -1692,6 +1688,10 @@ namespace AMDiS {
...
@@ -1692,6 +1688,10 @@ namespace AMDiS {
lastMeshChangeIndex
=
mesh
->
getChangeIndex
();
lastMeshChangeIndex
=
mesh
->
getChangeIndex
();
MSG
(
"--------> REMOVE THIS LINE <------------
\n
"
);
debug
::
writeElementIndexMesh
(
mesh
,
debugOutputDir
+
"elementIndex-"
+
lexical_cast
<
string
>
(
mpiRank
)
+
".vtu"
);
#if (DEBUG != 0)
#if (DEBUG != 0)
ParallelDebug
::
testDofContainerCommunication
(
*
this
);
ParallelDebug
::
testDofContainerCommunication
(
*
this
);
...
...
AMDiS/src/parallel/PetscSolverFeti.cc
View file @
30c34028
...
@@ -436,21 +436,23 @@ namespace AMDiS {
...
@@ -436,21 +436,23 @@ namespace AMDiS {
// === Define all vertices on the interior boundaries of the macro mesh ===
// === Define all vertices on the interior boundaries of the macro mesh ===
// === to be primal variables. ===
// === to be primal variables. ===
/// Set of DOF indices that are considered to be primal variables.
// Set of DOF indices that are considered to be primal variables.
DofContainerSet
&
vertices
=
DofContainerSet
&
vertices
=
meshDistributor
->
getBoundaryDofInfo
(
feSpace
,
meshLevel
).
geoDofs
[
VERTEX
];
meshDistributor
->
getBoundaryDofInfo
(
feSpace
,
meshLevel
).
geoDofs
[
VERTEX
];
DofIndexSet
primals
;
DofIndexSet
primals
;
for
(
DofContainerSet
::
iterator
it
=
vertices
.
begin
();
for
(
DofContainerSet
::
iterator
it
=
vertices
.
begin
();
it
!=
vertices
.
end
();
++
it
)
{
it
!=
vertices
.
end
();
++
it
)
{
WorldVector
<
double
>
c
;
feSpace
->
getMesh
()
->
getDofIndexCoords
(
*
it
,
feSpace
,
c
);
double
e
=
1e-8
;
double
e
=
1e-8
;
if
(
meshLevel
==
0
)
{
if
(
meshLevel
==
0
)
{
WorldVector
<
double
>
c
;
feSpace
->
getMesh
()
->
getDofIndexCoords
(
*
it
,
feSpace
,
c
);
MSG
(
"PRIMAL COORD %f %f
\n
"
,
c
[
0
],
c
[
1
]);
primals
.
insert
(
**
it
);
primals
.
insert
(
**
it
);
}
else
{
}
else
{
WorldVector
<
double
>
c
;
feSpace
->
getMesh
()
->
getDofIndexCoords
(
*
it
,
feSpace
,
c
);
if
(
fabs
(
c
[
0
])
<
e
||
fabs
(
c
[
1
])
<
e
||
if
(
fabs
(
c
[
0
])
<
e
||
fabs
(
c
[
1
])
<
e
||
fabs
(
c
[
0
]
-
25.0
)
<
e
||
fabs
(
c
[
1
]
-
25.0
)
<
e
||
fabs
(
c
[
0
]
-
25.0
)
<
e
||
fabs
(
c
[
1
]
-
25.0
)
<
e
||
(
fabs
(
c
[
0
]
-
12.5
)
<
e
&&
fabs
(
c
[
1
]
-
12.5
)
<
e
))
{
(
fabs
(
c
[
0
]
-
12.5
)
<
e
&&
fabs
(
c
[
1
]
-
12.5
)
<
e
))
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment