Salome HOME
3a26a5e6be525eb000a052c82d8332cc8336c71a
[tools/medcoupling.git] / src / MEDPartitioner / MEDPARTITIONER_Topology.hxx
1 // Copyright (C) 2007-2019  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 __MEDPARTITIONER_TOPOLOGY_HXX__
21 #define __MEDPARTITIONER_TOPOLOGY_HXX__
22
23 #include "MEDPARTITIONER.hxx"
24 #include "MCType.hxx"
25
26 #include <map>
27 #include <vector>
28
29 namespace MEDCoupling
30 {
31   class MEDCouplingUMesh;
32 }
33
34 namespace MEDPARTITIONER
35 {
36   class Graph;
37   class ConnectZone;
38   class MeshCollection;
39   class MEDPARTITIONER_FaceModel;
40     
41   class MEDPARTITIONER_EXPORT Topology
42   {
43   public:
44     Topology() { }
45     Topology(std::vector<MEDCoupling::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 mcIdType *list, mcIdType nb, mcIdType *local, int*ip) = 0;
52     virtual void convertGlobalNodeList(const mcIdType *list, mcIdType nb, mcIdType *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 mcIdType*list , mcIdType nb, mcIdType *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 mcIdType*list , mcIdType nb, mcIdType* local, int*ip) = 0;
61     virtual void convertGlobalFaceList(const mcIdType*list , mcIdType nb, mcIdType* local, int ip) = 0;
62     virtual void convertGlobalFaceListWithTwins(const mcIdType *face_list, mcIdType nbface, mcIdType*& local, int*& ip, mcIdType*& full_array, mcIdType& size) = 0;
63     virtual void convertGlobalNodeListWithTwins(const mcIdType *face_list, mcIdType nbnode, mcIdType*& local, int*& ip, mcIdType*& full_array, mcIdType& size) = 0;
64     /*! number of doamins */
65     virtual int nbDomain() const = 0;
66     /*! number of cells */
67     virtual mcIdType nbCells() const = 0;
68     /*! number of nodes */
69     virtual mcIdType nbNodes() const = 0;
70     /*! number of cells on a specific domain */
71     virtual mcIdType nbCells(int idomain) const = 0;
72     /*! converting node global numberings to local numberings */
73     virtual void convertToLocal2ndVersion(mcIdType*,mcIdType,int) = 0;
74     virtual mcIdType convertNodeToGlobal(int ip,mcIdType icell) const = 0;
75     virtual mcIdType convertFaceToGlobal(int ip,mcIdType icell) const = 0;
76     virtual mcIdType convertCellToGlobal(int ip,mcIdType icell) const = 0;
77     virtual void convertNodeToGlobal(int ip,const mcIdType *local, mcIdType n, mcIdType *global) const = 0;
78     virtual void convertCellToGlobal(int ip,const mcIdType *local, mcIdType n, mcIdType *global) const = 0;
79     virtual void convertFaceToGlobal(int ip,const mcIdType *local, mcIdType n, mcIdType *global) const = 0;
80     /*! retrieving number of nodes */
81     virtual mcIdType getNodeNumber(int idomain) const = 0;
82     virtual mcIdType getNodeNumber() const = 0;
83     /*! retrieving list of nodes */
84     virtual void getNodeList(int idomain, mcIdType *list) const = 0;
85     virtual std::vector<mcIdType> & getFusedCellNumbers(int idomain) = 0;
86     virtual const std::vector<mcIdType> & getFusedCellNumbers(int idomain) const = 0;
87     virtual std::vector<mcIdType> & getFusedFaceNumbers(int idomain) = 0;
88     virtual const std::vector<mcIdType> & getFusedFaceNumbers(int idomain) const = 0;
89     /*! retrieving number of nodes */
90     virtual mcIdType getCellNumber(int idomain) const = 0;
91     /*! retrieving list of nodes */
92     virtual void getCellList(int idomain, mcIdType *list) const = 0;
93     /*! retrieving number of faces */
94     virtual mcIdType getFaceNumber(int idomain) const = 0;
95     virtual mcIdType getFaceNumber() const = 0;
96     /*! retrieving list of nodes */
97     virtual void getFaceList(int idomain, mcIdType *list) const = 0;
98     /*! adding a face to the mapping */
99     virtual void appendFace(int idomain, mcIdType ilocal, mcIdType iglobal) = 0;
100     /*! returns max global face number */
101     virtual mcIdType getMaxGlobalFace() const = 0;
102     /*! converting a global cell number to a local representation */
103     virtual std::pair<int,mcIdType> convertGlobalCell(mcIdType iglobal) const = 0;
104     /*! converting a global face number to a local representation */
105     virtual mcIdType convertGlobalFace(mcIdType iglobal, int idomain) = 0;
106     /*! converting a global node number to a local representation */
107     virtual mcIdType convertGlobalNode(mcIdType iglobal, int idomain) = 0;
108     /*! getting a reference to connect zones vector */
109     virtual std::vector<MEDPARTITIONER::ConnectZone*>& getCZ() = 0;
110   };
111 }
112
113 #endif