mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-24 21:10:33 +05:00
Merge branch 'setdomainlayer_geom2d' into 'master'
Set Layers in SplineGeometry/csg2d See merge request jschoeberl/netgen!405
This commit is contained in:
commit
093b8bf9d6
@ -2183,7 +2183,11 @@ shared_ptr<netgen::SplineGeometry2d> CSG2d :: GenerateSplineGeometry()
|
||||
}
|
||||
}
|
||||
if(!is_solid_degenerated)
|
||||
{
|
||||
geo->SetMaterial(dom, s.name);
|
||||
if(s.layer != 1)
|
||||
geo->SetDomainLayer(dom, s.layer);
|
||||
}
|
||||
else
|
||||
dom--; // degenerated solid, use same domain index again
|
||||
}
|
||||
|
@ -630,6 +630,7 @@ struct Solid2d
|
||||
{
|
||||
Array<Loop> polys;
|
||||
|
||||
int layer = 1;
|
||||
string name = MAT_DEFAULT;
|
||||
|
||||
Solid2d() = default;
|
||||
@ -708,6 +709,12 @@ struct Solid2d
|
||||
return *this;
|
||||
}
|
||||
|
||||
Solid2d & Layer(int layer_)
|
||||
{
|
||||
layer = layer_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Box<2> GetBoundingBox() const;
|
||||
};
|
||||
|
||||
|
@ -250,7 +250,17 @@ namespace netgen
|
||||
if ( layer.Size() ) return layer[domnr-1];
|
||||
else return 1;
|
||||
}
|
||||
|
||||
void SetDomainLayer (int domnr, int layernr)
|
||||
{
|
||||
auto old_size = layer.Size();
|
||||
if(domnr > old_size)
|
||||
{
|
||||
layer.SetSize(domnr);
|
||||
for(size_t i = old_size; i < domnr; i++)
|
||||
layer[i] = 1;
|
||||
}
|
||||
layer[domnr-1] = layernr;
|
||||
}
|
||||
|
||||
string GetBCName (int bcnr) const;
|
||||
void SetBCName (int bcnr, string name);
|
||||
|
@ -49,6 +49,7 @@ NGCORE_API_EXPORT void ExportGeom2d(py::module &m)
|
||||
}))
|
||||
.def(NGSPickle<SplineGeometry2d>())
|
||||
.def("Load",&SplineGeometry2d::Load)
|
||||
.def("SetDomainLayer", &SplineGeometry2d::SetDomainLayer)
|
||||
.def("AppendPoint", FunctionPointer
|
||||
([](SplineGeometry2d &self, double px, double py, double maxh, double hpref, string name)
|
||||
{
|
||||
@ -432,6 +433,7 @@ NGCORE_API_EXPORT void ExportGeom2d(py::module &m)
|
||||
.def("Mat", &Solid2d::Mat)
|
||||
.def("BC", &Solid2d::BC)
|
||||
.def("Maxh", &Solid2d::Maxh)
|
||||
.def("Layer", &Solid2d::Layer)
|
||||
|
||||
.def("Copy", [](Solid2d & self) -> Solid2d { return self; })
|
||||
.def("Move", &Solid2d::Move)
|
||||
|
Loading…
Reference in New Issue
Block a user