Commit 80850671 authored by Dennis Gläser's avatar Dennis Gläser
Browse files

[io][gmshbackend] define variables as settable constants

parent 0b0d6a5d
Pipeline #3530 passed with stages
in 12 minutes and 26 seconds
......@@ -101,13 +101,15 @@ public:
* \param geoFile The geoFile to write to
* \param varName variable name
* \param varValue variable value
* \note We define all variables such that they can be overwritten
* via the command line when opening the .geo file with Gmsh
*/
template<class ValueType>
void writeVariableDefinition(std::ofstream& geoFile,
const std::string& varName,
const ValueType& varValue) const
{
geoFile << varName << " = " << varValue << ";\n";
geoFile << "DefineConstant[ " << varName << " = " << varValue << " ];\n";
}
/*!
......
......@@ -165,11 +165,11 @@ int main(int argc, char** argv)
writer.setMeshSize(isTag, Id(i+1), 0.01*(i+1));
writer.write("contained");
testGeoFile("contained", "Characteristic Length", allPhysicals);
testGeoFile("contained", "intersectionMeshSize_", numCurves, true);
testGeoFile("contained", "DefineConstant[ intersectionMeshSize_", numCurves, true);
writer.setMeshSize(isTag, 0.01);
writer.write("contained");
testGeoFile("contained", "Characteristic Length", allPhysicals);
testGeoFile("contained", "intersectionMeshSize_", 1, true);
testGeoFile("contained", "DefineConstant[ intersectionMeshSize_", 1, true);
// successively remove physical definitions
writer.setNonPhysical(isTag); writer.write("contained");
......@@ -189,14 +189,14 @@ int main(int argc, char** argv)
testGeoFile("contained", "MeshSize{", allPhysicals);
// test number of defined mesh size variables
testGeoFile("contained", "subDomainMeshSize_", numVolumes, true);
testGeoFile("contained", "entityMeshSize_", numSurfaces, true);
testGeoFile("contained", "DefineConstant[ subDomainMeshSize_", numVolumes, true);
testGeoFile("contained", "DefineConstant[ entityMeshSize_", numSurfaces, true);
writer.setMeshSize(entityTag, Id(2), 0.05); writer.write("contained");
testGeoFile("contained", "entityMeshSize_", numSurfaces-1, true);
testGeoFile("contained", "DefineConstant[ entityMeshSize_", numSurfaces-1, true);
writer.setMeshSize(domainTag, Id(2), 0.1); writer.write("contained");
testGeoFile("contained", "subDomainMeshSize_", numVolumes-1, true);
testGeoFile("contained", "DefineConstant[ subDomainMeshSize_", numVolumes-1, true);
writer.resetMeshSizes(isTag); writer.write("contained");
testGeoFile("contained", "intersectionMeshSize_", 0);
testGeoFile("contained", "DefineConstant[ intersectionMeshSize_", 0);
// make things physical again
writer.setPhysical(domainTag, Id(1)); writer.write("contained");
......
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