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