export mesh from python

This commit is contained in:
Joachim Schöberl 2016-07-10 18:07:36 +02:00
parent 5f823a11f2
commit 60063f711f
10 changed files with 33 additions and 15 deletions

View File

@ -44,12 +44,10 @@ void RunParallel ( void * (*fun)(void *), void * in)
#include "writeuser.hpp"
namespace netgen namespace netgen
{ {
#include "writeuser.hpp"
extern shared_ptr<Mesh> mesh; extern shared_ptr<Mesh> mesh;
extern shared_ptr<NetgenGeometry> ng_geometry; extern shared_ptr<NetgenGeometry> ng_geometry;

View File

@ -8,9 +8,10 @@
#include "nginterface_v2.hpp" #include "nginterface_v2.hpp"
// #include <visual.hpp> // #include <visual.hpp>
#include "writeuser.hpp"
namespace netgen namespace netgen
{ {
#include "writeuser.hpp"
extern shared_ptr<Mesh> mesh; extern shared_ptr<Mesh> mesh;
} }

View File

@ -11,10 +11,10 @@
#include <csg.hpp> #include <csg.hpp>
#include <meshing.hpp> #include <meshing.hpp>
namespace netgen
{
#include "writeuser.hpp" #include "writeuser.hpp"
namespace netgen
{
void ReadFile (Mesh & mesh, void ReadFile (Mesh & mesh,
const string & hfilename) const string & hfilename)
{ {

View File

@ -12,11 +12,11 @@
#include <meshing.hpp> #include <meshing.hpp>
#include <sys/stat.h> #include <sys/stat.h>
#include "writeuser.hpp"
namespace netgen namespace netgen
{ {
#include "writeuser.hpp"
extern MeshingParameters mparam; extern MeshingParameters mparam;

View File

@ -13,10 +13,10 @@
#include <string> #include <string>
using namespace std; using namespace std;
#include "writeuser.hpp"
namespace netgen namespace netgen
{ {
#include "writeuser.hpp"
// Forward declarations (don't know, where to define them, sorry) // Forward declarations (don't know, where to define them, sorry)
int addComponent(string &strComp, string &strSitu, ofstream &out); int addComponent(string &strComp, string &strSitu, ofstream &out);

View File

@ -10,10 +10,11 @@
#include <geometry2d.hpp> #include <geometry2d.hpp>
#include <meshing.hpp> #include <meshing.hpp>
namespace netgen
{
#include "writeuser.hpp" #include "writeuser.hpp"
namespace netgen
{
extern MeshingParameters mparam; extern MeshingParameters mparam;

View File

@ -7,6 +7,7 @@
/* Date: 10. Dec. 97 */ /* Date: 10. Dec. 97 */
/**************************************************************************/ /**************************************************************************/
namespace netgen {
DLL_HEADER extern DLL_HEADER extern
void WriteFile (int typ, void WriteFile (int typ,
@ -162,5 +163,7 @@ extern bool DLL_HEADER WriteUserFormat (const string & format,
const NetgenGeometry & geom, const NetgenGeometry & geom,
const string & filename); const string & filename);
}
#endif #endif

View File

@ -8,6 +8,7 @@
#include "meshing.hpp" #include "meshing.hpp"
#include <csg.hpp> #include <csg.hpp>
#include <geometry2d.hpp> #include <geometry2d.hpp>
#include <../interface/writeuser.hpp>
using namespace netgen; using namespace netgen;
@ -357,7 +358,22 @@ DLL_HEADER void ExportNetgenMeshing()
})) }))
// static_cast<void(Mesh::*)(const string & name)>(&Mesh::Load)) // static_cast<void(Mesh::*)(const string & name)>(&Mesh::Load))
.def("Save", static_cast<void(Mesh::*)(const string & name)const>(&Mesh::Save)) .def("Save", static_cast<void(Mesh::*)(const string & name)const>(&Mesh::Save))
.def("Export", FunctionPointer
([] (Mesh & self, string filename, string format)
{
if (WriteUserFormat (format, self, *self.GetGeometry(), filename))
{
string err = string ("nothing known about format")+format;
Array<const char*> names, extensions;
RegisterUserFormats (names, extensions);
err += "\navailable formats are:\n";
for (auto name : names)
err += string("'") + name + "'\n";
throw NgException (err);
}
}),
(bp::arg("self"), bp::arg("filename"), bp::arg("format")))
.add_property("dim", &Mesh::GetDimension, &Mesh::SetDimension) .add_property("dim", &Mesh::GetDimension, &Mesh::SetDimension)
.def("Elements3D", .def("Elements3D",

View File

@ -29,11 +29,10 @@ namespace netgen
#endif #endif
#include "../libsrc/interface/writeuser.hpp"
namespace netgen namespace netgen
{ {
#include "../libsrc/interface/writeuser.hpp"
//extern string ngdir;
Flags parameters; Flags parameters;
} }

View File

@ -36,12 +36,12 @@ extern bool nodisplay;
#include <nginterface.h> #include <nginterface.h>
#include "../libsrc/interface/writeuser.hpp"
namespace netgen namespace netgen
{ {
DLL_HEADER extern MeshingParameters mparam; DLL_HEADER extern MeshingParameters mparam;
DLL_HEADER extern void ImportSolution2(const char * filename); DLL_HEADER extern void ImportSolution2(const char * filename);
#include "../libsrc/interface/writeuser.hpp"
#include "demoview.hpp" #include "demoview.hpp"
} }