Commit 5eaded80 authored by Thomas Witkowski's avatar Thomas Witkowski

* New function: void ProblemScal::setMeshFromProblemVec(ProblemVec* pv, int i)

* New function: double AdaptInfo::getEstTSum(int index)
* New flag for problem initialization: INIT_GLOBAL_REFINES (is also set to INIT_ALL)
parent 78f007ce
......@@ -431,6 +431,13 @@ namespace AMDiS {
return scalContents[index]->est_sum;
};
/** \brief
* Returns \ref est_t_sum.
*/
inline double getEstTSum(int index) {
return scalContents[index]->est_t_sum;
};
/** \brief
* Returns \ref est_max.
*/
......
......@@ -162,6 +162,15 @@ namespace AMDiS {
}
}
void ProblemScal::setMeshFromProblemVec(ProblemVec* pv, int i)
{
mesh_ = pv->getMesh(i);
coarseningManager_ = pv->getCoarseningManager(i);
refinementManager_ = pv->getRefinementManager(i);
}
Flag ProblemScal::markElements(AdaptInfo *adaptInfo)
{
if(marker_)
......@@ -171,11 +180,13 @@ namespace AMDiS {
return 0;
}
Flag ProblemScal::refineMesh(AdaptInfo *adaptInfo)
{
return refinementManager_->refineMesh(mesh_);
}
Flag ProblemScal::coarsenMesh(AdaptInfo *adaptInfo)
{
if(adaptInfo->isCoarseningAllowed(0))
......@@ -223,16 +234,16 @@ namespace AMDiS {
FUNCNAME("Problem::initialize()");
// === create mesh ===
if(mesh_) {
if (mesh_) {
WARNING("mesh already created\n");
} else {
if(initFlag.isSet(CREATE_MESH) ||
if (initFlag.isSet(CREATE_MESH) ||
((!adoptFlag.isSet(INIT_MESH))&&
(initFlag.isSet(INIT_SYSTEM)||initFlag.isSet(INIT_FE_SPACE))))
{
createMesh();
}
if(adoptProblem &&
if (adoptProblem &&
(adoptFlag.isSet(INIT_MESH) ||
adoptFlag.isSet(INIT_SYSTEM) ||
adoptFlag.isSet(INIT_FE_SPACE)))
......@@ -244,24 +255,26 @@ namespace AMDiS {
}
}
if(!mesh_) WARNING("no mesh created\n");
if (!mesh_)
WARNING("no mesh created\n");
// === create fespace ===
if(feSpace_) {
if (feSpace_) {
WARNING("feSpace already created\n");
} else {
if(initFlag.isSet(INIT_FE_SPACE) || (initFlag.isSet(INIT_SYSTEM)&&!adoptFlag.isSet(INIT_FE_SPACE))) {
if (initFlag.isSet(INIT_FE_SPACE) || (initFlag.isSet(INIT_SYSTEM)&&!adoptFlag.isSet(INIT_FE_SPACE))) {
createFESpace();
}
if(adoptProblem &&
(adoptFlag.isSet(INIT_FE_SPACE) || adoptFlag.isSet(INIT_SYSTEM)))
if (adoptProblem &&
(adoptFlag.isSet(INIT_FE_SPACE) || adoptFlag.isSet(INIT_SYSTEM)))
{
TEST_EXIT(!feSpace_)("feSpace already created");
feSpace_ = dynamic_cast<ProblemScal*>(adoptProblem)->getFESpace();
}
}
if(!feSpace_) WARNING("no feSpace created\n");
if (!feSpace_)
WARNING("no feSpace created\n");
// === create system ===
if (initFlag.isSet(INIT_SYSTEM)) {
......@@ -305,25 +318,27 @@ namespace AMDiS {
}
}
if(!estimator_) WARNING("no estimator created\n");
if (!estimator_)
WARNING("no estimator created\n");
// === create marker ===
if(marker_) {
if (marker_) {
WARNING("marker already created\n");
} else {
if(initFlag.isSet(INIT_MARKER)) {
if (initFlag.isSet(INIT_MARKER)) {
createMarker();
}
if(adoptProblem && adoptFlag.isSet(INIT_MARKER)) {
if (adoptProblem && adoptFlag.isSet(INIT_MARKER)) {
TEST_EXIT(!marker_)("marker already created\n");
marker_ = adoptProblem->getMarker();
}
}
if(!marker_) WARNING("no marker created\n");
if (!marker_)
WARNING("no marker created\n");
// === create file writer ===
if(initFlag.isSet(INIT_FILEWRITER)) {
if (initFlag.isSet(INIT_FILEWRITER)) {
createFileWriter();
}
......@@ -371,11 +386,13 @@ namespace AMDiS {
mesh_->clearMacroFileInfo();
}
// === do global refinements ===
int globalRefinements = 0;
GET_PARAMETER(0, mesh_->getName() + "->global refinements", "%d", &globalRefinements);
refinementManager_->globalRefine(mesh_, globalRefinements);
if (initFlag.isSet(INIT_GLOBAL_REFINES)) {
int globalRefinements = 0;
GET_PARAMETER(0, mesh_->getName() + "->global refinements", "%d", &globalRefinements);
refinementManager_->globalRefine(mesh_, globalRefinements);
}
}
}
}
......
......@@ -29,6 +29,7 @@
#include "FixVec.h"
#include "Boundary.h"
#include "StandardProblemIteration.h"
#include "ProblemVec.h"
#include <list>
namespace AMDiS {
......@@ -358,6 +359,11 @@ namespace AMDiS {
* \{
*/
/** \brief
* Sets \ref mesh_
*/
void setMeshFromProblemVec(ProblemVec* pv, int i = 0);
/** \brief
* Sets \ref feSpace_.
*/
......
......@@ -43,6 +43,7 @@ namespace AMDiS {
const Flag INIT_MARKER = 0X40L;
const Flag INIT_ADAPT = 0X80L;
const Flag INIT_FILEWRITER = 0X100L;
const Flag INIT_GLOBAL_REFINES = 0X1000L;
// For time dependent problems
const Flag INIT_INITIAL_PROBLEM = 0X200L;
......@@ -57,7 +58,8 @@ namespace AMDiS {
const Flag INIT_ALL = INIT_FE_SPACE | INIT_MESH | CREATE_MESH | INIT_SYSTEM |
INIT_SOLVER | INIT_ESTIMATOR | INIT_MARKER |
INIT_ADAPT | INIT_FILEWRITER | INIT_INITIAL_PROBLEM |
INIT_UH_OLD | INIT_UPDATER | INIT_NONLIN_SOLVER ;
INIT_UH_OLD | INIT_UPDATER | INIT_NONLIN_SOLVER |
INIT_GLOBAL_REFINES ;
const Flag MESH_REFINED = 1;
const Flag MESH_COARSENED = 2;
......
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