Commit 4098e9e1 authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

That's it for today.

parent 7cb626f3
...@@ -870,6 +870,17 @@ namespace AMDiS { ...@@ -870,6 +870,17 @@ namespace AMDiS {
INFO(info, 8)("buildAfterCoarsen needed %.5f seconds\n", INFO(info, 8)("buildAfterCoarsen needed %.5f seconds\n",
TIME_USED(first, clock())); TIME_USED(first, clock()));
#endif #endif
#if 0
VtkWriter::writeFile(rhs, "rhs0.vtu");
for (int i = 0; i < nComponents; i++) {
double s = rhs->getDOFVector(i)->sum();
s /= -static_cast<double>(rhs->getDOFVector(i)->getUsedSize());
MSG("MOVE RHS: %f\n", s);
add(*(rhs->getDOFVector(i)), s, *(rhs->getDOFVector(i)));
}
VtkWriter::writeFile(rhs, "rhs1.vtu");
#endif
} }
......
...@@ -41,6 +41,8 @@ namespace AMDiS { ...@@ -41,6 +41,8 @@ namespace AMDiS {
if (overlap) if (overlap)
computeNonLocalIndices(); computeNonLocalIndices();
computeMatIndex(0);
} }
...@@ -89,6 +91,52 @@ namespace AMDiS { ...@@ -89,6 +91,52 @@ namespace AMDiS {
} }
void GlobalDofMap::computeMatIndex(int offset)
{
FUNCNAME("GlobalDofMap::computeMatIndex()");
map<DegreeOfFreedom, int> dofToMatIndex;
for (DofMapping::iterator it = dofMap.begin(); it != dofMap.end(); ++it) {
if (!nonRankDofs.count(it->first)) {
int globalMatIndex = it->second - rStartDofs + offset;
dofToMatIndex[it->first] = globalMatIndex;
}
}
if (!overlap)
return;
TEST_EXIT_DBG(sendDofs != NULL && recvDofs != NULL)
("No communicator given!\n");
StdMpi<vector<DegreeOfFreedom> > stdMpi(*mpiComm);
for (DofComm::Iterator it(*sendDofs, feSpace); !it.end(); it.nextRank()) {
vector<DegreeOfFreedom> sendGlobalDofs;
for (; !it.endDofIter(); it.nextDof())
if (dofMap.count(it.getDofIndex()))
sendGlobalDofs.push_back(dofToMatIndex[it.getDofIndex()]);
stdMpi.send(it.getRank(), sendGlobalDofs);
}
for (DofComm::Iterator it(*recvDofs, feSpace); !it.end(); it.nextRank())
stdMpi.recv(it.getRank());
stdMpi.startCommunication();
{
int i = 0;
for (DofComm::Iterator it(*recvDofs, feSpace); !it.end(); it.nextRank())
for (; !it.endDofIter(); it.nextDof())
if (dofMap.count(it.getDofIndex()))
dofToMatIndex[it.getDofIndex()] =
stdMpi.getRecvData(it.getRank())[i++];
}
}
void GlobalDofMap::print() void GlobalDofMap::print()
{ {
FUNCNAME("GlobalDofMap::print()"); FUNCNAME("GlobalDofMap::print()");
......
...@@ -46,6 +46,8 @@ namespace AMDiS { ...@@ -46,6 +46,8 @@ namespace AMDiS {
GlobalDofMap(MPI::Intracomm* m) GlobalDofMap(MPI::Intracomm* m)
: mpiComm(m), : mpiComm(m),
feSpace(NULL), feSpace(NULL),
sendDofs(NULL),
recvDofs(NULL),
nRankDofs(0), nRankDofs(0),
nOverallDofs(0), nOverallDofs(0),
rStartDofs(0), rStartDofs(0),
...@@ -102,6 +104,8 @@ namespace AMDiS { ...@@ -102,6 +104,8 @@ namespace AMDiS {
void computeNonLocalIndices(); void computeNonLocalIndices();
void computeMatIndex(int offset);
void print(); void print();
void setFeSpace(const FiniteElemSpace *fe) void setFeSpace(const FiniteElemSpace *fe)
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "parallel/DofComm.h" #include "parallel/DofComm.h"
#include "io/ElementFileWriter.h" #include "io/ElementFileWriter.h"
#include "io/MacroInfo.h" #include "io/MacroInfo.h"
#include "io/MacroWriter.h"
#include "io/VtkWriter.h" #include "io/VtkWriter.h"
#include "Mesh.h" #include "Mesh.h"
#include "Traverse.h" #include "Traverse.h"
......
...@@ -260,8 +260,7 @@ namespace AMDiS { ...@@ -260,8 +260,7 @@ namespace AMDiS {
primalDofMap[feSpace].update(); primalDofMap[feSpace].update();
MSG("nRankPrimals = %d nOverallPrimals = %d\n", MSG("nRankPrimals = %d nOverallPrimals = %d\n",
primalDofMap[feSpace].nRankDofs, primalDofMap[feSpace].nRankDofs, primalDofMap[feSpace].nOverallDofs);
primalDofMap[feSpace].nOverallDofs);
TEST_EXIT_DBG(primals.size() == primalDofMap[feSpace].size()) TEST_EXIT_DBG(primals.size() == primalDofMap[feSpace].size())
("Number of primals %d, but number of global primals on this rank is %d!\n", ("Number of primals %d, but number of global primals on this rank is %d!\n",
...@@ -433,8 +432,7 @@ namespace AMDiS { ...@@ -433,8 +432,7 @@ namespace AMDiS {
localDofMap[feSpace].update(false); localDofMap[feSpace].update(false);
TEST_EXIT_DBG(nLocalInterior + TEST_EXIT_DBG(nLocalInterior + primalDofMap[feSpace].size() +
primalDofMap[feSpace].size() +
dualDofMap[feSpace].size() == dualDofMap[feSpace].size() ==
static_cast<unsigned int>(admin->getUsedDofs())) static_cast<unsigned int>(admin->getUsedDofs()))
("Should not happen!\n"); ("Should not happen!\n");
......
...@@ -211,7 +211,6 @@ namespace AMDiS { ...@@ -211,7 +211,6 @@ namespace AMDiS {
// Print iteration counter and residual norm of the solution. // Print iteration counter and residual norm of the solution.
printSolutionInfo(adaptInfo); printSolutionInfo(adaptInfo);
// === Destroy PETSc's variables. === // === Destroy PETSc's variables. ===
VecDestroy(&petscRhsVec); VecDestroy(&petscRhsVec);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment