mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-24 04:50:34 +05:00
[occ] allow giving explicit edge partition
This commit is contained in:
parent
a4b2b46c0e
commit
bfcd77ff9c
@ -476,6 +476,20 @@ namespace netgen
|
||||
static Timer tdivide("Divide Edges");
|
||||
RegionTimer rt(tdivide);
|
||||
// -------------------- DivideEdge -----------------
|
||||
if(properties.partition)
|
||||
{
|
||||
points.SetSize(properties.partition->Size());
|
||||
params.SetSize(properties.partition->Size()+2);
|
||||
params[0] = 0.0;
|
||||
params.Last() = 1.0;
|
||||
for(auto i : Range(properties.partition->Size()))
|
||||
{
|
||||
params[i+1] = (*properties.partition)[i];
|
||||
points[i] = GetPoint(params[i+1]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
tdivedgesections.Start();
|
||||
auto layer = properties.layer;
|
||||
double safety = 0.5*(1.-mparam.grading);
|
||||
|
@ -27,10 +27,12 @@ namespace netgen
|
||||
double hpref = 0; // number of hp refinement levels (will be multiplied by factor later)
|
||||
int layer = 1;
|
||||
optional<bool> quad_dominated;
|
||||
optional<Array<double>> partition;
|
||||
void Merge(const ShapeProperties & prop2)
|
||||
{
|
||||
if (!name && prop2.name) name = prop2.name;
|
||||
if (!col && prop2.col) col = prop2.col;
|
||||
if (!partition && prop2.partition) partition = prop2.partition;
|
||||
maxh = min2(maxh, prop2.maxh);
|
||||
hpref = max2(hpref, prop2.hpref);
|
||||
if(!quad_dominated.has_value()) quad_dominated = prop2.quad_dominated;
|
||||
|
@ -1398,7 +1398,20 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m)
|
||||
return tuple(s0, s1);
|
||||
},
|
||||
"parameter interval of curve")
|
||||
|
||||
.def_property("partition",
|
||||
[](TopoDS_Shape & self) -> optional<Array<double>>
|
||||
{
|
||||
if (OCCGeometry::HaveProperties(self))
|
||||
return OCCGeometry::GetProperties(self).partition;
|
||||
return nullopt;
|
||||
},
|
||||
[](TopoDS_Shape &self, py::array_t<double> val)
|
||||
{
|
||||
Array<double> partition(val.size());
|
||||
for(auto i : Range(partition))
|
||||
partition[i] = val.at(i);
|
||||
OCCGeometry::GetProperties(self).partition = std::move(partition);
|
||||
})
|
||||
|
||||
.def("Split", [](const TopoDS_Edge& self, py::args args)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user