[Gmsh] To Optimize the 3D mesh
yoshihisa aoyagi
yoshi_aoyagi at supertech-cae.com
Wed Feb 29 05:54:10 CET 2012
Dear Gmsh User,
I would like to know how to optimize the 3D mesh in the program API.
I could compile ,link and run the mainSimple.EXE in the GMSH api_demos
after some toils and troubles.
I cloud generate the3D mesh(test.msh).
I know the operation to excute the Optimize or Optimize_Tetgen in the GMSH
menu Windows.
But, I don't know how to write the program to optimize 3D mesh.
If there is some functions such as m->mesh_Optimize or
m->mesh_Optimize_Tetgen,
Please let me 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();
}