hpref from occ geometry

This commit is contained in:
Joachim Schoeberl 2021-10-28 13:26:55 +02:00
parent 679fe05d19
commit 0f598bffa3
3 changed files with 22 additions and 2 deletions

View File

@ -319,7 +319,9 @@ namespace netgen
for (int i = 1; i <= nvertices; i++) for (int i = 1; i <= nvertices; i++)
{ {
gp_Pnt pnt = BRep_Tool::Pnt (TopoDS::Vertex(geom.vmap(i))); gp_Pnt pnt = BRep_Tool::Pnt (TopoDS::Vertex(geom.vmap(i)));
double hpref = OCCGeometry::global_shape_properties[TopoDS::Vertex(geom.vmap(i)).TShape()].hpref;
MeshPoint mp(occ2ng(pnt)); MeshPoint mp(occ2ng(pnt));
// mp.Singularity(hpref);
bool exists = false; bool exists = false;
if (merge_solids) if (merge_solids)
@ -331,13 +333,15 @@ namespace netgen
} }
if (!exists) if (!exists)
mesh.AddPoint (mp); {
mesh.AddPoint (mp);
mesh.Points().Last().Singularity(hpref);
}
double maxh = OCCGeometry::global_shape_properties[TopoDS::Vertex(geom.vmap(i)).TShape()].maxh; double maxh = OCCGeometry::global_shape_properties[TopoDS::Vertex(geom.vmap(i)).TShape()].maxh;
mesh.RestrictLocalH (occ2ng(pnt), maxh); mesh.RestrictLocalH (occ2ng(pnt), maxh);
} }
tsearch.Stop(); tsearch.Stop();
(*testout) << "different vertices = " << mesh.GetNP() << endl; (*testout) << "different vertices = " << mesh.GetNP() << endl;
// int first_ep = mesh.GetNP()+1; // int first_ep = mesh.GetNP()+1;
@ -604,6 +608,8 @@ namespace netgen
(*testout) << "NP = " << mesh.GetNP() << endl; (*testout) << "NP = " << mesh.GetNP() << endl;
//(*testout) << pnums[pnums.Size()-1] << endl; //(*testout) << pnums[pnums.Size()-1] << endl;
double hpref = OCCGeometry::global_shape_properties[edge.TShape()].hpref;
// for (size_t i = 1; i <= mp.Size()+1; i++) // for (size_t i = 1; i <= mp.Size()+1; i++)
for (size_t i = 1; i < pnums.Size(); i++) for (size_t i = 1; i < pnums.Size(); i++)
{ {
@ -632,6 +638,8 @@ namespace netgen
seg.epgeominfo[1].u = p2d2.X(); seg.epgeominfo[1].u = p2d2.X();
seg.epgeominfo[1].v = p2d2.Y(); seg.epgeominfo[1].v = p2d2.Y();
seg.singedge_left = hpref;
seg.singedge_right = hpref;
/* /*
if (occface->IsUPeriodic()) if (occface->IsUPeriodic())
{ {

View File

@ -220,6 +220,7 @@ namespace netgen
optional<string> name; optional<string> name;
optional<Vec<4>> col; optional<Vec<4>> col;
double maxh = 1e99; double maxh = 1e99;
double hpref = 0; // number of hp refinement levels (will be multiplied by factor later)
void Merge(const ShapeProperties & prop2) void Merge(const ShapeProperties & prop2)
{ {
if (prop2.name) name = prop2.name; if (prop2.name) name = prop2.name;

View File

@ -883,6 +883,17 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m)
} }
}, "maximal mesh-size for shape") }, "maximal mesh-size for shape")
.def_property("hpref",
[](const TopoDS_Shape& self)
{
return OCCGeometry::global_shape_properties[self.TShape()].hpref;
},
[](TopoDS_Shape& self, double val)
{
auto & hpref = OCCGeometry::global_shape_properties[self.TShape()].hpref;
hpref = max2(val, hpref);
}, "number of refinement levels for geometric refinement")
.def_property("col", [](const TopoDS_Shape & self) { .def_property("col", [](const TopoDS_Shape & self) {
auto it = OCCGeometry::global_shape_properties.find(self.TShape()); auto it = OCCGeometry::global_shape_properties.find(self.TShape());
Vec<4> col(0.2, 0.2, 0.2); Vec<4> col(0.2, 0.2, 0.2);