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.
This commit is contained in:
Arne Morten Kvarving 2016-09-15 10:19:30 +02:00
parent 2c154138db
commit 2d8b830a47
4 changed files with 23 additions and 9 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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