[Gmsh] How to write the program on the Optimize 3D Tetra Mesh.

1948 super super1948 at gmail.com
Wed Feb 29 06:21:29 CET 2012


Dear Gmsh User,

I cloud compile and link mainSimple.cpp using the MVC 2008 after some
troubles.

I could get the test.msh(3D Tetra mesh) using the T5.geo after the run
mainSimple.exe.

I know the operation to excute "Optimize" or Optimize_Tetgen" in Gmsh
Windows menu.

 But, I would like to know how to write the program to optimize 3D Tetra
mesh in the programming.

mainSimple.cpp is shown  under.

Please let me know if some one know.



#include <stdio.h>
#include "Gmsh.h"
#include "GModel.h"
#include "MElement.h"

int main(int argc, char **argv)
{
  GmshInitialize(argc, argv);
  //GmshSetOption("Mesh", "Algorithm", 5);
  GModel *m = new GModel();
  m->readGEO("../../tutorial/t5.geo");
  //GmshMergeFile("../../tutorial/t5.geo"); // will also set the bbox
  m->mesh(3);
  for(GModel::riter it = m->firstRegion(); it != m->lastRegion(); ++it){
    GRegion *r = *it;
    printf("volume %d contains %d elements:\n", r->tag(),
r->getNumMeshElements());
    for(unsigned int i = 0; i < r->getNumMeshElements(); i++)
      printf(" %d", r->getMeshElement(i)->getNum());
    printf("\n");
  }
  m->writeMSH("test.msh");
  m->writeUNV("test.unv");
  delete m;
  GmshFinalize();
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20120229/c54ca4a2/attachment.html>