mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-25 21:40:33 +05:00
* Nglib now supports surface and volume meshing of OCC geometry
* OCC code cleanup * Added to Nglib source code documentation
This commit is contained in:
parent
91ae6c4c70
commit
4a3a49f5fd
File diff suppressed because it is too large
Load Diff
@ -1603,8 +1603,6 @@ namespace netgen
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int OCCGenerateMesh (OCCGeometry & occgeometry, Mesh*& mesh,
|
|
||||||
int perfstepsstart, int perfstepsend, char* optstring);
|
|
||||||
|
|
||||||
int OCCGeometry :: GenerateMesh (Mesh*& mesh,
|
int OCCGeometry :: GenerateMesh (Mesh*& mesh,
|
||||||
int perfstepsstart, int perfstepsend, char* optstring)
|
int perfstepsstart, int perfstepsend, char* optstring)
|
||||||
|
@ -80,6 +80,7 @@
|
|||||||
#include "ShapeAnalysis.hxx"
|
#include "ShapeAnalysis.hxx"
|
||||||
#include "ShapeBuild_ReShape.hxx"
|
#include "ShapeBuild_ReShape.hxx"
|
||||||
|
|
||||||
|
|
||||||
// Philippose - 29/01/2009
|
// Philippose - 29/01/2009
|
||||||
// OpenCascade XDE Support
|
// OpenCascade XDE Support
|
||||||
// Include support for OpenCascade XDE Features
|
// Include support for OpenCascade XDE Features
|
||||||
@ -164,6 +165,17 @@ namespace netgen
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class Line
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Point<3> p0, p1;
|
||||||
|
|
||||||
|
double Dist (Line l);
|
||||||
|
|
||||||
|
double Length ();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
inline double Det3 (double a00, double a01, double a02,
|
inline double Det3 (double a00, double a01, double a02,
|
||||||
double a10, double a11, double a12,
|
double a10, double a11, double a12,
|
||||||
@ -386,6 +398,20 @@ namespace netgen
|
|||||||
OCCGeometry * LoadOCC_BREP (const char * filename);
|
OCCGeometry * LoadOCC_BREP (const char * filename);
|
||||||
|
|
||||||
extern OCCParameters occparam;
|
extern OCCParameters occparam;
|
||||||
|
|
||||||
|
|
||||||
|
// Philippose - 31.09.2009
|
||||||
|
// External access to the mesh generation functions within the OCC
|
||||||
|
// subsystem (Not sure if this is the best way to implement this....!!)
|
||||||
|
extern int OCCGenerateMesh (OCCGeometry & occgeometry, Mesh*& mesh,
|
||||||
|
int perfstepsstart, int perfstepsend,
|
||||||
|
char* optstring);
|
||||||
|
|
||||||
|
extern void OCCSetLocalMeshSize(OCCGeometry & geom, Mesh & mesh);
|
||||||
|
|
||||||
|
extern void OCCMeshSurface (OCCGeometry & geom, Mesh & mesh, int perfstepsend);
|
||||||
|
|
||||||
|
extern void OCCFindEdges (OCCGeometry & geom, Mesh & mesh);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
216
nglib/nglib.cpp
216
nglib/nglib.cpp
@ -27,8 +27,8 @@
|
|||||||
|
|
||||||
namespace netgen {
|
namespace netgen {
|
||||||
extern void MeshFromSpline2D (SplineGeometry2d & geometry,
|
extern void MeshFromSpline2D (SplineGeometry2d & geometry,
|
||||||
Mesh *& mesh,
|
Mesh *& mesh,
|
||||||
MeshingParameters & mp);
|
MeshingParameters & mp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ namespace nglib
|
|||||||
|
|
||||||
// Manually add a surface element of a given type to an existing mesh object
|
// Manually add a surface element of a given type to an existing mesh object
|
||||||
DLL_HEADER void Ng_AddSurfaceElement (Ng_Mesh * mesh, Ng_Surface_Element_Type et,
|
DLL_HEADER void Ng_AddSurfaceElement (Ng_Mesh * mesh, Ng_Surface_Element_Type et,
|
||||||
int * pi)
|
int * pi)
|
||||||
{
|
{
|
||||||
Mesh * m = (Mesh*)mesh;
|
Mesh * m = (Mesh*)mesh;
|
||||||
Element2d el (3);
|
Element2d el (3);
|
||||||
@ -146,7 +146,7 @@ namespace nglib
|
|||||||
|
|
||||||
// Manually add a volume element of a given type to an existing mesh object
|
// Manually add a volume element of a given type to an existing mesh object
|
||||||
DLL_HEADER void Ng_AddVolumeElement (Ng_Mesh * mesh, Ng_Volume_Element_Type et,
|
DLL_HEADER void Ng_AddVolumeElement (Ng_Mesh * mesh, Ng_Volume_Element_Type et,
|
||||||
int * pi)
|
int * pi)
|
||||||
{
|
{
|
||||||
Mesh * m = (Mesh*)mesh;
|
Mesh * m = (Mesh*)mesh;
|
||||||
Element el (4);
|
Element el (4);
|
||||||
@ -270,8 +270,10 @@ namespace nglib
|
|||||||
{
|
{
|
||||||
Mesh * m = (Mesh*)mesh;
|
Mesh * m = (Mesh*)mesh;
|
||||||
|
|
||||||
|
// Philippose - 30/08/2009
|
||||||
MeshingParameters mparam;
|
// Do not locally re-define "mparam" here... "mparam" is a global
|
||||||
|
// object
|
||||||
|
//MeshingParameters mparam;
|
||||||
mparam.maxh = mp->maxh;
|
mparam.maxh = mp->maxh;
|
||||||
mparam.meshsizefilename = mp->meshsize_filename;
|
mparam.meshsizefilename = mp->meshsize_filename;
|
||||||
|
|
||||||
@ -369,9 +371,12 @@ namespace nglib
|
|||||||
return (Ng_Geometry_2D *)geom;
|
return (Ng_Geometry_2D *)geom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DLL_HEADER Ng_Result Ng_GenerateMesh_2D (Ng_Geometry_2D * geom,
|
DLL_HEADER Ng_Result Ng_GenerateMesh_2D (Ng_Geometry_2D * geom,
|
||||||
Ng_Mesh ** mesh,
|
Ng_Mesh ** mesh,
|
||||||
Ng_Meshing_Parameters * mp)
|
Ng_Meshing_Parameters * mp)
|
||||||
{
|
{
|
||||||
// use global variable mparam
|
// use global variable mparam
|
||||||
// MeshingParameters mparam;
|
// MeshingParameters mparam;
|
||||||
@ -388,6 +393,9 @@ namespace nglib
|
|||||||
return NG_OK;
|
return NG_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DLL_HEADER void Ng_HP_Refinement (Ng_Geometry_2D * geom,
|
DLL_HEADER void Ng_HP_Refinement (Ng_Geometry_2D * geom,
|
||||||
Ng_Mesh * mesh,
|
Ng_Mesh * mesh,
|
||||||
int levels)
|
int levels)
|
||||||
@ -396,6 +404,9 @@ namespace nglib
|
|||||||
HPRefinement (*(Mesh*)mesh, &ref, levels);
|
HPRefinement (*(Mesh*)mesh, &ref, levels);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DLL_HEADER void Ng_HP_Refinement (Ng_Geometry_2D * geom,
|
DLL_HEADER void Ng_HP_Refinement (Ng_Geometry_2D * geom,
|
||||||
Ng_Mesh * mesh,
|
Ng_Mesh * mesh,
|
||||||
int levels, double parameter)
|
int levels, double parameter)
|
||||||
@ -461,12 +472,16 @@ namespace nglib
|
|||||||
return geo2;
|
return geo2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// generate new STL Geometry
|
// generate new STL Geometry
|
||||||
DLL_HEADER Ng_STL_Geometry * Ng_STL_NewGeometry ()
|
DLL_HEADER Ng_STL_Geometry * Ng_STL_NewGeometry ()
|
||||||
{
|
{
|
||||||
return (Ng_STL_Geometry*)(void*)new STLGeometry;
|
return (Ng_STL_Geometry*)(void*)new STLGeometry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// after adding triangles (and edges) initialize
|
// after adding triangles (and edges) initialize
|
||||||
DLL_HEADER Ng_Result Ng_STL_InitSTLGeometry (Ng_STL_Geometry * geom)
|
DLL_HEADER Ng_Result Ng_STL_InitSTLGeometry (Ng_STL_Geometry * geom)
|
||||||
{
|
{
|
||||||
@ -489,10 +504,12 @@ namespace nglib
|
|||||||
return NG_SURFACE_INPUT_ERROR;
|
return NG_SURFACE_INPUT_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// automatically generates edges:
|
// automatically generates edges:
|
||||||
DLL_HEADER Ng_Result Ng_STL_MakeEdges (Ng_STL_Geometry * geom,
|
DLL_HEADER Ng_Result Ng_STL_MakeEdges (Ng_STL_Geometry * geom,
|
||||||
Ng_Mesh* mesh,
|
Ng_Mesh* mesh,
|
||||||
Ng_Meshing_Parameters * mp)
|
Ng_Meshing_Parameters * mp)
|
||||||
{
|
{
|
||||||
STLGeometry* stlgeometry = (STLGeometry*)geom;
|
STLGeometry* stlgeometry = (STLGeometry*)geom;
|
||||||
Mesh* me = (Mesh*)mesh;
|
Mesh* me = (Mesh*)mesh;
|
||||||
@ -507,8 +524,8 @@ namespace nglib
|
|||||||
|
|
||||||
me -> SetGlobalH (mparam.maxh);
|
me -> SetGlobalH (mparam.maxh);
|
||||||
me -> SetLocalH (stlgeometry->GetBoundingBox().PMin() - Vec3d(10, 10, 10),
|
me -> SetLocalH (stlgeometry->GetBoundingBox().PMin() - Vec3d(10, 10, 10),
|
||||||
stlgeometry->GetBoundingBox().PMax() + Vec3d(10, 10, 10),
|
stlgeometry->GetBoundingBox().PMax() + Vec3d(10, 10, 10),
|
||||||
0.3);
|
0.3);
|
||||||
|
|
||||||
me -> LoadLocalMeshSize (mp->meshsize_filename);
|
me -> LoadLocalMeshSize (mp->meshsize_filename);
|
||||||
/*
|
/*
|
||||||
@ -533,8 +550,8 @@ namespace nglib
|
|||||||
|
|
||||||
// generates mesh, empty mesh be already created.
|
// generates mesh, empty mesh be already created.
|
||||||
DLL_HEADER Ng_Result Ng_STL_GenerateSurfaceMesh (Ng_STL_Geometry * geom,
|
DLL_HEADER Ng_Result Ng_STL_GenerateSurfaceMesh (Ng_STL_Geometry * geom,
|
||||||
Ng_Mesh* mesh,
|
Ng_Mesh* mesh,
|
||||||
Ng_Meshing_Parameters * mp)
|
Ng_Meshing_Parameters * mp)
|
||||||
{
|
{
|
||||||
STLGeometry* stlgeometry = (STLGeometry*)geom;
|
STLGeometry* stlgeometry = (STLGeometry*)geom;
|
||||||
Mesh* me = (Mesh*)mesh;
|
Mesh* me = (Mesh*)mesh;
|
||||||
@ -593,7 +610,8 @@ namespace nglib
|
|||||||
// positive orientation
|
// positive orientation
|
||||||
// normal vector may be null-pointer
|
// normal vector may be null-pointer
|
||||||
DLL_HEADER void Ng_STL_AddTriangle (Ng_STL_Geometry * geom,
|
DLL_HEADER void Ng_STL_AddTriangle (Ng_STL_Geometry * geom,
|
||||||
double * p1, double * p2, double * p3, double * nv)
|
double * p1, double * p2, double * p3,
|
||||||
|
double * nv)
|
||||||
{
|
{
|
||||||
Point<3> apts[3];
|
Point<3> apts[3];
|
||||||
apts[0] = Point<3>(p1[0],p1[1],p1[2]);
|
apts[0] = Point<3>(p1[0],p1[1],p1[2]);
|
||||||
@ -621,7 +639,6 @@ namespace nglib
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef OCCGEOMETRY
|
#ifdef OCCGEOMETRY
|
||||||
// --------------------- OCC Geometry / Meshing Utility Functions -------------------
|
// --------------------- OCC Geometry / Meshing Utility Functions -------------------
|
||||||
|
|
||||||
@ -632,46 +649,166 @@ namespace nglib
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Loads geometry from STEP File
|
// Loads geometry from STEP File
|
||||||
DLL_HEADER Ng_OCC_Geometry * Ng_OCC_Load_STEP (const char * filename)
|
DLL_HEADER Ng_OCC_Geometry * Ng_OCC_Load_STEP (const char * filename)
|
||||||
{
|
{
|
||||||
Ng_OCC_Geometry * geo = Ng_OCC_NewGeometry();
|
Ng_OCC_Geometry * geo = Ng_OCC_NewGeometry();
|
||||||
|
|
||||||
geo = (Ng_OCC_Geometry *)LoadOCC_STEP(filename);
|
OCCGeometry * occgeo = LoadOCC_STEP(filename);
|
||||||
|
|
||||||
|
// Create the initial triangulation for the OCC
|
||||||
|
BRepMesh_IncrementalMesh::BRepMesh_IncrementalMesh(occgeo->shape,0.1);
|
||||||
|
|
||||||
|
geo = (Ng_OCC_Geometry *)occgeo;
|
||||||
|
|
||||||
return (geo);
|
return (geo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Loads geometry from IGES File
|
// Loads geometry from IGES File
|
||||||
DLL_HEADER Ng_OCC_Geometry * Ng_OCC_Load_IGES (const char * filename)
|
DLL_HEADER Ng_OCC_Geometry * Ng_OCC_Load_IGES (const char * filename)
|
||||||
{
|
{
|
||||||
Ng_OCC_Geometry * geo = Ng_OCC_NewGeometry();
|
Ng_OCC_Geometry * geo = Ng_OCC_NewGeometry();
|
||||||
|
|
||||||
geo = (Ng_OCC_Geometry *)LoadOCC_IGES(filename);
|
OCCGeometry * occgeo = LoadOCC_IGES(filename);
|
||||||
|
|
||||||
|
// Create the initial triangulation for the OCC
|
||||||
|
BRepMesh_IncrementalMesh::BRepMesh_IncrementalMesh(occgeo->shape,0.1);
|
||||||
|
|
||||||
|
geo = (Ng_OCC_Geometry *)occgeo;
|
||||||
|
|
||||||
return (geo);
|
return (geo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Loads geometry from BREP File
|
// Loads geometry from BREP File
|
||||||
DLL_HEADER Ng_OCC_Geometry * Ng_OCC_Load_BREP (const char * filename)
|
DLL_HEADER Ng_OCC_Geometry * Ng_OCC_Load_BREP (const char * filename)
|
||||||
{
|
{
|
||||||
Ng_OCC_Geometry * geo = Ng_OCC_NewGeometry();
|
Ng_OCC_Geometry * geo = Ng_OCC_NewGeometry();
|
||||||
|
|
||||||
geo = (Ng_OCC_Geometry *)LoadOCC_BREP(filename);
|
OCCGeometry * occgeo = LoadOCC_BREP(filename);
|
||||||
|
|
||||||
|
// Create the initial triangulation for the OCC
|
||||||
|
BRepMesh_IncrementalMesh::BRepMesh_IncrementalMesh(occgeo->shape,0.1);
|
||||||
|
|
||||||
|
geo = (Ng_OCC_Geometry *)occgeo;
|
||||||
|
|
||||||
return (geo);
|
return (geo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Extract a
|
|
||||||
|
//
|
||||||
|
DLL_HEADER Ng_Result Ng_OCC_SetLocalMeshSize (Ng_OCC_Geometry * geom,
|
||||||
|
Ng_Mesh * mesh,
|
||||||
|
Ng_Meshing_Parameters * mp)
|
||||||
|
{
|
||||||
|
OCCGeometry * occgeom = (OCCGeometry*)geom;
|
||||||
|
Mesh * me = (Mesh*)mesh;
|
||||||
|
|
||||||
|
mparam.uselocalh = mp->uselocalh;
|
||||||
|
|
||||||
|
mparam.maxh = mp->maxh;
|
||||||
|
mparam.minh = mp->minh;
|
||||||
|
|
||||||
|
mparam.segmentsperedge = mp->elementsperedge;
|
||||||
|
mparam.curvaturesafety = mp->elementspercurve;
|
||||||
|
|
||||||
|
mparam.grading = mp->grading;
|
||||||
|
mparam.meshsizefilename = mp->meshsize_filename;
|
||||||
|
|
||||||
|
occparam.resthcloseedgeenable = mp->closeedgeenable;
|
||||||
|
occparam.resthcloseedgefac = mp->closeedgefact;
|
||||||
|
|
||||||
|
delete me;
|
||||||
|
me = new Mesh;
|
||||||
|
|
||||||
|
OCCSetLocalMeshSize(*occgeom, *me);
|
||||||
|
|
||||||
|
return(NG_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Mesh the edges and add Face descriptors to prepare for surface meshing
|
||||||
|
DLL_HEADER Ng_Result Ng_OCC_GenerateEdgeMesh (Ng_OCC_Geometry * geom,
|
||||||
|
Ng_Mesh * mesh,
|
||||||
|
Ng_Meshing_Parameters * mp)
|
||||||
|
{
|
||||||
|
OCCGeometry * occgeom = (OCCGeometry*)geom;
|
||||||
|
Mesh * me = (Mesh*)mesh;
|
||||||
|
|
||||||
|
mparam.uselocalh = mp->uselocalh;
|
||||||
|
|
||||||
|
OCCFindEdges(*occgeom, *me);
|
||||||
|
|
||||||
|
if((me->GetNP()) && (me->GetNFD()))
|
||||||
|
{
|
||||||
|
return NG_OK;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return NG_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Mesh the edges and add Face descriptors to prepare for surface meshing
|
||||||
|
DLL_HEADER Ng_Result Ng_OCC_GenerateSurfaceMesh (Ng_OCC_Geometry * geom,
|
||||||
|
Ng_Mesh * mesh,
|
||||||
|
Ng_Meshing_Parameters * mp)
|
||||||
|
{
|
||||||
|
int numpoints = 0;
|
||||||
|
|
||||||
|
OCCGeometry * occgeom = (OCCGeometry*)geom;
|
||||||
|
Mesh * me = (Mesh*)mesh;
|
||||||
|
|
||||||
|
mparam.uselocalh = mp->uselocalh;
|
||||||
|
|
||||||
|
// Only go into surface meshing if the face descriptors have already been added
|
||||||
|
if(!me->GetNFD())
|
||||||
|
return NG_ERROR;
|
||||||
|
|
||||||
|
numpoints = me->GetNP();
|
||||||
|
|
||||||
|
// Initially set up only for surface meshing without any optimisation
|
||||||
|
int perfstepsend = MESHCONST_MESHSURFACE;
|
||||||
|
|
||||||
|
// Check and if required, enable surface mesh optimisation step
|
||||||
|
if(mp->optsurfmeshenable)
|
||||||
|
{
|
||||||
|
perfstepsend = MESHCONST_OPTSURFACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
OCCMeshSurface(*occgeom, *me, perfstepsend);
|
||||||
|
|
||||||
|
me->CalcSurfacesOfNode();
|
||||||
|
|
||||||
|
if(me->GetNP() <= numpoints)
|
||||||
|
return NG_ERROR;
|
||||||
|
|
||||||
|
if(me->GetNSE() <= 0)
|
||||||
|
return NG_ERROR;
|
||||||
|
|
||||||
|
return NG_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Extract the face map from the OCC geometry
|
||||||
|
// The face map basically gives an index to each face in the geometry,
|
||||||
|
// which can be used to access a specific face
|
||||||
DLL_HEADER Ng_Result Ng_OCC_GetFMap(Ng_OCC_Geometry * geom,
|
DLL_HEADER Ng_Result Ng_OCC_GetFMap(Ng_OCC_Geometry * geom,
|
||||||
Ng_OCC_TopTools_IndexedMapOfShape * FMap)
|
Ng_OCC_TopTools_IndexedMapOfShape * FMap)
|
||||||
{
|
{
|
||||||
OCCGeometry* occgeom = (OCCGeometry*)geom;
|
OCCGeometry* occgeom = (OCCGeometry*)geom;
|
||||||
TopTools_IndexedMapOfShape *occfmap = (TopTools_IndexedMapOfShape *)FMap;
|
TopTools_IndexedMapOfShape *occfmap = (TopTools_IndexedMapOfShape *)FMap;
|
||||||
|
|
||||||
|
// Copy the face map from the geometry to the given variable
|
||||||
occfmap->Assign(occgeom->fmap);
|
occfmap->Assign(occgeom->fmap);
|
||||||
|
|
||||||
if(occfmap->Extent())
|
if(occfmap->Extent())
|
||||||
@ -694,13 +831,28 @@ namespace nglib
|
|||||||
|
|
||||||
DLL_HEADER Ng_Meshing_Parameters :: Ng_Meshing_Parameters()
|
DLL_HEADER Ng_Meshing_Parameters :: Ng_Meshing_Parameters()
|
||||||
{
|
{
|
||||||
|
uselocalh = 1;
|
||||||
|
|
||||||
maxh = 1000;
|
maxh = 1000;
|
||||||
|
minh = 0.0;
|
||||||
|
|
||||||
fineness = 0.5;
|
fineness = 0.5;
|
||||||
grading = 0.3;
|
grading = 0.3;
|
||||||
|
|
||||||
|
elementsperedge = 2.0;
|
||||||
|
elementspercurve = 2.0;
|
||||||
|
|
||||||
|
closeedgeenable = 0;
|
||||||
|
closeedgefact = 2.0;
|
||||||
|
|
||||||
secondorder = 0;
|
secondorder = 0;
|
||||||
meshsize_filename = 0;
|
|
||||||
quad_dominated = 0;
|
quad_dominated = 0;
|
||||||
|
|
||||||
|
meshsize_filename = 0;
|
||||||
|
|
||||||
|
optsurfmeshenable = 1;
|
||||||
|
optvolmeshenable = 1;
|
||||||
|
|
||||||
optsteps_2d = 3;
|
optsteps_2d = 3;
|
||||||
optsteps_3d = 3;
|
optsteps_3d = 3;
|
||||||
}
|
}
|
||||||
@ -709,13 +861,28 @@ namespace nglib
|
|||||||
|
|
||||||
DLL_HEADER void Ng_Meshing_Parameters :: Reset_Parameters()
|
DLL_HEADER void Ng_Meshing_Parameters :: Reset_Parameters()
|
||||||
{
|
{
|
||||||
|
uselocalh = 1;
|
||||||
|
|
||||||
maxh = 1000;
|
maxh = 1000;
|
||||||
|
minh = 0;
|
||||||
|
|
||||||
fineness = 0.5;
|
fineness = 0.5;
|
||||||
grading = 0.3;
|
grading = 0.3;
|
||||||
|
|
||||||
|
elementsperedge = 2.0;
|
||||||
|
elementspercurve = 2.0;
|
||||||
|
|
||||||
|
closeedgeenable = 0;
|
||||||
|
closeedgefact = 2.0;
|
||||||
|
|
||||||
secondorder = 0;
|
secondorder = 0;
|
||||||
meshsize_filename = 0;
|
|
||||||
quad_dominated = 0;
|
quad_dominated = 0;
|
||||||
|
|
||||||
|
meshsize_filename = 0;
|
||||||
|
|
||||||
|
optsurfmeshenable = 1;
|
||||||
|
optvolmeshenable = 1;
|
||||||
|
|
||||||
optsteps_2d = 3;
|
optsteps_2d = 3;
|
||||||
optsteps_3d = 3;
|
optsteps_3d = 3;
|
||||||
}
|
}
|
||||||
@ -723,6 +890,8 @@ namespace nglib
|
|||||||
} // End of namespace nglib
|
} // End of namespace nglib
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// compatibility functions:
|
// compatibility functions:
|
||||||
|
|
||||||
namespace netgen
|
namespace netgen
|
||||||
@ -762,3 +931,4 @@ namespace netgen
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // End of namespace netgen
|
} // End of namespace netgen
|
||||||
|
|
||||||
|
@ -92,12 +92,28 @@ enum Ng_Result
|
|||||||
class Ng_Meshing_Parameters
|
class Ng_Meshing_Parameters
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
double maxh; //!< Maximum global mesh size limit
|
int uselocalh; //!< Switch to enable / disable usage of local mesh size modifiers
|
||||||
|
|
||||||
|
double maxh; //!< Maximum global mesh size allowed
|
||||||
|
double minh; //!< Minimum global mesh size allowed
|
||||||
|
|
||||||
double fineness; //!< Mesh density: 0...1 (0 => coarse; 1 => fine)
|
double fineness; //!< Mesh density: 0...1 (0 => coarse; 1 => fine)
|
||||||
double grading; //!< Mesh grading: 0...1 (0 => uniform mesh; 1 => aggressive local grading)
|
double grading; //!< Mesh grading: 0...1 (0 => uniform mesh; 1 => aggressive local grading)
|
||||||
|
|
||||||
|
double elementsperedge; //!< Number of elements to generate per edge of the geometry
|
||||||
|
double elementspercurve; //!< Elements to generate per curvature radius
|
||||||
|
|
||||||
|
int closeedgeenable; //!< Enable / Disable mesh refinement at close edges
|
||||||
|
double closeedgefact; //!< Factor to use for refinement at close edges (STL: larger => finer ; OCC: larger => coarser)
|
||||||
|
|
||||||
int secondorder; //!< Generate second-order surface and volume elements
|
int secondorder; //!< Generate second-order surface and volume elements
|
||||||
char * meshsize_filename; //!< Optional external mesh size file
|
|
||||||
int quad_dominated; //!< Creates a Quad-dominated mesh
|
int quad_dominated; //!< Creates a Quad-dominated mesh
|
||||||
|
|
||||||
|
char * meshsize_filename; //!< Optional external mesh size file
|
||||||
|
|
||||||
|
int optsurfmeshenable; //!< Enable / Disable automatic surface mesh optimization
|
||||||
|
int optvolmeshenable; //!< Enable / Disable automatic volume mesh optimization
|
||||||
|
|
||||||
int optsteps_3d; //!< Number of optimize steps to use for 3-D mesh optimization
|
int optsteps_3d; //!< Number of optimize steps to use for 3-D mesh optimization
|
||||||
int optsteps_2d; //!< Number of optimize steps to use for 2-D mesh optimization
|
int optsteps_2d; //!< Number of optimize steps to use for 2-D mesh optimization
|
||||||
|
|
||||||
@ -107,12 +123,19 @@ public:
|
|||||||
|
|
||||||
Note: This constructor initialises the variables in the
|
Note: This constructor initialises the variables in the
|
||||||
class with the following default values
|
class with the following default values
|
||||||
|
- #uselocalh: 1
|
||||||
- #maxh: 1000.0
|
- #maxh: 1000.0
|
||||||
- #fineness: 0.5
|
- #fineness: 0.5
|
||||||
- #grading: 0.3
|
- #grading: 0.3
|
||||||
|
- #elementsperedge: 2.0
|
||||||
|
- #elementspercurve: 2.0
|
||||||
|
- #closeedgeenable: 0
|
||||||
|
- #closeedgefact: 2.0
|
||||||
- #secondorder: 0.0
|
- #secondorder: 0.0
|
||||||
- #meshsize_filename: null
|
- #meshsize_filename: null
|
||||||
- #quad_dominated: 0
|
- #quad_dominated: 0
|
||||||
|
- #optsurfmeshenable: 1
|
||||||
|
- #optvolmeshenable: 1
|
||||||
- #optsteps_2d: 3
|
- #optsteps_2d: 3
|
||||||
- #optsteps_3d: 3
|
- #optsteps_3d: 3
|
||||||
*/
|
*/
|
||||||
@ -543,8 +566,8 @@ DLL_HEADER Ng_Result Ng_STL_MakeEdges (Ng_STL_Geometry * geom,
|
|||||||
|
|
||||||
// generates mesh, empty mesh must be already created.
|
// generates mesh, empty mesh must be already created.
|
||||||
DLL_HEADER Ng_Result Ng_STL_GenerateSurfaceMesh (Ng_STL_Geometry * geom,
|
DLL_HEADER Ng_Result Ng_STL_GenerateSurfaceMesh (Ng_STL_Geometry * geom,
|
||||||
Ng_Mesh * mesh,
|
Ng_Mesh * mesh,
|
||||||
Ng_Meshing_Parameters * mp);
|
Ng_Meshing_Parameters * mp);
|
||||||
|
|
||||||
|
|
||||||
#ifdef ACIS
|
#ifdef ACIS
|
||||||
@ -587,10 +610,25 @@ DLL_HEADER Ng_OCC_Geometry * Ng_OCC_Load_IGES (const char * filename);
|
|||||||
// Loads geometry from BREP file
|
// Loads geometry from BREP file
|
||||||
DLL_HEADER Ng_OCC_Geometry * Ng_OCC_Load_BREP (const char * filename);
|
DLL_HEADER Ng_OCC_Geometry * Ng_OCC_Load_BREP (const char * filename);
|
||||||
|
|
||||||
|
// Set the local mesh size based on geometry / topology
|
||||||
|
DLL_HEADER Ng_Result Ng_OCC_SetLocalMeshSize (Ng_OCC_Geometry * geom,
|
||||||
|
Ng_Mesh * mesh,
|
||||||
|
Ng_Meshing_Parameters * mp);
|
||||||
|
|
||||||
|
// Mesh the edges and add Face descriptors to prepare for surface meshing
|
||||||
|
DLL_HEADER Ng_Result Ng_OCC_GenerateEdgeMesh (Ng_OCC_Geometry * geom,
|
||||||
|
Ng_Mesh * mesh,
|
||||||
|
Ng_Meshing_Parameters * mp);
|
||||||
|
|
||||||
|
// Mesh the surfaces of an OCC geometry
|
||||||
|
DLL_HEADER Ng_Result Ng_OCC_GenerateSurfaceMesh (Ng_OCC_Geometry * geom,
|
||||||
|
Ng_Mesh * mesh,
|
||||||
|
Ng_Meshing_Parameters * mp);
|
||||||
|
|
||||||
// Get the face map of an already loaded OCC geometry
|
// Get the face map of an already loaded OCC geometry
|
||||||
DLL_HEADER Ng_Result Ng_OCC_GetFMap(Ng_OCC_Geometry * geom,
|
DLL_HEADER Ng_Result Ng_OCC_GetFMap(Ng_OCC_Geometry * geom,
|
||||||
Ng_OCC_TopTools_IndexedMapOfShape * FMap);
|
Ng_OCC_TopTools_IndexedMapOfShape * FMap);
|
||||||
|
|
||||||
#endif
|
#endif // OCCGEOMETRY
|
||||||
|
|
||||||
#endif
|
#endif // NGLIB
|
||||||
|
Loading…
Reference in New Issue
Block a user