mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-26 05:50:32 +05:00
bcnames for python - facedescriptor
This commit is contained in:
parent
570d81c8cb
commit
52f65188e8
@ -5570,11 +5570,23 @@ namespace netgen
|
|||||||
|
|
||||||
void Mesh ::SetBCName ( int bcnr, const string & abcname )
|
void Mesh ::SetBCName ( int bcnr, const string & abcname )
|
||||||
{
|
{
|
||||||
|
if (bcnr >= bcnames.Size())
|
||||||
|
{
|
||||||
|
int oldsize = bcnames.Size();
|
||||||
|
bcnames.SetSize (bcnr+1); // keeps contents
|
||||||
|
for (int i = oldsize; i <= bcnr; i++)
|
||||||
|
bcnames[i] = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
if ( bcnames[bcnr] ) delete bcnames[bcnr];
|
if ( bcnames[bcnr] ) delete bcnames[bcnr];
|
||||||
if ( abcname != "default" )
|
if ( abcname != "default" )
|
||||||
bcnames[bcnr] = new string ( abcname );
|
bcnames[bcnr] = new string ( abcname );
|
||||||
else
|
else
|
||||||
bcnames[bcnr] = 0;
|
bcnames[bcnr] = nullptr;
|
||||||
|
|
||||||
|
for (auto & fd : facedecoding)
|
||||||
|
if (fd.BCProperty() < bcnames.Size())
|
||||||
|
fd.SetBCName (bcnames[fd.BCProperty()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
const string & Mesh ::GetBCName ( int bcnr ) const
|
const string & Mesh ::GetBCName ( int bcnr ) const
|
||||||
|
@ -203,24 +203,29 @@ DLL_HEADER void ExportNetgenMeshing()
|
|||||||
bp::class_<FaceDescriptor>("FaceDescriptor")
|
bp::class_<FaceDescriptor>("FaceDescriptor")
|
||||||
.def(bp::init<const FaceDescriptor&>())
|
.def(bp::init<const FaceDescriptor&>())
|
||||||
.def("__init__", bp::make_constructor
|
.def("__init__", bp::make_constructor
|
||||||
(FunctionPointer ([](int surfnr, int domin, int domout)
|
(FunctionPointer ([](int surfnr, int domin, int domout, int bc)
|
||||||
{
|
{
|
||||||
auto fd = new FaceDescriptor();
|
auto fd = new FaceDescriptor();
|
||||||
fd->SetSurfNr(surfnr);
|
fd->SetSurfNr(surfnr);
|
||||||
fd->SetDomainIn(domin);
|
fd->SetDomainIn(domin);
|
||||||
fd->SetDomainOut(domout);
|
fd->SetDomainOut(domout);
|
||||||
|
fd->SetBCProperty(bc);
|
||||||
return fd;
|
return fd;
|
||||||
}),
|
}),
|
||||||
bp::default_call_policies(), // need it to use arguments
|
bp::default_call_policies(), // need it to use arguments
|
||||||
(bp::arg("surfnr")=1,
|
(bp::arg("surfnr")=1,
|
||||||
bp::arg("domin")=1,
|
bp::arg("domin")=1,
|
||||||
bp::arg("domout")=0)),
|
bp::arg("domout")=0,
|
||||||
|
bp::arg("bc")=0
|
||||||
|
)),
|
||||||
"create facedescriptor")
|
"create facedescriptor")
|
||||||
.def("__str__", &ToString<FaceDescriptor>)
|
.def("__str__", &ToString<FaceDescriptor>)
|
||||||
.def("__repr__", &ToString<FaceDescriptor>)
|
.def("__repr__", &ToString<FaceDescriptor>)
|
||||||
.add_property("surfnr", &FaceDescriptor::SurfNr, &FaceDescriptor::SetSurfNr)
|
.add_property("surfnr", &FaceDescriptor::SurfNr, &FaceDescriptor::SetSurfNr)
|
||||||
.add_property("domin", &FaceDescriptor::DomainIn, &FaceDescriptor::SetDomainIn)
|
.add_property("domin", &FaceDescriptor::DomainIn, &FaceDescriptor::SetDomainIn)
|
||||||
.add_property("domout", &FaceDescriptor::DomainOut, &FaceDescriptor::SetDomainOut)
|
.add_property("domout", &FaceDescriptor::DomainOut, &FaceDescriptor::SetDomainOut)
|
||||||
|
.add_property("bc", &FaceDescriptor::BCProperty, &FaceDescriptor::SetBCProperty)
|
||||||
|
.add_property("bcname", FunctionPointer ([](FaceDescriptor & self) -> string { return self.GetBCName(); }))
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
@ -311,6 +316,8 @@ DLL_HEADER void ExportNetgenMeshing()
|
|||||||
return self.AddFaceDescriptor (fd);
|
return self.AddFaceDescriptor (fd);
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
.def ("SetBCName", &Mesh::SetBCName)
|
||||||
|
|
||||||
.def ("GenerateVolumeMesh", FunctionPointer
|
.def ("GenerateVolumeMesh", FunctionPointer
|
||||||
([](Mesh & self)
|
([](Mesh & self)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user