Salome HOME
Merge from V7_2_BR 09/08/2013
[tools/medcoupling.git] / src / MEDPartitioner / MEDPARTITIONER_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
20 #ifndef __MEDPARTITIONER_TOPOLOGY_HXX__
21 #define __MEDPARTITIONER_TOPOLOGY_HXX__
22
23 #include "MEDPARTITIONER.hxx"
24
25 #include <map>
26 #include <vector>
27
28 namespace ParaMEDMEM
29 {
30   class MEDCouplingUMesh;
31 }
32
33 namespace MEDPARTITIONER
34 {
35   class Graph;
36   class ConnectZone;
37   class SkyLineArray;
38   class MeshCollection;
39   class MEDPARTITIONER_FaceModel;
40     
41   class MEDPARTITIONER_EXPORT Topology
42   {
43   public:
44     Topology() { }
45     Topology(std::vector<ParaMEDMEM::MEDCouplingUMesh*>, std::vector<MEDPARTITIONER::ConnectZone*>) { }
46     virtual ~Topology() { }
47     
48     /*! converts a list of global cell numbers
49      *  to a distributed array with local cell numbers
50      */
51     virtual void convertGlobalNodeList(const int *list, int nb, int *local, int*ip) = 0;
52     virtual void convertGlobalNodeList(const int *list, int nb, int *local, int ip) = 0;
53     //converts a list of global node numbers
54     /*! to a distributed array with local cell numbers */
55     virtual void convertGlobalCellList(const int*list , int nb, int *local, int*ip) = 0;
56     
57     /*! converts a list of global face numbers
58      *  to a distributed array with local face numbers
59      */
60      virtual void convertGlobalFaceList(const int*list , int nb, int* local, int*ip) = 0;
61     virtual void convertGlobalFaceList(const int*list , int nb, int* local, int ip) = 0;
62     virtual void convertGlobalFaceListWithTwins(const int *face_list, int nbface, int*& local, int*& ip, int*& full_array, int& size) = 0;
63     virtual void convertGlobalNodeListWithTwins(const int *face_list, int nbnode, int*& local, int*& ip, int*& full_array, int& size) = 0;
64     /*! number of doamins */
65     virtual int nbDomain() const = 0;
66     /*! number of cells */
67     virtual int nbCells() const = 0;
68     /*! number of nodes */
69     virtual int nbNodes() const = 0;
70     /*! number of cells on a specific domain */
71     virtual int nbCells(int idomain) const = 0;
72     /*! converting node global numberings to local numberings */
73     virtual void convertToLocal2ndVersion(int*,int,int) = 0;
74     virtual int convertNodeToGlobal(int ip,int icell) const = 0;
75     virtual int convertFaceToGlobal(int ip,int icell) const = 0;
76     virtual int convertCellToGlobal(int ip,int icell) const = 0;
77     virtual void convertNodeToGlobal(int ip,const int *local, int n, int *global) const = 0;
78     virtual void convertCellToGlobal(int ip,const int *local, int n, int *global) const = 0;
79     virtual void convertFaceToGlobal(int ip,const int *local, int n, int *global) const = 0;
80     /*! retrieving number of nodes */
81     virtual int getNodeNumber(int idomain) const = 0;
82     virtual int getNodeNumber() const = 0;
83     /*! retrieving list of nodes */
84     virtual void getNodeList(int idomain, int *list) const = 0;
85     virtual std::vector<int> & getFusedCellNumbers(int idomain) = 0;
86     virtual const std::vector<int> & getFusedCellNumbers(int idomain) const = 0;
87     virtual std::vector<int> & getFusedFaceNumbers(int idomain) = 0;
88     virtual const std::vector<int> & getFusedFaceNumbers(int idomain) const = 0;
89     /*! retrieving number of nodes */
90     virtual int getCellNumber(int idomain) const = 0;
91     /*! retrieving list of nodes */
92     virtual void getCellList(int idomain, int *list) const = 0;
93     /*! retrieving number of faces */
94     virtual int getFaceNumber(int idomain) const = 0;
95     virtual int getFaceNumber() const = 0;
96     /*! retrieving list of nodes */
97     virtual void getFaceList(int idomain, int *list) const = 0;
98     /*! adding a face to the mapping */
99     virtual void appendFace(int idomain, int ilocal, int iglobal) = 0;
100     /*! returns max global face number */
101     virtual int getMaxGlobalFace() const = 0;
102     /*! converting a global cell number to a local representation */
103     virtual std::pair<int,int> convertGlobalCell(int iglobal) const = 0;
104     /*! converting a global face number to a local representation */
105     virtual int convertGlobalFace(int iglobal, int idomain) = 0;
106     /*! converting a global node number to a local representation */
107     virtual int convertGlobalNode(int iglobal, int idomain) = 0;
108   };
109 }
110
111 #endif