Salome HOME
MEDMEM suppression
[modules/med.git] / src / MEDSPLITTER / MEDSPLITTER_Topology.hxx
1 // Copyright (C) 2007-2013  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 TOPOLOGY_HXX_
20 #define TOPOLOGY_HXX_
21
22 #include "MEDMEM_define.hxx"
23
24 #include "boost/shared_ptr.hpp"
25
26 #include <map>
27 #include <vector>
28
29 namespace MEDMEM
30 {
31   class CONNECTZONE;
32   class MESH;
33   class MEDSKYLINEARRAY;
34 }
35
36 namespace MEDSPLITTER {
37
38   class Graph;
39   class MESHCollection;
40   class MEDSPLITTER_FaceModel;
41
42   typedef std::map<MED_EN::medGeometryElement, std::vector<MEDSPLITTER_FaceModel*> > TGeom2Faces;
43   typedef std::vector< TGeom2Faces > TGeom2FacesByDomian;
44
45   class Topology
46   {
47   public:
48     Topology(){}
49     Topology(std::vector<MEDMEM::MESH*>, std::vector<MEDMEM::CONNECTZONE*>){}
50
51     virtual ~Topology(){}
52
53     //!converts a list of global cell numbers
54     //!to a distributed array with local cell numbers
55     virtual void convertGlobalNodeList(const int* list, int nb, int* local, int*ip)=0;
56     virtual void convertGlobalNodeList(const int* list, int nb, int* local, int ip)=0;
57     //!converts a list of global node numbers
58     //!to a distributed array with local cell numbers
59     virtual void convertGlobalCellList(const int*list , int nb, int* local, int*ip)=0;
60
61     //!converts a list of global face numbers
62     //!to a distributed array with local face numbers
63     virtual void convertGlobalFaceList(const int*list , int nb, int* local, int*ip)=0;
64     virtual void convertGlobalFaceList(const int*list , int nb, int* local, int ip)=0;
65     virtual void convertGlobalFaceListWithTwins(const int* face_list, int nbface, int*& local, int*& ip, int*& full_array, int& size)=0;
66     virtual void convertGlobalNodeListWithTwins(const int* face_list, int nbnode, int*& local, int*& ip, int*& full_array, int& size)=0;
67
68
69     //number of doamins
70     virtual int nbDomain() const =0;
71
72     //number of cells
73     virtual int nbCells() const=0;
74
75
76     //number of cells on a specific domain
77     virtual int nbCells(int idomain) const=0;
78
79     ////creating node mapping 
80     virtual void createNodeMapping(std::map<MED_EN::medGeometryElement,int*>& type_connectivity,
81                                    std::map<MED_EN::medGeometryElement,int>& present_type_numbers,
82                                    std::vector<int>& polygon_conn,
83                                    std::vector<int>& polygon_conn_index,
84                                    std::vector<int>& polyhedron_conn,
85                                    std::vector<int>& polyhedron_conn_index,
86                                    std::vector<int>& polyhedron_face_index,
87                                    int domain)=0;
88
89     ////creating face mapping 
90     //  virtual void createFaceMapping(std::map<MED_EN::medGeometryElement,int*>& type_connectivity,
91     //                    std::map<MED_EN::medGeometryElement,int>& present_type_numbers,int domain)=0;
92     //      
93     virtual void createFaceMapping(const MESHCollection&,const MESHCollection&)=0;
94
95     //converting node global numberings to local numberings
96     virtual void convertToLocal(std::map<MED_EN::medGeometryElement,int*>& type_connectivity,
97                                 std::map<MED_EN::medGeometryElement,int>& present_type_numbers,
98                                 int idomain,
99                                 MED_EN::medEntityMesh entity)=0;
100     //converting node global numberings to local numberings
101     virtual void convertToLocal2ndVersion(int*,int,int)=0;
102
103     virtual int convertNodeToGlobal(int ip,int icell)const=0;
104     virtual int convertFaceToGlobal(int ip,int icell)const=0;
105     virtual int convertCellToGlobal(int ip,int icell)const=0;
106
107     virtual void convertNodeToGlobal(int ip,const int* local, int n, int* global)const=0 ;
108     virtual void convertCellToGlobal(int ip,const int* local, int n, int* global)const=0 ;
109     virtual void convertFaceToGlobal(int ip,const int* local, int n, int* global)const=0 ;
110
111     //retrieving number of nodes
112     virtual int getNodeNumber(int idomain) const =0;
113     virtual int getNodeNumber() const=0;
114     //retrieving list of nodes
115     virtual void getNodeList(int idomain, int* list) const =0;
116
117     virtual std::vector<int> & getFusedCellNumbers(int idomain) = 0;
118     virtual const std::vector<int> & getFusedCellNumbers(int idomain) const = 0;
119
120     virtual std::vector<int> & getFusedFaceNumbers(int idomain) = 0;
121     virtual const std::vector<int> & getFusedFaceNumbers(int idomain) const = 0;
122
123     //retrieving number of nodes
124     virtual int getCellNumber(int idomain) const =0;
125
126     //retrieving list of nodes
127     virtual void getCellList(int idomain, int* list) const =0;
128
129     //retrieving number of faces
130     virtual int getFaceNumber(int idomain) const =0;
131     virtual int getFaceNumber()const =0;
132
133     //retrieving list of nodes
134     virtual void getFaceList(int idomain, int* list) const =0;
135
136     //adding a face to the mapping
137     virtual void appendFace(int idomain, int ilocal, int iglobal)=0;
138
139     //return max global face number
140     virtual int getMaxGlobalFace()const=0;
141
142     //return next free global face number
143     //virtual int nextGlobalFace(int start_num) const=0;
144
145     //!converting a global cell number to a local representation
146     virtual std::pair<int,int> convertGlobalCell(int iglobal) const =0;
147
148     //converting a global face number to a local representation
149     virtual int convertGlobalFace(int iglobal, int idomain)=0;
150
151     //converting a global node number to a local representation
152     virtual int convertGlobalNode(int iglobal, int idomain)=0;
153
154     //! computing arrays with node/node correspondencies
155     virtual void computeNodeNodeCorrespondencies(int nbdomain, std::vector<MEDMEM::MEDSKYLINEARRAY*>&) const =0;
156
157     //! computing arrays with cell/cell correspondencies
158     virtual void computeCellCellCorrespondencies(int nbdomain, std::vector<MEDMEM::MEDSKYLINEARRAY*>&, const Graph*) const =0;
159
160     //! retrieving graph
161     virtual boost::shared_ptr<Graph> getGraph() const=0;
162
163     //!recreating a face mapping from scratch
164     virtual void recreateFaceMapping(const TGeom2FacesByDomian& )=0;
165
166     //!recreating cell and node mapping after send-reveive and fusion of domain meshes
167     virtual void recreateMappingAfterFusion(const std::vector<MEDMEM::MESH*>& ) = 0;
168   };
169 }
170 #endif /*TOPOLOGY_HXX_*/