36 : mp(), refine_with_geom(), refine_without_geom()
38 std::cout <<
"initializing netgen mesh generator" << std::endl;
40 mesh = nglib::Ng_NewMesh();
46 std::cout <<
"initializing netgen mesh generator" << std::endl;
49 mesh = nglib::Ng_NewMesh();
54 std::cout <<
"finalizing netgen mesh generator" << std::endl;
57 nglib::Ng_DeleteMesh(
mesh);
91 nglib::Ng_STL_Geometry *stl_geom;
94 nglib::Ng_Result ng_res;
99 std::ifstream inSTL(fname);
101 std::cerr <<
"Error reading in STL file: " << fname << std::endl;
106 stl_geom = nglib::Ng_STL_LoadGeometry(fname);
113 std::cerr <<
"Error reading in STL File: " << fname << std::endl;
116 std::cout <<
"Successfully loaded STL File: " << fname << std::endl;
118 std::cout <<
"Initialise the STL Geometry structure...." << std::endl;
119 ng_res = nglib::Ng_STL_InitSTLGeometry(stl_geom);
120 if (ng_res != nglib::NG_OK)
122 std::cerr <<
"Error Initialising the STL Geometry....Aborting!!" << std::endl;
126 std::cout <<
"Start Edge Meshing...." << std::endl;
127 ng_res = nglib::Ng_STL_MakeEdges(stl_geom,
mesh, &
mp);
128 if (ng_res != nglib::NG_OK)
130 std::cerr <<
"Error in Edge Meshing....Aborting!!" << std::endl;
134 std::cout <<
"Start Surface Meshing...." << std::endl;
135 ng_res = nglib::Ng_STL_GenerateSurfaceMesh(stl_geom,
mesh, &
mp);
136 if (ng_res != nglib::NG_OK)
138 std::cerr <<
"Error in Surface Meshing....Aborting!!" << std::endl;
142 std::cout <<
"Start Volume Meshing...." << std::endl;
143 ng_res = nglib::Ng_GenerateVolumeMesh(
mesh, &
mp);
144 if (ng_res != nglib::NG_OK)
146 std::cerr <<
"Error in Volume Meshing....Aborting!!" << std::endl;
150 std::cout <<
"Meshing successfully completed....!!" << std::endl;
153 np = nglib::Ng_GetNP(
mesh);
154 std::cout <<
"Points: " << np << std::endl;
156 ne = nglib::Ng_GetNE(
mesh);
157 std::cout <<
"Elements: " << ne << std::endl;
161 nglib::Ng_Uniform_Refinement(
mesh);
163 nglib::Ng_STL_Uniform_Refinement(stl_geom,
mesh);
165 std::cout <<
"elements after refinement: " << nglib::Ng_GetNE(
mesh)
167 std::cout <<
"points after refinement: " << nglib::Ng_GetNP(
mesh)
170 std::cout <<
"Saving Mesh in VOL Format...." << std::endl;
171 std::string newfname(fname);
int createMeshFromSTL(const char *fname) override
std::string trim_fname(const std::string &name, const std::string &ext)
nglib::Ng_Meshing_Parameters mp
bool check_overlapping_boundary
std::string meshsize_filename
void set_mp(const netgenParams *params)