From 2d8b830a47d3b48994576c280520b2065dfa4eeb Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Thu, 15 Sep 2016 10:19:30 +0200 Subject: [PATCH] fixed: due to the order of things, we need a model generator member due to the structure of parsing there is no way around this. we first need to generate the model (and topology sets) in the SIMbase parse function. we then need to refine the model in the SIMxD parse functions which are called after the SIMbase parsing. thus, we need to hand the model generator instanced in the SIMbase parsing to the SIMxD to create the topology at the appropriate time. --- src/SIM/SIM2D.C | 8 ++++++++ src/SIM/SIM3D.C | 7 +++++++ src/SIM/SIMbase.C | 16 +++++++--------- src/SIM/SIMbase.h | 1 + 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/src/SIM/SIM2D.C b/src/SIM/SIM2D.C index 9ed56552..8cb9c88c 100644 --- a/src/SIM/SIM2D.C +++ b/src/SIM/SIM2D.C @@ -372,6 +372,14 @@ bool SIM2D::parse (const TiXmlElement* elem) else if (!strcasecmp(elem->Value(),"boundaryconditions")) result &= this->parseBCTag(child); + if (myGen && result) { + if (!this->createFEMmodel()) return false; + myGen->createTopology(*this); + } + + delete myGen; + myGen = nullptr; + return result; } diff --git a/src/SIM/SIM3D.C b/src/SIM/SIM3D.C index e707e040..d6d7a6a6 100644 --- a/src/SIM/SIM3D.C +++ b/src/SIM/SIM3D.C @@ -280,6 +280,13 @@ bool SIM3D::parse (const TiXmlElement* elem) else if (!strcasecmp(elem->Value(),"boundaryconditions")) result &= this->parseBCTag(child); + if (myGen && result) { + if (!this->createFEMmodel()) return false; + myGen->createTopology(*this); + } + delete myGen; + myGen = nullptr; + return result; } diff --git a/src/SIM/SIMbase.C b/src/SIM/SIMbase.C index 1c4378f2..7f0d5559 100644 --- a/src/SIM/SIMbase.C +++ b/src/SIM/SIMbase.C @@ -54,6 +54,7 @@ SIMbase::SIMbase (IntegrandBase* itg) : g2l(&myGlb2Loc) myEqSys = nullptr; mySam = nullptr; mySolParams = nullptr; + myGen = nullptr; nGlPatches = 0; nIntGP = nBouGP = 0; @@ -496,7 +497,6 @@ bool SIMbase::parse (const TiXmlElement* elem) result = false; } - ModelGenerator* gen = nullptr; // Create the default geometry of no patchfile is specified if (myModel.empty() && !strcasecmp(elem->Value(),"geometry")) if (this->getNoParamDim() > 0 && !elem->FirstChildElement("patchfile")) @@ -506,12 +506,15 @@ bool SIMbase::parse (const TiXmlElement* elem) part; part = part->NextSiblingElement("partitioning")) result &= this->parseGeometryTag(part); - gen = this->createModelGenerator(elem); - myModel = gen->createGeometry(*this); + myGen = this->createModelGenerator(elem); + if (!myGen) + return false; + + myModel = myGen->createGeometry(*this); if (myPatches.empty()) nGlPatches = myModel.size(); - TopologySet set = gen->createTopologySets(*this); + TopologySet set = myGen->createTopologySets(*this); for (auto& it : set) myEntitys[it.first] = it.second; } @@ -539,11 +542,6 @@ bool SIMbase::parse (const TiXmlElement* elem) else if (!strcasecmp(elem->Value(),"discretization")) result &= opt.parseDiscretizationTag(child); - if (gen) - gen->createTopology(*this); - - delete gen; - return result; } diff --git a/src/SIM/SIMbase.h b/src/SIM/SIMbase.h index f1d92f08..006b6f5d 100644 --- a/src/SIM/SIMbase.h +++ b/src/SIM/SIMbase.h @@ -750,6 +750,7 @@ protected: IntegrandBase* myProblem; //!< The main integrand of this simulator IntegrandMap myInts; //!< Set of all integrands involved AnaSol* mySol; //!< Analytical/Exact solution + ModelGenerator* myGen; //!< Model generator //! \brief A struct with data for system matrix/vector dumps. struct DumpData