#include #include #include #include #include #ifdef OCCGEOMETRY #include #endif #ifdef ACIS #include #endif #ifdef SOCKETS #include "../sockets/sockets.hpp" #endif #ifndef NOTCL #include #endif #include "nginterface.h" #include "nginterface_v2.hpp" // #include // #include namespace netgen { #include "writeuser.hpp" extern AutoPtr mesh; #ifndef NOTCL extern VisualSceneMesh vsmesh; extern Tcl_Interp * tcl_interp; #endif extern AutoPtr geometry2d; extern AutoPtr geometry; extern STLGeometry * stlgeometry; #ifdef OCCGEOMETRY extern OCCGeometry * occgeometry; #endif #ifdef ACIS extern ACISGeometry * acisgeometry; #endif #ifdef OPENGL extern VisualSceneSolution vssolution; #endif extern CSGeometry * ParseCSG (istream & istr); #ifdef SOCKETS extern AutoPtr clientsocket; //extern Array< AutoPtr < ServerInfo > > servers; extern Array< ServerInfo* > servers; #endif } using namespace netgen; template <> int Ng_GetNElements<1> () { return mesh->GetNSeg(); } template <> int Ng_GetNElements<2> () { return mesh->GetNSE(); } template <> int Ng_GetNElements<3> () { return mesh->GetNE(); } template <> Ng_Element Ng_GetElement<1> (int nr) { const Segment & el = mesh->LineSegment (SegmentIndex(nr)); Ng_Element ret; ret.type = NG_ELEMENT_TYPE(el.GetType()); ret.npoints = el.GetNP(); ret.points = (int*)&(el[0]); return ret; } template <> Ng_Element Ng_GetElement<2> (int nr) { const Element2d & el = mesh->SurfaceElement (SurfaceElementIndex (nr)); Ng_Element ret; ret.type = NG_ELEMENT_TYPE(el.GetType()); ret.npoints = el.GetNP(); ret.points = (int*)&el[0]; return ret; } template <> Ng_Element Ng_GetElement<3> (int nr) { const Element & el = mesh->VolumeElement (ElementIndex (nr)); Ng_Element ret; ret.type = NG_ELEMENT_TYPE(el.GetType()); ret.npoints = el.GetNP(); ret.points = (int*)&el[0]; return ret; }