nginterface - dll

This commit is contained in:
Joachim Schoeberl 2009-04-04 13:43:02 +00:00
parent dcf5d73f3d
commit 62c877a83d
4 changed files with 143 additions and 129 deletions

View File

@ -13,6 +13,15 @@
*/ */
#ifdef WIN32
#ifdef NGINTERFACE_EXPORTS
#define DLL_HEADER __declspec(dllexport)
#else
#define DLL_HEADER __declspec(dllimport)
#endif
#else
#define DLL_HEADER
#endif
// max number of nodes per element // max number of nodes per element
@ -42,110 +51,110 @@ extern "C" {
#endif #endif
// load geomtry from file // load geomtry from file
void Ng_LoadGeometry (const char * filename); DLL_HEADER void Ng_LoadGeometry (const char * filename);
// load netgen mesh // load netgen mesh
void Ng_LoadMesh (const char * filename); DLL_HEADER void Ng_LoadMesh (const char * filename);
// load netgen mesh // load netgen mesh
void Ng_LoadMeshFromString (const char * mesh_as_string); DLL_HEADER void Ng_LoadMeshFromString (const char * mesh_as_string);
// space dimension (2 or 3) // space dimension (2 or 3)
int Ng_GetDimension (); DLL_HEADER int Ng_GetDimension ();
// number of mesh points // number of mesh points
int Ng_GetNP (); DLL_HEADER int Ng_GetNP ();
// number of mesh vertices (differs from GetNP for 2nd order elements) // number of mesh vertices (differs from GetNP for 2nd order elements)
int Ng_GetNV (); DLL_HEADER int Ng_GetNV ();
// number of mesh elements // number of mesh elements
int Ng_GetNE (); DLL_HEADER int Ng_GetNE ();
// number of surface triangles // number of surface triangles
int Ng_GetNSE (); DLL_HEADER int Ng_GetNSE ();
// Get Point coordintes, index from 1 .. np // Get Point coordintes, index from 1 .. np
void Ng_GetPoint (int pi, double * p); DLL_HEADER void Ng_GetPoint (int pi, double * p);
// Get Element Points // Get Element Points
NG_ELEMENT_TYPE Ng_GetElement (int ei, int * epi, int * np = 0); DLL_HEADER NG_ELEMENT_TYPE Ng_GetElement (int ei, int * epi, int * np = 0);
// Get Element Type // Get Element Type
NG_ELEMENT_TYPE Ng_GetElementType (int ei); DLL_HEADER NG_ELEMENT_TYPE Ng_GetElementType (int ei);
// Get sub-domain of element ei // Get sub-domain of element ei
int Ng_GetElementIndex (int ei); DLL_HEADER int Ng_GetElementIndex (int ei);
void Ng_SetElementIndex(const int ei, const int index); DLL_HEADER void Ng_SetElementIndex(const int ei, const int index);
// Get Material of element ei // Get Material of element ei
char * Ng_GetElementMaterial (int ei); DLL_HEADER char * Ng_GetElementMaterial (int ei);
// Get Material of domain dom // Get Material of domain dom
char * Ng_GetDomainMaterial (int dom); DLL_HEADER char * Ng_GetDomainMaterial (int dom);
// Get User Data // Get User Data
int Ng_GetUserDataSize (char * id); DLL_HEADER int Ng_GetUserDataSize (char * id);
void Ng_GetUserData (char * id, double * data); DLL_HEADER void Ng_GetUserData (char * id, double * data);
// Get Surface Element Points // Get Surface Element Points
NG_ELEMENT_TYPE Ng_GetSurfaceElement (int ei, int * epi, int * np = 0); DLL_HEADER NG_ELEMENT_TYPE Ng_GetSurfaceElement (int ei, int * epi, int * np = 0);
// Get Surface Element Type // Get Surface Element Type
NG_ELEMENT_TYPE Ng_GetSurfaceElementType (int ei); DLL_HEADER NG_ELEMENT_TYPE Ng_GetSurfaceElementType (int ei);
// Get Surface Element Index // Get Surface Element Index
int Ng_GetSurfaceElementIndex (int ei); DLL_HEADER int Ng_GetSurfaceElementIndex (int ei);
// Get Surface Element Surface Number // Get Surface Element Surface Number
int Ng_GetSurfaceElementSurfaceNumber (int ei); DLL_HEADER int Ng_GetSurfaceElementSurfaceNumber (int ei);
// Get Surface Element Number // Get Surface Element Number
int Ng_GetSurfaceElementFDNumber (int ei); DLL_HEADER int Ng_GetSurfaceElementFDNumber (int ei);
// Get BCName for Surface Element // Get BCName for Surface Element
char * Ng_GetSurfaceElementBCName (int ei); DLL_HEADER char * Ng_GetSurfaceElementBCName (int ei);
//void Ng_GetSurfaceElementBCName (int ei, char * name); //void Ng_GetSurfaceElementBCName (int ei, char * name);
// Get BCName for bc-number // Get BCName for bc-number
char * Ng_GetBCNumBCName (int bcnr); DLL_HEADER char * Ng_GetBCNumBCName (int bcnr);
//void Ng_GetBCNumBCName (int bcnr, char * name); //void Ng_GetBCNumBCName (int bcnr, char * name);
// Get normal vector of surface element node // Get normal vector of surface element node
void Ng_GetNormalVector (int sei, int locpi, double * nv); DLL_HEADER void Ng_GetNormalVector (int sei, int locpi, double * nv);
void Ng_SetPointSearchStartElement(int el); DLL_HEADER void Ng_SetPointSearchStartElement(int el);
// Find element of point, returns local coordinates // Find element of point, returns local coordinates
int Ng_FindElementOfPoint (double * p, double * lami, DLL_HEADER int Ng_FindElementOfPoint (double * p, double * lami,
int build_searchtrees = 0, int build_searchtrees = 0,
const int * const indices = NULL, const int numind = 0); const int * const indices = NULL, const int numind = 0);
// Find surface element of point, returns local coordinates // Find surface element of point, returns local coordinates
int Ng_FindSurfaceElementOfPoint (double * p, double * lami, DLL_HEADER int Ng_FindSurfaceElementOfPoint (double * p, double * lami,
int build_searchtrees = 0, int build_searchtrees = 0,
const int * const indices = NULL, const int numind = 0); const int * const indices = NULL, const int numind = 0);
// is elment ei curved ? // is elment ei curved ?
int Ng_IsElementCurved (int ei); DLL_HEADER int Ng_IsElementCurved (int ei);
// is elment sei curved ? // is elment sei curved ?
int Ng_IsSurfaceElementCurved (int sei); DLL_HEADER int Ng_IsSurfaceElementCurved (int sei);
/// Curved Elemens: /// Curved Elemens:
/// xi..local coordinates /// xi..local coordinates
/// x ..global coordinates /// x ..global coordinates
/// dxdxi...D x D Jacobian matrix (row major storage) /// dxdxi...D x D Jacobian matrix (row major storage)
void Ng_GetElementTransformation (int ei, const double * xi, DLL_HEADER void Ng_GetElementTransformation (int ei, const double * xi,
double * x, double * dxdxi); double * x, double * dxdxi);
/// buffer must be at least 100 doubles, alignment of double /// buffer must be at least 100 doubles, alignment of double
void Ng_GetBufferedElementTransformation (int ei, const double * xi, DLL_HEADER void Ng_GetBufferedElementTransformation (int ei, const double * xi,
double * x, double * dxdxi, double * x, double * dxdxi,
void * buffer, int buffervalid); void * buffer, int buffervalid);
@ -154,104 +163,104 @@ extern "C" {
/// x ..global coordinates /// x ..global coordinates
/// dxdxi...D x D-1 Jacobian matrix (row major storage) /// dxdxi...D x D-1 Jacobian matrix (row major storage)
/// curved ...is element curved ? /// curved ...is element curved ?
void Ng_GetSurfaceElementTransformation (int sei, const double * xi, DLL_HEADER void Ng_GetSurfaceElementTransformation (int sei, const double * xi,
double * x, double * dxdxi); double * x, double * dxdxi);
/// Curved Elemens: /// Curved Elemens:
/// xi..local coordinates /// xi..local coordinates
/// sxi..step xi /// sxi..step xi
/// x ..global coordinates /// x ..global coordinates
/// dxdxi...D x D Jacobian matrix (row major storage) /// dxdxi...D x D Jacobian matrix (row major storage)
void Ng_GetMultiElementTransformation (int ei, int n, DLL_HEADER void Ng_GetMultiElementTransformation (int ei, int n,
const double * xi, int sxi, const double * xi, int sxi,
double * x, int sx, double * x, int sx,
double * dxdxi, int sdxdxi); double * dxdxi, int sdxdxi);
int Ng_GetSegmentIndex (int elnr); DLL_HEADER int Ng_GetSegmentIndex (int elnr);
NG_ELEMENT_TYPE Ng_GetSegment (int elnr, int * epi, int * np = 0); DLL_HEADER NG_ELEMENT_TYPE Ng_GetSegment (int elnr, int * epi, int * np = 0);
// Mark element for refinement // Mark element for refinement
void Ng_SetRefinementFlag (int ei, int flag); DLL_HEADER void Ng_SetRefinementFlag (int ei, int flag);
void Ng_SetSurfaceRefinementFlag (int sei, int flag); DLL_HEADER void Ng_SetSurfaceRefinementFlag (int sei, int flag);
// Do local refinement // Do local refinement
enum NG_REFINEMENT_TYPE { NG_REFINE_H = 0, NG_REFINE_P = 1, NG_REFINE_HP = 2 }; enum NG_REFINEMENT_TYPE { NG_REFINE_H = 0, NG_REFINE_P = 1, NG_REFINE_HP = 2 };
void Ng_Refine (NG_REFINEMENT_TYPE reftype); DLL_HEADER void Ng_Refine (NG_REFINEMENT_TYPE reftype);
// Use second order elements // Use second order elements
void Ng_SecondOrder (); DLL_HEADER void Ng_SecondOrder ();
void Ng_HighOrder (int order, bool rational = false); DLL_HEADER void Ng_HighOrder (int order, bool rational = false);
//void Ng_HPRefinement (int levels, double parameter = 0.125); //void Ng_HPRefinement (int levels, double parameter = 0.125);
void Ng_HPRefinement (int levels, double parameter = 0.125, DLL_HEADER void Ng_HPRefinement (int levels, double parameter = 0.125,
bool setorders = true,bool ref_level = false); bool setorders = true,bool ref_level = false);
// void Ng_HPRefinement (int levels); // void Ng_HPRefinement (int levels);
// void Ng_HPRefinement (int levels, double parameter); // void Ng_HPRefinement (int levels, double parameter);
// Topology and coordinate information of master element: // Topology and coordinate information of master element:
int Ng_ME_GetNVertices (NG_ELEMENT_TYPE et); DLL_HEADER int Ng_ME_GetNVertices (NG_ELEMENT_TYPE et);
int Ng_ME_GetNEdges (NG_ELEMENT_TYPE et); DLL_HEADER int Ng_ME_GetNEdges (NG_ELEMENT_TYPE et);
int Ng_ME_GetNFaces (NG_ELEMENT_TYPE et); DLL_HEADER int Ng_ME_GetNFaces (NG_ELEMENT_TYPE et);
const NG_POINT * Ng_ME_GetVertices (NG_ELEMENT_TYPE et); DLL_HEADER const NG_POINT * Ng_ME_GetVertices (NG_ELEMENT_TYPE et);
const NG_EDGE * Ng_ME_GetEdges (NG_ELEMENT_TYPE et); DLL_HEADER const NG_EDGE * Ng_ME_GetEdges (NG_ELEMENT_TYPE et);
const NG_FACE * Ng_ME_GetFaces (NG_ELEMENT_TYPE et); DLL_HEADER const NG_FACE * Ng_ME_GetFaces (NG_ELEMENT_TYPE et);
int Ng_GetNEdges(); DLL_HEADER int Ng_GetNEdges();
int Ng_GetNFaces(); DLL_HEADER int Ng_GetNFaces();
int Ng_GetElement_Edges (int elnr, int * edges, int * orient = 0); DLL_HEADER int Ng_GetElement_Edges (int elnr, int * edges, int * orient = 0);
int Ng_GetElement_Faces (int elnr, int * faces, int * orient = 0); DLL_HEADER int Ng_GetElement_Faces (int elnr, int * faces, int * orient = 0);
int Ng_GetSurfaceElement_Edges (int selnr, int * edges, int * orient = 0); DLL_HEADER int Ng_GetSurfaceElement_Edges (int selnr, int * edges, int * orient = 0);
int Ng_GetSurfaceElement_Face (int selnr, int * orient = 0); DLL_HEADER int Ng_GetSurfaceElement_Face (int selnr, int * orient = 0);
void Ng_GetSurfaceElementNeighbouringDomains(const int selnr, int & in, int & out); DLL_HEADER void Ng_GetSurfaceElementNeighbouringDomains(const int selnr, int & in, int & out);
int Ng_GetFace_Vertices (int fnr, int * vert); DLL_HEADER int Ng_GetFace_Vertices (int fnr, int * vert);
void Ng_GetEdge_Vertices (int ednr, int * vert); DLL_HEADER void Ng_GetEdge_Vertices (int ednr, int * vert);
int Ng_GetFace_Edges (int fnr, int * edge); DLL_HEADER int Ng_GetFace_Edges (int fnr, int * edge);
int Ng_GetNVertexElements (int vnr); DLL_HEADER int Ng_GetNVertexElements (int vnr);
void Ng_GetVertexElements (int vnr, int * els); DLL_HEADER void Ng_GetVertexElements (int vnr, int * els);
int Ng_GetElementOrder (int enr); DLL_HEADER int Ng_GetElementOrder (int enr);
void Ng_GetElementOrders (int enr, int * ox, int * oy, int * oz); DLL_HEADER void Ng_GetElementOrders (int enr, int * ox, int * oy, int * oz);
void Ng_SetElementOrder (int enr, int order); DLL_HEADER void Ng_SetElementOrder (int enr, int order);
void Ng_SetElementOrders (int enr, int ox, int oy, int oz); DLL_HEADER void Ng_SetElementOrders (int enr, int ox, int oy, int oz);
int Ng_GetSurfaceElementOrder (int enr); DLL_HEADER int Ng_GetSurfaceElementOrder (int enr);
void Ng_GetSurfaceElementOrders (int enr, int * ox, int * oy); DLL_HEADER void Ng_GetSurfaceElementOrders (int enr, int * ox, int * oy);
void Ng_SetSurfaceElementOrder (int enr, int order); DLL_HEADER void Ng_SetSurfaceElementOrder (int enr, int order);
void Ng_SetSurfaceElementOrders (int enr, int ox, int oy); DLL_HEADER void Ng_SetSurfaceElementOrders (int enr, int ox, int oy);
// Multilevel functions: // Multilevel functions:
// number of levels: // number of levels:
int Ng_GetNLevels (); DLL_HEADER int Ng_GetNLevels ();
// get two parent nodes (indeed vertices !) of node ni // get two parent nodes (indeed vertices !) of node ni
void Ng_GetParentNodes (int ni, int * parents); DLL_HEADER void Ng_GetParentNodes (int ni, int * parents);
// get parent element (first child has always same number) // get parent element (first child has always same number)
int Ng_GetParentElement (int ei); DLL_HEADER int Ng_GetParentElement (int ei);
// get parent surface element (first child has always same number) // get parent surface element (first child has always same number)
int Ng_GetParentSElement (int ei); DLL_HEADER int Ng_GetParentSElement (int ei);
// representant of anisotropic cluster // representant of anisotropic cluster
int Ng_GetClusterRepVertex (int vi); DLL_HEADER int Ng_GetClusterRepVertex (int vi);
int Ng_GetClusterRepEdge (int edi); DLL_HEADER int Ng_GetClusterRepEdge (int edi);
int Ng_GetClusterRepFace (int fai); DLL_HEADER int Ng_GetClusterRepFace (int fai);
int Ng_GetClusterRepElement (int eli); DLL_HEADER int Ng_GetClusterRepElement (int eli);
void Ng_SurfaceElementTransformation (int eli, double x, double y, void Ng_SurfaceElementTransformation (int eli, double x, double y,
@ -313,45 +322,45 @@ extern "C" {
}; };
// initialize solution data with default arguments // initialize solution data with default arguments
void Ng_InitSolutionData (Ng_SolutionData * soldata); DLL_HEADER void Ng_InitSolutionData (Ng_SolutionData * soldata);
// set solution data // set solution data
void Ng_SetSolutionData (Ng_SolutionData * soldata); DLL_HEADER void Ng_SetSolutionData (Ng_SolutionData * soldata);
/// delete gridfunctions /// delete gridfunctions
void Ng_ClearSolutionData(); DLL_HEADER void Ng_ClearSolutionData();
// redraw // redraw
void Ng_Redraw(); DLL_HEADER void Ng_Redraw();
// //
void Ng_SetVisualizationParameter (const char * name, DLL_HEADER void Ng_SetVisualizationParameter (const char * name,
const char * value); const char * value);
// number of periodic vertices // number of periodic vertices
int Ng_GetNPeriodicVertices (int idnr); DLL_HEADER int Ng_GetNPeriodicVertices (int idnr);
// pairs should be an integer array of 2*npairs // pairs should be an integer array of 2*npairs
void Ng_GetPeriodicVertices (int idnr, int * pairs); DLL_HEADER void Ng_GetPeriodicVertices (int idnr, int * pairs);
// number of periodic edges // number of periodic edges
int Ng_GetNPeriodicEdges (int idnr); DLL_HEADER int Ng_GetNPeriodicEdges (int idnr);
// pairs should be an integer array of 2*npairs // pairs should be an integer array of 2*npairs
void Ng_GetPeriodicEdges (int idnr, int * pairs); DLL_HEADER void Ng_GetPeriodicEdges (int idnr, int * pairs);
void Ng_PushStatus (const char * str); DLL_HEADER void Ng_PushStatus (const char * str);
void Ng_PopStatus (); DLL_HEADER void Ng_PopStatus ();
void Ng_SetThreadPercentage (double percent); DLL_HEADER void Ng_SetThreadPercentage (double percent);
void Ng_GetStatus (char ** str, double & percent); DLL_HEADER void Ng_GetStatus (char ** str, double & percent);
void Ng_SetTerminate(void); DLL_HEADER void Ng_SetTerminate(void);
void Ng_UnSetTerminate(void); DLL_HEADER void Ng_UnSetTerminate(void);
int Ng_ShouldTerminate(void); DLL_HEADER int Ng_ShouldTerminate(void);
void Ng_SetRunning(int flag); DLL_HEADER void Ng_SetRunning(int flag);
int Ng_IsRunning(); DLL_HEADER int Ng_IsRunning();
//// added by Roman Stainko .... //// added by Roman Stainko ....
int Ng_GetVertex_Elements( int vnr, int* elems); DLL_HEADER int Ng_GetVertex_Elements( int vnr, int* elems);
int Ng_GetVertex_SurfaceElements( int vnr, int* elems ); DLL_HEADER int Ng_GetVertex_SurfaceElements( int vnr, int* elems );
int Ng_GetVertex_NElements( int vnr ); DLL_HEADER int Ng_GetVertex_NElements( int vnr );
int Ng_GetVertex_NSurfaceElements( int vnr ); DLL_HEADER int Ng_GetVertex_NSurfaceElements( int vnr );
#ifdef SOCKETS #ifdef SOCKETS
@ -363,8 +372,8 @@ extern "C" {
void Ng_SocketClientGetServerClientID ( const int number, int * id ); void Ng_SocketClientGetServerClientID ( const int number, int * id );
#endif #endif
void Ng_InitPointCurve(double red, double green, double blue); DLL_HEADER void Ng_InitPointCurve(double red, double green, double blue);
void Ng_AddPointCurvePoint(const double * point); DLL_HEADER void Ng_AddPointCurvePoint(const double * point);
#ifdef PARALLEL #ifdef PARALLEL
@ -372,12 +381,12 @@ extern "C" {
int Ng_GetElementPartition ( int elnr ); int Ng_GetElementPartition ( int elnr );
#endif #endif
void Ng_SaveMesh ( const char * meshfile ); DLL_HEADER void Ng_SaveMesh ( const char * meshfile );
void Ng_Bisect ( const char * refinementfile ); DLL_HEADER void Ng_Bisect ( const char * refinementfile );
// if qualityloss is not equal to NULL at input, a (1-based) list of qualitylosses (due to projection) // if qualityloss is not equal to NULL at input, a (1-based) list of qualitylosses (due to projection)
// is saved in *qualityloss, its size is the return value // is saved in *qualityloss, its size is the return value
int Ng_Bisect_WithInfo ( const char * refinementfile, double ** qualityloss); DLL_HEADER int Ng_Bisect_WithInfo ( const char * refinementfile, double ** qualityloss);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
@ -403,7 +412,7 @@ extern "C" {
nt = 2 is Face nt = 2 is Face
nt = 3 is Cell nt = 3 is Cell
*/ */
int Ng_GetNNodes (int nt); DLL_HEADER int Ng_GetNNodes (int nt);
/* /*
closure nodes of node (nt, nodenr): closure nodes of node (nt, nodenr):
@ -412,7 +421,7 @@ extern "C" {
nodes consists of pairs of integers (nodetype, nodenr) nodes consists of pairs of integers (nodetype, nodenr)
return value is number of nodes return value is number of nodes
*/ */
int Ng_GetClosureNodes (int nt, int nodenr, int nodeset, int * nodes); DLL_HEADER int Ng_GetClosureNodes (int nt, int nodenr, int nodeset, int * nodes);
/* /*
@ -422,7 +431,7 @@ extern "C" {
dim = 1 ... segments dim = 1 ... segments
dim = 0 ... not available dim = 0 ... not available
*/ */
int Ng_GetNElements (int dim); DLL_HEADER int Ng_GetNElements (int dim);
/* /*
closure nodes of dim-dimensional element elmentnr: closure nodes of dim-dimensional element elmentnr:
@ -431,6 +440,6 @@ extern "C" {
nodes consists of pairs of integers (nodetype, nodenr) nodes consists of pairs of integers (nodetype, nodenr)
return value is number of nodes return value is number of nodes
*/ */
int Ng_GetElementClosureNodes (int dim, int elementnr, int nodeset, int * nodes); DLL_HEADER int Ng_GetElementClosureNodes (int dim, int elementnr, int nodeset, int * nodes);
} }

View File

@ -24,6 +24,9 @@ public:
template <int DIM> int Ng_GetNElements (); template <int DIM>
template <int DIM> Ng_Element Ng_GetElement (int nr); DLL_HEADER int Ng_GetNElements ();
template <int DIM>
DLL_HEADER Ng_Element Ng_GetElement (int nr);

View File

@ -23,4 +23,6 @@ ngvisual.tcl sockets.tcl drawing.tcl nghelp.tcl ngshell.tcl \
ngtesting.tcl parameters.tcl variables.tcl ngtesting.tcl parameters.tcl variables.tcl
netgen_LDFLAGS = -rdynamic netgen_LDFLAGS = -rdynamic -pg

View File

@ -285,15 +285,15 @@ catch {
# source ngusers/ebg/elasticity/ebgelast.tcl # source ngusers/ebg/elasticity/ebgelast.tcl
if { [catch { load libngsolve.so ngsolve } result ] } { if { [catch { load libngsolve[info sharedlibextension] ngsolve } result ] } {
puts "cannot load ngsolve" # puts "cannot load ngsolve"
puts "error: $result" # puts "error: $result"
} { } {
catch { source ${ngdir}/ngsolve.tcl } catch { source ${ngdir}/ngsolve.tcl }
} }
if { [catch { load libdemoapp.so demoapp } result ] } { if { [catch { load libdemoapp[info sharedlibextension] demoapp } result ] } {
# puts "cannot load demoapp" # puts "cannot load demoapp"
# puts "error: $result" # puts "error: $result"
} { } {