Salome HOME
d1aed510c4d6f18b208863c8f6b6db547cf6c257
[plugins/ghs3dprlplugin.git] / src / GHS3DPRLPlugin / MG_TetraHPC_API.hxx
1 // Copyright (C) 2004-2021  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef __MG_TetraHPC_IO_HXX__
21 #define __MG_TetraHPC_IO_HXX__
22
23 extern "C"
24 {
25 #include "libmesh5.h"
26 }
27 #include <string>
28 #include <set>
29
30 /*!
31  * \brief Class providing a transparent switch between MG_TetraHPC usage as
32  *        a library and as an executable. API of libmesh5 inherited.
33  */
34 class MG_TetraHPC_API
35 {
36 public:
37
38   MG_TetraHPC_API( volatile bool& cancelled_flag, double& progress );
39   ~MG_TetraHPC_API();
40
41   bool IsLibrary();
42   bool IsExecutable() { return !IsLibrary(); }
43   void SetUseExecutable();
44
45   // IN to MESHGEMS
46   int  GmfOpenMesh(const char* theFile, int rdOrWr, int ver, int dim);
47   void GmfSetKwd(int iMesh, GmfKwdCod what, int nb );
48   void GmfSetLin(int iMesh, GmfKwdCod what, double x, double y, double z, int domain);
49   void GmfSetKwd(int iMesh, GmfKwdCod what, int nbNodes, int dummy, int type[] ); // sol type
50   void GmfSetLin(int iMesh, GmfKwdCod what, double vals[]); // sol
51   void GmfSetLin(int iMesh, GmfKwdCod what, int node1, int node2, int domain ); // edge
52   void GmfSetLin(int iMesh, GmfKwdCod what, int id ); // required
53   void GmfSetLin(int iMesh, GmfKwdCod what, int node1, int node2, int node3, int domain ); // tria
54
55   bool Compute( const std::string& cmdLine, std::string& errStr );
56
57   // OUT from MESHGEMS
58   int  GmfOpenMesh(const char* theFile, int rdOrWr, int * ver, int * dim);
59   int  GmfStatKwd( int iMesh, GmfKwdCod what );
60   void GmfGotoKwd( int iMesh, GmfKwdCod what );
61   void GmfGetLin( int iMesh, GmfKwdCod what, int* nbNodes, int* faceInd, int* ori, int* domain, int dummy );
62   void GmfGetLin(int iMesh, GmfKwdCod what, float* x, float* y, float *z, int* domain );
63   void GmfGetLin(int iMesh, GmfKwdCod what, double* x, double* y, double *z, int* domain );
64   void GmfGetLin(int iMesh, GmfKwdCod what, int* node );
65   void GmfGetLin(int iMesh, GmfKwdCod what, int* node1, int* node2, int* domain );
66   void GmfGetLin(int iMesh, GmfKwdCod what, int* node1, int* node2, int* node3, int* domain );
67   void GmfGetLin(int iMesh, GmfKwdCod what, int* node1, int* node2, int* node3, int* node4, int* domain );
68   void GmfGetLin(int iMesh, GmfKwdCod what, int* node1, int* node2, int* node3, int* node4, int* node5, int* node6, int* node7, int* node8, int* domain );
69   void GmfCloseMesh( int iMesh );
70
71   void SetLogFile( const std::string& logFileName ) { _logFile = logFileName; }
72   bool HasLog();
73   std::string GetLog();
74
75
76   struct LibData;
77
78 private:
79
80   bool          _useLib;
81   LibData*      _libData;
82   std::set<int> _openFiles;
83   std::string   _logFile;
84
85
86   // count mesh entities for MG license key generation
87   int           _nbNodes;
88   int           _nbEdges;
89   int           _nbFaces;
90   int           _nbVolumes;
91 };
92
93 #endif