mirror of
https://github.com/NGSolve/netgen.git
synced 2024-11-11 16:49:16 +05:00
firststep and laststep as meshingparameters to be exported to python
This commit is contained in:
parent
953bd13cf4
commit
7e4892a9e7
@ -129,14 +129,12 @@ namespace netgen
|
||||
|
||||
|
||||
extern int CSGGenerateMesh (CSGeometry & geom,
|
||||
shared_ptr<Mesh> & mesh, MeshingParameters & mparam,
|
||||
int perfstepsstart, int perfstepsend);
|
||||
shared_ptr<Mesh> & mesh, MeshingParameters & mparam);
|
||||
|
||||
|
||||
int CSGeometry :: GenerateMesh (shared_ptr<Mesh> & mesh, MeshingParameters & mparam,
|
||||
int perfstepsstart, int perfstepsend)
|
||||
int CSGeometry :: GenerateMesh (shared_ptr<Mesh> & mesh, MeshingParameters & mparam)
|
||||
{
|
||||
return CSGGenerateMesh (*this, mesh, mparam, perfstepsstart, perfstepsend);
|
||||
return CSGGenerateMesh (*this, mesh, mparam);
|
||||
}
|
||||
|
||||
|
||||
|
@ -313,8 +313,7 @@ namespace netgen
|
||||
|
||||
Array<BCModification> bcmodifications;
|
||||
|
||||
virtual int GenerateMesh (shared_ptr<Mesh> & mesh, MeshingParameters & mparam,
|
||||
int perfstepsstart, int perfstepsend);
|
||||
virtual int GenerateMesh (shared_ptr<Mesh> & mesh, MeshingParameters & mparam);
|
||||
|
||||
virtual const Refinement & GetRefinement () const;
|
||||
};
|
||||
|
@ -658,17 +658,16 @@ namespace netgen
|
||||
|
||||
|
||||
int CSGGenerateMesh (CSGeometry & geom,
|
||||
shared_ptr<Mesh> & mesh, MeshingParameters & mparam,
|
||||
int perfstepsstart, int perfstepsend)
|
||||
shared_ptr<Mesh> & mesh, MeshingParameters & mparam)
|
||||
{
|
||||
if (mesh && mesh->GetNSE() &&
|
||||
!geom.GetNSolids())
|
||||
{
|
||||
if (perfstepsstart < MESHCONST_MESHVOLUME)
|
||||
perfstepsstart = MESHCONST_MESHVOLUME;
|
||||
if (mparam.perfstepsstart < MESHCONST_MESHVOLUME)
|
||||
mparam.perfstepsstart = MESHCONST_MESHVOLUME;
|
||||
}
|
||||
|
||||
if (perfstepsstart <= MESHCONST_ANALYSE)
|
||||
if (mparam.perfstepsstart <= MESHCONST_ANALYSE)
|
||||
{
|
||||
if (mesh)
|
||||
mesh -> DeleteMesh();
|
||||
@ -709,11 +708,11 @@ namespace netgen
|
||||
}
|
||||
|
||||
|
||||
if (multithread.terminate || perfstepsend <= MESHCONST_ANALYSE)
|
||||
if (multithread.terminate || mparam.perfstepsend <= MESHCONST_ANALYSE)
|
||||
return TCL_OK;
|
||||
|
||||
|
||||
if (perfstepsstart <= MESHCONST_MESHEDGES)
|
||||
if (mparam.perfstepsstart <= MESHCONST_MESHEDGES)
|
||||
{
|
||||
FindEdges (geom, *mesh, mparam, true);
|
||||
if (multithread.terminate) return TCL_OK;
|
||||
@ -746,11 +745,11 @@ namespace netgen
|
||||
}
|
||||
}
|
||||
|
||||
if (multithread.terminate || perfstepsend <= MESHCONST_MESHEDGES)
|
||||
if (multithread.terminate || mparam.perfstepsend <= MESHCONST_MESHEDGES)
|
||||
return TCL_OK;
|
||||
|
||||
|
||||
if (perfstepsstart <= MESHCONST_MESHSURFACE)
|
||||
if (mparam.perfstepsstart <= MESHCONST_MESHSURFACE)
|
||||
{
|
||||
MeshSurface (geom, *mesh, mparam);
|
||||
if (multithread.terminate) return TCL_OK;
|
||||
@ -791,11 +790,11 @@ namespace netgen
|
||||
mesh->CalcSurfacesOfNode();
|
||||
}
|
||||
|
||||
if (multithread.terminate || perfstepsend <= MESHCONST_OPTSURFACE)
|
||||
if (multithread.terminate || mparam.perfstepsend <= MESHCONST_OPTSURFACE)
|
||||
return TCL_OK;
|
||||
|
||||
|
||||
if (perfstepsstart <= MESHCONST_MESHVOLUME)
|
||||
if (mparam.perfstepsstart <= MESHCONST_MESHVOLUME)
|
||||
{
|
||||
multithread.task = "Volume meshing";
|
||||
|
||||
@ -826,11 +825,11 @@ namespace netgen
|
||||
#endif
|
||||
}
|
||||
|
||||
if (multithread.terminate || perfstepsend <= MESHCONST_MESHVOLUME)
|
||||
if (multithread.terminate || mparam.perfstepsend <= MESHCONST_MESHVOLUME)
|
||||
return TCL_OK;
|
||||
|
||||
|
||||
if (perfstepsstart <= MESHCONST_OPTVOLUME)
|
||||
if (mparam.perfstepsstart <= MESHCONST_OPTVOLUME)
|
||||
{
|
||||
multithread.task = "Volume optimization";
|
||||
|
||||
|
@ -626,7 +626,7 @@ DLL_HEADER void ExportCSG(py::module &m)
|
||||
geo->FindIdenticSurfaces(1e-8 * geo->MaxSize());
|
||||
try
|
||||
{
|
||||
geo->GenerateMesh (dummy, param, 0, 6);
|
||||
geo->GenerateMesh (dummy, param);
|
||||
}
|
||||
catch (NgException ex)
|
||||
{
|
||||
|
@ -986,8 +986,7 @@ namespace netgen
|
||||
MeshingParameters & mp);
|
||||
|
||||
|
||||
int SplineGeometry2d :: GenerateMesh (shared_ptr<Mesh> & mesh, MeshingParameters & mparam,
|
||||
int perfstepsstart, int perfstepsend)
|
||||
int SplineGeometry2d :: GenerateMesh (shared_ptr<Mesh> & mesh, MeshingParameters & mparam)
|
||||
{
|
||||
MeshFromSpline2D (*this, mesh, mparam);
|
||||
return 0;
|
||||
|
@ -156,8 +156,7 @@ namespace netgen
|
||||
}
|
||||
|
||||
|
||||
DLL_HEADER virtual int GenerateMesh (shared_ptr<Mesh> & mesh, MeshingParameters & mparam,
|
||||
int perfstepsstart, int perfstepsend);
|
||||
DLL_HEADER virtual int GenerateMesh (shared_ptr<Mesh> & mesh, MeshingParameters & mparam);
|
||||
|
||||
void PartitionBoundary (MeshingParameters & mp, double h, Mesh & mesh2d);
|
||||
|
||||
|
@ -258,7 +258,7 @@ DLL_HEADER void ExportGeom2d(py::module &m)
|
||||
mesh->SetGeometry(self);
|
||||
SetGlobalMesh (mesh);
|
||||
ng_geometry = self;
|
||||
self->GenerateMesh(mesh, mparam, 0, 0);
|
||||
self->GenerateMesh(mesh, mparam);
|
||||
return mesh;
|
||||
}))
|
||||
|
||||
|
@ -14,12 +14,11 @@ namespace netgen
|
||||
|
||||
|
||||
|
||||
int NetgenGeometry :: GenerateMesh (shared_ptr<Mesh> & mesh, MeshingParameters & mparam,
|
||||
int perfstepsstart, int perfstepsend)
|
||||
int NetgenGeometry :: GenerateMesh (shared_ptr<Mesh> & mesh, MeshingParameters & mparam)
|
||||
{
|
||||
if (!mesh) return 1;
|
||||
|
||||
if (perfstepsstart <= MESHCONST_MESHVOLUME)
|
||||
if (mparam.perfstepsstart <= MESHCONST_MESHVOLUME)
|
||||
{
|
||||
multithread.task = "Volume meshing";
|
||||
|
||||
@ -37,11 +36,11 @@ namespace netgen
|
||||
}
|
||||
|
||||
|
||||
if (multithread.terminate || perfstepsend <= MESHCONST_MESHVOLUME)
|
||||
if (multithread.terminate || mparam.perfstepsend <= MESHCONST_MESHVOLUME)
|
||||
return 0;
|
||||
|
||||
|
||||
if (perfstepsstart <= MESHCONST_OPTVOLUME)
|
||||
if (mparam.perfstepsstart <= MESHCONST_OPTVOLUME)
|
||||
{
|
||||
multithread.task = "Volume optimization";
|
||||
|
||||
|
@ -18,8 +18,7 @@ namespace netgen
|
||||
public:
|
||||
virtual ~NetgenGeometry () { ; }
|
||||
|
||||
virtual int GenerateMesh (shared_ptr<Mesh> & mesh, MeshingParameters & mparam,
|
||||
int perfstepsstart, int perfstepsend);
|
||||
virtual int GenerateMesh (shared_ptr<Mesh> & mesh, MeshingParameters & mparam);
|
||||
|
||||
virtual const Refinement & GetRefinement () const;
|
||||
|
||||
|
@ -1091,6 +1091,11 @@ namespace netgen
|
||||
double elsizeweight = 0.2;
|
||||
/// init with default values
|
||||
|
||||
/// start at step
|
||||
int perfstepsstart = 0;
|
||||
/// end at step
|
||||
int perfstepsend = 6;
|
||||
|
||||
|
||||
/// from mp3:
|
||||
/// give up quality class, 2d meshing
|
||||
|
@ -590,19 +590,23 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
|
||||
py::class_<MP> (m, "MeshingParameters")
|
||||
.def(py::init<>())
|
||||
.def("__init__",
|
||||
[](MP *instance, double maxh, bool quad_dominated, int optsteps2d, int optsteps3d)
|
||||
[](MP *instance, double maxh, bool quad_dominated, int optsteps2d, int optsteps3d,
|
||||
int perfstepsstart, int perfstepsend)
|
||||
{
|
||||
new (instance) MeshingParameters;
|
||||
instance->maxh = maxh;
|
||||
instance->quad = int(quad_dominated);
|
||||
instance->optsteps2d = optsteps2d;
|
||||
instance->optsteps3d = optsteps3d;
|
||||
instance->perfstepsstart = perfstepsstart;
|
||||
instance->perfstepsend = perfstepsend;
|
||||
},
|
||||
py::arg("maxh")=1000,
|
||||
py::arg("quad_dominated")=false,
|
||||
py::arg("optsteps2d") = 3,
|
||||
py::arg("optsteps3d") = 3
|
||||
,
|
||||
py::arg("optsteps3d") = 3,
|
||||
py::arg("perfstepsstart") = 0,
|
||||
py::arg("perfstepsend") = 6,
|
||||
"create meshing parameters"
|
||||
)
|
||||
.def("__str__", &ToString<MP>)
|
||||
|
@ -1273,12 +1273,11 @@ namespace netgen
|
||||
|
||||
|
||||
|
||||
int OCCGenerateMesh (OCCGeometry & geom, shared_ptr<Mesh> & mesh, MeshingParameters & mparam,
|
||||
int perfstepsstart, int perfstepsend)
|
||||
int OCCGenerateMesh (OCCGeometry & geom, shared_ptr<Mesh> & mesh, MeshingParameters & mparam)
|
||||
{
|
||||
multithread.percent = 0;
|
||||
|
||||
if (perfstepsstart <= MESHCONST_ANALYSE)
|
||||
if (mparam.perfstepsstart <= MESHCONST_ANALYSE)
|
||||
{
|
||||
// delete mesh;
|
||||
// mesh = make_shared<Mesh>();
|
||||
@ -1287,10 +1286,10 @@ namespace netgen
|
||||
OCCSetLocalMeshSize(geom,*mesh);
|
||||
}
|
||||
|
||||
if (multithread.terminate || perfstepsend <= MESHCONST_ANALYSE)
|
||||
if (multithread.terminate || mparam.perfstepsend <= MESHCONST_ANALYSE)
|
||||
return TCL_OK;
|
||||
|
||||
if (perfstepsstart <= MESHCONST_MESHEDGES)
|
||||
if (mparam.perfstepsstart <= MESHCONST_MESHEDGES)
|
||||
{
|
||||
OCCFindEdges (geom, *mesh);
|
||||
|
||||
@ -1360,12 +1359,12 @@ namespace netgen
|
||||
#endif
|
||||
}
|
||||
|
||||
if (multithread.terminate || perfstepsend <= MESHCONST_MESHEDGES)
|
||||
if (multithread.terminate || mparam.perfstepsend <= MESHCONST_MESHEDGES)
|
||||
return TCL_OK;
|
||||
|
||||
if (perfstepsstart <= MESHCONST_MESHSURFACE)
|
||||
if (mparam.perfstepsstart <= MESHCONST_MESHSURFACE)
|
||||
{
|
||||
OCCMeshSurface (geom, *mesh, perfstepsend);
|
||||
OCCMeshSurface (geom, *mesh, mparam.perfstepsend);
|
||||
if (multithread.terminate) return TCL_OK;
|
||||
|
||||
#ifdef LOG_STREAM
|
||||
@ -1384,10 +1383,10 @@ namespace netgen
|
||||
mesh->CalcSurfacesOfNode();
|
||||
}
|
||||
|
||||
if (multithread.terminate || perfstepsend <= MESHCONST_OPTSURFACE)
|
||||
if (multithread.terminate || mparam.perfstepsend <= MESHCONST_OPTSURFACE)
|
||||
return TCL_OK;
|
||||
|
||||
if (perfstepsstart <= MESHCONST_MESHVOLUME)
|
||||
if (mparam.perfstepsstart <= MESHCONST_MESHVOLUME)
|
||||
{
|
||||
multithread.task = "Volume meshing";
|
||||
|
||||
@ -1426,10 +1425,10 @@ namespace netgen
|
||||
#endif
|
||||
}
|
||||
|
||||
if (multithread.terminate || perfstepsend <= MESHCONST_MESHVOLUME)
|
||||
if (multithread.terminate || mparam.perfstepsend <= MESHCONST_MESHVOLUME)
|
||||
return TCL_OK;
|
||||
|
||||
if (perfstepsstart <= MESHCONST_OPTVOLUME)
|
||||
if (mparam.perfstepsstart <= MESHCONST_OPTVOLUME)
|
||||
{
|
||||
multithread.task = "Volume optimization";
|
||||
|
||||
|
@ -1564,10 +1564,9 @@ namespace netgen
|
||||
|
||||
|
||||
|
||||
int OCCGeometry :: GenerateMesh (shared_ptr<Mesh> & mesh, MeshingParameters & mparam,
|
||||
int perfstepsstart, int perfstepsend)
|
||||
int OCCGeometry :: GenerateMesh (shared_ptr<Mesh> & mesh, MeshingParameters & mparam)
|
||||
{
|
||||
return OCCGenerateMesh (*this, mesh, mparam, perfstepsstart, perfstepsend);
|
||||
return OCCGenerateMesh (*this, mesh, mparam);
|
||||
}
|
||||
|
||||
|
||||
|
@ -387,8 +387,7 @@ namespace netgen
|
||||
|
||||
// void WriteOCC_STL(char * filename);
|
||||
|
||||
DLL_HEADER virtual int GenerateMesh (shared_ptr<Mesh> & mesh, MeshingParameters & mparam,
|
||||
int perfstepsstart, int perfstepsend);
|
||||
DLL_HEADER virtual int GenerateMesh (shared_ptr<Mesh> & mesh, MeshingParameters & mparam);
|
||||
|
||||
DLL_HEADER virtual const Refinement & GetRefinement () const;
|
||||
};
|
||||
|
@ -91,10 +91,9 @@ void STLGeometry :: Save (string filename) const
|
||||
|
||||
|
||||
|
||||
int STLGeometry :: GenerateMesh (shared_ptr<Mesh> & mesh, MeshingParameters & mparam,
|
||||
int perfstepsstart, int perfstepsend)
|
||||
int STLGeometry :: GenerateMesh (shared_ptr<Mesh> & mesh, MeshingParameters & mparam)
|
||||
{
|
||||
return STLMeshingDummy (this, mesh, mparam, perfstepsstart, perfstepsend);
|
||||
return STLMeshingDummy (this, mesh, mparam);
|
||||
}
|
||||
|
||||
|
||||
|
@ -452,8 +452,7 @@ namespace netgen
|
||||
friend class MeshingSTLSurface;
|
||||
|
||||
|
||||
virtual int GenerateMesh (shared_ptr<Mesh> & mesh, MeshingParameters & mparam,
|
||||
int perfstepsstart, int perfstepsend);
|
||||
virtual int GenerateMesh (shared_ptr<Mesh> & mesh, MeshingParameters & mparam);
|
||||
|
||||
virtual const Refinement & GetRefinement () const;
|
||||
};
|
||||
@ -463,8 +462,7 @@ namespace netgen
|
||||
|
||||
|
||||
|
||||
extern int STLMeshingDummy (STLGeometry* stlgeometry, shared_ptr<Mesh> & mesh, MeshingParameters & mparam,
|
||||
int perfstepsstart, int perfstepsend);
|
||||
extern int STLMeshingDummy (STLGeometry* stlgeometry, shared_ptr<Mesh> & mesh, MeshingParameters & mparam);
|
||||
|
||||
|
||||
}
|
||||
|
@ -1329,16 +1329,15 @@ void STLGeometry :: RestrictHChartDistOneChart(int chartnum, Array<int>& acttrig
|
||||
}
|
||||
|
||||
|
||||
int STLMeshingDummy (STLGeometry* stlgeometry, shared_ptr<Mesh> & mesh, MeshingParameters & mparam,
|
||||
int perfstepsstart, int perfstepsend)
|
||||
int STLMeshingDummy (STLGeometry* stlgeometry, shared_ptr<Mesh> & mesh, MeshingParameters & mparam)
|
||||
{
|
||||
if (perfstepsstart > perfstepsend) return 0;
|
||||
if (mparam.perfstepsstart > mparam.perfstepsend) return 0;
|
||||
|
||||
multithread.terminate = 0;
|
||||
int success = 1;
|
||||
//int trialcntouter = 0;
|
||||
|
||||
if (perfstepsstart <= MESHCONST_MESHEDGES)
|
||||
if (mparam.perfstepsstart <= MESHCONST_MESHEDGES)
|
||||
{
|
||||
if (mesh)
|
||||
mesh -> DeleteMesh();
|
||||
@ -1368,8 +1367,8 @@ int STLMeshingDummy (STLGeometry* stlgeometry, shared_ptr<Mesh> & mesh, MeshingP
|
||||
if (multithread.terminate)
|
||||
return 0;
|
||||
|
||||
if (perfstepsstart <= MESHCONST_MESHSURFACE &&
|
||||
perfstepsend >= MESHCONST_MESHSURFACE)
|
||||
if (mparam.perfstepsstart <= MESHCONST_MESHSURFACE &&
|
||||
mparam.perfstepsend >= MESHCONST_MESHSURFACE)
|
||||
{
|
||||
|
||||
if (!stlgeometry->edgesfound)
|
||||
@ -1417,8 +1416,8 @@ int STLMeshingDummy (STLGeometry* stlgeometry, shared_ptr<Mesh> & mesh, MeshingP
|
||||
|
||||
if (success)
|
||||
{
|
||||
if (perfstepsstart <= MESHCONST_OPTSURFACE &&
|
||||
perfstepsend >= MESHCONST_OPTSURFACE)
|
||||
if (mparam.perfstepsstart <= MESHCONST_OPTSURFACE &&
|
||||
mparam.perfstepsend >= MESHCONST_OPTSURFACE)
|
||||
{
|
||||
if (!stlgeometry->edgesfound)
|
||||
{
|
||||
@ -1469,8 +1468,8 @@ int STLMeshingDummy (STLGeometry* stlgeometry, shared_ptr<Mesh> & mesh, MeshingP
|
||||
if (multithread.terminate)
|
||||
return 0;
|
||||
|
||||
if (perfstepsstart <= MESHCONST_MESHVOLUME &&
|
||||
perfstepsend >= MESHCONST_MESHVOLUME)
|
||||
if (mparam.perfstepsstart <= MESHCONST_MESHVOLUME &&
|
||||
mparam.perfstepsend >= MESHCONST_MESHVOLUME)
|
||||
{
|
||||
if (stlgeometry->volumemeshed)
|
||||
{
|
||||
@ -1540,8 +1539,8 @@ int STLMeshingDummy (STLGeometry* stlgeometry, shared_ptr<Mesh> & mesh, MeshingP
|
||||
if (multithread.terminate)
|
||||
return 0;
|
||||
|
||||
if (perfstepsstart <= MESHCONST_OPTVOLUME &&
|
||||
perfstepsend >= MESHCONST_OPTVOLUME)
|
||||
if (mparam.perfstepsstart <= MESHCONST_OPTVOLUME &&
|
||||
mparam.perfstepsend >= MESHCONST_OPTVOLUME)
|
||||
{
|
||||
if (!stlgeometry->edgesfound)
|
||||
{
|
||||
|
@ -1328,8 +1328,9 @@ namespace netgen
|
||||
// vsmesh.SetMesh (mesh);
|
||||
SetGlobalMesh (mesh);
|
||||
mesh -> SetGeometry(ng_geometry);
|
||||
|
||||
int res = ng_geometry -> GenerateMesh (mesh, mparam, perfstepsstart, perfstepsend);
|
||||
mparam.perfstepsstart = perfstepsstart;
|
||||
mparam.perfstepsend = perfstepsend;
|
||||
int res = ng_geometry -> GenerateMesh (mesh, mparam);
|
||||
|
||||
if (res != MESHING3_OK)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user