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

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