thin-layer extrusion

This commit is contained in:
Joachim Schoeberl 2014-12-19 14:03:36 +00:00
parent 4be52c4ee5
commit 9a403ce44b
2 changed files with 29 additions and 2 deletions

View File

@ -6,7 +6,12 @@
using namespace netgen;
namespace netgen
{
extern shared_ptr<NetgenGeometry> ng_geometry;
}
inline void NOOP_Deleter(void *) { ; }
// a shadow solid tree using shared pointers.
@ -305,7 +310,7 @@ void ExportCSG()
auto mod_nr = bp::extract<int> (tup[1])();
Array<int> si;
mod_solid -> GetSolid() -> GetSurfaceIndices (si);
cout << "change bc on surfaces: " << si << " to " << mod_nr << endl;
// cout << "change bc on surfaces: " << si << " to " << mod_nr << endl;
for (int j = 0; j < si.Size(); j++)
{
@ -313,6 +318,7 @@ void ExportCSG()
bcm.bcname = NULL;
bcm.tlonr = tlonr;
bcm.si = si[j];
bcm.bcnr = mod_nr;
self.bcmodifications.Append (bcm);
}
}
@ -355,6 +361,7 @@ void ExportCSG()
// cout << "geom, bbox = " << geo.BoundingBox() << endl;
geo.FindIdenticSurfaces(1e-8 * geo.MaxSize());
geo.GenerateMesh (dummy, param, 0, 6);
ng_geometry.reset (&geo, NOOP_Deleter);
return dummy;
}))
;

View File

@ -11,6 +11,11 @@
using namespace netgen;
namespace bp = boost::python;
namespace netgen
{
extern shared_ptr<NetgenGeometry> ng_geometry;
}
template <typename T, int BASE = 0, typename TIND = int>
void ExportArray ()
@ -97,7 +102,22 @@ void ExportNetgenMeshing()
bp::class_<Mesh,shared_ptr<Mesh>,boost::noncopyable>("Mesh", bp::no_init)
.def(bp::init<>("create empty mesh"))
.def("__str__", &ToString<Mesh>)
.def("Load", static_cast<void(Mesh::*)(const string & name)>(&Mesh::Load))
.def("Load", FunctionPointer
([](Mesh & self, const string & filename)
{
ifstream input(filename);
self.Load(input);
for (int i = 0; i < geometryregister.Size(); i++)
{
NetgenGeometry * hgeom = geometryregister[i]->LoadFromMeshFile (input);
if (hgeom)
{
ng_geometry.reset (hgeom);
break;
}
}
}))
// static_cast<void(Mesh::*)(const string & name)>(&Mesh::Load))
.def("Save", static_cast<void(Mesh::*)(const string & name)const>(&Mesh::Save))
.def("Elements3D",