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

Merge branch 'feature/gmsh-write-settable-variables' into 'master'

Feature/gmsh write settable variables

See merge request tools/frackit!208
parents 8c96cbb7 80850671
Pipeline #3533 passed with stages
in 9 minutes and 48 seconds
...@@ -101,13 +101,15 @@ public: ...@@ -101,13 +101,15 @@ public:
* \param geoFile The geoFile to write to * \param geoFile The geoFile to write to
* \param varName variable name * \param varName variable name
* \param varValue variable value * \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> template<class ValueType>
void writeVariableDefinition(std::ofstream& geoFile, void writeVariableDefinition(std::ofstream& geoFile,
const std::string& varName, const std::string& varName,
const ValueType& varValue) const const ValueType& varValue) const
{ {
geoFile << varName << " = " << varValue << ";\n"; geoFile << "DefineConstant[ " << varName << " = " << varValue << " ];\n";
} }
/*! /*!
......
...@@ -165,11 +165,11 @@ int main(int argc, char** argv) ...@@ -165,11 +165,11 @@ int main(int argc, char** argv)
writer.setMeshSize(isTag, Id(i+1), 0.01*(i+1)); writer.setMeshSize(isTag, Id(i+1), 0.01*(i+1));
writer.write("contained"); writer.write("contained");
testGeoFile("contained", "Characteristic Length", allPhysicals); testGeoFile("contained", "Characteristic Length", allPhysicals);
testGeoFile("contained", "intersectionMeshSize_", numCurves, true); testGeoFile("contained", "DefineConstant[ intersectionMeshSize_", numCurves, true);
writer.setMeshSize(isTag, 0.01); writer.setMeshSize(isTag, 0.01);
writer.write("contained"); writer.write("contained");
testGeoFile("contained", "Characteristic Length", allPhysicals); testGeoFile("contained", "Characteristic Length", allPhysicals);
testGeoFile("contained", "intersectionMeshSize_", 1, true); testGeoFile("contained", "DefineConstant[ intersectionMeshSize_", 1, true);
// successively remove physical definitions // successively remove physical definitions
writer.setNonPhysical(isTag); writer.write("contained"); writer.setNonPhysical(isTag); writer.write("contained");
...@@ -189,14 +189,14 @@ int main(int argc, char** argv) ...@@ -189,14 +189,14 @@ int main(int argc, char** argv)
testGeoFile("contained", "MeshSize{", allPhysicals); testGeoFile("contained", "MeshSize{", allPhysicals);
// test number of defined mesh size variables // test number of defined mesh size variables
testGeoFile("contained", "subDomainMeshSize_", numVolumes, true); testGeoFile("contained", "DefineConstant[ subDomainMeshSize_", numVolumes, true);
testGeoFile("contained", "entityMeshSize_", numSurfaces, true); testGeoFile("contained", "DefineConstant[ entityMeshSize_", numSurfaces, true);
writer.setMeshSize(entityTag, Id(2), 0.05); writer.write("contained"); 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"); 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"); writer.resetMeshSizes(isTag); writer.write("contained");
testGeoFile("contained", "intersectionMeshSize_", 0); testGeoFile("contained", "DefineConstant[ intersectionMeshSize_", 0);
// make things physical again // make things physical again
writer.setPhysical(domainTag, Id(1)); writer.write("contained"); 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