Back to index

salome-med  6.5.0
MEDSPLITTER_Topology.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 #ifndef TOPOLOGY_HXX_
00020 #define TOPOLOGY_HXX_
00021 
00022 #include "MEDMEM_define.hxx"
00023 
00024 #include "boost/shared_ptr.hpp"
00025 
00026 #include <map>
00027 #include <vector>
00028 
00029 namespace MEDMEM
00030 {
00031   class CONNECTZONE;
00032   class MESH;
00033   class MEDSKYLINEARRAY;
00034 }
00035 
00036 namespace MEDSPLITTER {
00037 
00038   class Graph;
00039   class MESHCollection;
00040   class MEDSPLITTER_FaceModel;
00041 
00042   typedef std::map<MED_EN::medGeometryElement, std::vector<MEDSPLITTER_FaceModel*> > TGeom2Faces;
00043   typedef std::vector< TGeom2Faces > TGeom2FacesByDomian;
00044 
00045   class Topology
00046   {
00047   public:
00048     Topology(){}
00049     Topology(std::vector<MEDMEM::MESH*>, std::vector<MEDMEM::CONNECTZONE*>){}
00050 
00051     virtual ~Topology(){}
00052 
00055     virtual void convertGlobalNodeList(const int* list, int nb, int* local, int*ip)=0;
00056     virtual void convertGlobalNodeList(const int* list, int nb, int* local, int ip)=0;
00059     virtual void convertGlobalCellList(const int*list , int nb, int* local, int*ip)=0;
00060 
00063     virtual void convertGlobalFaceList(const int*list , int nb, int* local, int*ip)=0;
00064     virtual void convertGlobalFaceList(const int*list , int nb, int* local, int ip)=0;
00065     virtual void convertGlobalFaceListWithTwins(const int* face_list, int nbface, int*& local, int*& ip, int*& full_array, int& size)=0;
00066     virtual void convertGlobalNodeListWithTwins(const int* face_list, int nbnode, int*& local, int*& ip, int*& full_array, int& size)=0;
00067 
00068 
00069     //number of doamins
00070     virtual int nbDomain() const =0;
00071 
00072     //number of cells
00073     virtual int nbCells() const=0;
00074 
00075 
00076     //number of cells on a specific domain
00077     virtual int nbCells(int idomain) const=0;
00078 
00080     virtual void createNodeMapping(std::map<MED_EN::medGeometryElement,int*>& type_connectivity,
00081                                    std::map<MED_EN::medGeometryElement,int>& present_type_numbers,
00082                                    std::vector<int>& polygon_conn,
00083                                    std::vector<int>& polygon_conn_index,
00084                                    std::vector<int>& polyhedron_conn,
00085                                    std::vector<int>& polyhedron_conn_index,
00086                                    std::vector<int>& polyhedron_face_index,
00087                                    int domain)=0;
00088 
00090     //  virtual void createFaceMapping(std::map<MED_EN::medGeometryElement,int*>& type_connectivity,
00091     //                    std::map<MED_EN::medGeometryElement,int>& present_type_numbers,int domain)=0;
00092     //      
00093     virtual void createFaceMapping(const MESHCollection&,const MESHCollection&)=0;
00094 
00095     //converting node global numberings to local numberings
00096     virtual void convertToLocal(std::map<MED_EN::medGeometryElement,int*>& type_connectivity,
00097                                 std::map<MED_EN::medGeometryElement,int>& present_type_numbers,
00098                                 int idomain,
00099                                 MED_EN::medEntityMesh entity)=0;
00100     //converting node global numberings to local numberings
00101     virtual void convertToLocal2ndVersion(int*,int,int)=0;
00102 
00103     virtual int convertNodeToGlobal(int ip,int icell)const=0;
00104     virtual int convertFaceToGlobal(int ip,int icell)const=0;
00105     virtual int convertCellToGlobal(int ip,int icell)const=0;
00106 
00107     virtual void convertNodeToGlobal(int ip,const int* local, int n, int* global)const=0 ;
00108     virtual void convertCellToGlobal(int ip,const int* local, int n, int* global)const=0 ;
00109     virtual void convertFaceToGlobal(int ip,const int* local, int n, int* global)const=0 ;
00110 
00111     //retrieving number of nodes
00112     virtual int getNodeNumber(int idomain) const =0;
00113     virtual int getNodeNumber() const=0;
00114     //retrieving list of nodes
00115     virtual void getNodeList(int idomain, int* list) const =0;
00116 
00117     virtual std::vector<int> & getFusedCellNumbers(int idomain) = 0;
00118     virtual const std::vector<int> & getFusedCellNumbers(int idomain) const = 0;
00119 
00120     virtual std::vector<int> & getFusedFaceNumbers(int idomain) = 0;
00121     virtual const std::vector<int> & getFusedFaceNumbers(int idomain) const = 0;
00122 
00123     //retrieving number of nodes
00124     virtual int getCellNumber(int idomain) const =0;
00125 
00126     //retrieving list of nodes
00127     virtual void getCellList(int idomain, int* list) const =0;
00128 
00129     //retrieving number of faces
00130     virtual int getFaceNumber(int idomain) const =0;
00131     virtual int getFaceNumber()const =0;
00132 
00133     //retrieving list of nodes
00134     virtual void getFaceList(int idomain, int* list) const =0;
00135 
00136     //adding a face to the mapping
00137     virtual void appendFace(int idomain, int ilocal, int iglobal)=0;
00138 
00139     //return max global face number
00140     virtual int getMaxGlobalFace()const=0;
00141 
00142     //return next free global face number
00143     //virtual int nextGlobalFace(int start_num) const=0;
00144 
00146     virtual std::pair<int,int> convertGlobalCell(int iglobal) const =0;
00147 
00148     //converting a global face number to a local representation
00149     virtual int convertGlobalFace(int iglobal, int idomain)=0;
00150 
00151     //converting a global node number to a local representation
00152     virtual int convertGlobalNode(int iglobal, int idomain)=0;
00153 
00155     virtual void computeNodeNodeCorrespondencies(int nbdomain, std::vector<MEDMEM::MEDSKYLINEARRAY*>&) const =0;
00156 
00158     virtual void computeCellCellCorrespondencies(int nbdomain, std::vector<MEDMEM::MEDSKYLINEARRAY*>&, const Graph*) const =0;
00159 
00161     virtual boost::shared_ptr<Graph> getGraph() const=0;
00162 
00164     virtual void recreateFaceMapping(const TGeom2FacesByDomian& )=0;
00165 
00167     virtual void recreateMappingAfterFusion(const std::vector<MEDMEM::MESH*>& ) = 0;
00168   };
00169 }
00170 #endif /*TOPOLOGY_HXX_*/