closed modules

This commit is contained in:
Joachim Schoeberl 2014-08-30 00:15:59 +00:00
parent 9a5261057f
commit e2cf4ea591
38 changed files with 382 additions and 87 deletions

View File

@ -15,6 +15,7 @@ AC_DISABLE_STATIC
AC_LANG([C++])
AC_PROG_CXX
AX_CXX_COMPILE_STDCXX_11
AC_OPENMP
CXXFLAGS="$CXXFLAGS $OPENMP_CXXFLAGS"
@ -147,13 +148,15 @@ AC_ARG_ENABLE([mkl],
AM_PATH_PYTHON([3.2])
AX_PYTHON_DEVEL([>= '3.2'])
AX_BOOST_BASE([1.55])
AX_BOOST_PYTHON
pythonon=false
AC_ARG_ENABLE([python],
[AS_HELP_STRING([--enable-python],[link boost python, necessary for ngsolve])],
[if test "$enableval" = yes; then pythonon=true; else pythonon=false; fi]
[CXXFLAGS+=" $PYTHON_CPPFLAGS -DNGPYTHON"]
[LDFLAGS+=" $PYTHON_LDFLAGS"]
[LDFLAGS+=" $PYTHON_LDFLAGS -l$BOOST_PYTHON_LIB"]
)

View File

@ -15,7 +15,8 @@ libcsg_la_SOURCES = algprim.cpp brick.cpp \
bspline2d.cpp csgeom.cpp csgparser.cpp curve2d.cpp edgeflw.cpp \
explicitcurve2d.cpp extrusion.cpp gencyl.cpp genmesh.cpp identify.cpp \
manifold.cpp meshsurf.cpp polyhedra.cpp revolution.cpp singularref.cpp \
solid.cpp specpoin.cpp spline3d.cpp surface.cpp triapprox.cpp
solid.cpp specpoin.cpp spline3d.cpp surface.cpp triapprox.cpp zrefine.cpp \
python_csg.cpp
libcsg_la_LIBADD = $(top_builddir)/libsrc/meshing/libmesh.la

View File

@ -1404,7 +1404,8 @@ namespace netgen
double Cone :: LocH (const Point<3> & p, double /* x */,
double /* c */, double hmax) const
double /* c */,
const MeshingParameters & mparam, double hmax) const
{
//double bloch = Surface::LocH (p, x, c, hmax);
Vec<3> g;

View File

@ -341,7 +341,9 @@ namespace netgen
virtual double HesseNorm () const;
virtual double LocH (const Point<3> & p, double x,
double c, double hmax) const;
double c,
const MeshingParameters & mparam,
double hmax) const;
///
virtual Point<3> GetSurfacePoint () const;

View File

@ -511,9 +511,9 @@ namespace netgen
return TCL_ERROR;
}
double globh = mparam.maxh;
// double globh = mparam.maxh;
for (int i = 1; i <= geometry->singedges.Size(); i++)
geometry->singedges.Get(i)->SetMeshSize (*mesh, globh);
geometry->singedges.Get(i)->SetMeshSize (*mesh, 1e99 /* globh*/);
return TCL_OK;
}
@ -529,9 +529,9 @@ namespace netgen
return TCL_ERROR;
}
double globh = mparam.maxh;
// double globh = mparam.maxh;
for (int i = 1; i <= geometry->singpoints.Size(); i++)
geometry->singpoints.Get(i)->SetMeshSize (*mesh, globh);
geometry->singpoints.Get(i)->SetMeshSize (*mesh, 1e99 /* globh */ );
return TCL_OK;
}

View File

