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
{
#include "writeuser.hpp"
extern shared_ptr<Mesh> mesh;
extern shared_ptr<NetgenGeometry> ng_geometry;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -8,6 +8,7 @@
#include "meshing.hpp"
#include <csg.hpp>
#include <geometry2d.hpp>
#include <../interface/writeuser.hpp>
using namespace netgen;
@ -357,7 +358,22 @@ DLL_HEADER void ExportNetgenMeshing()
}))
// static_cast<void(Mesh::*)(const string & name)>(&Mesh::Load))
.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)
.def("Elements3D",

View File

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

View File

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