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
Backofen, Rainer
amdis
Commits
a530c60e
Commit
a530c60e
authored
Jan 27, 2012
by
Thomas Witkowski
Browse files
Changed names of some variables and functions in MeshDistributor to have a more consistant naming.
parent
75ffc1bf
Changes
9
Hide whitespace changes
Inline
Side-by-side
AMDiS/src/parallel/BddcMlSolver.cc
View file @
a530c60e
...
...
@@ -147,14 +147,14 @@ namespace AMDiS {
// array of indices of subdomain nodes in global numbering
int
isngn
[
nnods
];
for
(
int
i
=
0
;
i
<
nnods
;
i
++
)
isngn
[
i
]
=
meshDistributor
->
map
Local
ToGlobal
(
feSpace
,
i
);
isngn
[
i
]
=
meshDistributor
->
map
Dof
ToGlobal
(
feSpace
,
i
);
// array of indices of subdomain variables in global numbering
int
isvgvn
[
ndofs
];
for
(
int
j
=
0
;
j
<
nnods
;
j
++
)
for
(
int
i
=
0
;
i
<
nComponents
;
i
++
)
isvgvn
[
j
*
nComponents
+
i
]
=
meshDistributor
->
map
Local
ToGlobal
(
feSpace
,
j
)
*
nComponents
+
i
;
meshDistributor
->
map
Dof
ToGlobal
(
feSpace
,
j
)
*
nComponents
+
i
;
// array of indices of subdomain elements in global numbering
int
isegn
[
nelems
];
...
...
@@ -343,13 +343,13 @@ namespace AMDiS {
for
(
cursor_type
cursor
=
begin
<
row
>
(
dmat
->
getBaseMatrix
()),
cend
=
end
<
row
>
(
dmat
->
getBaseMatrix
());
cursor
!=
cend
;
++
cursor
)
{
int
rowIndex
=
meshDistributor
->
map
Local
ToGlobal
(
feSpace
,
*
cursor
)
*
nComponents
+
meshDistributor
->
map
Dof
ToGlobal
(
feSpace
,
*
cursor
)
*
nComponents
+
ithRowComponent
;
for
(
icursor_type
icursor
=
begin
<
nz
>
(
cursor
),
icend
=
end
<
nz
>
(
cursor
);
icursor
!=
icend
;
++
icursor
)
{
int
colIndex
=
meshDistributor
->
map
Local
ToGlobal
(
feSpace
,
col
(
*
icursor
))
*
nComponents
+
meshDistributor
->
map
Dof
ToGlobal
(
feSpace
,
col
(
*
icursor
))
*
nComponents
+
ithColComponent
;
double
val
=
value
(
*
icursor
);
...
...
AMDiS/src/parallel/MeshDistributor.cc
View file @
a530c60e
...
...
@@ -1152,7 +1152,7 @@ namespace AMDiS {
// === Run mesh partitioner to calculate a new mesh partitioning. ===
partitioner
->
setLocalGlobalDofMap
(
&
(
dofFeData
[
feSpaces
[
0
]].
map
Local
Global
Dofs
));
partitioner
->
setLocalGlobalDofMap
(
&
(
dofFeData
[
feSpaces
[
0
]].
map
DofTo
Global
));
bool
partitioningSucceed
=
partitioner
->
partition
(
elemWeights
,
ADAPTIVE_REPART
);
if
(
!
partitioningSucceed
)
{
MSG
(
"Mesh partitioner created empty partition!
\n
"
);
...
...
@@ -1988,15 +1988,15 @@ namespace AMDiS {
// === Create now the local to global index and local to DOF ===
// === index mappings. ===
dofFeData
[
feSpace
].
map
Local
Global
Dofs
.
clear
();
dofFeData
[
feSpace
].
mapLocalDof
Index
.
clear
();
dofFeData
[
feSpace
].
map
DofTo
Global
.
clear
();
dofFeData
[
feSpace
].
mapLocal
To
Dof
.
clear
();
for
(
DofIndexMap
::
iterator
dofIt
=
rankDofsNewGlobalIndex
.
begin
();
dofIt
!=
rankDofsNewGlobalIndex
.
end
();
++
dofIt
)
dofFeData
[
feSpace
].
map
Local
Global
Dofs
[
*
(
dofIt
->
first
)]
=
dofIt
->
second
;
dofFeData
[
feSpace
].
map
DofTo
Global
[
*
(
dofIt
->
first
)]
=
dofIt
->
second
;
for
(
unsigned
int
i
=
0
;
i
<
rankDofs
.
size
();
i
++
)
dofFeData
[
feSpace
].
mapLocalDof
Index
[
i
]
=
*
(
rankDofs
[
i
]);
dofFeData
[
feSpace
].
mapLocal
To
Dof
[
i
]
=
*
(
rankDofs
[
i
]);
// === Update DOF admins due to new number of DOFs. ===
...
...
@@ -2059,9 +2059,9 @@ namespace AMDiS {
for
(
unsigned
int
j
=
0
;
j
<
dofs0
.
size
();
j
++
)
{
DegreeOfFreedom
globalDof0
=
dofFeData
[
feSpace
].
map
Local
Global
Dofs
[
*
(
dofs0
[
j
])];
dofFeData
[
feSpace
].
map
DofTo
Global
[
*
(
dofs0
[
j
])];
DegreeOfFreedom
globalDof1
=
dofFeData
[
feSpace
].
map
Local
Global
Dofs
[
*
(
dofs1
[
j
])];
dofFeData
[
feSpace
].
map
DofTo
Global
[
*
(
dofs1
[
j
])];
if
(
!
periodicMap
.
isPeriodicOnBound
(
feSpace
,
type
,
globalDof0
))
periodicMap
.
add
(
feSpace
,
type
,
globalDof0
,
globalDof1
);
...
...
@@ -2086,7 +2086,7 @@ namespace AMDiS {
// Send the global indices to the rank on the other side.
stdMpi
.
getSendData
(
it
->
first
).
reserve
(
dofs
.
size
());
for
(
unsigned
int
i
=
0
;
i
<
dofs
.
size
();
i
++
)
stdMpi
.
getSendData
(
it
->
first
).
push_back
(
dofFeData
[
feSpace
].
map
Local
Global
Dofs
[
*
(
dofs
[
i
])]);
stdMpi
.
getSendData
(
it
->
first
).
push_back
(
dofFeData
[
feSpace
].
map
DofTo
Global
[
*
(
dofs
[
i
])]);
// Receive from this rank the same number of dofs.
stdMpi
.
recv
(
it
->
first
,
dofs
.
size
());
...
...
@@ -2112,7 +2112,7 @@ namespace AMDiS {
// Added the received DOFs to the mapping.
for
(
unsigned
int
i
=
0
;
i
<
dofs
.
size
();
i
++
)
{
int
globalDofIndex
=
dofFeData
[
feSpace
].
map
Local
Global
Dofs
[
*
(
dofs
[
i
])];
int
globalDofIndex
=
dofFeData
[
feSpace
].
map
DofTo
Global
[
*
(
dofs
[
i
])];
int
mapGlobalDofIndex
=
stdMpi
.
getRecvData
(
it
->
first
)[
i
];
BoundaryType
type
=
types
[
i
];
...
...
@@ -2144,7 +2144,7 @@ namespace AMDiS {
for
(
unsigned
int
i
=
0
;
i
<
dofs
.
size
();
i
++
)
{
DegreeOfFreedom
globalDof
=
dofFeData
[
feSpace
].
map
Local
Global
Dofs
[
*
dofs
[
i
]];
dofFeData
[
feSpace
].
map
DofTo
Global
[
*
dofs
[
i
]];
std
::
set
<
BoundaryType
>&
assoc
=
periodicMap
.
getAssociations
(
feSpace
,
globalDof
);
...
...
@@ -2164,13 +2164,12 @@ namespace AMDiS {
stdMpi2
.
startCommunication
();
// NOTE: Before changing the data structure of periodic boundary DOFS,
// at this place no periodicDofAssociations are set for the received
// DOFs. I'm note sure what is correct here.
for
(
map
<
int
,
PeriodicDofMap
>::
iterator
it
=
stdMpi2
.
getRecvData
().
begin
();
it
!=
stdMpi2
.
getRecvData
().
end
();
++
it
)
for
(
PeriodicDofMap
::
iterator
perIt
=
it
->
second
.
begin
();
perIt
!=
it
->
second
.
end
();
++
perIt
)
for
(
DofMapping
::
iterator
dofIt
=
perIt
->
second
.
begin
();
dofIt
!=
perIt
->
second
.
end
();
++
dofIt
)
periodicMap
.
add
(
feSpace
,
perIt
->
first
,
dofIt
->
second
,
dofIt
->
first
);
periodicMap
.
add
(
feSpace
,
it
->
second
);
}
...
...
@@ -2217,8 +2216,8 @@ namespace AMDiS {
TEST_EXIT_DBG
(
dofFeData
.
count
(
feSpace
))(
"Should not happen!
\n
"
);
for
(
DofMapping
::
iterator
it
=
dofFeData
[
feSpace
].
map
Local
Global
Dofs
.
begin
();
it
!=
dofFeData
[
feSpace
].
map
Local
Global
Dofs
.
end
();
++
it
)
for
(
DofMapping
::
iterator
it
=
dofFeData
[
feSpace
].
map
DofTo
Global
.
begin
();
it
!=
dofFeData
[
feSpace
].
map
DofTo
Global
.
end
();
++
it
)
if
(
it
->
second
==
dof
)
return
it
->
first
;
...
...
@@ -2257,8 +2256,8 @@ namespace AMDiS {
SerUtil
::
serialize
(
out
,
dofFeData
[
feSpaces
[
i
]].
rStartDofs
);
SerUtil
::
serialize
(
out
,
dofFeData
[
feSpaces
[
i
]].
isRankDof
);
SerUtil
::
serialize
(
out
,
dofFeData
[
feSpaces
[
i
]].
map
Local
Global
Dofs
);
SerUtil
::
serialize
(
out
,
dofFeData
[
feSpaces
[
i
]].
mapLocalDof
Index
);
SerUtil
::
serialize
(
out
,
dofFeData
[
feSpaces
[
i
]].
map
DofTo
Global
);
SerUtil
::
serialize
(
out
,
dofFeData
[
feSpaces
[
i
]].
mapLocal
To
Dof
);
}
periodicMap
.
serialize
(
out
,
feSpaces
);
...
...
@@ -2330,8 +2329,8 @@ namespace AMDiS {
SerUtil
::
deserialize
(
in
,
dofFeData
[
feSpaces
[
i
]].
rStartDofs
);
SerUtil
::
deserialize
(
in
,
dofFeData
[
feSpaces
[
i
]].
isRankDof
);
SerUtil
::
deserialize
(
in
,
dofFeData
[
feSpaces
[
i
]].
map
Local
Global
Dofs
);
SerUtil
::
deserialize
(
in
,
dofFeData
[
feSpaces
[
i
]].
mapLocalDof
Index
);
SerUtil
::
deserialize
(
in
,
dofFeData
[
feSpaces
[
i
]].
map
DofTo
Global
);
SerUtil
::
deserialize
(
in
,
dofFeData
[
feSpaces
[
i
]].
mapLocal
To
Dof
);
}
periodicMap
.
deserialize
(
in
,
feSpaces
);
...
...
AMDiS/src/parallel/MeshDistributor.h
View file @
a530c60e
...
...
@@ -63,18 +63,16 @@ namespace AMDiS {
/// Number of DOFs in the whole domain.
int
nOverallDofs
;
/** \brief
* Maps all DOFs in ranks partition to a bool value. If it is true, the DOF
* is owned by the rank. Otherwise, its an interior boundary DOF that is
* owned by another rank.
*/
/// Maps all DOFs in ranks partition to a bool value. If it is true, the DOF
/// is owned by the rank. Otherwise, its an interior boundary DOF that is
/// owned by another rank.
DofIndexToBool
isRankDof
;
/// Maps local to global dof indices.
DofMapping
map
Local
Global
Dofs
;
DofMapping
map
DofTo
Global
;
/// Maps local dof indices to real dof indices.
DofMapping
mapLocalDof
Index
;
DofMapping
mapLocal
To
Dof
;
};
...
...
@@ -242,40 +240,44 @@ namespace AMDiS {
return
result
;
}
inline
DofMapping
&
getMap
Local
Global
Dofs
(
const
FiniteElemSpace
*
feSpace
)
inline
DofMapping
&
getMap
DofTo
Global
(
const
FiniteElemSpace
*
feSpace
)
{
FUNCNAME
(
"MeshDistributor::getMap
Local
Global
Dofs
()"
);
FUNCNAME
(
"MeshDistributor::getMap
DofTo
Global()"
);
TEST_EXIT_DBG
(
dofFeData
.
count
(
feSpace
))(
"Should not happen!
\n
"
);
return
dofFeData
[
feSpace
].
map
Local
Global
Dofs
;
return
dofFeData
[
feSpace
].
map
DofTo
Global
;
}
/// Maps a local DOF to its global index.
inline
DegreeOfFreedom
map
Local
ToGlobal
(
const
FiniteElemSpace
*
feSpace
,
DegreeOfFreedom
dof
)
inline
DegreeOfFreedom
map
Dof
ToGlobal
(
const
FiniteElemSpace
*
feSpace
,
DegreeOfFreedom
dof
)
{
FUNCNAME
(
"MeshDistributor::map
Local
ToGlobal()"
);
FUNCNAME
(
"MeshDistributor::map
Dof
ToGlobal()"
);
TEST_EXIT_DBG
(
dofFeData
.
count
(
feSpace
))
(
"No DOF data for FE space at addr %p!
\n
"
,
feSpace
);
return
dofFeData
[
feSpace
].
map
Local
Global
Dofs
[
dof
];
return
dofFeData
[
feSpace
].
map
DofTo
Global
[
dof
];
}
/// Returns for a global index the DOF index in rank's subdomain. As there
/// is no direct data structure that stores this information, we have to
/// search for it in \ref dofFeData.mapDofToGlobal. This is not very
/// efficient and this function should thus be used for debugging only.
DegreeOfFreedom
mapGlobalToLocal
(
const
FiniteElemSpace
*
feSpace
,
DegreeOfFreedom
dof
);
/// Maps a local DOF to its local index.
inline
DegreeOfFreedom
mapLocalToDof
Index
(
const
FiniteElemSpace
*
feSpace
,
DegreeOfFreedom
dof
)
inline
DegreeOfFreedom
mapLocalToDof
(
const
FiniteElemSpace
*
feSpace
,
DegreeOfFreedom
dof
)
{
FUNCNAME
(
"MeshDistributor::mapLocalToDof
Index
()"
);
FUNCNAME
(
"MeshDistributor::mapLocalToDof()"
);
TEST_EXIT_DBG
(
dofFeData
.
count
(
feSpace
))
(
"No DOF data for FE space at addr %p!
\n
"
,
feSpace
);
return
dofFeData
[
feSpace
].
mapLocalDof
Index
[
dof
];
return
dofFeData
[
feSpace
].
mapLocal
To
Dof
[
dof
];
}
/// Returns the periodic mapping handler, \ref periodicMap.
...
...
AMDiS/src/parallel/ParallelDebug.cc
View file @
a530c60e
...
...
@@ -482,7 +482,7 @@ namespace AMDiS {
DOFIterator
<
WorldVector
<
double
>
>
it
(
&
coords
,
USED_DOFS
);
for
(
it
.
reset
();
!
it
.
end
();
++
it
)
{
coordsToIndex
[(
*
it
)]
=
pdb
.
dofFeData
[
feSpace
].
map
Local
Global
Dofs
[
it
.
getDOFIndex
()];
pdb
.
dofFeData
[
feSpace
].
map
DofTo
Global
[
it
.
getDOFIndex
()];
// MSG(" CHECK FOR DOF %d AT COORDS %f %f %f\n",
// coordsToIndex[(*it)], (*it)[0], (*it)[1], (*it)[2]);
...
...
@@ -644,11 +644,11 @@ namespace AMDiS {
cout
<<
"====== DOF MAP LOCAL -> GLOBAL ====== "
<<
endl
;
for
(
DofMapping
::
iterator
it
=
pdb
.
dofFeData
[
feSpace
].
map
Local
Global
Dofs
.
begin
();
it
!=
pdb
.
dofFeData
[
feSpace
].
map
Local
Global
Dofs
.
end
();
it
++
)
{
for
(
DofMapping
::
iterator
it
=
pdb
.
dofFeData
[
feSpace
].
map
DofTo
Global
.
begin
();
it
!=
pdb
.
dofFeData
[
feSpace
].
map
DofTo
Global
.
end
();
it
++
)
{
DegreeOfFreedom
localdof
=
-
1
;
if
(
pdb
.
dofFeData
[
feSpace
].
mapLocalDof
Index
.
count
(
it
->
first
)
>
0
)
localdof
=
pdb
.
dofFeData
[
feSpace
].
mapLocalDof
Index
[
it
->
first
];
if
(
pdb
.
dofFeData
[
feSpace
].
mapLocal
To
Dof
.
count
(
it
->
first
)
>
0
)
localdof
=
pdb
.
dofFeData
[
feSpace
].
mapLocal
To
Dof
[
it
->
first
];
cout
<<
"DOF "
<<
it
->
first
<<
" "
<<
it
->
second
<<
" "
...
...
@@ -699,8 +699,8 @@ namespace AMDiS {
cout << endl;
DegreeOfFreedom localdof = -1;
for (DofMapping::iterator dofIt = pdb.dofFeData[feSpace].map
Local
Global
Dofs
.begin();
dofIt != pdb.dofFeData[feSpace].map
Local
Global
Dofs
.end(); ++dofIt)
for (DofMapping::iterator dofIt = pdb.dofFeData[feSpace].map
DofTo
Global.begin();
dofIt != pdb.dofFeData[feSpace].map
DofTo
Global.end(); ++dofIt)
if (dofIt->second == it->first)
localdof = dofIt->first;
...
...
@@ -816,7 +816,7 @@ namespace AMDiS {
DOFIterator
<
WorldVector
<
double
>
>
it
(
&
coords
,
USED_DOFS
);
for
(
it
.
reset
();
!
it
.
end
();
++
it
)
{
file
<<
it
.
getDOFIndex
()
<<
" "
<<
pdb
.
dofFeData
[
feSpace
].
map
Local
Global
Dofs
[
it
.
getDOFIndex
()]
<<
" "
<<
pdb
.
dofFeData
[
feSpace
].
map
DofTo
Global
[
it
.
getDOFIndex
()]
<<
" "
<<
pdb
.
getIsRankDof
(
feSpace
,
it
.
getDOFIndex
());
for
(
int
i
=
0
;
i
<
pdb
.
mesh
->
getDim
();
i
++
)
file
<<
" "
<<
(
*
it
)[
i
];
...
...
AMDiS/src/parallel/PeriodicMap.cc
View file @
a530c60e
...
...
@@ -15,6 +15,18 @@
namespace
AMDiS
{
void
PeriodicMap
::
add
(
const
FiniteElemSpace
*
feSpace
,
PeriodicDofMap
&
newMap
)
{
FUNCNAME
(
"PeriodicMap::add()"
);
for
(
PeriodicDofMap
::
iterator
it
=
newMap
.
begin
();
it
!=
newMap
.
end
();
++
it
)
for
(
DofMapping
::
iterator
dofIt
=
it
->
second
.
begin
();
dofIt
!=
it
->
second
.
end
();
++
dofIt
)
add
(
feSpace
,
it
->
first
,
dofIt
->
second
,
dofIt
->
first
);
}
void
PeriodicMap
::
serialize
(
ostream
&
out
,
vector
<
const
FiniteElemSpace
*>
feSpaces
)
{
...
...
AMDiS/src/parallel/PeriodicMap.h
View file @
a530c60e
...
...
@@ -54,6 +54,7 @@ namespace AMDiS {
public:
PeriodicMap
()
{}
/// Reset all data.
void
clear
()
{
periodicDofMap
.
clear
();
...
...
@@ -61,12 +62,26 @@ namespace AMDiS {
}
/// Get a periodic DOF mapping for a given FE space.
inline
PeriodicDofMap
&
getPeriodicMap
(
const
FiniteElemSpace
*
feSpace
)
{
return
periodicDofMap
[
feSpace
];
}
/** \brief
* Map a DOF
*
* \param[in] feSpace FE space from which the DOF comes from.
* \param[in] type Index of the periodic boundary. Is used to get
* the correct mapping if the DOF has multiple
* periodic associations.
* \param[in] globalDofIndex Global DOF index.
*
* \return Mapping of the global DOF index. The function fails if the
* the DOF is not periodic in the given FE space and periodic
* boundary type.
*/
inline
int
map
(
const
FiniteElemSpace
*
feSpace
,
BoundaryType
type
,
int
globalDofIndex
)
...
...
@@ -82,6 +97,8 @@ namespace AMDiS {
}
/// Adds a new periodic mapping. Fails if there is already a mapping for
/// this DOFs that maps to a different DOF index than the given one.
inline
void
add
(
const
FiniteElemSpace
*
feSpace
,
BoundaryType
type
,
DegreeOfFreedom
dof0
,
DegreeOfFreedom
dof1
)
...
...
@@ -96,6 +113,10 @@ namespace AMDiS {
periodicDofAssociations
[
feSpace
][
dof0
].
insert
(
type
);
}
/// Adds a whole periodic mapping to the current one.
void
add
(
const
FiniteElemSpace
*
feSpace
,
PeriodicDofMap
&
newMap
);
/// For a given global DOF index, this function returns the set of periodic
/// associations, i.e., the boundary types the DOF is associated to, for
...
...
AMDiS/src/parallel/PetscSolverGlobalBlockMatrix.cc
View file @
a530c60e
...
...
@@ -128,7 +128,7 @@ namespace AMDiS {
VecGetArray
(
tmp
,
&
vecPointer
);
for
(
int
j
=
0
;
j
<
nRankDofs
;
j
++
)
dofvec
[
meshDistributor
->
mapLocalToDof
Index
(
feSpace
,
j
)]
=
vecPointer
[
j
];
dofvec
[
meshDistributor
->
mapLocalToDof
(
feSpace
,
j
)]
=
vecPointer
[
j
];
VecRestoreArray
(
tmp
,
&
vecPointer
);
}
...
...
@@ -192,7 +192,7 @@ namespace AMDiS {
cend
=
end
<
row
>
(
mat
->
getBaseMatrix
());
cursor
!=
cend
;
++
cursor
)
{
// Global index of the current row DOF.
int
rowIndex
=
meshDistributor
->
map
Local
ToGlobal
(
feSpace
,
*
cursor
);
int
rowIndex
=
meshDistributor
->
map
Dof
ToGlobal
(
feSpace
,
*
cursor
);
cols
.
clear
();
values
.
clear
();
...
...
@@ -200,7 +200,7 @@ namespace AMDiS {
for
(
icursor_type
icursor
=
begin
<
nz
>
(
cursor
),
icend
=
end
<
nz
>
(
cursor
);
icursor
!=
icend
;
++
icursor
)
{
// Global index of the current column index.
int
colIndex
=
meshDistributor
->
map
Local
ToGlobal
(
feSpace
,
col
(
*
icursor
));
int
colIndex
=
meshDistributor
->
map
Dof
ToGlobal
(
feSpace
,
col
(
*
icursor
));
// Ignore all zero entries, expect it is a diagonal entry.
if
(
value
(
*
icursor
)
==
0.0
&&
rowIndex
!=
colIndex
)
...
...
@@ -227,7 +227,7 @@ namespace AMDiS {
// Traverse all used DOFs in the dof vector.
DOFVector
<
double
>::
Iterator
dofIt
(
vec
,
USED_DOFS
);
for
(
dofIt
.
reset
();
!
dofIt
.
end
();
++
dofIt
)
{
int
index
=
meshDistributor
->
map
Local
ToGlobal
(
feSpace
,
dofIt
.
getDOFIndex
());
int
index
=
meshDistributor
->
map
Dof
ToGlobal
(
feSpace
,
dofIt
.
getDOFIndex
());
double
value
=
*
dofIt
;
VecSetValues
(
petscVec
,
1
,
&
index
,
&
value
,
ADD_VALUES
);
...
...
AMDiS/src/parallel/PetscSolverGlobalMatrix.cc
View file @
a530c60e
...
...
@@ -161,7 +161,7 @@ namespace AMDiS {
int
nRankDofs
=
meshDistributor
->
getNumberRankDofs
(
feSpace
);
for
(
int
j
=
0
;
j
<
nRankDofs
;
j
++
)
dv
[
meshDistributor
->
mapLocalToDof
Index
(
feSpace
,
j
)]
=
vecPointer
[
c
++
];
dv
[
meshDistributor
->
mapLocalToDof
(
feSpace
,
j
)]
=
vecPointer
[
c
++
];
}
VecRestoreArray
(
petscSolVec
,
&
vecPointer
);
...
...
@@ -231,7 +231,7 @@ namespace AMDiS {
// Global index of the current row DOF.
int
globalRowDof
=
meshDistributor
->
map
Local
ToGlobal
(
rowFe
,
*
cursor
);
meshDistributor
->
map
Dof
ToGlobal
(
rowFe
,
*
cursor
);
// Test if the current row DOF is a periodic DOF.
bool
periodicRow
=
perMap
.
isPeriodic
(
rowFe
,
globalRowDof
);
...
...
@@ -249,7 +249,7 @@ namespace AMDiS {
// Global index of the current column index.
int
globalColDof
=
meshDistributor
->
map
Local
ToGlobal
(
colFe
,
col
(
*
icursor
));
meshDistributor
->
map
Dof
ToGlobal
(
colFe
,
col
(
*
icursor
));
// Test if the current col dof is a periodic dof.
bool
periodicCol
=
perMap
.
isPeriodic
(
colFe
,
globalColDof
);
// Get PETSc's mat col index.
...
...
@@ -326,7 +326,7 @@ namespace AMDiS {
// Global index of the current column index.
int
globalColDof
=
meshDistributor
->
map
Local
ToGlobal
(
colFe
,
col
(
*
icursor
));
meshDistributor
->
map
Dof
ToGlobal
(
colFe
,
col
(
*
icursor
));
// Ignore all zero entries, expect it is a diagonal entry.
if
(
value
(
*
icursor
)
==
0.0
&&
globalRowDof
!=
globalColDof
)
...
...
@@ -436,7 +436,7 @@ namespace AMDiS {
// Calculate global row index of the DOF.
DegreeOfFreedom
globalRowDof
=
meshDistributor
->
map
Local
ToGlobal
(
feSpace
,
dofIt
.
getDOFIndex
());
meshDistributor
->
map
Dof
ToGlobal
(
feSpace
,
dofIt
.
getDOFIndex
());
// Get PETSc's mat index of the row DOF.
int
index
=
dofToMatIndex
.
get
(
dispAdd
,
globalRowDof
);
...
...
@@ -539,7 +539,7 @@ namespace AMDiS {
cend
=
end
<
row
>
(
bmat
);
cursor
!=
cend
;
++
cursor
)
{
int
globalRowDof
=
meshDistributor
->
map
Local
ToGlobal
(
feSpaces
[
i
],
*
cursor
);
meshDistributor
->
map
Dof
ToGlobal
(
feSpaces
[
i
],
*
cursor
);
// The corresponding global matrix row index of the current row DOF.
int
petscRowIdx
=
dofToMatIndex
.
get
(
i
,
globalRowDof
);
...
...
@@ -555,7 +555,7 @@ namespace AMDiS {
TEST_EXIT_DBG
(
localPetscRowIdx
>=
0
&&
localPetscRowIdx
<
nRankRows
)
(
"Should not happen!
\n
Debug info: localRowIdx = %d globalRowIndx = %d petscRowIdx = %d localPetscRowIdx = %d rStart = %d nCompontens = %d nRankRows = %d
\n
"
,
*
cursor
,
meshDistributor
->
map
Local
ToGlobal
(
feSpaces
[
i
],
*
cursor
),
meshDistributor
->
map
Dof
ToGlobal
(
feSpaces
[
i
],
*
cursor
),
petscRowIdx
,
localPetscRowIdx
,
rankStartIndex
,
...
...
@@ -567,7 +567,7 @@ namespace AMDiS {
for
(
icursor_type
icursor
=
begin
<
nz
>
(
cursor
),
icend
=
end
<
nz
>
(
cursor
);
icursor
!=
icend
;
++
icursor
)
{
int
globalColDof
=
meshDistributor
->
map
Local
ToGlobal
(
feSpaces
[
j
],
col
(
*
icursor
));
meshDistributor
->
map
Dof
ToGlobal
(
feSpaces
[
j
],
col
(
*
icursor
));
int
petscColIdx
=
dofToMatIndex
.
get
(
j
,
globalColDof
);
if
(
value
(
*
icursor
)
!=
0.0
||
petscRowIdx
==
petscColIdx
)
{
...
...
@@ -595,7 +595,7 @@ namespace AMDiS {
icend
=
end
<
nz
>
(
cursor
);
icursor
!=
icend
;
++
icursor
)
{
if
(
value
(
*
icursor
)
!=
0.0
)
{
int
globalColDof
=
meshDistributor
->
map
Local
ToGlobal
(
feSpaces
[
j
],
col
(
*
icursor
));
meshDistributor
->
map
Dof
ToGlobal
(
feSpaces
[
j
],
col
(
*
icursor
));
int
petscColIdx
=
dofToMatIndex
.
get
(
j
,
globalColDof
);
sendMatrixEntry
[
sendToRank
].
...
...
@@ -672,7 +672,7 @@ namespace AMDiS {
it
!=
rankDofSet
.
end
();
++
it
)
if
(
meshDistributor
->
getIsRankDof
(
feSpaces
[
i
],
**
it
))
{
int
globalIndex
=
meshDistributor
->
map
Local
ToGlobal
(
feSpaces
[
i
],
**
it
);
meshDistributor
->
map
Dof
ToGlobal
(
feSpaces
[
i
],
**
it
);
int
globalMatIndex
=
globalIndex
-
meshDistributor
->
getStartDofs
(
feSpaces
[
i
])
+
offset
;
...
...
@@ -690,7 +690,7 @@ namespace AMDiS {
for
(;
!
it
.
endDofIter
();
it
.
nextDof
())
{
int
globalIndex
=
meshDistributor
->
map
Local
ToGlobal
(
feSpaces
[
i
],
it
.
getDofIndex
());
meshDistributor
->
map
Dof
ToGlobal
(
feSpaces
[
i
],
it
.
getDofIndex
());
int
globalMatIndex
=
dofToMatIndex
.
get
(
i
,
globalIndex
);
sendGlobalDofs
.
push_back
(
globalMatIndex
);
}
...
...
@@ -707,8 +707,10 @@ namespace AMDiS {
for
(
DofComm
::
Iterator
it
(
meshDistributor
->
getRecvDofs
(),
feSpaces
[
i
]);
!
it
.
end
();
it
.
nextRank
())
for
(;
!
it
.
endDofIter
();
it
.
nextDof
())
{
int
globalIndex
=
meshDistributor
->
mapLocalToGlobal
(
feSpaces
[
i
],
it
.
getDofIndex
());
int
globalMatIndex
=
stdMpi
.
getRecvData
(
it
.
getRank
())[
it
.
getDofCounter
()];
int
globalIndex
=
meshDistributor
->
mapDofToGlobal
(
feSpaces
[
i
],
it
.
getDofIndex
());
int
globalMatIndex
=
stdMpi
.
getRecvData
(
it
.
getRank
())[
it
.
getDofCounter
()];
dofToMatIndex
.
add
(
i
,
globalIndex
,
globalMatIndex
);
}
...
...
@@ -723,7 +725,8 @@ namespace AMDiS {
vector
<
DegreeOfFreedom
>
sendGlobalDofs
;
for
(;
!
it
.
endDofIter
();
it
.
nextDof
())
{
int
ind0
=
meshDistributor
->
mapLocalToGlobal
(
feSpaces
[
i
],
it
.
getDofIndex
());
int
ind0
=
meshDistributor
->
mapDofToGlobal
(
feSpaces
[
i
],
it
.
getDofIndex
());
int
ind1
=
dofToMatIndex
.
get
(
i
,
ind0
);
sendGlobalDofs
.
push_back
(
ind0
);
...
...
AMDiS/src/parallel/PetscSolverSchur.cc
View file @
a530c60e
...
...
@@ -36,7 +36,7 @@ namespace AMDiS {
!
it
.
end
();
it
.
nextRank
())
for
(;
!
it
.
endDofIter
();
it
.
nextDof
())
{
boundaryLocalDofs
.
insert
(
it
.
getDofIndex
());
boundaryDofs
.
insert
(
meshDistributor
->
map
Local
ToGlobal
(
feSpace
,
it
.
getDofIndex
()));
boundaryDofs
.
insert
(
meshDistributor
->
map
Dof
ToGlobal
(
feSpace
,
it
.
getDofIndex
()));
}
...
...
@@ -73,14 +73,14 @@ namespace AMDiS {
int
counter
=
rStartEdgeDofs
;
for
(
DofContainerSet
::
iterator
it
=
edgeDofs
.
begin
();
it
!=
edgeDofs
.
end
();
++
it
)
mapGlobalBoundaryDof
[
meshDistributor
->
map
Local
ToGlobal
(
feSpace
,
**
it
)]
=
mapGlobalBoundaryDof
[
meshDistributor
->
map
Dof
ToGlobal
(
feSpace
,
**
it
)]
=
counter
++
;
}
{
int
counter
=
nOverallEdgeDofs
+
rStartVertexDofs
;
for
(
DofContainerSet
::
iterator
it
=
vertexDofs
.
begin
();
it
!=
vertexDofs
.
end
();
++
it
)
mapGlobalBoundaryDof
[
meshDistributor
->
map
Local
ToGlobal
(
feSpace
,
**
it
)]
=
mapGlobalBoundaryDof
[
meshDistributor
->
map
Dof
ToGlobal
(
feSpace
,
**
it
)]
=
counter
++
;
}
#else
...
...
@@ -106,7 +106,7 @@ namespace AMDiS {
if
(
dofIt
->
second
&&
boundaryLocalDofs
.
count
(
dofIt
->
first
)
==
0
&&
otherBoundaryLocalDofs
.
count
(
dofIt
->
first
)
==
0
)
interiorDofs
.
insert
(
meshDistributor
->
map
Local
ToGlobal
(
feSpace
,
dofIt
->
first
));
interiorDofs
.
insert
(
meshDistributor
->
map
Dof
ToGlobal
(
feSpace
,
dofIt
->
first
));
}
nInteriorDofs
=
interiorDofs
.
size
();
...
...
@@ -133,7 +133,7 @@ namespace AMDiS {
for
(;
!
it
.
endDofIter
();
it
.
nextDof
())
{
int
globalSendDof
=
meshDistributor
->
map
Local
ToGlobal
(
feSpace
,
it
.
getDofIndex
());
meshDistributor
->
map
Dof
ToGlobal
(
feSpace
,
it
.
getDofIndex
());
TEST_EXIT_DBG
(
mapGlobalBoundaryDof
.
count
(
globalSendDof
))
(
"No mapping for boundary DOF %d!
\n
"
,
globalSendDof
);
...
...
@@ -154,7 +154,7 @@ namespace AMDiS {
!
it
.
end
();
it
.
nextRank
())
for
(;
!
it
.
endDofIter
();
it
.
nextDof
())
{
int
globalRecvDof
=
meshDistributor
->
map
Local
ToGlobal
(
feSpace
,
it
.
getDofIndex
());
meshDistributor
->
map
Dof
ToGlobal
(
feSpace
,
it
.
getDofIndex
());
mapGlobalBoundaryDof
[
globalRecvDof
]
=
stdMpi
.
getRecvData
(
it
.
getRank
())[
it
.
getDofCounter
()];
boundaryDofs
.
insert
(
globalRecvDof
);
...
...
@@ -302,7 +302,7 @@ namespace AMDiS {
DOFVector
<
double
>::
Iterator
dofIt
(
vec
.
getDOFVector
(
i
),
USED_DOFS
);
for
(
dofIt
.
reset
();
!
dofIt
.
end
();
++
dofIt
)
{
DegreeOfFreedom
globalRowDof
=
meshDistributor
->
map
Local
ToGlobal
(
feSpace
,
dofIt
.
getDOFIndex
());
meshDistributor
->
map
Dof
ToGlobal
(
feSpace
,
dofIt
.
getDOFIndex
());
if
(
boundaryDofs
.
count
(
globalRowDof
))
{
int
index
=
(
mapGlobalBoundaryDof
[
globalRowDof
]
-
rStartBoundaryDofs
+
nInteriorDofs
)
*
(
i
+
1
);
...
...
@@ -373,7 +373,7 @@ namespace AMDiS {
cend
=
end
<
row
>
(
mat
->
getBaseMatrix
());
cursor
!=
cend
;
++
cursor
)
{
// Global index of the current row DOF.
int
globalRowDof
=
meshDistributor
->
map
Local
ToGlobal
(
feSpace
,
*
cursor
);
int
globalRowDof
=
meshDistributor
->
map
Dof
ToGlobal
(
feSpace
,
*
cursor
);
colsBoundary
.
clear
();
colsInterior
.
clear
();
...
...
@@ -382,7 +382,7 @@ namespace AMDiS {
for
(
icursor_type
icursor
=
begin
<
nz
>
(
cursor
),
icend
=
end
<
nz
>
(
cursor
);
icursor
!=
icend
;
++
icursor
)
{
int
globalColDof
=
meshDistributor
->
map
Local
ToGlobal
(
feSpace
,
col
(
*
icursor
));
int
globalColDof
=
meshDistributor
->
map
Dof
ToGlobal
(
feSpace
,
col
(
*
icursor
));
if
(
boundaryDofs
.
count
(
globalColDof
))
{
TEST_EXIT_DBG
(
mapGlobalBoundaryDof
.
count
(
globalColDof
))
...
...
@@ -446,7 +446,7 @@ namespace AMDiS {
// Calculate global row index of the DOF.
DegreeOfFreedom
globalRowDof
=
meshDistributor
->
map
Local
ToGlobal
(
feSpace
,
dofIt
.
getDOFIndex
());
meshDistributor
->
map
Dof
ToGlobal
(
feSpace
,
dofIt
.
getDOFIndex
());
double
value
=
*
dofIt
;
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment