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 {
template<>
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<>
void DOFVector<WorldVector<double> >::refineInterpol(RCNeighbourList& list, int n)
{
if (refineOperation == NO_OPERATION)
return;
if (n < 1)
return;
......
......@@ -276,8 +276,9 @@ namespace AMDiS {
typedef enum{
NO_OPERATION = 0,
COARSE_RESTRICT = 1,
COARSE_INTERPOL = 2
} CoarsenOperation;
COARSE_INTERPOL = 2,
REFINE_INTERPOL = 4
} RefineCoarsenOperation;
/** \ingroup DOFAdministration
......@@ -386,17 +387,29 @@ namespace AMDiS {
std::vector<DegreeOfFreedom> &newDof);
/// Sets \ref coarsenOperation to op
inline void setCoarsenOperation(CoarsenOperation op)
inline void setCoarsenOperation(RefineCoarsenOperation op)
{
coarsenOperation = op;
}
/// Returns \ref coarsenOperation
inline CoarsenOperation getCoarsenOperation()
inline RefineCoarsenOperation getCoarsenOperation()
{
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>
inline void coarseRestrict(RCNeighbourList&, int) {}
......@@ -633,7 +646,8 @@ namespace AMDiS {
std::vector<T> vec;
/// Specifies what operation should be performed after coarsening
CoarsenOperation coarsenOperation;
RefineCoarsenOperation coarsenOperation;
RefineCoarsenOperation refineOperation;
};
......
......@@ -112,7 +112,8 @@ namespace AMDiS {
template<typename T>
DOFVector<T>::DOFVector(const FiniteElemSpace* f, std::string n)
: DOFVectorBase<T>(f, n),
coarsenOperation(COARSE_INTERPOL)
coarsenOperation(COARSE_INTERPOL),
refineOperation(REFINE_INTERPOL)
{
vec.resize(0);
init(f, n);
......@@ -1029,6 +1030,7 @@ namespace AMDiS {
vec = rhs.vec;
this->elementVector.change_dim(this->nBasFcts);
coarsenOperation = rhs.coarsenOperation;
refineOperation = rhs.refineOperation;
this->operators = rhs.operators;
this->operatorFactor = rhs.operatorFactor;
......
......@@ -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;
Parameters::get("parallel->pre refine", tmp);
......@@ -1426,10 +1426,7 @@ namespace AMDiS {
else
globalRefinements -= nParallelPreRefinements;
stringstream oss;
oss << globalRefinements;
string tmpStr = oss.str();
Parameters::add(name + "->global refinements", tmpStr);
Parameters::set(name + "->global refinements", globalRefinements);
// === Print a note to the screen that another mesh file will be used. ===
......
......@@ -166,12 +166,18 @@ namespace AMDiS {
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++)
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.
inline SystemVector& operator=(double value)
{
......
......@@ -143,6 +143,9 @@ namespace AMDiS { namespace Parallel {
if (partStr == "simple")
partitioner = new SimplePartitioner("parallel->partitioner", &mpiComm);
if (!partitioner) {
ERROR_EXIT("Unknown partitioner or no partitioner specified!\n");
}
// === Create initial partitioner object. ===
......@@ -363,8 +366,38 @@ namespace AMDiS { namespace Parallel {
Parameters::get(mesh->getName() + "->global refinements", globalRefinement);
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);
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();
#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