@ -10,8 +10,9 @@ namespace netgen
EdgeCalculation ::
EdgeCalculation (const CSGeometry & ageometry,
Array<SpecialPoint> & aspecpoints)
: geometry(ageometry), specpoints(aspecpoints)
Array<SpecialPoint> & aspecpoints,
MeshingParameters & amparam)
: geometry(ageometry), specpoints(aspecpoints), mparam(amparam)
{
Box<3> bbox = geometry.BoundingBox();
@ -698,8 +699,8 @@ namespace netgen
// (*testout) << "geometry.GetSurface(s1) -> LocH (p, 3, 1, h) " << geometry.GetSurface(s1) -> LocH (p, 3, 1, h)
// << " geometry.GetSurface(s2) -> LocH (p, 3, 1, h) " << geometry.GetSurface(s2) -> LocH (p, 3, 1, h) << endl;
loch = min2 (geometry.GetSurface(s1) -> LocH (p, 3, 1, h),
geometry.GetSurface(s2) -> LocH (p, 3, 1, h));
loch = min2 (geometry.GetSurface(s1) -> LocH (p, 3, 1, mparam, h),
geometry.GetSurface(s2) -> LocH (p, 3, 1, mparam, h));
@ -848,8 +849,8 @@ namespace netgen
}
*/
loch = min2 (geometry.GetSurface(s1_rep) -> LocH (np, 3, 1, h),
geometry.GetSurface(s2_rep) -> LocH (np, 3, 1, h));
loch = min2 (geometry.GetSurface(s1_rep) -> LocH (np, 3, 1, mparam, h),
geometry.GetSurface(s2_rep) -> LocH (np, 3, 1, mparam, h));
loch = max2 (loch, mparam.minh);
if (uselocalh)
@ -1736,7 +1737,7 @@ namespace netgen
Vec<3> nv = s -> GetNormalVector (p1);
double hloc =
min2 (s->LocH (p1, 3, 1, h), mesh.GetH(p1));
min2 (s->LocH (p1, 3, 1, mparam, h), mesh.GetH(p1));

View File

@ -42,10 +42,12 @@ namespace netgen
int cntedge;
double ideps;
MeshingParameters & mparam;
public:
EdgeCalculation (const CSGeometry & ageometry,
Array<SpecialPoint> & aspecpoints);
Array<SpecialPoint> & aspecpoints,
MeshingParameters & amparam);
~EdgeCalculation();

View File

@ -60,9 +60,10 @@ namespace netgen
static void FindEdges (CSGeometry & geom, Mesh & mesh, const bool setmeshsize = false)
static void FindEdges (CSGeometry & geom, Mesh & mesh, MeshingParameters & mparam,
const bool setmeshsize = false)
{
EdgeCalculation ec (geom, specpoints);
EdgeCalculation ec (geom, specpoints, mparam);
ec.SetIdEps(geom.GetIdEps());
ec.Calc (mparam.maxh, mesh);
@ -219,7 +220,7 @@ namespace netgen
static void MeshSurface (CSGeometry & geom, Mesh & mesh)
static void MeshSurface (CSGeometry & geom, Mesh & mesh, MeshingParameters & mparam)
{
const char * savetask = multithread.task;
multithread.task = "Surface meshing";
@ -561,8 +562,7 @@ namespace netgen
PrintMessage (3, (mesh.GetNSE() - oldnf), " elements, ", mesh.GetNP(), " points");
extern void Render();
Render();
mparam.Render();
}
mesh.Compress();
@ -639,8 +639,7 @@ namespace netgen
PrintMessage (3, (mesh.GetNSE() - oldnf), " elements, ", mesh.GetNP(), " points");
}
extern void Render();
Render();
mparam.Render();
}
while (changed);
@ -709,7 +708,7 @@ namespace netgen
if (perfstepsstart <= MESHCONST_MESHEDGES)
{
FindEdges (geom, *mesh, true);
FindEdges (geom, *mesh, mparam, true);
if (multithread.terminate) return TCL_OK;
#ifdef LOG_STREAM
(*logout) << "Edges meshed" << endl
@ -728,14 +727,14 @@ namespace netgen
FindPoints (geom, *mesh);
if (multithread.terminate) return TCL_OK;
FindEdges (geom, *mesh, true);
FindEdges (geom, *mesh, mparam, true);
if (multithread.terminate) return TCL_OK;
mesh->DeleteMesh();
FindPoints (geom, *mesh);
if (multithread.terminate) return TCL_OK;
FindEdges (geom, *mesh);
FindEdges (geom, *mesh, mparam);
if (multithread.terminate) return TCL_OK;
}
}
@ -746,7 +745,7 @@ namespace netgen
if (perfstepsstart <= MESHCONST_MESHSURFACE)
{
MeshSurface (geom, *mesh);
MeshSurface (geom, *mesh, mparam);
if (multithread.terminate) return TCL_OK;
#ifdef LOG_STREAM
@ -762,10 +761,10 @@ namespace netgen
FindPoints (geom, *mesh);
if (multithread.terminate) return TCL_OK;
FindEdges (geom, *mesh);
FindEdges (geom, *mesh, mparam);
if (multithread.terminate) return TCL_OK;
MeshSurface (geom, *mesh);
MeshSurface (geom, *mesh, mparam);
if (multithread.terminate) return TCL_OK;
}

