Skip to content
Snippets Groups Projects
Commit 52e48513 authored by Boman Romain's avatar Boman Romain
Browse files

improve postprocessing

parent 73ad7fba
No related branches found
No related tags found
No related merge requests found
......@@ -53,7 +53,7 @@ class FEM_API DOFMask
size_t v; ///< mask
public:
/// create a mask from a single dof (implicitly if needed)
DOFMask(DOF const &dof) : dofs(dof.dofs), v(1 << dof.index()) {}
DOFMask(DOF const &dof) : dofs(dof.dofs), v(1ULL << dof.index()) {}
/// combine masks & other dofs
DOFMask operator|(DOFMask const &obj) const
{
......
......@@ -5,6 +5,7 @@
#include "femGroup.h"
#include "femEntity.h"
#include <numeric>
#include <fstream>
namespace fem
{
......@@ -226,6 +227,7 @@ int Post::add_view(std::string const &name)
// sview = 1 for the first view although it is named Views[0] in the GUI and the options!!
views[name] = sview;
configure(sview);
//set_viridis(sview); // <= already present in gmsh with 'F4' key (View.ColormapNumber=23)
return sview;
}
......@@ -269,6 +271,9 @@ void Post::configure(int sview)
gmsh::option::setNumber("View[" + std::to_string(sview - 1) + "].GlyphLocation", 2); // at the node (default=barycenter)
gmsh::option::setNumber("View[" + std::to_string(sview - 1) + "].VectorType", 2); // simple Arrow (default=3D arrow)
gmsh::option::setNumber("View[" + std::to_string(sview - 1) + "].ColormapNumber", 23); // Viridis colormap
gmsh::option::setNumber("View[" + std::to_string(sview - 1) + "].LightLines", 0); // disable lighting for lines
gmsh::option::setNumber("View[" + std::to_string(sview - 1) + "].LightTwoSide", 0); // disable 2-sided lighting
gmsh::option::setNumber("View[" + std::to_string(sview - 1) + "].ShowElement", 1); // view black mesh outline
gmsh::option::setNumber("View[" + std::to_string(sview - 1) + "].DrawSkinOnly", 1); // display skin only (should be faster)
gmsh::option::setNumber("View[" + std::to_string(sview - 1) + "].Visible", 0); // hide all views
......@@ -302,6 +307,11 @@ void Post::write()
gmsh::write("mesh.opt"); // save the options
gmsh::write("mesh.msh"); // only save the mesh
// save the views (without the mesh)
gmsh::option::setNumber("PostProcessing.SaveMesh", 0);
gmsh::option::setNumber("PostProcessing.SaveInterpolationMatrices", 0);
for (auto const &[name, sview] : views)
{
// gmsh::view::write(sview, name+".pos"); // pos format: list-based data (indep. of any model)
......@@ -406,4 +416,5 @@ operator<<(std::ostream &out, Post const &obj)
return out;
}
} // namespace fem
......@@ -13,7 +13,8 @@ namespace fem
Problem::Problem() : quadrature("Gauss2")
{
gmsh::initialize();
if(!gmsh::isInitialized())
gmsh::initialize();
// General.Verbosity
// (0: silent except for fatal errors, 1: +errors, 2: +warnings, 3: +direct, 4: +information, 5: +status (default), 99: +debug)
gmsh::option::setNumber("General.Verbosity", 2);
......
......@@ -150,11 +150,12 @@ if __name__ == "__main__":
exec(open(testname, encoding='utf-8').read())
elif action == 'post':
import gmsh
gmsh.initialize()
# gmsh.merge('mesh.msh')
# print('loading options...')
# gmsh.merge('mesh.opt')
if not gmsh.isInitialized():
gmsh.initialize()
# load empty mesh
gmsh.merge('mesh.msh')
gmsh.option.setNumber("General.Verbosity", 3)
# load views from the option file
views = []
with open('mesh.opt') as f:
import re
......@@ -167,14 +168,7 @@ if __name__ == "__main__":
for v in views:
print(f'loading "{v[1]}"')
gmsh.merge(v[1])
# gmsh.view.combine("elements",
# "all",
# True,
# True)
print('loading options...')
gmsh.merge('mesh.opt')
print('please wait...')
# for f in os.listdir():
# print(f)
print('starting Gmsh GUI, please wait...')
gmsh.fltk.run()
......@@ -85,8 +85,6 @@ def solve(p={}):
pbl = fem.Problem()
gmsh.initialize()
gmsh.option.setNumber("General.Terminal", 1)
# load main mandible mesh (volume or surface - it will be meshed in 3D)
import_mesh(p['bone'])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment