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
iwr
amdis
Commits
0c1e2d14
Commit
0c1e2d14
authored
Oct 19, 2012
by
Thomas Witkowski
Browse files
DOES NOT COMPILE, BUT I MUST MERGE TO WORK HARD ON WEEKEND....
parent
518c24d9
Changes
8
Hide whitespace changes
Inline
Side-by-side
AMDiS/src/parallel/MatrixNnzStructure.cc
View file @
0c1e2d14
...
...
@@ -122,8 +122,8 @@ namespace AMDiS {
const
FiniteElemSpace
*
rowFeSpace
=
dofMat
->
getRowFeSpace
();
const
FiniteElemSpace
*
colFeSpace
=
dofMat
->
getColFeSpace
();
if
(
rowDofMap
.
isDefinedFor
(
row
FeSpace
)
==
false
||
colDofMap
.
isDefinedFor
(
col
FeSpace
)
==
false
)
if
(
rowDofMap
.
isDefinedFor
(
row
Comp
)
==
false
||
colDofMap
.
isDefinedFor
(
col
Comp
)
==
false
)
continue
;
// === Prepare MTL4 iterators for the current DOF matrix. ===
...
...
@@ -137,8 +137,8 @@ namespace AMDiS {
// === Iterate on all DOFs of the row mapping. ===
DofMap
::
iterator
rowIt
=
rowDofMap
[
row
FeSpace
].
begin
();
DofMap
::
iterator
rowEndIt
=
rowDofMap
[
rowFeSpace
].
end
();
DofMap
::
iterator
rowIt
=
rowDofMap
[
row
Comp
].
begin
();
DofMap
::
iterator
rowEndIt
=
rowDofMap
[
colComp
].
end
();
for
(;
rowIt
!=
rowEndIt
;
++
rowIt
)
{
// Go to the corresponding matrix row (note, both the mapping and the
...
...
@@ -165,7 +165,7 @@ namespace AMDiS {
perMap
->
fillAssociations
(
rowFeSpace
,
rowIt
->
second
.
global
,
elObjDb
,
perRowAsc
);
if
(
localMatrix
||
rowDofMap
[
row
FeSpace
].
isRankDof
(
*
cursor
))
{
if
(
localMatrix
||
rowDofMap
[
row
Comp
].
isRankDof
(
*
cursor
))
{
// === The current row DOF is a rank DOF, so create the ===
// === corresponding nnz values directly on rank's nnz data. ===
...
...
@@ -178,7 +178,7 @@ namespace AMDiS {
TEST_EXIT_DBG
(
localPetscRowIdx
>=
0
&&
localPetscRowIdx
<
nRankRows
)
(
"Should not happen!
\n
Debug info: DOF = %d globalRowIndx = %d petscRowIdx = %d localPetscRowIdx = %d rStart = %d compontens = %d from %d nRankRows = %d
\n
"
,
*
cursor
,
rowDofMap
[
row
FeSpace
][
*
cursor
].
global
,
rowDofMap
[
row
Comp
][
*
cursor
].
global
,
petscRowIdx
,
localPetscRowIdx
,
rankStartRowIndex
,
...
...
@@ -190,7 +190,7 @@ namespace AMDiS {
if
(
localMatrix
)
{
for
(
icursor_type
icursor
=
begin
<
nz
>
(
cursor
),
icend
=
end
<
nz
>
(
cursor
);
icursor
!=
icend
;
++
icursor
)
if
(
colDofMap
[
col
FeSpace
].
isSet
(
col
(
*
icursor
)))
if
(
colDofMap
[
col
Comp
].
isSet
(
col
(
*
icursor
)))
dnnz
[
localPetscRowIdx
]
++
;
}
else
{
MultiIndex
colDofIndex
;
...
...
@@ -198,7 +198,7 @@ namespace AMDiS {
// Traverse all non zero entries in this row.
for
(
icursor_type
icursor
=
begin
<
nz
>
(
cursor
),
icend
=
end
<
nz
>
(
cursor
);
icursor
!=
icend
;
++
icursor
)
{
if
(
colDofMap
[
col
FeSpace
].
find
(
col
(
*
icursor
),
colDofIndex
)
==
false
)
if
(
colDofMap
[
col
Comp
].
find
(
col
(
*
icursor
),
colDofIndex
)
==
false
)
continue
;
// Set of periodic row associations (is empty, if row DOF is not
...
...
@@ -208,7 +208,7 @@ namespace AMDiS {
perMap
->
fillAssociations
(
colFeSpace
,
colDofIndex
.
global
,
elObjDb
,
perColAsc
);
if
(
perColAsc
.
empty
())
{
if
(
colDofMap
[
col
FeSpace
].
isRankDof
(
col
(
*
icursor
)))
if
(
colDofMap
[
col
Comp
].
isRankDof
(
col
(
*
icursor
)))
dnnz
[
localPetscRowIdx
]
++
;
else
onnz
[
localPetscRowIdx
]
++
;
...
...
@@ -252,7 +252,7 @@ namespace AMDiS {
for
(
icursor_type
icursor
=
begin
<
nz
>
(
cursor
),
icend
=
end
<
nz
>
(
cursor
);
icursor
!=
icend
;
++
icursor
)
{
if
(
colDofMap
[
col
FeSpace
].
find
(
col
(
*
icursor
),
colDofIndex
)
==
false
)
if
(
colDofMap
[
col
Comp
].
find
(
col
(
*
icursor
),
colDofIndex
)
==
false
)
continue
;
int
petscColIdx
=
(
colDofMap
.
isMatIndexFromGlobal
()
?
...
...
AMDiS/src/parallel/MeshDistributor.cc
View file @
0c1e2d14
...
...
@@ -74,7 +74,7 @@ namespace AMDiS {
:
problemStat
(
0
),
initialized
(
false
),
name
(
"parallel"
),
fe
Spaces
(
0
),
component
Spaces
(
0
),
mesh
(
NULL
),
refineManager
(
NULL
),
info
(
10
),
...
...
@@ -148,7 +148,7 @@ namespace AMDiS {
TEST_EXIT
(
mpiSize
>
1
)
(
"Parallelization does not work with only one process!
\n
"
);
TEST_EXIT
(
fe
Spaces
.
size
()
>
0
)
TEST_EXIT
(
component
Spaces
.
size
()
>
0
)
(
"No FE space has been defined for the mesh distributor!
\n
"
);
TEST_EXIT
(
mesh
)(
"No mesh has been defined for the mesh distributor!
\n
"
);
...
...
@@ -158,18 +158,18 @@ namespace AMDiS {
bool
doNext
=
false
;
do
{
doNext
=
false
;
for
(
unsigned
int
i
=
0
;
i
<
f
eSpaces
.
size
()
-
1
;
i
++
)
{
if
(
f
eSpaces
[
i
]
->
getBasisFcts
()
->
getDegree
()
>
f
eSpaces
[
i
+
1
]
->
getBasisFcts
()
->
getDegree
())
{
const
FiniteElemSpace
*
tmp
=
f
eSpaces
[
i
+
1
];
f
eSpaces
[
i
+
1
]
=
f
eSpaces
[
i
];
f
eSpaces
[
i
]
=
tmp
;
for
(
unsigned
int
i
=
0
;
i
<
uniqueF
eSpaces
.
size
()
-
1
;
i
++
)
{
if
(
uniqueF
eSpaces
[
i
]
->
getBasisFcts
()
->
getDegree
()
>
uniqueF
eSpaces
[
i
+
1
]
->
getBasisFcts
()
->
getDegree
())
{
const
FiniteElemSpace
*
tmp
=
uniqueF
eSpaces
[
i
+
1
];
uniqueF
eSpaces
[
i
+
1
]
=
uniqueF
eSpaces
[
i
];
uniqueF
eSpaces
[
i
]
=
tmp
;
doNext
=
true
;
}
}
}
while
(
doNext
);
elObjDb
.
setFeSpace
(
f
eSpaces
[
0
]);
elObjDb
.
setFeSpace
(
uniqueF
eSpaces
[
0
]);
// If required, create hierarchical mesh level structure.
createMeshLevelStructure
();
...
...
@@ -191,7 +191,8 @@ namespace AMDiS {
elObjDb
.
setData
(
partitionMap
,
levelData
);
#if (DEBUG != 0)
ParallelDebug
::
writeDebugFile
(
feSpaces
[
feSpaces
.
size
()
-
1
],
dofMap
,
ParallelDebug
::
writeDebugFile
(
uniqueFeSpaces
[
uniqueFeSpaces
.
size
()
-
1
],
dofMap
,
debugOutputDir
+
"mpi-dbg"
,
"dat"
);
#endif
...
...
@@ -315,7 +316,7 @@ namespace AMDiS {
ParallelDebug
::
testInteriorBoundary
(
*
this
);
ParallelDebug
::
followBoundary
(
*
this
);
debug
::
writeMesh
(
f
eSpaces
[
0
],
-
1
,
debugOutputDir
+
"macro_mesh"
);
debug
::
writeMesh
(
uniqueF
eSpaces
[
0
],
-
1
,
debugOutputDir
+
"macro_mesh"
);
MSG
(
"Debug mode tests finished!
\n
"
);
#endif
...
...
@@ -363,25 +364,12 @@ namespace AMDiS {
TEST_EXIT_DBG
(
probStat
->
getFeSpaces
().
size
())
(
"No FE spaces in stationary problem!
\n
"
);
// === Add FE spaces from stationary problem to mesh distributor. ===
TEST_EXIT
(
componentSpaces
.
size
()
==
0
)
(
"Parallelization of coupled problems is deactived at the moment!
\n
"
);
for
(
unsigned
int
i
=
0
;
i
<
probStat
->
getFeSpaces
().
size
();
i
++
)
{
bool
foundFeSpace
=
false
;
for
(
unsigned
int
j
=
0
;
j
<
feSpaces
.
size
();
j
++
)
{
if
(
feSpaces
[
j
]
==
probStat
->
getFeSpaces
()[
i
])
foundFeSpace
=
true
;
TEST_EXIT
(
feSpaces
[
j
]
->
getMesh
()
==
probStat
->
getFeSpaces
()[
i
]
->
getMesh
())
(
"MeshDistributor does not yet support usage of different meshes!
\n
"
);
}
if
(
!
foundFeSpace
)
feSpaces
.
push_back
(
probStat
->
getFeSpaces
()[
i
]);
}
TEST_EXIT
(
feSpaces
.
size
()
>
0
)(
"Should not happen!
\n
"
);
mesh
=
feSpaces
[
0
]
->
getMesh
();
componentSpaces
=
probStat
->
getComponentFeSpaces
();
uniqueFeSpaces
=
probStat
->
getFeSpaces
();
mesh
=
uniqueFeSpaces
[
0
]
->
getMesh
();
info
=
probStat
->
getInfo
();
switch
(
mesh
->
getDim
())
{
...
...
@@ -678,8 +666,8 @@ namespace AMDiS {
DofEdge
dofEdge1
=
edge1
.
first
->
getEdge
(
edge1
.
second
);
WorldVector
<
double
>
c0
,
c1
;
mesh
->
getDofIndexCoords
(
dofEdge0
.
first
,
f
eSpaces
[
0
],
c0
);
mesh
->
getDofIndexCoords
(
dofEdge0
.
second
,
f
eSpaces
[
0
],
c1
);
mesh
->
getDofIndexCoords
(
dofEdge0
.
first
,
uniqueF
eSpaces
[
0
],
c0
);
mesh
->
getDofIndexCoords
(
dofEdge0
.
second
,
uniqueF
eSpaces
[
0
],
c1
);
MSG
(
"FOUND EDGE %d/%d <-> %d/%d
\n
"
,
edge0
.
first
->
getIndex
(),
edge0
.
second
,
...
...
@@ -976,7 +964,7 @@ namespace AMDiS {
MPI
::
Wtime
()
-
first
);
#if (DEBUG != 0)
debug
::
writeMesh
(
f
eSpaces
[
0
],
-
1
,
debugOutputDir
+
"mesh"
);
debug
::
writeMesh
(
uniqueF
eSpaces
[
0
],
-
1
,
debugOutputDir
+
"mesh"
);
#endif
// Because the mesh has been changed, update the DOF numbering and mappings.
...
...
@@ -1196,8 +1184,10 @@ namespace AMDiS {
int
rank
=
0
;
SerUtil
::
deserialize
(
in
,
rank
);
for
(
unsigned
int
j
=
0
;
j
<
feSpaces
.
size
();
j
++
)
deserialize
(
in
,
data
[
rank
][
feSpaces
[
j
]],
dofIndexMap
[
feSpaces
[
j
]]);
for
(
unsigned
int
j
=
0
;
j
<
componentSpaces
.
size
();
j
++
)
deserialize
(
in
,
data
[
rank
][
componentSpaces
[
j
]],
dofIndexMap
[
componentSpaces
[
j
]]);
}
}
...
...
@@ -1274,7 +1264,8 @@ namespace AMDiS {
Parameters
::
get
(
"dbg->write part mesh"
,
writePartMesh
);
if
(
writePartMesh
>
0
&&
repartitioningCounter
==
0
)
ParallelDebug
::
writePartitioningFile
(
debugOutputDir
+
"partitioning"
,
repartitioningCounter
,
feSpaces
[
0
]);
repartitioningCounter
,
uniqueFeSpaces
[
0
]);
repartitioningCounter
++
;
...
...
@@ -1305,7 +1296,7 @@ namespace AMDiS {
// === Run mesh partitioner to calculate a new mesh partitioning. ===
partitioner
->
setLocalGlobalDofMap
(
&
(
dofMap
[
f
eSpaces
[
0
]].
getMap
()));
partitioner
->
setLocalGlobalDofMap
(
&
(
dofMap
[
uniqueF
eSpaces
[
0
]].
getMap
()));
bool
partitioningSucceed
=
partitioner
->
partition
(
elemWeights
,
ADAPTIVE_REPART
);
if
(
!
partitioningSucceed
)
{
...
...
@@ -1482,11 +1473,11 @@ namespace AMDiS {
// Note that also if there are no macros to be deleted, this function will
// update the number of elements, vertices, etc. of the mesh.
mesh
->
removeMacroElements
(
deleteMacroElements
,
f
eSpaces
);
mesh
->
removeMacroElements
(
deleteMacroElements
,
uniqueF
eSpaces
);
// === Remove double DOFs. ===
MeshManipulation
meshManipulation
(
mesh
);
meshManipulation
.
deleteDoubleDofs
(
f
eSpaces
,
newMacroEl
,
elObjDb
);
meshManipulation
.
deleteDoubleDofs
(
uniqueF
eSpaces
,
newMacroEl
,
elObjDb
);
mesh
->
dofCompress
();
partitioner
->
createPartitionMap
(
partitionMap
);
...
...
@@ -1521,7 +1512,8 @@ namespace AMDiS {
MSG
(
"AMDiS runs in debug mode, so make some test ...
\n
"
);
ParallelDebug
::
writePartitioningFile
(
debugOutputDir
+
"partitioning"
,
repartitioningCounter
,
feSpaces
[
0
]);
repartitioningCounter
,
uniqueFeSpaces
[
0
]);
ParallelDebug
::
testAllElements
(
*
this
);
ParallelDebug
::
testDoubleDofs
(
mesh
);
ParallelDebug
::
testInteriorBoundary
(
*
this
);
...
...
@@ -1567,11 +1559,11 @@ namespace AMDiS {
// === Create DOF communicator. ===
dofComm
.
init
(
0
,
levelData
,
f
eSpaces
);
dofComm
.
init
(
0
,
levelData
,
uniqueF
eSpaces
);
dofComm
.
create
(
intBoundary
);
if
(
levelData
.
getLevelNumber
()
>
1
)
{
dofCommSd
.
init
(
0
,
levelData
,
f
eSpaces
);
dofCommSd
.
init
(
0
,
levelData
,
uniqueF
eSpaces
);
dofCommSd
.
create
(
intBoundarySd
);
}
...
...
@@ -1583,8 +1575,8 @@ namespace AMDiS {
int
nLevels
=
levelData
.
getLevelNumber
();
boundaryDofInfo
.
resize
(
nLevels
);
for
(
unsigned
int
i
=
0
;
i
<
f
eSpaces
.
size
();
i
++
)
{
const
FiniteElemSpace
*
feSpace
=
f
eSpaces
[
i
];
for
(
unsigned
int
i
=
0
;
i
<
uniqueF
eSpaces
.
size
();
i
++
)
{
const
FiniteElemSpace
*
feSpace
=
uniqueF
eSpaces
[
i
];
for
(
int
level
=
0
;
level
<
nLevels
;
level
++
)
{
...
...
@@ -1636,7 +1628,7 @@ namespace AMDiS {
if
(
partitioner
->
getElementInRank
()[(
*
it
)
->
getIndex
()]
==
false
)
macrosToRemove
.
insert
(
*
it
);
mesh
->
removeMacroElements
(
macrosToRemove
,
f
eSpaces
);
mesh
->
removeMacroElements
(
macrosToRemove
,
uniqueF
eSpaces
);
}
...
...
@@ -1657,13 +1649,13 @@ namespace AMDiS {
int
nLevels
=
levelData
.
getLevelNumber
();
TEST_EXIT_DBG
(
nLevels
>=
1
)(
"Should not happen!
\n
"
);
dofMap
.
init
(
levelData
,
fe
Spaces
,
f
eSpaces
);
dofMap
.
init
(
levelData
,
component
Spaces
,
uniqueF
eSpaces
);
dofMap
.
setMpiComm
(
levelData
.
getMpiComm
(
0
),
0
);
dofMap
.
setDofComm
(
dofComm
);
dofMap
.
clear
();
if
(
nLevels
>
1
)
{
dofMapSd
.
init
(
levelData
,
fe
Spaces
,
f
eSpaces
);
dofMapSd
.
init
(
levelData
,
component
Spaces
,
uniqueF
eSpaces
);
dofMapSd
.
setMpiComm
(
levelData
.
getMpiComm
(
1
),
1
);
dofMapSd
.
setDofComm
(
dofCommSd
);
dofMapSd
.
clear
();
...
...
@@ -1671,13 +1663,13 @@ namespace AMDiS {
createBoundaryDofs
();
for
(
unsigned
int
i
=
0
;
i
<
f
eSpaces
.
size
();
i
++
)
updateLocalGlobalNumbering
(
dofMap
,
dofComm
,
f
eSpaces
[
i
]);
for
(
unsigned
int
i
=
0
;
i
<
uniqueF
eSpaces
.
size
();
i
++
)
updateLocalGlobalNumbering
(
dofMap
,
dofComm
,
uniqueF
eSpaces
[
i
]);
dofMap
.
update
();
if
(
nLevels
>
1
)
{
for
(
unsigned
int
i
=
0
;
i
<
f
eSpaces
.
size
();
i
++
)
updateLocalGlobalNumbering
(
dofMapSd
,
dofCommSd
,
f
eSpaces
[
i
]);
for
(
unsigned
int
i
=
0
;
i
<
uniqueF
eSpaces
.
size
();
i
++
)
updateLocalGlobalNumbering
(
dofMapSd
,
dofCommSd
,
uniqueF
eSpaces
[
i
]);
dofMapSd
.
update
();
}
...
...
@@ -1691,27 +1683,28 @@ namespace AMDiS {
MSG
(
"------------- Debug information -------------
\n
"
);
MSG
(
"| number of levels: %d
\n
"
,
nLevels
);
MSG
(
"| number of FE spaces: %d
\n
"
,
f
eSpaces
.
size
());
MSG
(
"| number of FE spaces: %d
\n
"
,
uniqueF
eSpaces
.
size
());
for
(
unsigned
int
i
=
0
;
i
<
f
eSpaces
.
size
();
i
++
)
{
MSG
(
"| FE space = %d (pointer adr %p):
\n
"
,
i
,
f
eSpaces
[
i
]);
MSG
(
"| nRankDofs = %d
\n
"
,
dofMap
[
f
eSpaces
[
i
]].
nRankDofs
);
MSG
(
"| nOverallDofs = %d
\n
"
,
dofMap
[
f
eSpaces
[
i
]].
nOverallDofs
);
MSG
(
"| rStartDofs = %d
\n
"
,
dofMap
[
f
eSpaces
[
i
]].
rStartDofs
);
for
(
unsigned
int
i
=
0
;
i
<
uniqueF
eSpaces
.
size
();
i
++
)
{
MSG
(
"| FE space = %d (pointer adr %p):
\n
"
,
i
,
uniqueF
eSpaces
[
i
]);
MSG
(
"| nRankDofs = %d
\n
"
,
dofMap
[
uniqueF
eSpaces
[
i
]].
nRankDofs
);
MSG
(
"| nOverallDofs = %d
\n
"
,
dofMap
[
uniqueF
eSpaces
[
i
]].
nOverallDofs
);
MSG
(
"| rStartDofs = %d
\n
"
,
dofMap
[
uniqueF
eSpaces
[
i
]].
rStartDofs
);
}
if
(
nLevels
>
1
)
{
for
(
unsigned
int
i
=
0
;
i
<
f
eSpaces
.
size
();
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
uniqueF
eSpaces
.
size
();
i
++
)
{
MSG
(
"| FE space = %d:
\n
"
,
i
);
MSG
(
"| nRankDofs = %d
\n
"
,
dofMapSd
[
f
eSpaces
[
i
]].
nRankDofs
);
MSG
(
"| nOverallDofs = %d
\n
"
,
dofMapSd
[
f
eSpaces
[
i
]].
nOverallDofs
);
MSG
(
"| rStartDofs = %d
\n
"
,
dofMapSd
[
f
eSpaces
[
i
]].
rStartDofs
);
MSG
(
"| nRankDofs = %d
\n
"
,
dofMapSd
[
uniqueF
eSpaces
[
i
]].
nRankDofs
);
MSG
(
"| nOverallDofs = %d
\n
"
,
dofMapSd
[
uniqueF
eSpaces
[
i
]].
nOverallDofs
);
MSG
(
"| rStartDofs = %d
\n
"
,
dofMapSd
[
uniqueF
eSpaces
[
i
]].
rStartDofs
);
}
}
// debug::writeElementIndexMesh(mesh, debugOutputDir + "elementIndex-" +
// lexical_cast<string>(mpiRank) + ".vtu");
ParallelDebug
::
writeDebugFile
(
feSpaces
[
feSpaces
.
size
()
-
1
],
dofMap
,
ParallelDebug
::
writeDebugFile
(
uniqueFeSpaces
[
uniqueFeSpaces
.
size
()
-
1
],
dofMap
,
debugOutputDir
+
"mpi-dbg"
,
"dat"
);
debug
::
testSortedDofs
(
mesh
,
elMap
);
...
...
@@ -1722,14 +1715,16 @@ namespace AMDiS {
ParallelDebug
::
testGlobalIndexByCoords
(
*
this
);
}
#else
for
(
unsigned
int
i
=
0
;
i
<
f
eSpaces
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
uniqueF
eSpaces
.
size
();
i
++
)
MSG
(
"FE space %d: nRankDofs = %d nOverallDofs = %d
\n
"
,
i
,
dofMap
[
feSpaces
[
i
]].
nRankDofs
,
dofMap
[
feSpaces
[
i
]].
nOverallDofs
);
i
,
dofMap
[
uniqueFeSpaces
[
i
]].
nRankDofs
,
dofMap
[
uniqueFeSpaces
[
i
]].
nOverallDofs
);
int
tmp
=
0
;
Parameters
::
get
(
name
+
"->write parallel debug file"
,
tmp
);
if
(
tmp
)
ParallelDebug
::
writeDebugFile
(
feSpaces
[
feSpaces
.
size
()
-
1
],
dofMap
,
ParallelDebug
::
writeDebugFile
(
uniqueFeSpaces
[
uniqueFeSpaces
.
size
()
-
1
],
dofMap
,
debugOutputDir
+
"mpi-dbg"
,
"dat"
);
#endif
...
...
@@ -1786,8 +1781,8 @@ namespace AMDiS {
// MPI::COMM_WORLD.Barrier(); [TODO: CHANGE BECAUSE NOT ALL RANKS HAVE PERIODIC MAP!!!]
double
first
=
MPI
::
Wtime
();
for
(
unsigned
int
i
=
0
;
i
<
f
eSpaces
.
size
();
i
++
)
createPeriodicMap
(
f
eSpaces
[
i
]);
for
(
unsigned
int
i
=
0
;
i
<
uniqueF
eSpaces
.
size
();
i
++
)
createPeriodicMap
(
uniqueF
eSpaces
[
i
]);
// MPI::COMM_WORLD.Barrier();
INFO
(
info
,
8
)(
"Creation of periodic mapping needed %.5f seconds
\n
"
,
...
...
@@ -2024,14 +2019,14 @@ namespace AMDiS {
// Create a map from DOF indices to the corresponding DOF pointers.
map
<
const
FiniteElemSpace
*
,
map
<
int
,
const
DegreeOfFreedom
*>
>
dofIndexMap
;
for
(
unsigned
int
i
=
0
;
i
<
f
eSpaces
.
size
();
i
++
)
{
ElementDofIterator
elDofIter
(
f
eSpaces
[
i
]);
for
(
unsigned
int
i
=
0
;
i
<
uniqueF
eSpaces
.
size
();
i
++
)
{
ElementDofIterator
elDofIter
(
uniqueF
eSpaces
[
i
]);
TraverseStack
stack
;
ElInfo
*
elInfo
=
stack
.
traverseFirst
(
mesh
,
-
1
,
Mesh
::
CALL_LEAF_EL
);
while
(
elInfo
)
{
elDofIter
.
reset
(
elInfo
->
getElement
());
do
{
dofIndexMap
[
f
eSpaces
[
i
]][
elDofIter
.
getDof
()]
=
elDofIter
.
getDofPtr
();
dofIndexMap
[
uniqueF
eSpaces
[
i
]][
elDofIter
.
getDof
()]
=
elDofIter
.
getDofPtr
();
}
while
(
elDofIter
.
next
());
elInfo
=
stack
.
traverseNext
(
elInfo
);
...
...
AMDiS/src/parallel/MeshDistributor.h
View file @
0c1e2d14
...
...
@@ -132,6 +132,7 @@ namespace AMDiS {
return
mesh
;
}
#if 0
/// Returns an FE space from \ref feSpaces.
inline const FiniteElemSpace* getFeSpace(unsigned int i = 0)
{
...
...
@@ -147,6 +148,7 @@ namespace AMDiS {
{
return feSpaces;
}
#endif
/// Returns the DOF mapping object, \ref dofMap.
inline
ParallelDofMapping
&
getDofMap
()
...
...
@@ -486,7 +488,10 @@ namespace AMDiS {
string
name
;
/// Finite element spaces of the problem.
vector
<
const
FiniteElemSpace
*>
feSpaces
;
//vector<const FiniteElemSpace*> feSpaces;
vector
<
const
FiniteElemSpace
*>
componentSpaces
;
vector
<
const
FiniteElemSpace
*>
uniqueFeSpaces
;
/// Mesh of the problem.
Mesh
*
mesh
;
...
...
AMDiS/src/parallel/ParallelCoarseSpaceMatVec.h
View file @
0c1e2d14
...
...
@@ -204,14 +204,12 @@ namespace AMDiS {
* space is not really necessary. Rewrite this!
*
* \param[in] component Component number of the system.
* \param[in] feSpace Finite element space of the component.
* \param[in] dof DOF index
*
* \return True, if the dof is a coarse space DOF in the component.
* False otherwise.
*/
inline
bool
isCoarseSpace
(
int
component
,
const
FiniteElemSpace
*
feSpace
,
DegreeOfFreedom
dof
)
{
FUNCNAME
(
"ParallelCoarseSpaceMatVec::isCoarseSpace()"
);
...
...
@@ -222,7 +220,7 @@ namespace AMDiS {
TEST_EXIT_DBG
(
coarseSpaceMap
.
count
(
component
))
(
"Component %d has no coarse space defined!
\n
"
,
component
);
return
(
*
(
coarseSpaceMap
[
component
]))[
feSpace
].
isSet
(
dof
);
return
(
*
(
coarseSpaceMap
[
component
]))[
component
].
isSet
(
dof
);
}
...
...
AMDiS/src/parallel/ParallelDebug.cc
View file @
0c1e2d14
...
...
@@ -164,7 +164,7 @@ namespace AMDiS {
perMap
.
periodicDofAssociations
[
feSpace
].
begin
();
it
!=
perMap
.
periodicDofAssociations
[
feSpace
].
end
();
++
it
)
{
WorldVector
<
double
>
c
;
pdb
.
mesh
->
getDofIndexCoords
(
it
->
first
,
pdb
.
f
eSpaces
[
0
],
c
);
pdb
.
mesh
->
getDofIndexCoords
(
it
->
first
,
pdb
.
uniqueF
eSpaces
[
0
],
c
);
int
nAssoc
=
it
->
second
.
size
();
}
...
...
@@ -329,7 +329,7 @@ namespace AMDiS {
clock_t
first
=
clock
();
// Get FE space with basis functions of the highest degree
const
FiniteElemSpace
*
feSpace
=
pdb
.
f
eSpaces
[
pdb
.
f
eSpaces
.
size
()
-
1
];
const
FiniteElemSpace
*
feSpace
=
pdb
.
uniqueF
eSpaces
[
pdb
.
uniqueF
eSpaces
.
size
()
-
1
];
int
testCommonDofs
=
1
;
Parameters
::
get
(
"dbg->test common dofs"
,
testCommonDofs
);
...
...
@@ -471,7 +471,7 @@ namespace AMDiS {
FUNCNAME
(
"ParallelDebug::testGlobalIndexByCoords()"
);
// Get FE space with basis functions of the highest degree
const
FiniteElemSpace
*
feSpace
=
pdb
.
f
eSpaces
[
pdb
.
f
eSpaces
.
size
()
-
1
];
const
FiniteElemSpace
*
feSpace
=
pdb
.
uniqueF
eSpaces
[
pdb
.
uniqueF
eSpaces
.
size
()
-
1
];
DOFVector
<
WorldVector
<
double
>
>
coords
(
feSpace
,
"tmp"
);
pdb
.
mesh
->
getDofIndexCoords
(
feSpace
,
coords
);
...
...
@@ -649,7 +649,7 @@ namespace AMDiS {
#if 0
if (rank == -1 || pdb.mpiRank == rank) {
const FiniteElemSpace *feSpace = pdb.
f
eSpaces[0];
const FiniteElemSpace *feSpace = pdb.
uniqueF
eSpaces[0];
cout << "====== DOF MAP LOCAL -> GLOBAL ====== " << endl;
...
...
@@ -700,7 +700,7 @@ namespace AMDiS {
dofit
!=
rankDofs
.
end
();
++
dofit
)
{
cout
<<
" "
<<
**
dofit
<<
endl
;
WorldVector
<
double
>
coords
;
pdb
.
mesh
->
getDofIndexCoords
(
*
dofit
,
pdb
.
f
eSpaces
[
0
],
coords
);
pdb
.
mesh
->
getDofIndexCoords
(
*
dofit
,
pdb
.
uniqueF
eSpaces
[
0
],
coords
);
coords
.
print
();
}
...
...
@@ -709,7 +709,7 @@ namespace AMDiS {
dofit
!=
rankAllDofs
.
end
();
++
dofit
)
{
cout
<<
" "
<<
**
dofit
<<
endl
;
WorldVector
<
double
>
coords
;
pdb
.
mesh
->
getDofIndexCoords
(
*
dofit
,
pdb
.
f
eSpaces
[
0
],
coords
);
pdb
.
mesh
->
getDofIndexCoords
(
*
dofit
,
pdb
.
uniqueF
eSpaces
[
0
],
coords
);
coords
.
print
();
}
}
...
...
@@ -886,13 +886,13 @@ namespace AMDiS {
if
(
followThisBound
(
it
->
rankObj
.
elIndex
,
it
->
neighObj
.
elIndex
))
debug
::
writeLocalElementDofs
(
pdb
.
mpiRank
,
it
->
rankObj
.
elIndex
,
pdb
.
f
eSpaces
[
0
]);
pdb
.
uniqueF
eSpaces
[
0
]);
for
(
InteriorBoundary
::
iterator
it
(
pdb
.
intBoundary
.
other
);
!
it
.
end
();
++
it
)
if
(
followThisBound
(
it
->
rankObj
.
elIndex
,
it
->
neighObj
.
elIndex
))
debug
::
writeLocalElementDofs
(
pdb
.
mpiRank
,
it
->
rankObj
.
elIndex
,
pdb
.
f
eSpaces
[
0
]);
pdb
.
uniqueF
eSpaces
[
0
]);
}
...
...
AMDiS/src/parallel/ParallelDofMapping.cc
View file @
0c1e2d14
...
...
@@ -38,7 +38,7 @@ namespace AMDiS {
}
FeSpaceDofMap
::
FeSpace
DofMap
(
MeshLevelData
*
ld
)
ComponentDofMap
::
Component
DofMap
(
MeshLevelData
*
ld
)
:
levelData
(
ld
),
dofComm
(
NULL
),
feSpace
(
NULL
),
...
...
@@ -49,7 +49,7 @@ namespace AMDiS {
}
void
FeSpace
DofMap
::
clear
()
void
Component
DofMap
::
clear
()
{
dofMap
.
clear
();
...
...
@@ -62,9 +62,9 @@ namespace AMDiS {
}
void
FeSpace
DofMap
::
update
()
void
Component
DofMap
::
update
()
{
FUNCNAME
(
"
FeSpace
DofMap::update()"
);
FUNCNAME
(
"
Component
DofMap::update()"
);
// === Compute local indices for all rank owned DOFs. ===
...
...
@@ -89,18 +89,18 @@ namespace AMDiS {
}
void
FeSpace
DofMap
::
computeGlobalMapping
()
void
Component
DofMap
::
computeGlobalMapping
()
{
FUNCNAME
(
"
FeSpace
DofMap::computeGlobalMapping()"
);
FUNCNAME
(
"
Component
DofMap::computeGlobalMapping()"
);
for
(
DofMap
::
iterator
it
=
dofMap
.
begin
();
it
!=
dofMap
.
end
();
++
it
)
it
->
second
.
global
=
it
->
second
.
local
+
rStartDofs
;
}
void
FeSpace
DofMap
::
computeNonLocalIndices
()
void
Component
DofMap
::
computeNonLocalIndices
()
{
FUNCNAME
(
"
FeSpace
DofMap::computeNonLocalIndices()"
);
FUNCNAME
(
"
Component
DofMap::computeNonLocalIndices()"
);
TEST_EXIT_DBG
(
dofComm
)(
"No DOF communicator defined!
\n
"
);
...
...
@@ -178,19 +178,9 @@ namespace AMDiS {
FUNCNAME
(
"ParallelDofMapping::init()"
);
levelData
=
&
ldata
;
feSpaces
=
fe
;
feSpacesUnique
=
uniqueFe
;
isNonLocal
=
b
;
// === Init the mapping for all different FE spaces. ===
for
(
vector
<
const
FiniteElemSpace
*>::
iterator
it
=
feSpacesUnique
.
begin
();
it
!=
feSpacesUnique
.
end
();
++
it
)
{
addFeSpace
(
*
it
);
data
[
*
it
].
setNeedGlobalMapping
(
isNonLocal
);
data
[
*
it
].
setNonLocal
(
isNonLocal
);
}
data
->
init
(
fe
,
uniqueFe
,
isNonLocal
);
}
...
...
@@ -200,9 +190,8 @@ namespace AMDiS {
TEST_EXIT_DBG
(
levelData
)(
"No mesh level data object defined!
\n
"
);
for
(
vector
<
const
FiniteElemSpace
*>::
iterator
it
=
feSpacesUnique
.
begin
();
it
!=
feSpacesUnique
.
end
();
++
it
)
data
[
*
it
].
clear
();
for
(
ComponentIterator
&
it
=
data
->
getIteratorData
();
!
it
.
end
();
it
.
next
())
data
->
clear
();
nRankDofs
=
-
1
;
nLocalDofs
=
-
1
;
...
...
@@ -217,9 +206,8 @@ namespace AMDiS {
mpiComm
=
m
;
meshLevel
=
l
;
for
(
vector
<
const
FiniteElemSpace
*>::
iterator
it
=
feSpacesUnique
.
begin
();