View File

@ -17,7 +17,7 @@ Meshing2Surfaces :: Meshing2Surfaces (const Surface & asurface)
Meshing2Surfaces :: Meshing2Surfaces (const Surface & asurf,
const MeshingParameters & mp,
const Box<3> & abb)
: Meshing2(mp, abb), surface(asurf)
: Meshing2(mp, abb), surface(asurf), mparam (mp)
{
;
}
@ -58,7 +58,7 @@ int Meshing2Surfaces :: TransformFromPlain (Point2d & planepoint,
double Meshing2Surfaces :: CalcLocalH (const Point3d & p, double gh) const
{
return surface.LocH (p, 3, 1, gh);
return surface.LocH (p, 3, 1, mparam, gh);
/*
double loch = mesh.lochfunc->GetH(p);
if (gh < loch) loch = gh;

View File

@ -10,6 +10,8 @@ namespace netgen
///
const Surface & surface;
/// should be movec to base ...
const MeshingParameters & mparam;
public:
///
// Meshing2Surfaces (const Surface & asurf);

95
libsrc/csg/python_csg.cpp Normal file
View File

@ -0,0 +1,95 @@
#include <boost/python.hpp>
#include <csg.hpp>
using namespace netgen;
namespace bp = boost::python;
//////////////////////////////////////////////////////////////////////
// Lambda to function pointer conversion
template <typename Function>
struct function_traits
: public function_traits<decltype(&Function::operator())> {};
template <typename ClassType, typename ReturnType, typename... Args>
struct function_traits<ReturnType(ClassType::*)(Args...) const> {
typedef ReturnType (*pointer)(Args...);
typedef ReturnType return_type;
};
template <typename Function>
typename function_traits<Function>::pointer
FunctionPointer (const Function& lambda) {
return static_cast<typename function_traits<Function>::pointer>(lambda);
}
template <class T>
inline string ToString (const T& t)
{
stringstream ss;
ss << t;
return ss.str();
}
namespace netgen
{
extern CSGeometry * ParseCSG (istream & istr);
}
void ExportCSG()
{
std::string nested_name = "csg";
if( bp::scope() )
nested_name = bp::extract<std::string>(bp::scope().attr("__name__") + ".csg");
bp::object module(bp::handle<>(bp::borrowed(PyImport_AddModule(nested_name.c_str()))));
cout << "exporting csg " << nested_name << endl;
bp::object parent = bp::scope() ? bp::scope() : bp::import("__main__");
parent.attr("csg") = module ;
bp::scope local_scope(module);
bp::class_<CSGeometry, boost::noncopyable> ("CSGeometry")
.def("__init__", bp::make_constructor (FunctionPointer
([](const string & filename)
{
cout << "load geometry";
ifstream ist(filename);
shared_ptr<CSGeometry> geom(ParseCSG(ist));
geom -> FindIdenticSurfaces(1e-8 * geom->MaxSize());
return geom;
})))
.add_property ("ntlo", &CSGeometry::GetNTopLevelObjects)
;
bp::def("GenerateMesh", FunctionPointer
([](CSGeometry & geo, MeshingParameters & param)
{
Mesh * dummy = NULL;
cout << "Genrate Mesh, params = "; // << param << endl;
geo.GenerateMesh (dummy, param, 0, 6);
return shared_ptr<Mesh> (dummy);
}));
}
BOOST_PYTHON_MODULE(libcsg) {
ExportCSG();
}

View File

@ -11,7 +11,7 @@
namespace netgen
{
extern DLL_HEADER MeshingParameters mparam;
// extern DLL_HEADER MeshingParameters mparam;
/*

View File

@ -163,8 +163,9 @@ MaxCurvatureLoc (const Point<3> & /* c */ , double /* rad */) const
double Surface :: LocH (const Point<3> & p, double x,
double c, double hmax) const
double Surface :: LocH (const Point<3> & p, double x, double c,
const MeshingParameters & mparam,
double hmax) const
// finds h <= hmax, s.t. h * \kappa_x*h < c
{
/*

View File

@ -176,7 +176,9 @@ namespace netgen
\[ h \times \kappa (x) \leq c \qquad \mbox{in} B(x, h), \]
where kappa(x) is the curvature in x. */
virtual double LocH (const Point<3> & p, double x,
double c, double hmax) const;
double c,
const MeshingParameters & mparam,
double hmax) const;
/**
Gets Approximation by triangles,

View File

@ -62,6 +62,11 @@ void RunParallel ( void* (*fun)(void *), void * in)
// #include <pthread.h>
namespace netgen
{
MeshingParameters mparam;
}
static pthread_t meshingthread;
void RunParallel ( void * (*fun)(void *), void * in)
{
@ -99,8 +104,6 @@ namespace netgen
{
#include "writeuser.hpp"
MeshingParameters mparam;
// global variable mesh (should not be used in libraries)
AutoPtr<Mesh> mesh;
// NetgenGeometry * ng_geometry = NULL; // new NetgenGeometry;

View File

@ -35,6 +35,8 @@ namespace netgen
{
#include "writeuser.hpp"
extern MeshingParameters & mparam;
// Global arrays used to maintain the owner, neighbour and face lists
// so that they are accessible across functions
static Array<int> owner_facelist;

View File

@ -20,7 +20,7 @@ namespace netgen
void WriteDiffPackFormat (const Mesh & mesh,
const CSGeometry & geom,
const NetgenGeometry & geom,
const string & filename)
{
// double scale = globflags.GetNumFlag ("scale", 1);

View File

@ -17,6 +17,7 @@ namespace netgen
{
#include "writeuser.hpp"
extern MeshingParameters & mparam;
void WriteElmerFormat (const Mesh &mesh,

View File

@ -16,6 +16,8 @@
namespace netgen
{
extern MeshingParameters & mparam;
#include "writeuser.hpp"

View File

@ -22,6 +22,7 @@ namespace netgen
{
#include "writeuser.hpp"
extern MeshingParameters & mparam;
/*
@ -30,7 +31,7 @@ namespace netgen
*/
void WriteGmshFormat (const Mesh & mesh,
const CSGeometry & geom,
const NetgenGeometry & geom,
const string & filename)
{
ofstream outfile (filename.c_str());

View File

@ -25,6 +25,8 @@ namespace netgen
{
#include "writeuser.hpp"
extern MeshingParameters & mparam;
// Mapping of entities from Netgen definitions to GMSH definitions
enum GMSH_ELEMENTS {GMSH_TRIG = 2, GMSH_TRIG6 = 9,
GMSH_QUAD = 3, GMSH_QUAD8 = 16,
@ -46,7 +48,7 @@ namespace netgen
*
*/
void WriteGmsh2Format (const Mesh & mesh,
const CSGeometry & geom,
const NetgenGeometry & geom,
const string & filename)
{
ofstream outfile (filename.c_str());

View File

@ -16,7 +16,7 @@ namespace netgen
#include "writeuser.hpp"
void WriteJCMFormat (const Mesh & mesh,
const CSGeometry & geom,
const NetgenGeometry & geom,
const string & filename)
{
if (mesh.GetDimension() != 3)

View File

@ -14,6 +14,8 @@ namespace netgen
{
#include "writeuser.hpp"
extern MeshingParameters & mparam;
void RegisterUserFormats (Array<const char*> & names,
Array<const char*> & extensions)
@ -157,7 +159,7 @@ bool WriteUserFormat (const string & format,
*/
void WriteNeutralFormat (const Mesh & mesh,
const CSGeometry & geom,
const NetgenGeometry & geom,
const string & filename)
{
cout << "write neutral, new" << endl;
@ -617,7 +619,7 @@ void WriteVRMLFormat (const Mesh & mesh,
* FEPP .. a finite element package developed at University Linz, Austria
*/
void WriteFEPPFormat (const Mesh & mesh,
const CSGeometry & geom,
const NetgenGeometry & geom,
const string & filename)
{
@ -708,7 +710,7 @@ void WriteFEPPFormat (const Mesh & mesh,
}
*/
/*
// write CSG surfaces
if (&geom && geom.GetNSurf() >= ns)
{
@ -717,6 +719,7 @@ void WriteFEPPFormat (const Mesh & mesh,
geom.GetSurface(mesh.GetFaceDescriptor(i).SurfNr())->Print(outfile);
}
else
*/
outfile << "0" << endl;
}
@ -747,7 +750,7 @@ void WriteFEPPFormat (const Mesh & mesh,
*/
void WriteEdgeElementFormat (const Mesh & mesh,
const CSGeometry & geom,
const NetgenGeometry & geom,
const string & filename)
{
cout << "write edge element format" << endl;

View File

@ -11,7 +11,7 @@
extern
void WriteFile (int typ,
const Mesh & mesh,
const CSGeometry & geom,
const NetgenGeometry & geom,
const char * filename,
const char * geomfile = NULL,
double h = 0);
@ -29,7 +29,7 @@ void ReadFile (Mesh & mesh,
extern
void WriteNeutralFormat (const Mesh & mesh,
const CSGeometry & geom,
const NetgenGeometry & geom,
const string & filename);
extern
@ -57,19 +57,19 @@ void WriteVRMLFormat (const Mesh & mesh,
extern
void WriteFEPPFormat (const Mesh & mesh,
const CSGeometry & geom,
const NetgenGeometry & geom,
const string & filename);
extern
void WriteGmshFormat (const Mesh & mesh,
const CSGeometry & geom,
const NetgenGeometry & geom,
const string & filename);
// Philippose - 29/01/2009
// Added GMSH v2.xx Mesh Export support
void WriteGmsh2Format (const Mesh & mesh,
const CSGeometry & geom,
const NetgenGeometry & geom,
const string & filename);
@ -87,13 +87,13 @@ void WriteUserChemnitz (const Mesh & mesh,
extern
void WriteJCMFormat (const Mesh & mesh,
const CSGeometry & geom,
const NetgenGeometry & geom,
const string & filename);
extern
void WriteDiffPackFormat (const Mesh & mesh,
const CSGeometry & geom,
const NetgenGeometry & geom,
const string & filename);
extern
@ -102,7 +102,7 @@ void WriteTochnogFormat (const Mesh & mesh,
extern
void WriteTecPlotFormat (const Mesh & mesh,
const CSGeometry & geom,
const NetgenGeometry & geom,
const string & filename);
extern
@ -128,7 +128,7 @@ void WriteElmerFormat (const Mesh & mesh,
extern
void WriteEdgeElementFormat (const Mesh & mesh,
const CSGeometry & geom,
const NetgenGeometry & geom,
const string & filename);

View File

@ -27,8 +27,9 @@ libmesh_la_SOURCES = adfront2.cpp adfront3.cpp bisect.cpp boundarylayer.cpp \
pyramid2rls.cpp pyramidrls.cpp quadrls.cpp refine.cpp \
ruler2.cpp ruler3.cpp secondorder.cpp smoothing2.5.cpp \
smoothing2.cpp smoothing3.cpp specials.cpp tetrarls.cpp \
topology.cpp triarls.cpp validate.cpp zrefine.cpp bcfunctions.cpp \
parallelmesh.cpp paralleltop.cpp paralleltop.hpp basegeom.cpp
topology.cpp triarls.cpp validate.cpp bcfunctions.cpp \
parallelmesh.cpp paralleltop.cpp paralleltop.hpp basegeom.cpp \
python_mesh.cpp
libmesh_la_LIBADD = $(top_builddir)/libsrc/linalg/libla.la \
$(top_builddir)/libsrc/gprim/libgprim.la \

View File

@ -1909,7 +1909,7 @@ namespace netgen
void BisectTetsCopyMesh (Mesh & mesh, const class CSGeometry *,
void BisectTetsCopyMesh (Mesh & mesh, const NetgenGeometry *,
BisectionOptions & opt,
const Array< Array<int,PointIndex::BASE>* > & idmaps,
const string & refinfofile)

View File

@ -23,12 +23,8 @@ public:
};
/*
extern void BisectTets (Mesh &, const CSGeometry *,
BisectionOptions & opt);
*/
extern void BisectTetsCopyMesh (Mesh &, const class CSGeometry *,
extern void BisectTetsCopyMesh (Mesh &, const NetgenGeometry *,
BisectionOptions & opt);
extern void ZRefinement (Mesh &, const class NetgenGeometry *,

View File

@ -27,6 +27,35 @@ namespace netgen
string ngdir = ".";
// parallel netgen
int id = 0, ntasks = 1;
void Ng_PrintDest(const char * s)
{
if (id == 0)
(*mycout) << s << flush;
}
DLL_HEADER void MyError(const char * ch)
{
cout << ch;
(*testout) << "Error !!! " << ch << endl << flush;
}
static clock_t starttimea;
void ResetTime ()
{
starttimea = clock();
}
double GetTime ()
{
return double(clock() - starttimea) / CLOCKS_PER_SEC;
}
Array<int> tets_in_qualclass;
int h_argc = 0;

View File

@ -773,12 +773,20 @@ namespace netgen
void Mesh :: Load (const string & filename)
{
cout << "filename = " << filename << endl;
istream * infile = NULL;
ifstream infile(filename.c_str());
if (!infile.good())
if (filename.find(".vol.gz") != string::npos)
infile = new igzstream (filename.c_str());
else
infile = new ifstream (filename.c_str());
// ifstream infile(filename.c_str());
if (! (infile -> good()) )
throw NgException ("mesh file not found");
Load(infile);
Load(*infile);
delete infile;
}
@ -786,7 +794,6 @@ namespace netgen
void Mesh :: Load (istream & infile)
{
char str[100];
int i, n;
@ -799,10 +806,10 @@ namespace netgen
bool endmesh = false;
while (infile.good() && !endmesh)
{
infile >> str;
if (strcmp (str, "dimension") == 0)
{
infile >> dimension;

View File

@ -14,7 +14,7 @@ namespace netgen
{
// extern int printmessage_importance;
class CSGeometry;
// class CSGeometry;
class NetgenGeometry;
}

View File

@ -749,7 +749,7 @@ namespace netgen
void SaveVolumeMesh (const Mesh & mesh,
const CSGeometry & geometry,
const NetgenGeometry & geometry,
char * filename)
{
INDEX i;

View File

@ -38,7 +38,7 @@ extern void SaveVolumeMesh (
///
void SaveVolumeMesh (const Mesh & mesh,
const class CSGeometry & geometry,
const class NetgenGeometry & geometry,
char * filename);
///

View File

@ -1104,6 +1104,13 @@ namespace netgen
void Print (ostream & ost) const;
void CopyFrom(const MeshingParameters & other);
void (*render_function)() = NULL;
void Render()
{
if (render_function)
(*render_function)();
}
};

View File

@ -0,0 +1,125 @@
#include <boost/python.hpp>
#include <mystdlib.h>
#include "meshing.hpp"
using namespace netgen;
namespace bp = boost::python;
//////////////////////////////////////////////////////////////////////
// Lambda to function pointer conversion
template <typename Function>
struct function_traits
: public function_traits<decltype(&Function::operator())> {};
template <typename ClassType, typename ReturnType, typename... Args>
struct function_traits<ReturnType(ClassType::*)(Args...) const> {
typedef ReturnType (*pointer)(Args...);
typedef ReturnType return_type;
};
template <typename Function>
typename function_traits<Function>::pointer
FunctionPointer (const Function& lambda) {
return static_cast<typename function_traits<Function>::pointer>(lambda);
}
template <class T>
inline string ToString (const T& t)
{
stringstream ss;
ss << t;
return ss.str();
}
template <typename T>
void ExportArray ()
{
string name = string("Array_") + typeid(T).name();
bp::class_<Array<T>,boost::noncopyable>(name.c_str())
.def ("__len__", &Array<T>::Size)
.def ("__getitem__",
FunctionPointer ([](Array<T> & self, int i) -> T&
{
if (i < 0 || i >= self.Size())
bp::exec("raise IndexError()\n");
return self[i];
}),
bp::return_value_policy<bp::reference_existing_object>())
;
}
void ExportNetgenMeshing()
{
std::string nested_name = "meshing";
if( bp::scope() )
nested_name = bp::extract<std::string>(bp::scope().attr("__name__") + ".meshing");
bp::object module(bp::handle<>(bp::borrowed(PyImport_AddModule(nested_name.c_str()))));
cout << "exporting meshing " << nested_name << endl;
bp::object parent = bp::scope() ? bp::scope() : bp::import("__main__");
parent.attr("meshing") = module ;
bp::scope local_scope(module);
bp::class_<PointIndex>("PointId")
.def("__repr__", &ToString<PointIndex>)
.def("__str__", &ToString<PointIndex>)
.add_property("nr", &PointIndex::operator int)
;
bp::class_<Element>("Element3D")
.add_property("vertices",
FunctionPointer ([](const Element & self) -> bp::list
{
bp::list li;
for (int i = 0; i < self.GetNV(); i++)
li.append (self[i]);
return li;
}))
;
ExportArray<Element>();
;
bp::class_<Mesh,shared_ptr<Mesh>,boost::noncopyable>("Mesh")
.def("__str__", &ToString<Mesh>)
.def("Load", static_cast<void(Mesh::*)(const string & name)>(&Mesh::Load))
.def("Save", static_cast<void(Mesh::*)(const string & name)const>(&Mesh::Save))
.def("Elements3D",
static_cast<Array<Element>&(Mesh::*)()> (& &Mesh::VolumeElements),
bp::return_value_policy<bp::reference_existing_object>())
/*
.def("Elements2D", &Mesh::SurfaceElements,
bp::return_value_policy<bp::reference_existing_object>())
*/
;
bp::class_<MeshingParameters> ("MeshingParameters")
;
}
BOOST_PYTHON_MODULE(libmesh) {
ExportNetgenMeshing();
}

View File

@ -1172,7 +1172,7 @@ FuncDeriv (const Vector & x, const Vector & dir, double & deriv) const
#ifdef SOLIDGEOMxxxx
void Mesh :: ImproveMesh (const CSGeometry & geometry, OPTIMIZEGOAL goal)
void Mesh :: ImproveMesh (const CSG eometry & geometry, OPTIMIZEGOAL goal)
{
INDEX i, eli;
int j;

View File

@ -11,10 +11,12 @@
#include <boost/python.hpp>
#endif
/*
namespace netgen
{
int id = 0, ntasks = 1;
}
*/
#ifdef PARALLEL
#include <mpi.h>

View File

@ -36,6 +36,7 @@ extern bool nodisplay;
namespace netgen
{
extern MeshingParameters mparam;
#include "../libsrc/interface/writeuser.hpp"
#include "demoview.hpp"
}
@ -156,7 +157,7 @@ namespace netgen
*/
}
DLL_HEADER void MyError(const char * ch)
DLL_HEADER void MyError2(const char * ch)
{
cout << ch;
(*testout) << "Error !!! " << ch << endl << flush;
@ -164,13 +165,13 @@ namespace netgen
#endif
static clock_t starttimea;
void ResetTime ()
void ResetTime2 ()
{
starttimea = clock();
}
#ifndef SMALLLIB
DLL_HEADER double GetTime ()
DLL_HEADER double GetTime2 ()
{
return double(clock() - starttimea) / CLOCKS_PER_SEC;
}
@ -1127,6 +1128,7 @@ namespace netgen
{
mparam.maxh = atof (Tcl_GetVar (interp, "::options.meshsize", 0));
mparam.minh = atof (Tcl_GetVar (interp, "::options.minmeshsize", 0));
mparam.meshsizefilename = Tcl_GetVar (interp, "::options.meshsizefilename", 0);
if (!strlen (mparam.meshsizefilename))
mparam.meshsizefilename = NULL;
@ -1357,6 +1359,9 @@ namespace netgen
multithread.running = 1;
multithread.terminate = 0;
extern void Render();
mparam.render_function = &Render;
for (int i = 0; i < geometryregister.Size(); i++)
geometryregister[i] -> SetParameters (interp);

View File

@ -45,11 +45,12 @@ namespace netgen
#endif
/*
namespace netgen
{
int id = 0, ntasks = 1;
}
*/
/*
@ -1176,7 +1177,7 @@ namespace netgen
{
char geomfilename[255];
DLL_HEADER void MyError (const char * ch)
DLL_HEADER void MyError2 (const char * ch)
{
cerr << ch;
}
@ -1185,7 +1186,7 @@ namespace netgen
//Destination for messages, errors, ...
DLL_HEADER void Ng_PrintDest(const char * s)
DLL_HEADER void Ng_PrintDest2(const char * s)
{
#ifdef PARALLEL
int id = 0;
@ -1196,13 +1197,12 @@ namespace netgen
}
/*
DLL_HEADER double GetTime ()
{
return 0;
}
*/