mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-27 13:20:34 +05:00
don't use global mparam in occ-meshing
This commit is contained in:
parent
b2e4eb3ff0
commit
954cae2686
@ -57,7 +57,7 @@ namespace netgen
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
double ComputeH (double kappa)
|
double ComputeH (double kappa, const MeshingParameters & mparam)
|
||||||
{
|
{
|
||||||
double hret;
|
double hret;
|
||||||
kappa *= mparam.curvaturesafety;
|
kappa *= mparam.curvaturesafety;
|
||||||
@ -77,7 +77,8 @@ namespace netgen
|
|||||||
|
|
||||||
|
|
||||||
void RestrictHTriangle (gp_Pnt2d & par0, gp_Pnt2d & par1, gp_Pnt2d & par2,
|
void RestrictHTriangle (gp_Pnt2d & par0, gp_Pnt2d & par1, gp_Pnt2d & par2,
|
||||||
BRepLProp_SLProps * prop, Mesh & mesh, int depth, double h = 0)
|
BRepLProp_SLProps * prop, Mesh & mesh, int depth, double h,
|
||||||
|
const MeshingParameters & mparam)
|
||||||
{
|
{
|
||||||
int ls = -1;
|
int ls = -1;
|
||||||
|
|
||||||
@ -166,7 +167,7 @@ namespace netgen
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
h = ComputeH (curvature+1e-10);
|
h = ComputeH (curvature+1e-10, mparam);
|
||||||
|
|
||||||
if(h < 1e-4*maxside)
|
if(h < 1e-4*maxside)
|
||||||
return;
|
return;
|
||||||
@ -188,20 +189,20 @@ namespace netgen
|
|||||||
if(ls == 0)
|
if(ls == 0)
|
||||||
{
|
{
|
||||||
pm.SetX(0.5*(par1.X()+par2.X())); pm.SetY(0.5*(par1.Y()+par2.Y()));
|
pm.SetX(0.5*(par1.X()+par2.X())); pm.SetY(0.5*(par1.Y()+par2.Y()));
|
||||||
RestrictHTriangle(pm, par2, par0, prop, mesh, depth+1, h);
|
RestrictHTriangle(pm, par2, par0, prop, mesh, depth+1, h, mparam);
|
||||||
RestrictHTriangle(pm, par0, par1, prop, mesh, depth+1, h);
|
RestrictHTriangle(pm, par0, par1, prop, mesh, depth+1, h, mparam);
|
||||||
}
|
}
|
||||||
else if(ls == 1)
|
else if(ls == 1)
|
||||||
{
|
{
|
||||||
pm.SetX(0.5*(par0.X()+par2.X())); pm.SetY(0.5*(par0.Y()+par2.Y()));
|
pm.SetX(0.5*(par0.X()+par2.X())); pm.SetY(0.5*(par0.Y()+par2.Y()));
|
||||||
RestrictHTriangle(pm, par1, par2, prop, mesh, depth+1, h);
|
RestrictHTriangle(pm, par1, par2, prop, mesh, depth+1, h, mparam);
|
||||||
RestrictHTriangle(pm, par0, par1, prop, mesh, depth+1, h);
|
RestrictHTriangle(pm, par0, par1, prop, mesh, depth+1, h, mparam);
|
||||||
}
|
}
|
||||||
else if(ls == 2)
|
else if(ls == 2)
|
||||||
{
|
{
|
||||||
pm.SetX(0.5*(par0.X()+par1.X())); pm.SetY(0.5*(par0.Y()+par1.Y()));
|
pm.SetX(0.5*(par0.X()+par1.X())); pm.SetY(0.5*(par0.Y()+par1.Y()));
|
||||||
RestrictHTriangle(pm, par1, par2, prop, mesh, depth+1, h);
|
RestrictHTriangle(pm, par1, par2, prop, mesh, depth+1, h, mparam);
|
||||||
RestrictHTriangle(pm, par2, par0, prop, mesh, depth+1, h);
|
RestrictHTriangle(pm, par2, par0, prop, mesh, depth+1, h, mparam);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -232,7 +233,8 @@ namespace netgen
|
|||||||
|
|
||||||
|
|
||||||
void DivideEdge (TopoDS_Edge & edge, NgArray<MeshPoint> & ps,
|
void DivideEdge (TopoDS_Edge & edge, NgArray<MeshPoint> & ps,
|
||||||
NgArray<double> & params, Mesh & mesh)
|
NgArray<double> & params, Mesh & mesh,
|
||||||
|
const MeshingParameters & mparam)
|
||||||
{
|
{
|
||||||
double s0, s1;
|
double s0, s1;
|
||||||
double maxh = mparam.maxh;
|
double maxh = mparam.maxh;
|
||||||
@ -312,7 +314,7 @@ namespace netgen
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void OCCFindEdges (OCCGeometry & geom, Mesh & mesh)
|
void OCCFindEdges (OCCGeometry & geom, Mesh & mesh, const MeshingParameters & mparam)
|
||||||
{
|
{
|
||||||
const char * savetask = multithread.task;
|
const char * savetask = multithread.task;
|
||||||
multithread.task = "Edge meshing";
|
multithread.task = "Edge meshing";
|
||||||
@ -474,7 +476,7 @@ namespace netgen
|
|||||||
NgArray <MeshPoint> mp;
|
NgArray <MeshPoint> mp;
|
||||||
NgArray <double> params;
|
NgArray <double> params;
|
||||||
|
|
||||||
DivideEdge (edge, mp, params, mesh);
|
DivideEdge (edge, mp, params, mesh, mparam);
|
||||||
|
|
||||||
NgArray <int> pnums;
|
NgArray <int> pnums;
|
||||||
pnums.SetSize (mp.Size()+2);
|
pnums.SetSize (mp.Size()+2);
|
||||||
@ -606,7 +608,8 @@ namespace netgen
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void OCCMeshSurface (OCCGeometry & geom, Mesh & mesh, int perfstepsend)
|
void OCCMeshSurface (OCCGeometry & geom, Mesh & mesh, int perfstepsend,
|
||||||
|
MeshingParameters & mparam)
|
||||||
{
|
{
|
||||||
int i, j, k;
|
int i, j, k;
|
||||||
int changed;
|
int changed;
|
||||||
@ -661,7 +664,7 @@ namespace netgen
|
|||||||
|
|
||||||
// int projecttype = PLANESPACE;
|
// int projecttype = PLANESPACE;
|
||||||
|
|
||||||
Meshing2OCCSurfaces meshing(TopoDS::Face(geom.fmap(k)), bb, projecttype);
|
Meshing2OCCSurfaces meshing(TopoDS::Face(geom.fmap(k)), bb, projecttype, mparam);
|
||||||
|
|
||||||
if (meshing.GetProjectionType() == PLANESPACE)
|
if (meshing.GetProjectionType() == PLANESPACE)
|
||||||
PrintMessage (2, "Face ", k, " / ", mesh.GetNFD(), " (plane space projection)");
|
PrintMessage (2, "Face ", k, " / ", mesh.GetNFD(), " (plane space projection)");
|
||||||
@ -988,10 +991,11 @@ namespace netgen
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void OCCSetLocalMeshSize(OCCGeometry & geom, Mesh & mesh)
|
void OCCSetLocalMeshSize(OCCGeometry & geom, Mesh & mesh,
|
||||||
|
const MeshingParameters & mparam)
|
||||||
{
|
{
|
||||||
mesh.SetGlobalH (mparam.maxh);
|
mesh.SetGlobalH (mparam.maxh);
|
||||||
mesh.SetMinimalH (mparam.minh);
|
mesh.SetMinimalH (mparam.minh);
|
||||||
|
|
||||||
NgArray<double> maxhdom;
|
NgArray<double> maxhdom;
|
||||||
maxhdom.SetSize (geom.NrSolids());
|
maxhdom.SetSize (geom.NrSolids());
|
||||||
@ -1117,7 +1121,7 @@ namespace netgen
|
|||||||
|
|
||||||
gp_Pnt pnt = c->Value (s);
|
gp_Pnt pnt = c->Value (s);
|
||||||
|
|
||||||
mesh.RestrictLocalH (Point3d(pnt.X(), pnt.Y(), pnt.Z()), ComputeH (fabs(curvature)));
|
mesh.RestrictLocalH (Point3d(pnt.X(), pnt.Y(), pnt.Z()), ComputeH (fabs(curvature), mparam));
|
||||||
}
|
}
|
||||||
// (*testout) << "edge " << i << " max. curvature: " << maxcur << endl;
|
// (*testout) << "edge " << i << " max. curvature: " << maxcur << endl;
|
||||||
}
|
}
|
||||||
@ -1165,7 +1169,7 @@ namespace netgen
|
|||||||
//maxside = max (maxside, p[1].Distance(p[2]));
|
//maxside = max (maxside, p[1].Distance(p[2]));
|
||||||
//cout << "\rFace " << i << " pos11 ntriangles " << ntriangles << " maxside " << maxside << flush;
|
//cout << "\rFace " << i << " pos11 ntriangles " << ntriangles << " maxside " << maxside << flush;
|
||||||
|
|
||||||
RestrictHTriangle (par[0], par[1], par[2], &prop, mesh, 0);
|
RestrictHTriangle (par[0], par[1], par[2], &prop, mesh, 0, 0, mparam);
|
||||||
//cout << "\rFace " << i << " pos12 ntriangles " << ntriangles << flush;
|
//cout << "\rFace " << i << " pos12 ntriangles " << ntriangles << flush;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1298,7 +1302,7 @@ namespace netgen
|
|||||||
mesh = make_shared<Mesh>();
|
mesh = make_shared<Mesh>();
|
||||||
mesh->geomtype = Mesh::GEOM_OCC;
|
mesh->geomtype = Mesh::GEOM_OCC;
|
||||||
|
|
||||||
OCCSetLocalMeshSize(geom,*mesh);
|
OCCSetLocalMeshSize(geom,*mesh, mparam);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (multithread.terminate || mparam.perfstepsend <= MESHCONST_ANALYSE)
|
if (multithread.terminate || mparam.perfstepsend <= MESHCONST_ANALYSE)
|
||||||
@ -1306,7 +1310,7 @@ namespace netgen
|
|||||||
|
|
||||||
if (mparam.perfstepsstart <= MESHCONST_MESHEDGES)
|
if (mparam.perfstepsstart <= MESHCONST_MESHEDGES)
|
||||||
{
|
{
|
||||||
OCCFindEdges (geom, *mesh);
|
OCCFindEdges (geom, *mesh, mparam);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
cout << "Removing redundant points" << endl;
|
cout << "Removing redundant points" << endl;
|
||||||
@ -1379,7 +1383,7 @@ namespace netgen
|
|||||||
|
|
||||||
if (mparam.perfstepsstart <= MESHCONST_MESHSURFACE)
|
if (mparam.perfstepsstart <= MESHCONST_MESHSURFACE)
|
||||||
{
|
{
|
||||||
OCCMeshSurface (geom, *mesh, mparam.perfstepsend);
|
OCCMeshSurface (geom, *mesh, mparam.perfstepsend, mparam);
|
||||||
if (multithread.terminate) return TCL_OK;
|
if (multithread.terminate) return TCL_OK;
|
||||||
|
|
||||||
#ifdef LOG_STREAM
|
#ifdef LOG_STREAM
|
||||||
|
@ -166,7 +166,7 @@ void STEP_GetEntityName(const TopoDS_Shape & theShape, STEPCAFControl_Reader * a
|
|||||||
for (exp0.Init(shape, TopAbs_COMPSOLID); exp0.More(); exp0.Next()) nrcs++;
|
for (exp0.Init(shape, TopAbs_COMPSOLID); exp0.More(); exp0.Next()) nrcs++;
|
||||||
|
|
||||||
double surfacecont = 0;
|
double surfacecont = 0;
|
||||||
|
|
||||||
{
|
{
|
||||||
Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
|
Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
|
||||||
rebuild->Apply(shape);
|
rebuild->Apply(shape);
|
||||||
@ -869,7 +869,7 @@ void STEP_GetEntityName(const TopoDS_Shape & theShape, STEPCAFControl_Reader * a
|
|||||||
// Philippose - 15/01/2009
|
// Philippose - 15/01/2009
|
||||||
face_maxh.DeleteAll();
|
face_maxh.DeleteAll();
|
||||||
face_maxh.SetSize (fmap.Extent());
|
face_maxh.SetSize (fmap.Extent());
|
||||||
face_maxh = mparam.maxh;
|
face_maxh = 1e99; // mparam.maxh;
|
||||||
|
|
||||||
// Philippose - 15/01/2010
|
// Philippose - 15/01/2010
|
||||||
face_maxh_modified.DeleteAll();
|
face_maxh_modified.DeleteAll();
|
||||||
|
@ -114,7 +114,7 @@ namespace netgen
|
|||||||
{
|
{
|
||||||
#include "occmeshsurf.hpp"
|
#include "occmeshsurf.hpp"
|
||||||
|
|
||||||
extern DLL_HEADER MeshingParameters mparam;
|
// extern DLL_HEADER MeshingParameters mparam;
|
||||||
|
|
||||||
#define PROJECTION_TOLERANCE 1e-10
|
#define PROJECTION_TOLERANCE 1e-10
|
||||||
|
|
||||||
@ -300,7 +300,7 @@ namespace netgen
|
|||||||
// Philippose - 15/01/2009
|
// Philippose - 15/01/2009
|
||||||
// Sets the maximum mesh size for a given face
|
// Sets the maximum mesh size for a given face
|
||||||
// (Note: Local mesh size limited by the global max mesh size)
|
// (Note: Local mesh size limited by the global max mesh size)
|
||||||
void SetFaceMaxH(int facenr, double faceh)
|
void SetFaceMaxH(int facenr, double faceh, const MeshingParameters & mparam)
|
||||||
{
|
{
|
||||||
if((facenr> 0) && (facenr <= fmap.Extent()))
|
if((facenr> 0) && (facenr <= fmap.Extent()))
|
||||||
{
|
{
|
||||||
@ -310,7 +310,7 @@ namespace netgen
|
|||||||
// If the face maxh is greater than or equal to the
|
// If the face maxh is greater than or equal to the
|
||||||
// current global maximum, then identify the face as
|
// current global maximum, then identify the face as
|
||||||
// not explicitly controlled by the user any more
|
// not explicitly controlled by the user any more
|
||||||
if(faceh >= mparam.maxh)
|
if(faceh >= mparam.maxh)
|
||||||
{
|
{
|
||||||
face_maxh_modified[facenr-1] = 0;
|
face_maxh_modified[facenr-1] = 0;
|
||||||
}
|
}
|
||||||
@ -444,11 +444,11 @@ namespace netgen
|
|||||||
DLL_HEADER extern int OCCGenerateMesh (OCCGeometry & occgeometry, shared_ptr<Mesh> & mesh,
|
DLL_HEADER extern int OCCGenerateMesh (OCCGeometry & occgeometry, shared_ptr<Mesh> & mesh,
|
||||||
MeshingParameters & mparam);
|
MeshingParameters & mparam);
|
||||||
|
|
||||||
DLL_HEADER extern void OCCSetLocalMeshSize(OCCGeometry & geom, Mesh & mesh);
|
DLL_HEADER extern void OCCSetLocalMeshSize(OCCGeometry & geom, Mesh & mesh, const MeshingParameters & mparam);
|
||||||
|
|
||||||
DLL_HEADER extern void OCCMeshSurface (OCCGeometry & geom, Mesh & mesh, int perfstepsend);
|
DLL_HEADER extern void OCCMeshSurface (OCCGeometry & geom, Mesh & mesh, int perfstepsend, MeshingParameters & mparam);
|
||||||
|
|
||||||
DLL_HEADER extern void OCCFindEdges (OCCGeometry & geom, Mesh & mesh);
|
DLL_HEADER extern void OCCFindEdges (OCCGeometry & geom, Mesh & mesh, const MeshingParameters & mparam);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -376,7 +376,8 @@ namespace netgen
|
|||||||
|
|
||||||
|
|
||||||
Meshing2OCCSurfaces :: Meshing2OCCSurfaces (const TopoDS_Shape & asurf,
|
Meshing2OCCSurfaces :: Meshing2OCCSurfaces (const TopoDS_Shape & asurf,
|
||||||
const Box<3> & abb, int aprojecttype)
|
const Box<3> & abb, int aprojecttype,
|
||||||
|
const MeshingParameters & mparam)
|
||||||
: Meshing2(mparam, Box<3>(abb.PMin(), abb.PMax())), surface(TopoDS::Face(asurf), aprojecttype)
|
: Meshing2(mparam, Box<3>(abb.PMin(), abb.PMax())), surface(TopoDS::Face(asurf), aprojecttype)
|
||||||
{
|
{
|
||||||
;
|
;
|
||||||
|
@ -112,7 +112,8 @@ class Meshing2OCCSurfaces : public Meshing2
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
Meshing2OCCSurfaces (const TopoDS_Shape & asurf, const Box<3> & aboundingbox, int aprojecttype);
|
Meshing2OCCSurfaces (const TopoDS_Shape & asurf, const Box<3> & aboundingbox,
|
||||||
|
int aprojecttype, const MeshingParameters & mparam);
|
||||||
|
|
||||||
///
|
///
|
||||||
int GetProjectionType ()
|
int GetProjectionType ()
|
||||||
|
@ -27,6 +27,7 @@ namespace netgen
|
|||||||
{
|
{
|
||||||
extern DLL_HEADER shared_ptr<NetgenGeometry> ng_geometry;
|
extern DLL_HEADER shared_ptr<NetgenGeometry> ng_geometry;
|
||||||
extern DLL_HEADER shared_ptr<Mesh> mesh;
|
extern DLL_HEADER shared_ptr<Mesh> mesh;
|
||||||
|
extern DLL_HEADER MeshingParameters mparam;
|
||||||
|
|
||||||
char * err_needsoccgeometry = (char*) "This operation needs an OCC geometry";
|
char * err_needsoccgeometry = (char*) "This operation needs an OCC geometry";
|
||||||
extern char * err_needsmesh;
|
extern char * err_needsmesh;
|
||||||
@ -588,7 +589,7 @@ namespace netgen
|
|||||||
{
|
{
|
||||||
if(!occgeometry->GetFaceMaxhModified(i))
|
if(!occgeometry->GetFaceMaxhModified(i))
|
||||||
{
|
{
|
||||||
occgeometry->SetFaceMaxH(i, mparam.maxh);
|
occgeometry->SetFaceMaxH(i, mparam.maxh, mparam);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -597,7 +598,7 @@ namespace netgen
|
|||||||
int facenr = atoi (argv[2]);
|
int facenr = atoi (argv[2]);
|
||||||
double surfms = atof (argv[3]);
|
double surfms = atof (argv[3]);
|
||||||
if (occgeometry && facenr >= 1 && facenr <= occgeometry->NrFaces())
|
if (occgeometry && facenr >= 1 && facenr <= occgeometry->NrFaces())
|
||||||
occgeometry->SetFaceMaxH(facenr, surfms);
|
occgeometry->SetFaceMaxH(facenr, surfms, mparam);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -608,7 +609,7 @@ namespace netgen
|
|||||||
{
|
{
|
||||||
int nrFaces = occgeometry->NrFaces();
|
int nrFaces = occgeometry->NrFaces();
|
||||||
for (int i = 1; i <= nrFaces; i++)
|
for (int i = 1; i <= nrFaces; i++)
|
||||||
occgeometry->SetFaceMaxH(i, surfms);
|
occgeometry->SetFaceMaxH(i, surfms, mparam);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -857,7 +857,7 @@ namespace nglib
|
|||||||
// slate
|
// slate
|
||||||
me->DeleteMesh();
|
me->DeleteMesh();
|
||||||
|
|
||||||
OCCSetLocalMeshSize(*occgeom, *me);
|
OCCSetLocalMeshSize(*occgeom, *me, mparam);
|
||||||
|
|
||||||
return(NG_OK);
|
return(NG_OK);
|
||||||
}
|
}
|
||||||
@ -875,7 +875,7 @@ namespace nglib
|
|||||||
|
|
||||||
mp->Transfer_Parameters();
|
mp->Transfer_Parameters();
|
||||||
|
|
||||||
OCCFindEdges(*occgeom, *me);
|
OCCFindEdges(*occgeom, *me, mparam);
|
||||||
|
|
||||||
if((me->GetNP()) && (me->GetNFD()))
|
if((me->GetNP()) && (me->GetNFD()))
|
||||||
{
|
{
|
||||||
@ -920,7 +920,7 @@ namespace nglib
|
|||||||
perfstepsend = MESHCONST_OPTSURFACE;
|
perfstepsend = MESHCONST_OPTSURFACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
OCCMeshSurface(*occgeom, *me, perfstepsend);
|
OCCMeshSurface(*occgeom, *me, perfstepsend, mparam);
|
||||||
|
|
||||||
me->CalcSurfacesOfNode();
|
me->CalcSurfacesOfNode();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user