Commit a530c60e authored by Thomas Witkowski's avatar Thomas Witkowski

Changed names of some variables and functions in MeshDistributor to have a more consistant naming.

parent 75ffc1bf
...@@ -147,14 +147,14 @@ namespace AMDiS { ...@@ -147,14 +147,14 @@ namespace AMDiS {
// array of indices of subdomain nodes in global numbering // array of indices of subdomain nodes in global numbering
int isngn[nnods]; int isngn[nnods];
for (int i = 0; i < nnods; i++) for (int i = 0; i < nnods; i++)
isngn[i] = meshDistributor->mapLocalToGlobal(feSpace, i); isngn[i] = meshDistributor->mapDofToGlobal(feSpace, i);
// array of indices of subdomain variables in global numbering // array of indices of subdomain variables in global numbering
int isvgvn[ndofs]; int isvgvn[ndofs];
for (int j = 0; j < nnods; j++) for (int j = 0; j < nnods; j++)
for (int i = 0; i < nComponents; i++) for (int i = 0; i < nComponents; i++)
isvgvn[j * nComponents + i] = isvgvn[j * nComponents + i] =
meshDistributor->mapLocalToGlobal(feSpace, j) * nComponents + i; meshDistributor->mapDofToGlobal(feSpace, j) * nComponents + i;
// array of indices of subdomain elements in global numbering // array of indices of subdomain elements in global numbering
int isegn[nelems]; int isegn[nelems];
...@@ -343,13 +343,13 @@ namespace AMDiS { ...@@ -343,13 +343,13 @@ namespace AMDiS {
for (cursor_type cursor = begin<row>(dmat->getBaseMatrix()), for (cursor_type cursor = begin<row>(dmat->getBaseMatrix()),
cend = end<row>(dmat->getBaseMatrix()); cursor != cend; ++cursor) { cend = end<row>(dmat->getBaseMatrix()); cursor != cend; ++cursor) {
int rowIndex = int rowIndex =
meshDistributor->mapLocalToGlobal(feSpace, *cursor) * nComponents + meshDistributor->mapDofToGlobal(feSpace, *cursor) * nComponents +
ithRowComponent; ithRowComponent;
for (icursor_type icursor = begin<nz>(cursor), icend = end<nz>(cursor); for (icursor_type icursor = begin<nz>(cursor), icend = end<nz>(cursor);
icursor != icend; ++icursor) { icursor != icend; ++icursor) {
int colIndex = int colIndex =
meshDistributor->mapLocalToGlobal(feSpace, col(*icursor)) * nComponents + meshDistributor->mapDofToGlobal(feSpace, col(*icursor)) * nComponents +
ithColComponent; ithColComponent;
double val = value(*icursor); double val = value(*icursor);
......
...@@ -1152,7 +1152,7 @@ namespace AMDiS { ...@@ -1152,7 +1152,7 @@ namespace AMDiS {
// === Run mesh partitioner to calculate a new mesh partitioning. === // === Run mesh partitioner to calculate a new mesh partitioning. ===
partitioner->setLocalGlobalDofMap(&(dofFeData[feSpaces[0]].mapLocalGlobalDofs)); partitioner->setLocalGlobalDofMap(&(dofFeData[feSpaces[0]].mapDofToGlobal));
bool partitioningSucceed = partitioner->partition(elemWeights, ADAPTIVE_REPART); bool partitioningSucceed = partitioner->partition(elemWeights, ADAPTIVE_REPART);
if (!partitioningSucceed) { if (!partitioningSucceed) {
MSG("Mesh partitioner created empty partition!\n"); MSG("Mesh partitioner created empty partition!\n");
...@@ -1988,15 +1988,15 @@ namespace AMDiS { ...@@ -1988,15 +1988,15 @@ namespace AMDiS {
// === Create now the local to global index and local to DOF === // === Create now the local to global index and local to DOF ===
// === index mappings. === // === index mappings. ===
dofFeData[feSpace].mapLocalGlobalDofs.clear(); dofFeData[feSpace].mapDofToGlobal.clear();
dofFeData[feSpace].mapLocalDofIndex.clear(); dofFeData[feSpace].mapLocalToDof.clear();
for (DofIndexMap::iterator dofIt = rankDofsNewGlobalIndex.begin(); for (DofIndexMap::iterator dofIt = rankDofsNewGlobalIndex.begin();
dofIt != rankDofsNewGlobalIndex.end(); ++dofIt) dofIt != rankDofsNewGlobalIndex.end(); ++dofIt)
dofFeData[feSpace].mapLocalGlobalDofs[*(dofIt->first)] = dofIt->second; dofFeData[feSpace].mapDofToGlobal[*(dofIt->first)] = dofIt->second;
for (unsigned int i = 0; i < rankDofs.size(); i++) for (unsigned int i = 0; i < rankDofs.size(); i++)
dofFeData[feSpace].mapLocalDofIndex[i] = *(rankDofs[i]); dofFeData[feSpace].mapLocalToDof[i] = *(rankDofs[i]);
// === Update DOF admins due to new number of DOFs. === // === Update DOF admins due to new number of DOFs. ===
...@@ -2059,9 +2059,9 @@ namespace AMDiS { ...@@ -2059,9 +2059,9 @@ namespace AMDiS {
for (unsigned int j = 0; j < dofs0.size(); j++) { for (unsigned int j = 0; j < dofs0.size(); j++) {
DegreeOfFreedom globalDof0 = DegreeOfFreedom globalDof0 =
dofFeData[feSpace].mapLocalGlobalDofs[*(dofs0[j])]; dofFeData[feSpace].mapDofToGlobal[*(dofs0[j])];
DegreeOfFreedom globalDof1 = DegreeOfFreedom globalDof1 =
dofFeData[feSpace].mapLocalGlobalDofs[*(dofs1[j])]; dofFeData[feSpace].mapDofToGlobal[*(dofs1[j])];
if (!periodicMap.isPeriodicOnBound(feSpace, type, globalDof0)) if (!periodicMap.isPeriodicOnBound(feSpace, type, globalDof0))
periodicMap.add(feSpace, type, globalDof0, globalDof1); periodicMap.add(feSpace, type, globalDof0, globalDof1);
...@@ -2086,7 +2086,7 @@ namespace AMDiS { ...@@ -2086,7 +2086,7 @@ namespace AMDiS {
// Send the global indices to the rank on the other side. // Send the global indices to the rank on the other side.
stdMpi.getSendData(it->first).reserve(dofs.size()); stdMpi.getSendData(it->first).reserve(dofs.size());
for (unsigned int i = 0; i < dofs.size(); i++) for (unsigned int i = 0; i < dofs.size(); i++)
stdMpi.getSendData(it->first).push_back(dofFeData[feSpace].mapLocalGlobalDofs[*(dofs[i])]); stdMpi.getSendData(it->first).push_back(dofFeData[feSpace].mapDofToGlobal[*(dofs[i])]);
// Receive from this rank the same number of dofs. // Receive from this rank the same number of dofs.
stdMpi.recv(it->first, dofs.size()); stdMpi.recv(it->first, dofs.size());
...@@ -2112,7 +2112,7 @@ namespace AMDiS { ...@@ -2112,7 +2112,7 @@ namespace AMDiS {
// Added the received DOFs to the mapping. // Added the received DOFs to the mapping.
for (unsigned int i = 0; i < dofs.size(); i++) { for (unsigned int i = 0; i < dofs.size(); i++) {
int globalDofIndex = dofFeData[feSpace].mapLocalGlobalDofs[*(dofs[i])]; int globalDofIndex = dofFeData[feSpace].mapDofToGlobal[*(dofs[i])];
int mapGlobalDofIndex = stdMpi.getRecvData(it->first)[i]; int mapGlobalDofIndex = stdMpi.getRecvData(it->first)[i];
BoundaryType type = types[i]; BoundaryType type = types[i];
...@@ -2144,7 +2144,7 @@ namespace AMDiS { ...@@ -2144,7 +2144,7 @@ namespace AMDiS {
for (unsigned int i = 0; i < dofs.size(); i++) { for (unsigned int i = 0; i < dofs.size(); i++) {
DegreeOfFreedom globalDof = DegreeOfFreedom globalDof =
dofFeData[feSpace].mapLocalGlobalDofs[*dofs[i]]; dofFeData[feSpace].mapDofToGlobal[*dofs[i]];
std::set<BoundaryType>& assoc = std::set<BoundaryType>& assoc =
periodicMap.getAssociations(feSpace, globalDof); periodicMap.getAssociations(feSpace, globalDof);
...@@ -2164,13 +2164,12 @@ namespace AMDiS { ...@@ -2164,13 +2164,12 @@ namespace AMDiS {
stdMpi2.startCommunication(); 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(); for (map<int, PeriodicDofMap>::iterator it = stdMpi2.getRecvData().begin();
it != stdMpi2.getRecvData().end(); ++it) it != stdMpi2.getRecvData().end(); ++it)
for (PeriodicDofMap::iterator perIt = it->second.begin(); periodicMap.add(feSpace, it->second);
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);
} }
...@@ -2217,8 +2216,8 @@ namespace AMDiS { ...@@ -2217,8 +2216,8 @@ namespace AMDiS {
TEST_EXIT_DBG(dofFeData.count(feSpace))("Should not happen!\n"); TEST_EXIT_DBG(dofFeData.count(feSpace))("Should not happen!\n");
for (DofMapping::iterator it = dofFeData[feSpace].mapLocalGlobalDofs.begin(); for (DofMapping::iterator it = dofFeData[feSpace].mapDofToGlobal.begin();
it != dofFeData[feSpace].mapLocalGlobalDofs.end(); ++it) it != dofFeData[feSpace].mapDofToGlobal.end(); ++it)
if (it->second == dof) if (it->second == dof)
return it->first; return it->first;
...@@ -2257,8 +2256,8 @@ namespace AMDiS { ...@@ -2257,8 +2256,8 @@ namespace AMDiS {
SerUtil::serialize(out, dofFeData[feSpaces[i]].rStartDofs); SerUtil::serialize(out, dofFeData[feSpaces[i]].rStartDofs);
SerUtil::serialize(out, dofFeData[feSpaces[i]].isRankDof); SerUtil::serialize(out, dofFeData[feSpaces[i]].isRankDof);
SerUtil::serialize(out, dofFeData[feSpaces[i]].mapLocalGlobalDofs); SerUtil::serialize(out, dofFeData[feSpaces[i]].mapDofToGlobal);
SerUtil::serialize(out, dofFeData[feSpaces[i]].mapLocalDofIndex); SerUtil::serialize(out, dofFeData[feSpaces[i]].mapLocalToDof);
} }
periodicMap.serialize(out, feSpaces); periodicMap.serialize(out, feSpaces);
...@@ -2330,8 +2329,8 @@ namespace AMDiS { ...@@ -2330,8 +2329,8 @@ namespace AMDiS {
SerUtil::deserialize(in, dofFeData[feSpaces[i]].rStartDofs); SerUtil::deserialize(in, dofFeData[feSpaces[i]].rStartDofs);
SerUtil::deserialize(in, dofFeData[feSpaces[i]].isRankDof); SerUtil::deserialize(in, dofFeData[feSpaces[i]].isRankDof);
SerUtil::deserialize(in, dofFeData[feSpaces[i]].mapLocalGlobalDofs); SerUtil::deserialize(in, dofFeData[feSpaces[i]].mapDofToGlobal);
SerUtil::deserialize(in, dofFeData[feSpaces[i]].mapLocalDofIndex); SerUtil::deserialize(in, dofFeData[feSpaces[i]].mapLocalToDof);
} }
periodicMap.deserialize(in, feSpaces); periodicMap.deserialize(in, feSpaces);
......
...@@ -63,18 +63,16 @@ namespace AMDiS { ...@@ -63,18 +63,16 @@ namespace AMDiS {
/// Number of DOFs in the whole domain. /// Number of DOFs in the whole domain.
int nOverallDofs; int nOverallDofs;
/** \brief /// Maps all DOFs in ranks partition to a bool value. If it is true, the DOF
* 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
* is owned by the rank. Otherwise, its an interior boundary DOF that is /// owned by another rank.
* owned by another rank.
*/
DofIndexToBool isRankDof; DofIndexToBool isRankDof;
/// Maps local to global dof indices. /// Maps local to global dof indices.
DofMapping mapLocalGlobalDofs; DofMapping mapDofToGlobal;
/// Maps local dof indices to real dof indices. /// Maps local dof indices to real dof indices.
DofMapping mapLocalDofIndex; DofMapping mapLocalToDof;
}; };
...@@ -242,40 +240,44 @@ namespace AMDiS { ...@@ -242,40 +240,44 @@ namespace AMDiS {
return result; return result;
} }
inline DofMapping& getMapLocalGlobalDofs(const FiniteElemSpace *feSpace) inline DofMapping& getMapDofToGlobal(const FiniteElemSpace *feSpace)
{ {
FUNCNAME("MeshDistributor::getMapLocalGlobalDofs()"); FUNCNAME("MeshDistributor::getMapDofToGlobal()");
TEST_EXIT_DBG(dofFeData.count(feSpace))("Should not happen!\n"); TEST_EXIT_DBG(dofFeData.count(feSpace))("Should not happen!\n");
return dofFeData[feSpace].mapLocalGlobalDofs; return dofFeData[feSpace].mapDofToGlobal;
} }
/// Maps a local DOF to its global index. /// Maps a local DOF to its global index.
inline DegreeOfFreedom mapLocalToGlobal(const FiniteElemSpace *feSpace, inline DegreeOfFreedom mapDofToGlobal(const FiniteElemSpace *feSpace,
DegreeOfFreedom dof) DegreeOfFreedom dof)
{ {
FUNCNAME("MeshDistributor::mapLocalToGlobal()"); FUNCNAME("MeshDistributor::mapDofToGlobal()");
TEST_EXIT_DBG(dofFeData.count(feSpace)) TEST_EXIT_DBG(dofFeData.count(feSpace))
("No DOF data for FE space at addr %p!\n", feSpace); ("No DOF data for FE space at addr %p!\n", feSpace);
return dofFeData[feSpace].mapLocalGlobalDofs[dof]; return dofFeData[feSpace].mapDofToGlobal[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 mapGlobalToLocal(const FiniteElemSpace *feSpace,
DegreeOfFreedom dof); DegreeOfFreedom dof);
/// Maps a local DOF to its local index. /// Maps a local DOF to its local index.
inline DegreeOfFreedom mapLocalToDofIndex(const FiniteElemSpace *feSpace, inline DegreeOfFreedom mapLocalToDof(const FiniteElemSpace *feSpace,
DegreeOfFreedom dof) DegreeOfFreedom dof)
{ {
FUNCNAME("MeshDistributor::mapLocalToDofIndex()"); FUNCNAME("MeshDistributor::mapLocalToDof()");
TEST_EXIT_DBG(dofFeData.count(feSpace)) TEST_EXIT_DBG(dofFeData.count(feSpace))
("No DOF data for FE space at addr %p!\n", feSpace); ("No DOF data for FE space at addr %p!\n", feSpace);
return dofFeData[feSpace].mapLocalDofIndex[dof]; return dofFeData[feSpace].mapLocalToDof[dof];
} }
/// Returns the periodic mapping handler, \ref periodicMap. /// Returns the periodic mapping handler, \ref periodicMap.
......
...@@ -482,7 +482,7 @@ namespace AMDiS { ...@@ -482,7 +482,7 @@ namespace AMDiS {
DOFIterator<WorldVector<double> > it(&coords, USED_DOFS); DOFIterator<WorldVector<double> > it(&coords, USED_DOFS);
for (it.reset(); !it.end(); ++it) { for (it.reset(); !it.end(); ++it) {
coordsToIndex[(*it)] = coordsToIndex[(*it)] =
pdb.dofFeData[feSpace].mapLocalGlobalDofs[it.getDOFIndex()]; pdb.dofFeData[feSpace].mapDofToGlobal[it.getDOFIndex()];
// MSG(" CHECK FOR DOF %d AT COORDS %f %f %f\n", // MSG(" CHECK FOR DOF %d AT COORDS %f %f %f\n",
// coordsToIndex[(*it)], (*it)[0], (*it)[1], (*it)[2]); // coordsToIndex[(*it)], (*it)[0], (*it)[1], (*it)[2]);
...@@ -644,11 +644,11 @@ namespace AMDiS { ...@@ -644,11 +644,11 @@ namespace AMDiS {
cout << "====== DOF MAP LOCAL -> GLOBAL ====== " << endl; cout << "====== DOF MAP LOCAL -> GLOBAL ====== " << endl;
for (DofMapping::iterator it = pdb.dofFeData[feSpace].mapLocalGlobalDofs.begin(); for (DofMapping::iterator it = pdb.dofFeData[feSpace].mapDofToGlobal.begin();
it != pdb.dofFeData[feSpace].mapLocalGlobalDofs.end(); it++) { it != pdb.dofFeData[feSpace].mapDofToGlobal.end(); it++) {
DegreeOfFreedom localdof = -1; DegreeOfFreedom localdof = -1;
if (pdb.dofFeData[feSpace].mapLocalDofIndex.count(it->first) > 0) if (pdb.dofFeData[feSpace].mapLocalToDof.count(it->first) > 0)
localdof = pdb.dofFeData[feSpace].mapLocalDofIndex[it->first]; localdof = pdb.dofFeData[feSpace].mapLocalToDof[it->first];
cout << "DOF " << it->first << " " cout << "DOF " << it->first << " "
<< it->second << " " << it->second << " "
...@@ -699,8 +699,8 @@ namespace AMDiS { ...@@ -699,8 +699,8 @@ namespace AMDiS {
cout << endl; cout << endl;
DegreeOfFreedom localdof = -1; DegreeOfFreedom localdof = -1;
for (DofMapping::iterator dofIt = pdb.dofFeData[feSpace].mapLocalGlobalDofs.begin(); for (DofMapping::iterator dofIt = pdb.dofFeData[feSpace].mapDofToGlobal.begin();
dofIt != pdb.dofFeData[feSpace].mapLocalGlobalDofs.end(); ++dofIt) dofIt != pdb.dofFeData[feSpace].mapDofToGlobal.end(); ++dofIt)
if (dofIt->second == it->first) if (dofIt->second == it->first)
localdof = dofIt->first; localdof = dofIt->first;
...@@ -816,7 +816,7 @@ namespace AMDiS { ...@@ -816,7 +816,7 @@ namespace AMDiS {
DOFIterator<WorldVector<double> > it(&coords, USED_DOFS); DOFIterator<WorldVector<double> > it(&coords, USED_DOFS);
for (it.reset(); !it.end(); ++it) { for (it.reset(); !it.end(); ++it) {
file << it.getDOFIndex() << " " file << it.getDOFIndex() << " "
<< pdb.dofFeData[feSpace].mapLocalGlobalDofs[it.getDOFIndex()] << " " << pdb.dofFeData[feSpace].mapDofToGlobal[it.getDOFIndex()] << " "
<< pdb.getIsRankDof(feSpace, it.getDOFIndex()); << pdb.getIsRankDof(feSpace, it.getDOFIndex());
for (int i = 0; i < pdb.mesh->getDim(); i++) for (int i = 0; i < pdb.mesh->getDim(); i++)
file << " " << (*it)[i]; file << " " << (*it)[i];
......
...@@ -15,6 +15,18 @@ ...@@ -15,6 +15,18 @@
namespace AMDiS { 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, void PeriodicMap::serialize(ostream &out,
vector<const FiniteElemSpace*> feSpaces) vector<const FiniteElemSpace*> feSpaces)
{ {
......
...@@ -54,6 +54,7 @@ namespace AMDiS { ...@@ -54,6 +54,7 @@ namespace AMDiS {
public: public:
PeriodicMap() {} PeriodicMap() {}
/// Reset all data.
void clear() void clear()
{ {
periodicDofMap.clear(); periodicDofMap.clear();
...@@ -61,12 +62,26 @@ namespace AMDiS { ...@@ -61,12 +62,26 @@ namespace AMDiS {
} }
/// Get a periodic DOF mapping for a given FE space.
inline PeriodicDofMap& getPeriodicMap(const FiniteElemSpace *feSpace) inline PeriodicDofMap& getPeriodicMap(const FiniteElemSpace *feSpace)
{ {
return periodicDofMap[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, inline int map(const FiniteElemSpace *feSpace,
BoundaryType type, BoundaryType type,
int globalDofIndex) int globalDofIndex)
...@@ -82,6 +97,8 @@ namespace AMDiS { ...@@ -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, inline void add(const FiniteElemSpace *feSpace,
BoundaryType type, BoundaryType type,
DegreeOfFreedom dof0, DegreeOfFreedom dof1) DegreeOfFreedom dof0, DegreeOfFreedom dof1)
...@@ -96,6 +113,10 @@ namespace AMDiS { ...@@ -96,6 +113,10 @@ namespace AMDiS {
periodicDofAssociations[feSpace][dof0].insert(type); 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 /// 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 /// associations, i.e., the boundary types the DOF is associated to, for
......
...@@ -128,7 +128,7 @@ namespace AMDiS { ...@@ -128,7 +128,7 @@ namespace AMDiS {
VecGetArray(tmp, &vecPointer); VecGetArray(tmp, &vecPointer);
for (int j = 0; j < nRankDofs; j++) for (int j = 0; j < nRankDofs; j++)
dofvec[meshDistributor->mapLocalToDofIndex(feSpace, j)] = vecPointer[j]; dofvec[meshDistributor->mapLocalToDof(feSpace, j)] = vecPointer[j];
VecRestoreArray(tmp, &vecPointer); VecRestoreArray(tmp, &vecPointer);
} }
...@@ -192,7 +192,7 @@ namespace AMDiS { ...@@ -192,7 +192,7 @@ namespace AMDiS {
cend = end<row>(mat->getBaseMatrix()); cursor != cend; ++cursor) { cend = end<row>(mat->getBaseMatrix()); cursor != cend; ++cursor) {
// Global index of the current row DOF. // Global index of the current row DOF.
int rowIndex = meshDistributor->mapLocalToGlobal(feSpace, *cursor); int rowIndex = meshDistributor->mapDofToGlobal(feSpace, *cursor);
cols.clear(); cols.clear();
values.clear(); values.clear();
...@@ -200,7 +200,7 @@ namespace AMDiS { ...@@ -200,7 +200,7 @@ namespace AMDiS {
for (icursor_type icursor = begin<nz>(cursor), icend = end<nz>(cursor); for (icursor_type icursor = begin<nz>(cursor), icend = end<nz>(cursor);
icursor != icend; ++icursor) { icursor != icend; ++icursor) {
// Global index of the current column index. // Global index of the current column index.
int colIndex = meshDistributor->mapLocalToGlobal(feSpace, col(*icursor)); int colIndex = meshDistributor->mapDofToGlobal(feSpace, col(*icursor));
// Ignore all zero entries, expect it is a diagonal entry. // Ignore all zero entries, expect it is a diagonal entry.
if (value(*icursor) == 0.0 && rowIndex != colIndex) if (value(*icursor) == 0.0 && rowIndex != colIndex)
...@@ -227,7 +227,7 @@ namespace AMDiS { ...@@ -227,7 +227,7 @@ namespace AMDiS {
// Traverse all used DOFs in the dof vector. // Traverse all used DOFs in the dof vector.
DOFVector<double>::Iterator dofIt(vec, USED_DOFS); DOFVector<double>::Iterator dofIt(vec, USED_DOFS);
for (dofIt.reset(); !dofIt.end(); ++dofIt) { for (dofIt.reset(); !dofIt.end(); ++dofIt) {
int index = meshDistributor->mapLocalToGlobal(feSpace, dofIt.getDOFIndex()); int index = meshDistributor->mapDofToGlobal(feSpace, dofIt.getDOFIndex());
double value = *dofIt; double value = *dofIt;
VecSetValues(petscVec, 1, &index, &value, ADD_VALUES); VecSetValues(petscVec, 1, &index, &value, ADD_VALUES);
......
...@@ -161,7 +161,7 @@ namespace AMDiS { ...@@ -161,7 +161,7 @@ namespace AMDiS {
int nRankDofs = meshDistributor->getNumberRankDofs(feSpace); int nRankDofs = meshDistributor->getNumberRankDofs(feSpace);
for (int j = 0; j < nRankDofs; j++) for (int j = 0; j < nRankDofs; j++)
dv[meshDistributor->mapLocalToDofIndex(feSpace, j)] = vecPointer[c++]; dv[meshDistributor->mapLocalToDof(feSpace, j)] = vecPointer[c++];
} }
VecRestoreArray(petscSolVec, &vecPointer); VecRestoreArray(petscSolVec, &vecPointer);
...@@ -231,7 +231,7 @@ namespace AMDiS { ...@@ -231,7 +231,7 @@ namespace AMDiS {
// Global index of the current row DOF. // Global index of the current row DOF.
int globalRowDof = int globalRowDof =
meshDistributor->mapLocalToGlobal(rowFe, *cursor); meshDistributor->mapDofToGlobal(rowFe, *cursor);
// Test if the current row DOF is a periodic DOF. // Test if the current row DOF is a periodic DOF.
bool periodicRow = perMap.isPeriodic(rowFe, globalRowDof); bool periodicRow = perMap.isPeriodic(rowFe, globalRowDof);
...@@ -249,7 +249,7 @@ namespace AMDiS { ...@@ -249,7 +249,7 @@ namespace AMDiS {
// Global index of the current column index. // Global index of the current column index.
int globalColDof = int globalColDof =
meshDistributor->mapLocalToGlobal(colFe, col(*icursor)); meshDistributor->mapDofToGlobal(colFe, col(*icursor));
// Test if the current col dof is a periodic dof. // Test if the current col dof is a periodic dof.
bool periodicCol = perMap.isPeriodic(colFe, globalColDof); bool periodicCol = perMap.isPeriodic(colFe, globalColDof);
// Get PETSc's mat col index. // Get PETSc's mat col index.
...@@ -326,7 +326,7 @@ namespace AMDiS { ...@@ -326,7 +326,7 @@ namespace AMDiS {
// Global index of the current column index. // Global index of the current column index.
int globalColDof = int globalColDof =
meshDistributor->mapLocalToGlobal(colFe, col(*icursor)); meshDistributor->mapDofToGlobal(colFe, col(*icursor));
// Ignore all zero entries, expect it is a diagonal entry. // Ignore all zero entries, expect it is a diagonal entry.
if (value(*icursor) == 0.0 && globalRowDof != globalColDof) if (value(*icursor) == 0.0 && globalRowDof != globalColDof)
...@@ -436,7 +436,7 @@ namespace AMDiS { ...@@ -436,7 +436,7 @@ namespace AMDiS {
// Calculate global row index of the DOF. // Calculate global row index of the DOF.
DegreeOfFreedom globalRowDof = DegreeOfFreedom globalRowDof =
meshDistributor->mapLocalToGlobal(feSpace, dofIt.getDOFIndex()); meshDistributor->mapDofToGlobal(feSpace, dofIt.getDOFIndex());
// Get PETSc's mat index of the row DOF. // Get PETSc's mat index of the row DOF.
int index = dofToMatIndex.get(dispAdd, globalRowDof); int index = dofToMatIndex.get(dispAdd, globalRowDof);
...@@ -539,7 +539,7 @@ namespace AMDiS { ...@@ -539,7 +539,7 @@ namespace AMDiS {
cend = end<row>(bmat); cursor != cend; ++cursor) { cend = end<row>(bmat); cursor != cend; ++cursor) {