Memosa-FVM  0.2
MeshDismantler.h
Go to the documentation of this file.
1 // This file os part of FVM
2 // Copyright (c) 2012 FVM Authors
3 // See LICENSE file for terms.
4 
5 #ifndef _MESHDISMANTLER_H_
6 #define _MESHDISMANTLER_H_
7 
8 #include "Mesh.h"
9 #include "Array.h"
10 #include "Vector.h"
11 #include <vector>
12 #include <set>
13 #include <string>
14 #include <fstream>
15 
17 {
18 public:
19 
20  typedef shared_ptr< Array<double> > ArrayDblePtr;
21  typedef shared_ptr< Array<int> > ArrayIntPtr;
22  typedef map<int,ArrayIntPtr> ArrayIntPtrMap;
23  typedef map<int, int> IntMap;
24  typedef map<int, vector<int> > IntVecMap;
25  typedef shared_ptr< StorageSite > StorageSitePtr;
26  typedef shared_ptr< CRConnectivity > CRConnectivityPtr;
27  //typedef shared_ptr< Array<int> > ArrayIntPtr;
28  typedef shared_ptr< Array<Mesh::VecD3> > ArrayVecD3Ptr;
29  typedef vector< map<int, set<int> > > VecMap;
30  typedef map<int, multimap<int,int> > NestedMap;
31  typedef pair<int,int> EntryIndex;
32  typedef map<EntryIndex,int> EntryMap;
33  typedef map<EntryIndex, vector<int> > EntryVecMap;
34  typedef map<int, const StorageSite* > IntStorageSiteMap;
35 
38 
39  //return single mesh, for sake of compatibality we return as meshList
40  const MeshList& meshList() const { return _meshList;}
41 
42  //debug files
43  void debug_print();
44  void debug_cell_site();
45  void debug_face_site();
46  void debug_node_site();
47  void debug_cells_mapper();
48  void debug_face_cells();
49  void debug_nodes_mapper();
50  void debug_face_nodes();
51  void debug_scatter_mappers();
52  void debug_gather_mappers();
53 
54 
55  //get methods
56 
57 
58 private:
60  void init();
61 
62  void setCellsSite();
63  void setFacesSite();
64  void setNodesSite();
65  void setCellsMapper();
66  void setNodesMapper();
67  void setCoord();
68 
69 
70  void setFaceCells();
71  void faceCellsInit( vector<int>& localCellID );
72  void faceCellsAddInteriorFaces( vector<int>& faceID );
73  void faceCellsAddPartitionInterfaces( vector<int>& faceID, vector<int>& localCellID );
74  void faceCellsAddMeshInterfaces ( vector<int>& faceID, vector<int>& localCellID );
75  void faceCellsAddBoundaryInterfaces ( vector<int>& faceID, vector<int>& localCellID );
76  void faceCellsFinishAdd();
77 
78  void setFaceNodes();
79  void faceNodesInit();
80  void faceNodesAddInteriorFaces( vector<int>& faceID );
81  void faceNodesAddPartitionInterfaces( vector<int>& faceID );
82  void faceNodesAddMeshInterfaces(vector<int>& faceID);
83  void faceNodesAddBoundaryInterfaces( vector<int>& faceID );
84  void faceNodesFinishAdd();
85 
86 
87 
88  void setMesh();
89  void setSites();
91  void createInterFaceGroup();
93  void createCoords();
94  void createFaceNodes();
95  void createFaceCells();
96  void setMappers();
98  void meshInterfaceMappers();
99  void getScatterArrays(const Array<int>& scatterArray, EntryVecMap& scatterArrayLocal, const StorageSite& site );
100  void getGatherArrays (const Array<int>& gatherArray , EntryVecMap& gatherArrayLocal , const StorageSite& site );
101 
102  void set_local_global();
103  int global_offset();
104 
105  void setCellCellsGhostExt();
106 
107 
108  void debug_file_open( const string& fname );
109  void debug_file_close();
110 
111  //DATA MEMBERS:
112  const Mesh& _mesh;
114 
115  vector<StorageSitePtr> _cellSite;
116  vector<StorageSitePtr> _faceSite;
117  vector<StorageSitePtr> _nodeSite;
118 
119  //mappers for inner cells
120  vector< ArrayIntPtr > _localCellToGlobal; //only inner cells
121  vector<int> _globalCellToMeshID; //belongs to which mesh from global Cell ID
122  vector<int> _globalCellToLocal; //only inner cells
123 
124  vector < map<int,int> > _globalToLocalNodes;
125  map<int, ArrayIntPtr > _localNodeToGlobal;
126  vector< map<int,int> > _globalToLocalFaces; //for each mesh (vector) and only for partition and mesh interfaces
127 
128  vector< multimap<int,int> > _faceIdentifierList;
129 
130  vector<CRConnectivityPtr> _faceCells;
131  vector<CRConnectivityPtr> _faceNodes;
132  vector<ArrayVecD3Ptr> _coord;
133 
134  map< int, vector<int> > _interfaceSize;
135  map< int, vector<int> > _interfaceOffset;
136  map< int, vector<int> > _interfaceID;
137 
138  map< int, vector<int> > _boundarySize;
139  map< int, vector<int> > _boundaryOffset;
140  map< int, vector<int> > _boundaryID;
141  map< int,vector<string> > _boundaryType;
142 
145 
146  ofstream _debugFile;
147  int _procID;
148  int _nPart;
149 
150  int _nmesh;
152 
153 };
154 
155 
156 #endif
vector< ArrayIntPtr > _localCellToGlobal
void createInterFaceGroup()
ofstream _debugFile
map< int, multimap< int, int > > NestedMap
shared_ptr< StorageSite > StorageSitePtr
void debug_file_open(const string &fname)
CRConnectivityPtr _cellFaces
map< int, vector< int > > _interfaceOffset
map< int, vector< string > > _boundaryType
void faceCellsAddPartitionInterfaces(vector< int > &faceID, vector< int > &localCellID)
void faceNodesAddBoundaryInterfaces(vector< int > &faceID)
Definition: Mesh.h:49
map< EntryIndex, vector< int > > EntryVecMap
MeshDismantler(const MeshList &meshList)
map< int, vector< int > > _boundaryID
vector< CRConnectivityPtr > _faceNodes
map< int, vector< int > > _boundaryOffset
shared_ptr< Array< double > > ArrayDblePtr
vector< ArrayVecD3Ptr > _coord
shared_ptr< Array< Mesh::VecD3 > > ArrayVecD3Ptr
vector< int > _globalCellToMeshID
const MeshList & meshList() const
map< int, int > IntMap
map< int, ArrayIntPtr > _localNodeToGlobal
map< EntryIndex, int > EntryMap
void getGatherArrays(const Array< int > &gatherArray, EntryVecMap &gatherArrayLocal, const StorageSite &site)
void faceCellsInit(vector< int > &localCellID)
void faceCellsAddInteriorFaces(vector< int > &faceID)
void faceNodesAddPartitionInterfaces(vector< int > &faceID)
pair< int, int > EntryIndex
void faceNodesAddMeshInterfaces(vector< int > &faceID)
vector< int > _globalCellToLocal
void faceCellsAddMeshInterfaces(vector< int > &faceID, vector< int > &localCellID)
map< int, vector< int > > _interfaceID
vector< StorageSitePtr > _cellSite
shared_ptr< Array< int > > ArrayIntPtr
vector< StorageSitePtr > _nodeSite
void createInteriorFaceGroup()
void partitionInterfaceMappers()
vector< map< int, int > > _globalToLocalFaces
shared_ptr< CRConnectivity > CRConnectivityPtr
vector< map< int, int > > _globalToLocalNodes
void debug_scatter_mappers()
map< int, const StorageSite * > IntStorageSiteMap
void faceNodesAddInteriorFaces(vector< int > &faceID)
MeshList _meshList
vector< CRConnectivityPtr > _faceCells
vector< StorageSitePtr > _faceSite
void faceCellsAddBoundaryInterfaces(vector< int > &faceID, vector< int > &localCellID)
void getScatterArrays(const Array< int > &scatterArray, EntryVecMap &scatterArrayLocal, const StorageSite &site)
vector< map< int, set< int > > > VecMap
const Mesh & _mesh
map< int, vector< int > > IntVecMap
vector< multimap< int, int > > _faceIdentifierList
void createBoundaryFaceGroup()
vector< Mesh * > MeshList
Definition: Mesh.h:439
map< int, vector< int > > _boundarySize
map< int, vector< int > > _interfaceSize
map< int, ArrayIntPtr > ArrayIntPtrMap