Commit 9ab2bbda authored by Naumann, Andreas's avatar Naumann, Andreas
Browse files

MacroReader: Warnings if the periodic indexing is

  overwritten
Others: Add each DOFVector by construction to the list of interchange vectors
and remove them by destruction
If you dont want to exchange the vector, set the boolean synch to false
parent bdd4eac8
...@@ -350,10 +350,10 @@ namespace AMDiS { ...@@ -350,10 +350,10 @@ namespace AMDiS {
{} {}
/// Constructs a DOFVector with name n belonging to FiniteElemSpace f /// Constructs a DOFVector with name n belonging to FiniteElemSpace f
DOFVector(const FiniteElemSpace* f, std::string n); DOFVector(const FiniteElemSpace* f, std::string n, bool addToSynch = true);
/// Initialization. /// Initialization.
void init(const FiniteElemSpace* f, std::string n); void init(const FiniteElemSpace* f, std::string n, bool addToSynch = true);
/// Copy Constructor /// Copy Constructor
DOFVector(const DOFVector& rhs) : DOFVectorBase<T>() DOFVector(const DOFVector& rhs) : DOFVectorBase<T>()
......
...@@ -111,29 +111,37 @@ namespace AMDiS { ...@@ -111,29 +111,37 @@ namespace AMDiS {
template<typename T> template<typename T>
DOFVector<T>::DOFVector(const FiniteElemSpace* f, std::string n) DOFVector<T>::DOFVector(const FiniteElemSpace* f, std::string n, bool addToSynch)
: DOFVectorBase<T>(f, n), : DOFVectorBase<T>(f, n),
coarsenOperation(COARSE_INTERPOL), coarsenOperation(COARSE_INTERPOL),
refineOperation(REFINE_INTERPOL) refineOperation(REFINE_INTERPOL)
{ {
vec.resize(0); vec.resize(0);
init(f, n); init(f, n, addToSynch);
} }
template<typename T> template<typename T>
void DOFVector<T>::init(const FiniteElemSpace* f, std::string n) void DOFVector<T>::init(const FiniteElemSpace* f, std::string n, bool addToSynch)
{ {
this->name = n; this->name = n;
this->feSpace = f; this->feSpace = f;
if (this->feSpace && this->feSpace->getAdmin()) if (this->feSpace && this->feSpace->getAdmin())
(this->feSpace->getAdmin())->addDOFIndexed(this); (this->feSpace->getAdmin())->addDOFIndexed(this);
this->boundaryManager = new BoundaryManager(f); this->boundaryManager = new BoundaryManager(f);
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
if ( Parallel::MeshDistributor::globalMeshDistributor != NULL)
Parallel::MeshDistributor::globalMeshDistributor->addInterchangeVector(this);
#endif
} }
template<typename T> template<typename T>
DOFVector<T>::~DOFVector() DOFVector<T>::~DOFVector()
{ {
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
if ( Parallel::MeshDistributor::globalMeshDistributor != NULL)
Parallel::MeshDistributor::globalMeshDistributor->removeInterchangeVector(this);
#endif
if (this->feSpace && this->feSpace->getAdmin()) if (this->feSpace && this->feSpace->getAdmin())
(this->feSpace->getAdmin())->removeDOFIndexed(this); (this->feSpace->getAdmin())->removeDOFIndexed(this);
......
...@@ -523,11 +523,13 @@ namespace AMDiS { ...@@ -523,11 +523,13 @@ namespace AMDiS {
componentSpaces[i], "A_ii"); componentSpaces[i], "A_ii");
(*systemMatrix)[i][i]->setCoupleMatrix(false); (*systemMatrix)[i][i]->setCoupleMatrix(false);
//set parallel synchronization later in ParalleProblemStat
rhs->setDOFVector(i, new DOFVector<double>(componentSpaces[i], rhs->setDOFVector(i, new DOFVector<double>(componentSpaces[i],
"rhs[" + lexical_cast<string>(i) + "]")); "rhs[" + lexical_cast<string>(i) + "]", false));
//set parallel synchronization later in ParalleProblemStat
solution->setDOFVector(i, new DOFVector<double>(componentSpaces[i], solution->setDOFVector(i, new DOFVector<double>(componentSpaces[i],
componentNames[i])); componentNames[i], false));
solution->getDOFVector(i)->setCoarsenOperation(COARSE_INTERPOL); solution->getDOFVector(i)->setCoarsenOperation(COARSE_INTERPOL);
solution->getDOFVector(i)->set(0.0); solution->getDOFVector(i)->set(0.0);
} }
......
...@@ -228,6 +228,17 @@ namespace AMDiS { namespace io { ...@@ -228,6 +228,17 @@ namespace AMDiS { namespace io {
} }
for (int j = 0; j < dim; j++) { for (int j = 0; j < dim; j++) {
#ifdef DEBUG
{
unsigned initData(melVertex[el1][verticesEl1[j]]);
unsigned oldData((*associated)[melVertex[el1][verticesEl1[j]]]);
unsigned newData(melVertex[el2][vertexMapEl1[verticesEl1[j]]]);
if( initData != oldData && newData != oldData ) {
MSG("warning: element %d overwrites assoc index %d: %d -> %d\n",
el1, initData, oldData, newData);
}
}
#endif
(*associated)[melVertex[el1][verticesEl1[j]]] = (*associated)[melVertex[el1][verticesEl1[j]]] =
melVertex[el2][vertexMapEl1[verticesEl1[j]]]; melVertex[el2][vertexMapEl1[verticesEl1[j]]];
(*associated)[melVertex[el2][verticesEl2[j]]] = (*associated)[melVertex[el2][verticesEl2[j]]] =
......
...@@ -193,6 +193,11 @@ namespace AMDiS { namespace Parallel { ...@@ -193,6 +193,11 @@ namespace AMDiS { namespace Parallel {
interchangeVectors.push_back(vec->getDOFVector(i)); interchangeVectors.push_back(vec->getDOFVector(i));
} }
void MeshDistributor::removeInterchangeVector(SystemVector* vec)
{
for (int i = 0; i < vec->getSize(); i++)
removeInterchangeVector(vec->getDOFVector(i));
}
void MeshDistributor::initParallelization() void MeshDistributor::initParallelization()
{ {
......
...@@ -89,13 +89,30 @@ namespace AMDiS { namespace Parallel { ...@@ -89,13 +89,30 @@ namespace AMDiS { namespace Parallel {
/// Adds a DOFVector to the set of \ref interchangeVecs. Thus, this vector /// Adds a DOFVector to the set of \ref interchangeVecs. Thus, this vector
/// will be automatically interchanged between ranks when mesh is /// will be automatically interchanged between ranks when mesh is
/// repartitioned. /// repartitioned.
template< typename T >
void addInterchangeVector(DOFVector<T> *vec) {}
void addInterchangeVector(DOFVector<double> *vec) void addInterchangeVector(DOFVector<double> *vec)
{ {
interchangeVectors.push_back(vec); interchangeVectors.push_back(vec);
} }
/// Removes the pointer to DOFVector @param vec from the
/// set of interchange vectors.
template< typename T >
void removeInterchangeVector(DOFVector<T> *vec) {}
void removeInterchangeVector(DOFVector< double >* vec)
{
std::vector< DOFVector< double >* >::iterator it;
it = std::find(interchangeVectors.begin(), interchangeVectors.end(), vec);
if ( it != interchangeVectors.end())
interchangeVectors.erase(it);
}
/// Adds all DOFVectors of a SystemVector to \ref interchangeVecs. /// Adds all DOFVectors of a SystemVector to \ref interchangeVecs.
void addInterchangeVector(SystemVector *vec); void addInterchangeVector(SystemVector *vec);
/// The same as for DOFVectors
void removeInterchangeVector(SystemVector* vec);
/** \brief /** \brief
* This function checks if the mesh has changed on at least on rank. In * This function checks if the mesh has changed on at least on rank. In
......
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