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