Ellipsoid Meshing Issue in C++

More
3 years 9 months ago #3503 by wzh
Hello,

I have Netgen5.3 installed in my PC, the netgen GUI program can mesh the ellipsoid.geo file quickly. Recently, I have tried to call the nglib::Ng_CSG_GenerateMesh() function in C++.
Code:
#include <iostream> #include <fstream> namespace nglib { #include <nglib.h> } int main(int argc, char** argv) { using namespace nglib; char file_name[256]; strcpy(file_name, argv[1]); std::cout << file_name << std::endl; // Initialise the Netgen Core library nglib::Ng_Init(); long nvertices = 0; long ntriangles = 0; long ntetrahedrons = 0; double* vertexlist = NULL; int* trianglelist = NULL; int* tetralist = NULL; nglib::Ng_CSG_GenerateMesh(file_name, &nvertices, &ntriangles, &ntetrahedrons, vertexlist, trianglelist, tetralist); // deconstruct Netgen library. nglib::Ng_Exit(); return 0; } DLL_HEADER Ng_Result Ng_CSG_GenerateMesh (const char * filename, long *nvertices, long *ntriangles, long *ntetrahedrons, double * vertexlist, int * trianglelist, int * tetralist);


This code works fine with all the tutorials .geo files in the tutorials directory except the ellipsoid.geo file.
Code:
# ## An elliptic cylinder # algebraic3d solid test = ellipsoid (0, 0, 0; 2, 0, 0; 0, 1, 0; 0, 0, 1) -maxh=0.5; tlo test;


It takes a very long time to mesh and prints a lot of messages:
Code:
define solid test Calc Triangle Approximation Object 0 has 882 triangles Start Findpoints main-solids: 1 Found points 0 Analyze spec points done find points done Find edges Add line segment to smooth surface 0 edges found Check intersecting edges CalcLocalH: 2 Points 0 Elements 0 Surface Elements Start Findpoints main-solids: 1 Found points 0 Analyze spec points done Find edges Add line segment to smooth surface 0 edges found Check intersecting edges Start Findpoints main-solids: 1 Found points 0 Analyze spec points done Find edges Add line segment to smooth surface 0 edges found Check intersecting edges Surface 1 / 1 load internal triangle rules [b]faces = 66 trials = 1000 elements = 65 els/sec = 650000 faces = 113 trials = 2000 elements = 111 els/sec = 1.11e+06 faces = 141 trials = 3000 elements = 139 els/sec = 1.39e+06 faces = 174 trials = 4000 elements = 172 els/sec = 1.72e+06[/b] ........

I wonder if I need to set the Ng_Meshing_Parameters before meshing ellipsoid object?

Could someone give me a tip on how to generate ellipsoid object mesh correctly.

Thank you.
Wei
Time to create page: 0.089 seconds