Path: blob/devel/ElmerGUI/netgen/libsrc/interface/nginterface.h
3206 views
#ifndef NGINTERFACE1#define NGINTERFACE234/**************************************************************************/5/* File: nginterface.h */6/* Author: Joachim Schoeberl */7/* Date: 20. Nov. 99 */8/**************************************************************************/910/*11Application program interface to Netgen1213*/14151617// max number of nodes per element18#define NG_ELEMENT_MAXPOINTS 121920// max number of nodes per surface element21#define NG_SURFACE_ELEMENT_MAXPOINTS 822232425// implemented element types:26enum NG_ELEMENT_TYPE {27NG_SEGM = 1, NG_SEGM3 = 2,28NG_TRIG = 10, NG_QUAD=11, NG_TRIG6 = 12, NG_QUAD6 = 13,29NG_TET = 20, NG_TET10 = 21,30NG_PYRAMID = 22, NG_PRISM = 23, NG_PRISM12 = 24,31NG_HEX = 2532};3334typedef double NG_POINT[3]; // coordinates35typedef int NG_EDGE[2]; // initial point, end point36typedef int NG_FACE[4]; // points, last one is 0 for trig373839#ifdef __cplusplus40extern "C" {41#endif4243// load geomtry from file44void Ng_LoadGeometry (const char * filename);4546// load netgen mesh47void Ng_LoadMesh (const char * filename);4849// load netgen mesh50void Ng_LoadMeshFromString (const char * mesh_as_string);5152// space dimension (2 or 3)53int Ng_GetDimension ();5455// number of mesh points56int Ng_GetNP ();5758// number of mesh vertices (differs from GetNP for 2nd order elements)59int Ng_GetNV ();6061// number of mesh elements62int Ng_GetNE ();6364// number of surface triangles65int Ng_GetNSE ();6667// Get Point coordintes, index from 1 .. np68void Ng_GetPoint (int pi, double * p);6970// Get Element Points71NG_ELEMENT_TYPE Ng_GetElement (int ei, int * epi, int * np = 0);7273// Get Element Type74NG_ELEMENT_TYPE Ng_GetElementType (int ei);7576// Get sub-domain of element ei77int Ng_GetElementIndex (int ei);7879void Ng_SetElementIndex(const int ei, const int index);8081// Get Material of element ei82char * Ng_GetElementMaterial (int ei);8384// Get Material of domain dom85char * Ng_GetDomainMaterial (int dom);8687// Get Surface Element Points88NG_ELEMENT_TYPE Ng_GetSurfaceElement (int ei, int * epi, int * np = 0);8990// Get Surface Element Type91NG_ELEMENT_TYPE Ng_GetSurfaceElementType (int ei);9293// Get Surface Element Index94int Ng_GetSurfaceElementIndex (int ei);9596// Get Surface Element Surface Number97int Ng_GetSurfaceElementSurfaceNumber (int ei);9899// Get Surface Element Number100int Ng_GetSurfaceElementFDNumber (int ei);101102// Get BCName for Surface Element103char * Ng_GetSurfaceElementBCName (int ei);104//void Ng_GetSurfaceElementBCName (int ei, char * name);105106// Get BCName for bc-number107char * Ng_GetBCNumBCName (int bcnr);108//void Ng_GetBCNumBCName (int bcnr, char * name);109110// Get normal vector of surface element node111void Ng_GetNormalVector (int sei, int locpi, double * nv);112113114void Ng_SetPointSearchStartElement(int el);115116// Find element of point, returns local coordinates117int Ng_FindElementOfPoint (double * p, double * lami,118int build_searchtrees = 0,119const int * const indices = NULL, const int numind = 0);120121// Find surface element of point, returns local coordinates122int Ng_FindSurfaceElementOfPoint (double * p, double * lami,123int build_searchtrees = 0,124const int * const indices = NULL, const int numind = 0);125126127// is elment ei curved ?128int Ng_IsElementCurved (int ei);129// is elment sei curved ?130int Ng_IsSurfaceElementCurved (int sei);131132/// Curved Elemens:133/// xi..local coordinates134/// x ..global coordinates135/// dxdxi...D x D Jacobian matrix (row major storage)136void Ng_GetElementTransformation (int ei, const double * xi,137double * x, double * dxdxi);138139140/// buffer must be at least 100 doubles, alignment of double141void Ng_GetBufferedElementTransformation (int ei, const double * xi,142double * x, double * dxdxi,143void * buffer, int buffervalid);144145146147/// Curved Elemens:148/// xi..local coordinates149/// x ..global coordinates150/// dxdxi...D x D-1 Jacobian matrix (row major storage)151/// curved ...is element curved ?152void Ng_GetSurfaceElementTransformation (int sei, const double * xi,153double * x, double * dxdxi);154155/// Curved Elemens:156/// xi..local coordinates157/// sxi..step xi158/// x ..global coordinates159/// dxdxi...D x D Jacobian matrix (row major storage)160void Ng_GetMultiElementTransformation (int ei, int n,161const double * xi, int sxi,162double * x, int sx,163double * dxdxi, int sdxdxi);164165166// Mark element for refinement167void Ng_SetRefinementFlag (int ei, int flag);168void Ng_SetSurfaceRefinementFlag (int sei, int flag);169170// Do local refinement171enum NG_REFINEMENT_TYPE { NG_REFINE_H = 0, NG_REFINE_P = 1, NG_REFINE_HP = 2 };172void Ng_Refine (NG_REFINEMENT_TYPE reftype);173174// Use second order elements175void Ng_SecondOrder ();176void Ng_HighOrder (int order, bool rational = false);177//void Ng_HPRefinement (int levels, double parameter = 0.125);178void Ng_HPRefinement (int levels, double parameter = 0.125,179bool setorders = true,bool ref_level = false);180// void Ng_HPRefinement (int levels);181// void Ng_HPRefinement (int levels, double parameter);182183184// Topology and coordinate information of master element:185186int Ng_ME_GetNVertices (NG_ELEMENT_TYPE et);187int Ng_ME_GetNEdges (NG_ELEMENT_TYPE et);188int Ng_ME_GetNFaces (NG_ELEMENT_TYPE et);189190const NG_POINT * Ng_ME_GetVertices (NG_ELEMENT_TYPE et);191const NG_EDGE * Ng_ME_GetEdges (NG_ELEMENT_TYPE et);192const NG_FACE * Ng_ME_GetFaces (NG_ELEMENT_TYPE et);193194int Ng_GetNEdges();195int Ng_GetNFaces();196197198int Ng_GetElement_Edges (int elnr, int * edges, int * orient = 0);199int Ng_GetElement_Faces (int elnr, int * faces, int * orient = 0);200201int Ng_GetSurfaceElement_Edges (int selnr, int * edges, int * orient = 0);202int Ng_GetSurfaceElement_Face (int selnr, int * orient = 0);203204void Ng_GetSurfaceElementNeighbouringDomains(const int selnr, int & in, int & out);205206int Ng_GetFace_Vertices (int fnr, int * vert);207void Ng_GetEdge_Vertices (int ednr, int * vert);208int Ng_GetFace_Edges (int fnr, int * edge);209210int Ng_GetNVertexElements (int vnr);211void Ng_GetVertexElements (int vnr, int * els);212213int Ng_GetElementOrder (int enr);214void Ng_GetElementOrders (int enr, int * ox, int * oy, int * oz);215216void Ng_SetElementOrder (int enr, int order);217void Ng_SetElementOrders (int enr, int ox, int oy, int oz);218219int Ng_GetSurfaceElementOrder (int enr);220void Ng_GetSurfaceElementOrders (int enr, int * ox, int * oy);221222void Ng_SetSurfaceElementOrder (int enr, int order);223void Ng_SetSurfaceElementOrders (int enr, int ox, int oy);224225// Multilevel functions:226227// number of levels:228int Ng_GetNLevels ();229// get two parent nodes (indeed vertices !) of node ni230void Ng_GetParentNodes (int ni, int * parents);231232// get parent element (first child has always same number)233int Ng_GetParentElement (int ei);234235// get parent surface element (first child has always same number)236int Ng_GetParentSElement (int ei);237238// representant of anisotropic cluster239int Ng_GetClusterRepVertex (int vi);240int Ng_GetClusterRepEdge (int edi);241int Ng_GetClusterRepFace (int fai);242int Ng_GetClusterRepElement (int eli);243244245void Ng_SurfaceElementTransformation (int eli, double x, double y,246double * p3d, double * jacobian);247248#ifdef PARALLEL249// Is Element ei an element of this processor ??250bool Ng_IsGhostEl (int ei);251252void Ng_SetGhostEl(const int ei, const bool aisghost );253254bool Ng_IsGhostSEl (int ei);255256void Ng_SetGhostSEl(const int ei, const bool aisghost );257258bool Ng_IsGhostVert ( int pnum );259bool Ng_IsGhostEdge ( int ednum );260bool Ng_IsGhostFace ( int fanum );261262bool Ng_IsExchangeEl ( int elnum );263bool Ng_IsExchangeSEl ( int selnr );264265void Ng_UpdateOverlap ();266int Ng_Overlap();267/* void Ng_SetGhostVert ( const int pnum, const bool aisghost ); */268/* void Ng_SetGhostEdge ( const int ednum, const bool aisghost ); */269/* void Ng_SetGhostFace ( const int fanum, const bool aisghost ); */270271#endif272273namespace netgen {274#include "../visualization/soldata.hpp"275}276277enum Ng_SolutionType278{ NG_SOLUTION_NODAL = 1,279NG_SOLUTION_ELEMENT = 2,280NG_SOLUTION_SURFACE_ELEMENT = 3,281NG_SOLUTION_NONCONTINUOUS = 4,282NG_SOLUTION_SURFACE_NONCONTINUOUS = 5,283NG_SOLUTION_VIRTUAL_FUNCTION = 6,284NG_SOLUTION_MARKED_ELEMENTS = 10,285NG_SOLUTION_ELEMENT_ORDER = 11286};287288struct Ng_SolutionData289{290const char * name; // name of gridfunction291double * data; // solution values292int components; // relevant (double) components in solution vector293int dist; // # doubles per entry alignment!294int iscomplex; // complex vector ?295bool draw_surface;296bool draw_volume;297int order; // order of elements, only partially supported298Ng_SolutionType soltype; // type of solution function299netgen::SolutionData * solclass;300};301302// initialize solution data with default arguments303void Ng_InitSolutionData (Ng_SolutionData * soldata);304// set solution data305void Ng_SetSolutionData (Ng_SolutionData * soldata);306/// delete gridfunctions307void Ng_ClearSolutionData();308// redraw309void Ng_Redraw();310//311void Ng_SetVisualizationParameter (const char * name,312const char * value);313314315// number of periodic vertices316int Ng_GetNPeriodicVertices (int idnr);317// pairs should be an integer array of 2*npairs318void Ng_GetPeriodicVertices (int idnr, int * pairs);319320// number of periodic edges321int Ng_GetNPeriodicEdges (int idnr);322// pairs should be an integer array of 2*npairs323void Ng_GetPeriodicEdges (int idnr, int * pairs);324325326void Ng_PushStatus (const char * str);327void Ng_PopStatus ();328void Ng_SetThreadPercentage (double percent);329void Ng_GetStatus (char ** str, double & percent);330331void Ng_SetTerminate(void);332void Ng_UnSetTerminate(void);333int Ng_ShouldTerminate(void);334335336//// added by Roman Stainko ....337int Ng_GetVertex_Elements( int vnr, int* elems);338int Ng_GetVertex_SurfaceElements( int vnr, int* elems );339int Ng_GetVertex_NElements( int vnr );340int Ng_GetVertex_NSurfaceElements( int vnr );341342343#ifdef SOCKETS344int Ng_SocketClientOpen( const int port, const char * host );345void Ng_SocketClientWrite( const char * write, char ** reply);346void Ng_SocketClientClose ( void );347void Ng_SocketClientGetServerHost ( const int number, char ** host );348void Ng_SocketClientGetServerPort ( const int number, int * port );349void Ng_SocketClientGetServerClientID ( const int number, int * id );350#endif351352void Ng_InitPointCurve(double red, double green, double blue);353void Ng_AddPointCurvePoint(const double * point);354355356#ifdef PARALLEL357void Ng_SetElementPartition ( int elnr, int part );358int Ng_GetElementPartition ( int elnr );359#endif360361void Ng_SaveMesh ( const char * meshfile );362void Ng_Bisect ( const char * refinementfile );363364// if qualityloss is not equal to NULL at input, a (1-based) list of qualitylosses (due to projection)365// is saved in *qualityloss, its size is the return value366int Ng_Bisect_WithInfo ( const char * refinementfile, double ** qualityloss);367#ifdef __cplusplus368}369#endif370371#endif372373374375376377378/*379The new node interface ...380it is 0-based !381*/382383extern "C" {384385/*386number of nodes of type nt387nt = 0 is Vertex388nt = 1 is Edge389nt = 2 is Face390nt = 3 is Cell391*/392int Ng_GetNNodes (int nt);393394/*395closure nodes of node (nt, nodenr):396nodeset is bit-coded, bit 0 includes Vertices, bit 1 edges, etc397E.g., nodeset = 6 includes edge and face nodes398nodes consists of pairs of integers (nodetype, nodenr)399return value is number of nodes400*/401int Ng_GetClosureNodes (int nt, int nodenr, int nodeset, int * nodes);402403404/*405number of dim-dimensional elements406dim = 3 ... volume elements407dim = 2 ... surface elements408dim = 1 ... segments409dim = 0 ... not available410*/411int Ng_GetNElements (int dim);412413/*414closure nodes of dim-dimensional element elmentnr:415nodeset is bit-coded, bit 0 includes Vertices, bit 1 edges, etc416E.g., nodeset = 6 includes edge and face nodes417nodes consists of pairs of integers (nodetype, nodenr)418return value is number of nodes419*/420int Ng_GetElementClosureNodes (int dim, int elementnr, int nodeset, int * nodes);421}422423424