[Gmsh] Remesh geometry from C++

Emilie Sauvage emilie.sauvage at uclouvain.be
Mon Nov 28 10:48:52 CET 2011


Dear Gmsh users and developers,

I'm trying to remesh a cube (loaded from an msh file) in volume. I created
a GModel, set new Compound faces, and remeshed them. I tried to remesh the
volume as well (using a GRegion). Unfortunately, the volume mesh is not
written in the output file.

I copy below a piece of the code which is also attached to this email.
Does anyone has an idea what's wrong with the 3D remesh part?


  /// Should we create a GRegion or discreteRegion ???

  discreteRegion* region = new discreteRegion(model, 2);
  std::set<int> bound_faces_tags;
  /// new_entity tags is a vector of tags of the new (remeshed)
  /// walls of the original cube
  for (int t = 0; t<new_entity_tags.size(); ++t)
  {
    bound_faces_tags.insert(new_entity_tags[t]);
  }
  region->setBoundFaces(bound_faces_tags);

  /// Add a compound volume to the model. Is this the correct way to go???
  std::vector<GRegion*> volume_compound;
  volume_compound.push_back(region);
  GRegionCompound * region_compound = new GRegionCompound(model, 100,
  volume_compound);

  model->add(region);

Thank you.

Emilie Sauvage.

PS: In attachment:
*a geo file to create a very simple cube. Run with the command "gmsh -3
Cube.geo". This creates a mesh called "Cube.msh"
*the C++ code used to load the Cube.msh and resmesh it.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.cpp
Type: text/x-c++src
Size: 5113 bytes
Desc: not available
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20111128/061b3e69/attachment.cpp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Cube.geo
Type: application/vnd.dynageo
Size: 815 bytes
Desc: not available
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20111128/061b3e69/attachment.geo>