Salome HOME
adding a new test for makeMesh method.
[modules/med.git] / src / ParaMEDMEM / MEDLoader / MEDLoader.hxx
1 //  Copyright (C) 2007-2008  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.
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 #ifndef __MEDLOADER_HXX__
20 #define __MEDLOADER_HXX__
21
22 #include "InterpKernelException.hxx"
23 #include "NormalizedUnstructuredMesh.hxx"
24
25 #include <list>
26 #include <vector>
27
28 namespace ParaMEDMEM
29 {
30   class ParaMESH;
31   class ParaFIELD;
32   class DataArrayInt;
33   class MEDCouplingUMesh;
34 }
35
36 namespace MEDLoader
37 {
38   class MEDConnOfOneElemType
39   {
40   public:
41     MEDConnOfOneElemType(INTERP_KERNEL::NormalizedCellType type, int *conn, int lgth);
42     INTERP_KERNEL::NormalizedCellType getType() const { return _type; }
43     int getLength() const { return _lgth; }
44     int *getArray() const { return _conn; }
45     void setGlobal(int *global);
46     void releaseArray();
47   private:
48     int _lgth;
49     int *_conn;
50     int *_global;
51     INTERP_KERNEL::NormalizedCellType _type;
52   };
53   unsigned calculateHighestMeshDim(const std::list<MEDConnOfOneElemType>& conn);
54   void keepSpecifiedMeshDim(std::list<MEDConnOfOneElemType>& conn, unsigned meshDim);
55   void tradMEDFileCoreFrmt2MEDCouplingUMesh(const std::list<MEDConnOfOneElemType>& medConnFrmt,
56                                             ParaMEDMEM::DataArrayInt* &conn,
57                                             ParaMEDMEM::DataArrayInt* &connIndex);
58   void releaseMEDFileCoreFrmt(std::list<MEDLoader::MEDConnOfOneElemType>& medConnFrmt);
59   void writeMasterFile(const char *fileName, const std::vector<std::string>& fileNames, const char *meshName);
60   int buildMEDSubConnectivityOfOneType(ParaMEDMEM::DataArrayInt *conn, ParaMEDMEM::DataArrayInt *connIndex,
61                                        INTERP_KERNEL::NormalizedCellType type, std::vector<int>& conn4MEDFile);
62   //
63   ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const char *fileName, const char *meshName=0, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception);
64   void writeUMesh(const char *fileName, ParaMEDMEM::MEDCouplingUMesh *mesh);
65   void writeParaMesh(const char *fileName, ParaMEDMEM::ParaMESH *mesh);
66   void writeParaField(const char *fileName, const char *meshName, ParaMEDMEM::ParaFIELD *f);
67 }
68
69 #endif