mirror of
https://github.com/NGSolve/netgen.git
synced 2024-11-11 16:49:16 +05:00
Merge branch 'explicit_edge_partition' into 'master'
[occ] allow giving explicit edge partition See merge request ngsolve/netgen!645
This commit is contained in:
commit
ea380ecb47
@ -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