Am Montag, 13. Mai 2022, finden Wartungsarbeiten am Gitlab-Server (Update auf neue Version statt). Der Dienst wird daher am Montag für einige Zeit nicht verfügbar sein.
On Monday, May 13th 2022, the Gitlab server will be updated. The service will therefore not be accessible for some time on Monday.

Commit 041231a5 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

refine operationen added to DOFVector

parent 99fdbce7
...@@ -55,13 +55,24 @@ namespace AMDiS { ...@@ -55,13 +55,24 @@ namespace AMDiS {
template<> template<>
void DOFVector<double>::refineInterpol(RCNeighbourList& list, int n) void DOFVector<double>::refineInterpol(RCNeighbourList& list, int n)
{ {
(const_cast<BasisFunction*>(feSpace->getBasisFcts()))->refineInter(this, &list, n); switch (refineOperation) {
case NO_OPERATION:
return;
break;
case REFINE_INTERPOL:
default:
(const_cast<BasisFunction*>(feSpace->getBasisFcts()))->refineInter(this, &list, n);
break;
}
} }
template<> template<>
void DOFVector<WorldVector<double> >::refineInterpol(RCNeighbourList& list, int n) void DOFVector<WorldVector<double> >::refineInterpol(RCNeighbourList& list, int n)
{ {
if (refineOperation == NO_OPERATION)
return;
if (n < 1) if (n < 1)
return; return;
......
...@@ -276,8 +276,9 @@ namespace AMDiS { ...@@ -276,8 +276,9 @@ namespace AMDiS {
typedef enum{ typedef enum{
NO_OPERATION = 0, NO_OPERATION = 0,
COARSE_RESTRICT = 1, COARSE_RESTRICT = 1,
COARSE_INTERPOL = 2 COARSE_INTERPOL = 2,
} CoarsenOperation; REFINE_INTERPOL = 4
} RefineCoarsenOperation;
/** \ingroup DOFAdministration /** \ingroup DOFAdministration
...@@ -386,17 +387,29 @@ namespace AMDiS { ...@@ -386,17 +387,29 @@ namespace AMDiS {
std::vector<DegreeOfFreedom> &newDof); std::vector<DegreeOfFreedom> &newDof);
/// Sets \ref coarsenOperation to op /// Sets \ref coarsenOperation to op
inline void setCoarsenOperation(CoarsenOperation op) inline void setCoarsenOperation(RefineCoarsenOperation op)
{ {
coarsenOperation = op; coarsenOperation = op;
} }
/// Returns \ref coarsenOperation /// Returns \ref coarsenOperation
inline CoarsenOperation getCoarsenOperation() inline RefineCoarsenOperation getCoarsenOperation()
{ {
return coarsenOperation; return coarsenOperation;
} }
/// Sets \ref refineOperation to op
inline void setRefineOperation(RefineCoarsenOperation op)
{
refineOperation = op;
}
/// Returns \ref refineOperation
inline RefineCoarsenOperation getRefineOperation()
{
return refineOperation;
}
/// Restriction after coarsening. Implemented for DOFVector<double> /// Restriction after coarsening. Implemented for DOFVector<double>
inline void coarseRestrict(RCNeighbourList&, int) {} inline void coarseRestrict(RCNeighbourList&, int) {}
...@@ -633,7 +646,8 @@ namespace AMDiS { ...@@ -633,7 +646,8 @@ namespace AMDiS {
std::vector<T> vec; std::vector<T> vec;
/// Specifies what operation should be performed after coarsening /// Specifies what operation should be performed after coarsening
CoarsenOperation coarsenOperation; RefineCoarsenOperation coarsenOperation;
RefineCoarsenOperation refineOperation;
}; };
......
...@@ -112,7 +112,8 @@ namespace AMDiS { ...@@ -112,7 +112,8 @@ 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)
: DOFVectorBase<T>(f, n), : DOFVectorBase<T>(f, n),
coarsenOperation(COARSE_INTERPOL) coarsenOperation(COARSE_INTERPOL),
refineOperation(REFINE_INTERPOL)
{ {
vec.resize(0); vec.resize(0);
init(f, n); init(f, n);
...@@ -1029,6 +1030,7 @@ namespace AMDiS { ...@@ -1029,6 +1030,7 @@ namespace AMDiS {
vec = rhs.vec; vec = rhs.vec;
this->elementVector.change_dim(this->nBasFcts); this->elementVector.change_dim(this->nBasFcts);
coarsenOperation = rhs.coarsenOperation; coarsenOperation = rhs.coarsenOperation;
refineOperation = rhs.refineOperation;
this->operators = rhs.operators; this->operators = rhs.operators;
this->operatorFactor = rhs.operatorFactor; this->operatorFactor = rhs.operatorFactor;
......
...@@ -1338,7 +1338,7 @@ namespace AMDiS { ...@@ -1338,7 +1338,7 @@ namespace AMDiS {
} }
// === Check if number of pre refinements is set ini init file. === // === Check if number of pre refinements is set in init file. ===
int tmp = -1; int tmp = -1;
Parameters::get("parallel->pre refine", tmp); Parameters::get("parallel->pre refine", tmp);
...@@ -1426,10 +1426,7 @@ namespace AMDiS { ...@@ -1426,10 +1426,7 @@ namespace AMDiS {
else else
globalRefinements -= nParallelPreRefinements; globalRefinements -= nParallelPreRefinements;
stringstream oss; Parameters::set(name + "->global refinements", globalRefinements);
oss << globalRefinements;
string tmpStr = oss.str();
Parameters::add(name + "->global refinements", tmpStr);
// === Print a note to the screen that another mesh file will be used. === // === Print a note to the screen that another mesh file will be used. ===
......
...@@ -166,12 +166,18 @@ namespace AMDiS { ...@@ -166,12 +166,18 @@ namespace AMDiS {
vectors[i]->set(value); vectors[i]->set(value);
} }
inline void setCoarsenOperation(CoarsenOperation op) inline void setCoarsenOperation(RefineCoarsenOperation op)
{ {
for (int i = 0; i < static_cast<int>(vectors.size()); i++) for (int i = 0; i < static_cast<int>(vectors.size()); i++)
vectors[i]->setCoarsenOperation(op); vectors[i]->setCoarsenOperation(op);
} }
inline void setRefineOperation(RefineCoarsenOperation op)
{
for (int i = 0; i < static_cast<int>(vectors.size()); i++)
vectors[i]->setRefineOperation(op);
}
/// Sets all entries in all vectors to value. /// Sets all entries in all vectors to value.
inline SystemVector& operator=(double value) inline SystemVector& operator=(double value)
{ {
......
...@@ -143,6 +143,9 @@ namespace AMDiS { namespace Parallel { ...@@ -143,6 +143,9 @@ namespace AMDiS { namespace Parallel {
if (partStr == "simple") if (partStr == "simple")
partitioner = new SimplePartitioner("parallel->partitioner", &mpiComm); partitioner = new SimplePartitioner("parallel->partitioner", &mpiComm);
if (!partitioner) {
ERROR_EXIT("Unknown partitioner or no partitioner specified!\n");
}
// === Create initial partitioner object. === // === Create initial partitioner object. ===
...@@ -363,8 +366,38 @@ namespace AMDiS { namespace Parallel { ...@@ -363,8 +366,38 @@ namespace AMDiS { namespace Parallel {
Parameters::get(mesh->getName() + "->global refinements", globalRefinement); Parameters::get(mesh->getName() + "->global refinements", globalRefinement);
if (globalRefinement > 0) { if (globalRefinement > 0) {
bool doRefineInter = true;
Parameters::get(mesh->getName() + "->refinement interpol", doRefineInter);
std::map<DOFVector<double>*, RefineCoarsenOperation> rememberOp;
if (!doRefineInter) {
// no refinement during initial global refinement
for (int iadmin = 0; iadmin < mesh->getNumberOfDOFAdmin(); iadmin++) {
std::list<DOFIndexedBase*>::iterator it;
DOFAdmin* admin = const_cast<DOFAdmin*>(&mesh->getDofAdmin(iadmin));
std::list<DOFIndexedBase*>::iterator end = admin->endDOFIndexed();
for (it = admin->beginDOFIndexed(); it != end; it++) {
DOFVector<double>* vec = dynamic_cast<DOFVector<double>*>(*it);
if (vec) {
rememberOp[vec] = vec->getRefineOperation();
vec->setRefineOperation(NO_OPERATION);
}
}
}
}
refineManager->globalRefine(mesh, globalRefinement); refineManager->globalRefine(mesh, globalRefinement);
if (!doRefineInter) {
// no refinement during initial global refinement
for (int iadmin = 0; iadmin < mesh->getNumberOfDOFAdmin(); iadmin++) {
std::list<DOFIndexedBase*>::iterator it;
DOFAdmin* admin = const_cast<DOFAdmin*>(&mesh->getDofAdmin(iadmin));
std::list<DOFIndexedBase*>::iterator end = admin->endDOFIndexed();
for (it = admin->beginDOFIndexed(); it != end; it++) {
DOFVector<double>* vec = dynamic_cast<DOFVector<double>*>(*it);
if (vec)
vec->setRefineOperation(rememberOp[vec]);
}
}
}
updateLocalGlobalNumbering(); updateLocalGlobalNumbering();
#if (DEBUG != 0) #if (DEBUG != 0)
......
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