Skip to content
Snippets Groups Projects
Commit 05f32daa authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

sanity checks

parent 526f1a9d
No related branches found
No related tags found
No related merge requests found
......@@ -75,10 +75,15 @@ int main(int argc, char **argv)
// If we were to follow the geo example blindly, we would read the number of
// views from the relevant option value, and use the gmsh::option::setNumber()
// and gmsh::option::setString() functions. A nicer way is to use
// gmsh::view::getTags() and to use the gmsh::view::setNumber() and
// gmsh::view::setString() functions.
// gmsh::view::getTags() and to use the gmsh::view::option::setNumber() and
// gmsh::view::option::setString() functions.
std::vector<int> v;
gmsh::view::getTags(v);
if(v.size() != 4) {
gmsh::logger::write("Wrong number of views!", "error");
gmsh::finalize();
return 1;
}
gmsh::view::option::setNumber(v[0], "IntervalsType", 2);
gmsh::view::option::setNumber(v[0], "OffsetZ", 0.05);
......
......@@ -35,6 +35,11 @@ int main(int argc, char **argv)
std::vector<int> v;
gmsh::view::getTags(v);
if(v.size() != 1) {
gmsh::logger::write("Wrong number of views!", "error");
gmsh::finalize();
return 1;
}
// We then set some options for the `Isosurface' plugin (which extracts an
// isosurface from a 3D scalar view), and run it:
......
......@@ -70,11 +70,15 @@ if '-nopopup' not in sys.argv:
# We also set some options for each post-processing view:
# If we were to follow the geo example blindly, we would read the number of
# views from the relevant option value, and use the gmsh.option.setNumber()
# and gmsh.option.setString() functions. A nicer way is to use
# gmsh.view.getTags() and to use the gmsh.view.setNumber() and
# gmsh.view.setString() functions.
# views from the relevant option value, and use the gmsh.option.setNumber() and
# gmsh.option.setString() functions. A nicer way is to use gmsh.view.getTags()
# and to use the gmsh.view.option.setNumber() and gmsh.view.option.setString()
# functions.
v = gmsh.view.getTags()
if len(v) != 4:
gmsh.logger.write("Wrong number of views!", "error")
gmsh.finalize()
exit()
# We set some options for each post-processing view:
gmsh.view.option.setNumber(v[0], "IntervalsType", 2)
......
......@@ -25,6 +25,10 @@ gmsh.initialize()
path = os.path.dirname(os.path.abspath(__file__))
gmsh.merge(os.path.join(path, os.pardir, 'view3.pos'))
v = gmsh.view.getTags()
if len(v) != 1:
gmsh.logger.write("Wrong number of views!", "error")
gmsh.finalize()
exit()
# We then set some options for the `Isosurface' plugin (which extracts an
# isosurface from a 3D scalar view), and run it:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment