Memosa-FVM  0.2
MeshDismantler Class Reference

#include <MeshDismantler.h>

Collaboration diagram for MeshDismantler:

Public Types

typedef shared_ptr< Array
< double > > 
ArrayDblePtr
 
typedef shared_ptr< Array< int > > ArrayIntPtr
 
typedef map< int, ArrayIntPtrArrayIntPtrMap
 
typedef map< int, int > IntMap
 
typedef map< int, vector< int > > IntVecMap
 
typedef shared_ptr< StorageSiteStorageSitePtr
 
typedef shared_ptr
< CRConnectivity
CRConnectivityPtr
 
typedef shared_ptr< Array
< Mesh::VecD3 > > 
ArrayVecD3Ptr
 
typedef vector< map< int, set
< int > > > 
VecMap
 
typedef map< int, multimap
< int, int > > 
NestedMap
 
typedef pair< int, int > EntryIndex
 
typedef map< EntryIndex, int > EntryMap
 
typedef map< EntryIndex,
vector< int > > 
EntryVecMap
 
typedef map< int, const
StorageSite * > 
IntStorageSiteMap
 

Public Member Functions

 MeshDismantler (const MeshList &meshList)
 
 ~MeshDismantler ()
 
const MeshListmeshList () const
 
void debug_print ()
 
void debug_cell_site ()
 
void debug_face_site ()
 
void debug_node_site ()
 
void debug_cells_mapper ()
 
void debug_face_cells ()
 
void debug_nodes_mapper ()
 
void debug_face_nodes ()
 
void debug_scatter_mappers ()
 
void debug_gather_mappers ()
 

Private Member Functions

 MeshDismantler (const MeshDismantler &)
 
void init ()
 
void setCellsSite ()
 
void setFacesSite ()
 
void setNodesSite ()
 
void setCellsMapper ()
 
void setNodesMapper ()
 
void setCoord ()
 
void setFaceCells ()
 
void faceCellsInit (vector< int > &localCellID)
 
void faceCellsAddInteriorFaces (vector< int > &faceID)
 
void faceCellsAddPartitionInterfaces (vector< int > &faceID, vector< int > &localCellID)
 
void faceCellsAddMeshInterfaces (vector< int > &faceID, vector< int > &localCellID)
 
void faceCellsAddBoundaryInterfaces (vector< int > &faceID, vector< int > &localCellID)
 
void faceCellsFinishAdd ()
 
void setFaceNodes ()
 
void faceNodesInit ()
 
void faceNodesAddInteriorFaces (vector< int > &faceID)
 
void faceNodesAddPartitionInterfaces (vector< int > &faceID)
 
void faceNodesAddMeshInterfaces (vector< int > &faceID)
 
void faceNodesAddBoundaryInterfaces (vector< int > &faceID)
 
void faceNodesFinishAdd ()
 
void setMesh ()
 
void setSites ()
 
void createInteriorFaceGroup ()
 
void createInterFaceGroup ()
 
void createBoundaryFaceGroup ()
 
void createCoords ()
 
void createFaceNodes ()
 
void createFaceCells ()
 
void setMappers ()
 
void partitionInterfaceMappers ()
 
void meshInterfaceMappers ()
 
void getScatterArrays (const Array< int > &scatterArray, EntryVecMap &scatterArrayLocal, const StorageSite &site)
 
void getGatherArrays (const Array< int > &gatherArray, EntryVecMap &gatherArrayLocal, const StorageSite &site)
 
void set_local_global ()
 
int global_offset ()
 
void setCellCellsGhostExt ()
 
void debug_file_open (const string &fname)
 
void debug_file_close ()
 

Private Attributes

const Mesh_mesh
 
CRConnectivityPtr _cellFaces
 
vector< StorageSitePtr_cellSite
 
vector< StorageSitePtr_faceSite
 
vector< StorageSitePtr_nodeSite
 
vector< ArrayIntPtr_localCellToGlobal
 
vector< int > _globalCellToMeshID
 
vector< int > _globalCellToLocal
 
vector< map< int, int > > _globalToLocalNodes
 
map< int, ArrayIntPtr_localNodeToGlobal
 
vector< map< int, int > > _globalToLocalFaces
 
vector< multimap< int, int > > _faceIdentifierList
 
vector< CRConnectivityPtr_faceCells
 
vector< CRConnectivityPtr_faceNodes
 
vector< ArrayVecD3Ptr_coord
 
map< int, vector< int > > _interfaceSize
 
map< int, vector< int > > _interfaceOffset
 
map< int, vector< int > > _interfaceID
 
map< int, vector< int > > _boundarySize
 
map< int, vector< int > > _boundaryOffset
 
map< int, vector< int > > _boundaryID
 
map< int, vector< string > > _boundaryType
 
int _nInterfaceNodes
 
int _interiorFaceSize
 
ofstream _debugFile
 
int _procID
 
int _nPart
 
int _nmesh
 
MeshList _meshList
 

Detailed Description

Definition at line 16 of file MeshDismantler.h.

Member Typedef Documentation

typedef shared_ptr< Array<double> > MeshDismantler::ArrayDblePtr

Definition at line 20 of file MeshDismantler.h.

typedef shared_ptr< Array<int> > MeshDismantler::ArrayIntPtr

Definition at line 21 of file MeshDismantler.h.

Definition at line 22 of file MeshDismantler.h.

Definition at line 28 of file MeshDismantler.h.

Definition at line 26 of file MeshDismantler.h.

typedef pair<int,int> MeshDismantler::EntryIndex

Definition at line 31 of file MeshDismantler.h.

Definition at line 32 of file MeshDismantler.h.

typedef map<EntryIndex, vector<int> > MeshDismantler::EntryVecMap

Definition at line 33 of file MeshDismantler.h.

typedef map<int, int> MeshDismantler::IntMap

Definition at line 23 of file MeshDismantler.h.

Definition at line 34 of file MeshDismantler.h.

typedef map<int, vector<int> > MeshDismantler::IntVecMap

Definition at line 24 of file MeshDismantler.h.

typedef map<int, multimap<int,int> > MeshDismantler::NestedMap

Definition at line 30 of file MeshDismantler.h.

Definition at line 25 of file MeshDismantler.h.

typedef vector< map<int, set<int> > > MeshDismantler::VecMap

Definition at line 29 of file MeshDismantler.h.

Constructor & Destructor Documentation

MeshDismantler::MeshDismantler ( const MeshList meshList)

Definition at line 24 of file MeshDismantler.cpp.

References init().

24  :_mesh( *meshList.at(0) ), _procID(0)
25 {
26  //assert condition for meshList size
27  assert( meshList.size() == 1 );
28  init();
29 }
const MeshList & meshList() const
const Mesh & _mesh
MeshDismantler::~MeshDismantler ( )

Definition at line 31 of file MeshDismantler.cpp.

References _meshList.

32 {
33  vector< Mesh* >::iterator it_mesh;
34  for ( it_mesh = _meshList.begin(); it_mesh != _meshList.end(); it_mesh++)
35  delete *it_mesh;
36 }
MeshList _meshList
MeshDismantler::MeshDismantler ( const MeshDismantler )
private

Member Function Documentation

void MeshDismantler::createBoundaryFaceGroup ( )
private

Definition at line 839 of file MeshDismantler.cpp.

References _boundaryID, _boundaryOffset, _boundarySize, _boundaryType, _meshList, and _nmesh.

Referenced by setMesh().

840 {
841  for ( int id = 0; id < _nmesh; id++ ){
842  for ( unsigned int i = 0; i < _boundaryOffset[id].size(); i++ ){
843  const int size = _boundarySize[id][i];
844  const int offset = _boundaryOffset[id][i];
845  const int boundaryID = _boundaryID[id][i];
846  const string& bType = _boundaryType[id][i];
847  if ( size > 0 )
848  _meshList.at(id)->createBoundaryFaceGroup( size, offset, boundaryID, bType );
849  }
850  }
851 }
map< int, vector< string > > _boundaryType
map< int, vector< int > > _boundaryID
map< int, vector< int > > _boundaryOffset
MeshList _meshList
map< int, vector< int > > _boundarySize
void MeshDismantler::createCoords ( )
private

Definition at line 854 of file MeshDismantler.cpp.

References _coord, _meshList, and _nmesh.

Referenced by setMesh().

855 {
856  for ( int id = 0 ; id < _nmesh; id++ )
857  _meshList.at(id)->setCoordinates( _coord.at(id) );
858 }
vector< ArrayVecD3Ptr > _coord
MeshList _meshList
void MeshDismantler::createFaceCells ( )
private

Definition at line 868 of file MeshDismantler.cpp.

References _faceCells, _meshList, and _nmesh.

Referenced by setMesh().

869 {
870  for ( int id = 0; id < _nmesh; id++ )
871  _meshList.at(id)->setFaceCells( _faceCells.at(id) );
872 }
MeshList _meshList
vector< CRConnectivityPtr > _faceCells
void MeshDismantler::createFaceNodes ( )
private

Definition at line 861 of file MeshDismantler.cpp.

References _faceNodes, _meshList, and _nmesh.

Referenced by setMesh().

862 {
863  for ( int id = 0; id < _nmesh; id++ )
864  _meshList.at(id)->setFaceNodes( _faceNodes.at(id) );
865 }
vector< CRConnectivityPtr > _faceNodes
MeshList _meshList
void MeshDismantler::createInterFaceGroup ( )
private

Definition at line 825 of file MeshDismantler.cpp.

References _interfaceID, _interfaceOffset, _interfaceSize, _meshList, and _nmesh.

Referenced by setMesh().

826 {
827  for ( int id = 0; id < _nmesh; id++ ){
828  for ( unsigned int i = 0; i < _interfaceOffset[id].size(); i++ ){
829  const int size = _interfaceSize[id][i];
830  const int offset = _interfaceOffset[id][i];
831  const int interfaceID = _interfaceID[id][i];
832  if ( size > 0 )
833  _meshList.at(id)->createInterfaceGroup( size, offset, interfaceID);
834  }
835  }
836 }
map< int, vector< int > > _interfaceOffset
map< int, vector< int > > _interfaceID
MeshList _meshList
map< int, vector< int > > _interfaceSize
void MeshDismantler::createInteriorFaceGroup ( )
private

Definition at line 806 of file MeshDismantler.cpp.

References _cellSite, _faceCells, _faceSite, _meshList, _nmesh, and StorageSite::getCount().

Referenced by setMesh().

807 {
808  for ( int id = 0; id < _nmesh; id++ ){
809  int nInteriorFace = 0;
810  const CRConnectivity& faceCells = *_faceCells.at(id);
811  const StorageSite& faceSite = *_faceSite.at(id);
812  const int cellSelfCount = _cellSite.at(id)->getSelfCount();
813  for ( int i = 0; i < faceSite.getCount(); i++ ){
814  int cell1 = faceCells(i,0);
815  int cell2 = faceCells(i,1);
816  if ( (cell1 < cellSelfCount) && (cell2 < cellSelfCount) )
817  nInteriorFace++;
818  }
819  _meshList.at(id)->createInteriorFaceGroup( nInteriorFace );
820  }
821 
822 }
vector< StorageSitePtr > _cellSite
MeshList _meshList
int getCount() const
Definition: StorageSite.h:39
vector< CRConnectivityPtr > _faceCells
vector< StorageSitePtr > _faceSite
void MeshDismantler::debug_cell_site ( )

Definition at line 1219 of file MeshDismantler.cpp.

References _cellSite, _debugFile, _nmesh, debug_file_close(), and debug_file_open().

Referenced by debug_print().

1220 {
1221  debug_file_open("cellSite");
1222  for ( int id = 0; id < _nmesh; id++ )
1223  _debugFile <<"meshid = " << id << " selfCount = " << _cellSite.at(id)->getSelfCount() << " count = " << _cellSite.at(id)->getCount() <<
1224  " countLevel1 = " << _cellSite.at(id)->getCountLevel1() <<endl;
1225  debug_file_close();
1226 }
ofstream _debugFile
void debug_file_open(const string &fname)
vector< StorageSitePtr > _cellSite
void MeshDismantler::debug_cells_mapper ( )

Definition at line 1247 of file MeshDismantler.cpp.

References _debugFile, _globalCellToLocal, _globalCellToMeshID, debug_file_close(), and debug_file_open().

Referenced by debug_print().

1248 {
1249  debug_file_open("cellsMapper");
1250  for ( unsigned int i = 0; i < _globalCellToMeshID.size(); i++ )
1251  _debugFile << "glblID = " << i << " meshID = " << _globalCellToMeshID[i] << endl;
1252  _debugFile << endl;
1253  for ( unsigned int i = 0; i < _globalCellToLocal.size(); i++ )
1254  _debugFile << "glblID = " << i << " localID = " << _globalCellToLocal[i] << endl;
1255  debug_file_close();
1256 
1257 }
ofstream _debugFile
void debug_file_open(const string &fname)
vector< int > _globalCellToMeshID
vector< int > _globalCellToLocal
void MeshDismantler::debug_face_cells ( )

Definition at line 1275 of file MeshDismantler.cpp.

References _debugFile, _faceCells, _faceSite, _nmesh, debug_file_close(), debug_file_open(), StorageSite::getCount(), and CRConnectivity::getCount().

Referenced by debug_print().

1276 {
1277  debug_file_open("faceCells");
1278  for ( int id = 0; id < _nmesh; id++ ){
1279  const StorageSite & faceSite = *_faceSite.at(id);
1280  const CRConnectivity& faceCells = *_faceCells.at(id);
1281  _debugFile << " meshID : " << id << endl;
1282  for ( int n = 0; n < faceSite.getCount(); n++ ){
1283  _debugFile << "faceCells(" << n << " ) = ";
1284  for ( int i = 0; i < faceCells.getCount(n); i++ ){
1285  _debugFile << faceCells(n,i) << " ";
1286  }
1287  _debugFile << endl;
1288  }
1289  }
1290  debug_file_close();
1291 
1292 }
int getCount(const int i) const
ofstream _debugFile
void debug_file_open(const string &fname)
int getCount() const
Definition: StorageSite.h:39
vector< CRConnectivityPtr > _faceCells
vector< StorageSitePtr > _faceSite
void MeshDismantler::debug_face_nodes ( )

Definition at line 1295 of file MeshDismantler.cpp.

References _debugFile, _faceNodes, _faceSite, _nmesh, debug_file_close(), debug_file_open(), StorageSite::getCount(), and CRConnectivity::getCount().

Referenced by debug_print().

1296 {
1297  debug_file_open("faceNodes");
1298  for ( int id = 0; id < _nmesh; id++ ){
1299  const StorageSite & faceSite = *_faceSite.at(id);
1300  const CRConnectivity& faceNodes = *_faceNodes.at(id);
1301  _debugFile << " meshID : " << id << endl;
1302  for ( int n = 0; n < faceSite.getCount(); n++ ){
1303  _debugFile << "faceNodes(" << n << " ) = ";
1304  for ( int i = 0; i < faceNodes.getCount(n); i++ ){
1305  _debugFile << faceNodes(n,i) << " ";
1306  }
1307  _debugFile << endl;
1308  }
1309  }
1310  debug_file_close();
1311 }
int getCount(const int i) const
ofstream _debugFile
void debug_file_open(const string &fname)
vector< CRConnectivityPtr > _faceNodes
int getCount() const
Definition: StorageSite.h:39
vector< StorageSitePtr > _faceSite
void MeshDismantler::debug_face_site ( )

Definition at line 1229 of file MeshDismantler.cpp.

References _debugFile, _faceSite, _nmesh, debug_file_close(), and debug_file_open().

Referenced by debug_print().

1230 {
1231  debug_file_open("faceSite");
1232  for ( int id = 0; id < _nmesh; id++ )
1233  _debugFile <<"meshid = " << id << " count = " << _faceSite.at(id)->getCount() << endl;
1234  debug_file_close();
1235 }
ofstream _debugFile
void debug_file_open(const string &fname)
vector< StorageSitePtr > _faceSite
void MeshDismantler::debug_file_close ( )
private
void MeshDismantler::debug_file_open ( const string &  fname)
private

Definition at line 1484 of file MeshDismantler.cpp.

References _debugFile, and _procID.

Referenced by debug_cell_site(), debug_cells_mapper(), debug_face_cells(), debug_face_nodes(), debug_face_site(), debug_gather_mappers(), debug_node_site(), debug_nodes_mapper(), and debug_scatter_mappers().

1485 {
1486  stringstream ss;
1487  ss << _procID;
1488 
1489  string fname = "MESHDISMANTLER_"+fname_+"_proc"+ss.str()+".dat";
1490  _debugFile.open( fname.c_str() );
1491 }
ofstream _debugFile
void MeshDismantler::debug_gather_mappers ( )

Definition at line 1398 of file MeshDismantler.cpp.

References _debugFile, _meshList, _nmesh, _procID, debug_file_close(), debug_file_open(), StorageSite::getGatherProcID(), Array< T >::getLength(), and StorageSite::getTag().

Referenced by debug_print().

1399 {
1400 
1401  debug_file_open("gatherMappers");
1402  //creating mappers between cell storage site to mesh id
1403  map< const StorageSite*, int > siteMeshMapper; //key = storage site, value = mesh ID of cellSite
1404  for ( int id = 0; id < _nmesh; id++ )
1405  siteMeshMapper[&_meshList.at(id)->getCells()] = id;
1406 
1407  //first make sure consistent order for gatherMap since map order with key which is pointer
1408  //first mesh interface (increasing order) then partition interface (increasing order)
1409  vector< const StorageSite* > gatherSiteVec;
1410  map <int, int> packIDToMeshID;
1411  vector< int > gatherSiteVecID;
1412  IntStorageSiteMap orderedMeshInterface;
1413  for ( int id = 0; id < _nmesh; id++ ){
1414  const StorageSite::GatherMap& gatherMap = _meshList.at(id)->getCells().getGatherMap();
1415  foreach ( const StorageSite::GatherMap::value_type& pos, gatherMap ){
1416  const StorageSite& gatherSite = *pos.first;
1417  if ( gatherSite.getGatherProcID() == -1 ){ //this means mesh interface
1418  int neighMeshID = siteMeshMapper[ pos.first ];
1419  const int packed_info = ( (id << 16) | neighMeshID );
1420  orderedMeshInterface.insert( make_pair<int, const StorageSite*>(packed_info, pos.first) );
1421  packIDToMeshID.insert( make_pair<int,int>(packed_info,id) );
1422  }
1423  }
1424  }
1425 
1426  //fill gatherSiteVec, map data structure already ordered them
1427  foreach ( const IntStorageSiteMap::value_type& pos, orderedMeshInterface ){
1428  gatherSiteVec.push_back( pos.second );
1429  const int meshID = packIDToMeshID[pos.first];
1430  gatherSiteVecID.push_back( meshID );
1431  }
1432  //clear for usage in partition interface
1433  packIDToMeshID.clear();
1434  //order partition interface (map will reorder)
1435  IntStorageSiteMap orderedPartInterface;
1436  for ( int id = 0; id < _nmesh; id++ ){
1437  const StorageSite::GatherMap& gatherMap = _meshList.at(id)->getCells().getGatherMap();
1438  foreach ( const StorageSite::GatherMap::value_type& pos, gatherMap ){
1439  const StorageSite& gatherSite = *pos.first;
1440  if ( gatherSite.getGatherProcID() != -1 ){ //this means partition face
1441  const int neighID = gatherSite.getGatherProcID();
1442  const int tag = gatherSite.getTag();
1443  const int packed_info = ( (id << 31) | (neighID << 24) | tag );
1444  orderedPartInterface.insert( make_pair<int, const StorageSite*>(packed_info, pos.first) );
1445  packIDToMeshID.insert( make_pair<int,int>(packed_info,id) );
1446  }
1447  }
1448  }
1449 
1450  //fill scatterSiteVec, map data structure already
1451  foreach ( const IntStorageSiteMap::value_type& pos, orderedPartInterface ){
1452  gatherSiteVec.push_back( pos.second );
1453  const int meshID = packIDToMeshID[pos.first];
1454  gatherSiteVecID.push_back( meshID );
1455  }
1456 
1457  int indx = 0;
1458  foreach( const vector<const StorageSite*>::value_type& pos, gatherSiteVec){
1459  if ( pos->getGatherProcID() != -1 ){ //this means partition face
1460  const int id = gatherSiteVecID[indx++];
1461  const StorageSite::GatherMap& gatherMap = _meshList.at(id)->getCells().getGatherMap();
1462  const Array<int>& gatherArray = *(gatherMap.find(pos)->second);
1463  const int neighID = pos->getGatherProcID();
1464  _debugFile << " meshID = " << id << " procID = " << _procID << " neighProcID = " << neighID << " Tag = " << pos->getTag() << " : " << endl;
1465  for ( int i = 0; i < gatherArray.getLength(); i++ ){
1466  _debugFile << " gatherArray[" << i << "] = " << gatherArray[i] << endl;
1467  }
1468  } else { //this means mesh interface
1469  const int id = gatherSiteVecID[indx++];
1470  const StorageSite::GatherMap& gatherMap = _meshList.at(id)->getCells().getGatherMap();
1471  const Array<int>& gatherArray = *(gatherMap.find(pos)->second);
1472  int neighMeshID = siteMeshMapper[pos];
1473  _debugFile << " meshID = " << id << " otherside MeshID = " << neighMeshID << " : " << endl;
1474  for ( int i = 0; i < gatherArray.getLength(); i++ ){
1475  _debugFile << " gatherArray[" << i << "] = " << gatherArray[i] << endl;
1476  }
1477  }
1478  }
1479  debug_file_close();
1480 }
ofstream _debugFile
void debug_file_open(const string &fname)
int getTag() const
Definition: StorageSite.h:84
int getGatherProcID() const
Definition: StorageSite.h:83
map< int, const StorageSite * > IntStorageSiteMap
MeshList _meshList
map< const StorageSite *, shared_ptr< Array< int > > > GatherMap
Definition: StorageSite.h:24
int getLength() const
Definition: Array.h:87
void MeshDismantler::debug_node_site ( )

Definition at line 1238 of file MeshDismantler.cpp.

References _debugFile, _nmesh, _nodeSite, debug_file_close(), and debug_file_open().

Referenced by debug_print().

1239 {
1240  debug_file_open("nodeSite");
1241  for ( int id = 0; id < _nmesh; id++ )
1242  _debugFile <<"meshid = " << id << " count = " << _nodeSite.at(id)->getCount() << endl;
1243  debug_file_close();
1244 }
ofstream _debugFile
void debug_file_open(const string &fname)
vector< StorageSitePtr > _nodeSite
void MeshDismantler::debug_nodes_mapper ( )

Definition at line 1260 of file MeshDismantler.cpp.

References _debugFile, _globalToLocalNodes, debug_file_close(), and debug_file_open().

Referenced by debug_print().

1261 {
1262  debug_file_open("nodesMapper");
1263  for ( unsigned i = 0; i < _globalToLocalNodes.size(); i++ ){
1264  const map<int,int>& nodeMap = _globalToLocalNodes[i];
1265  foreach(const IntMap::value_type& mpos, nodeMap){
1266  int colorID = mpos.first;
1267  int localNodeID = mpos.second;
1268  _debugFile << "glblNodeID = " << i << " meshID = " << colorID << " localNodeID = " << localNodeID << endl;
1269  }
1270  }
1271  debug_file_close();
1272 }
ofstream _debugFile
void debug_file_open(const string &fname)
vector< map< int, int > > _globalToLocalNodes
void MeshDismantler::debug_scatter_mappers ( )

Definition at line 1314 of file MeshDismantler.cpp.

References _debugFile, _meshList, _nmesh, _procID, debug_file_close(), debug_file_open(), StorageSite::getGatherProcID(), Array< T >::getLength(), and StorageSite::getTag().

Referenced by debug_print().

1315 {
1316  debug_file_open("scatterMappers");
1317  //creating mappers between cell storage site to mesh id
1318  map< const StorageSite*, int > siteMeshMapper; //key = storage site, value = mesh ID of cellSite
1319  for ( int id = 0; id < _nmesh; id++ )
1320  siteMeshMapper[&_meshList.at(id)->getCells()] = id;
1321 
1322  //first make sure consistent order for scatterMap since map order with key which is pointer
1323  //first mesh interface (increasing order) then partition interface (increasing order)
1324  vector< const StorageSite* > scatterSiteVec;
1325  map <int, int> packIDToMeshID;
1326  vector< int > scatterSiteVecID;
1327  IntStorageSiteMap orderedMeshInterface;
1328  for ( int id = 0; id < _nmesh; id++ ){
1329  const StorageSite::ScatterMap& scatterMap = _meshList.at(id)->getCells().getScatterMap();
1330  foreach ( const StorageSite::ScatterMap::value_type& pos, scatterMap ){
1331  const StorageSite& scatterSite = *pos.first;
1332  if ( scatterSite.getGatherProcID() == -1 ){ //this means mesh interface
1333  int neighMeshID = siteMeshMapper[ pos.first ];
1334  const int packed_info = ( (id << 16) | neighMeshID );
1335  orderedMeshInterface.insert( make_pair<int, const StorageSite*>(packed_info, pos.first) );
1336  packIDToMeshID.insert( make_pair<int,int>(packed_info,id) );
1337  }
1338  }
1339  }
1340 
1341  //fill scatterSiteVec, map data structure already ordered them
1342  foreach ( const IntStorageSiteMap::value_type& pos, orderedMeshInterface ){
1343  scatterSiteVec.push_back( pos.second );
1344  const int meshID = packIDToMeshID[pos.first];
1345  scatterSiteVecID.push_back( meshID );
1346  }
1347  //clear for usage in partition interface
1348  packIDToMeshID.clear();
1349  //order partition interface (map will reorder)
1350  IntStorageSiteMap orderedPartInterface;
1351  for ( int id = 0; id < _nmesh; id++ ){
1352  const StorageSite::ScatterMap& scatterMap = _meshList.at(id)->getCells().getScatterMap();
1353  foreach ( const StorageSite::ScatterMap::value_type& pos, scatterMap ){
1354  const StorageSite& scatterSite = *pos.first;
1355  if ( scatterSite.getGatherProcID() != -1 ){ //this means partition face
1356  const int neighID = scatterSite.getGatherProcID();
1357  const int tag = scatterSite.getTag();
1358  const int packed_info = ( (id << 31) | (neighID << 24) | tag );
1359  orderedPartInterface.insert( make_pair<int, const StorageSite*>(packed_info, pos.first) );
1360  packIDToMeshID.insert( make_pair<int,int>(packed_info,id) );
1361  }
1362  }
1363  }
1364 
1365  //fill scatterSiteVec, map data structure already
1366  foreach ( const IntStorageSiteMap::value_type& pos, orderedPartInterface ){
1367  scatterSiteVec.push_back( pos.second );
1368  const int meshID = packIDToMeshID[pos.first];
1369  scatterSiteVecID.push_back( meshID );
1370  }
1371 
1372  int indx = 0;
1373  foreach( const vector<const StorageSite*>::value_type& pos, scatterSiteVec){
1374  if ( pos->getGatherProcID() != -1 ){ //this means partition face
1375  const int id = scatterSiteVecID[indx++];
1376  const StorageSite::ScatterMap& scatterMap = _meshList.at(id)->getCells().getScatterMap();
1377  const Array<int>& scatterArray = *(scatterMap.find(pos)->second);
1378  const int neighID = pos->getGatherProcID();
1379  _debugFile << " meshID = " << id << " procID = " << _procID << " neighProcID = " << neighID << " Tag = " << pos->getTag() << " : " << endl;
1380  for ( int i = 0; i < scatterArray.getLength(); i++ ){
1381  _debugFile << " scatterArray[" << i << "] = " << scatterArray[i] << endl;
1382  }
1383  } else { //this means mesh interface
1384  const int id = scatterSiteVecID[indx++];
1385  const StorageSite::ScatterMap& scatterMap = _meshList.at(id)->getCells().getScatterMap();
1386  const Array<int>& scatterArray = *(scatterMap.find(pos)->second);
1387  int neighMeshID = siteMeshMapper[pos];
1388  _debugFile << " meshID = " << id << " otherside MeshID = " << neighMeshID << " : " << endl;
1389  for ( int i = 0; i < scatterArray.getLength(); i++ ){
1390  _debugFile << " scatterArray[" << i << "] = " << scatterArray[i] << endl;
1391  }
1392  }
1393  }
1394  debug_file_close();
1395 }
ofstream _debugFile
void debug_file_open(const string &fname)
int getTag() const
Definition: StorageSite.h:84
int getGatherProcID() const
Definition: StorageSite.h:83
map< const StorageSite *, shared_ptr< Array< int > > > ScatterMap
Definition: StorageSite.h:23
map< int, const StorageSite * > IntStorageSiteMap
MeshList _meshList
int getLength() const
Definition: Array.h:87
void MeshDismantler::faceCellsAddBoundaryInterfaces ( vector< int > &  faceID,
vector< int > &  localCellID 
)
private

Definition at line 429 of file MeshDismantler.cpp.

References _boundaryID, _boundaryOffset, _boundarySize, _boundaryType, _faceCells, _globalCellToLocal, _globalCellToMeshID, _globalToLocalFaces, _mesh, _nmesh, Mesh::getAllFaceCells(), Mesh::getBoundaryFaceGroups(), Mesh::getBoundaryGroupCount(), Mesh::getCells(), StorageSite::getCount(), StorageSite::getOffset(), and StorageSite::getSelfCount().

Referenced by setFaceCells().

430 {
431  _globalToLocalFaces.resize( _nmesh );
432  int cellSelfCount = _mesh.getCells().getSelfCount();
433  int boundaryCount = _mesh.getBoundaryGroupCount();
434  const CRConnectivity& faceCells = _mesh.getAllFaceCells();
435  const FaceGroupList& boundaryGroupList = _mesh.getBoundaryFaceGroups();
436  //loop over partition faces (
437  for ( int i = 0; i < boundaryCount; i++ ){
438  const StorageSite& boundaryFaceSite = boundaryGroupList[i]->site;
439  int offset = boundaryFaceSite.getOffset(); //where to begin face
440  int nBeg = offset;
441  int nEnd = nBeg + boundaryFaceSite.getCount();
442  //filling faceOffset and ID and Type
443  const int bounID = boundaryGroupList[i]->id;
444  const string& bType = boundaryGroupList[i]->groupType;
445  for ( int id = 0; id < _nmesh; id++ ){
446  _boundaryOffset[id].push_back( faceID[id] );
447  _boundaryID [id].push_back( bounID );
448  _boundaryType [id].push_back( bType );
449  }
450  for ( int n = nBeg; n < nEnd; n++ ){
451  int cell1 = faceCells(n,0);
452  int cell2 = faceCells(n,1);
453  //if inner cells take it first, second one ghost cell
454  if ( cell1 < cellSelfCount ){
455  int meshID = _globalCellToMeshID[ cell1 ];
456  _faceCells.at( meshID )->add( faceID[meshID], _globalCellToLocal[cell1] );
457  _faceCells.at( meshID )->add( faceID[meshID], localCellID[meshID]++ );
458  faceID[meshID]++;
459  } else {
460  int meshID = _globalCellToMeshID[ cell2 ];
461  _faceCells.at( meshID )->add( faceID[meshID], _globalCellToLocal[cell2] );
462  _faceCells.at( meshID )->add( faceID[meshID], localCellID[meshID]++ );
463  faceID[meshID]++;
464  }
465  }
466  //filling sizes
467  for ( int id = 0; id < _nmesh; id++ )
468  _boundarySize[id].push_back( faceID[id] - _boundaryOffset[id][i] );
469 
470  }
471 
472 }
const FaceGroupList & getBoundaryFaceGroups() const
Definition: Mesh.h:187
int getBoundaryGroupCount() const
Definition: Mesh.h:184
int getSelfCount() const
Definition: StorageSite.h:40
map< int, vector< string > > _boundaryType
map< int, vector< int > > _boundaryID
map< int, vector< int > > _boundaryOffset
vector< int > _globalCellToMeshID
const CRConnectivity & getAllFaceCells() const
Definition: Mesh.cpp:378
vector< int > _globalCellToLocal
vector< FaceGroupPtr > FaceGroupList
Definition: Mesh.h:47
const StorageSite & getCells() const
Definition: Mesh.h:109
vector< map< int, int > > _globalToLocalFaces
int getOffset() const
Definition: StorageSite.h:87
int getCount() const
Definition: StorageSite.h:39
vector< CRConnectivityPtr > _faceCells
const Mesh & _mesh
map< int, vector< int > > _boundarySize
void MeshDismantler::faceCellsAddInteriorFaces ( vector< int > &  faceID)
private

Definition at line 286 of file MeshDismantler.cpp.

References _faceCells, _globalCellToLocal, _globalCellToMeshID, _mesh, Mesh::getAllFaceCells(), StorageSite::getCount(), Mesh::getInteriorFaceGroup(), and FaceGroup::site.

Referenced by setFaceCells().

287 {
288  //first add interior faces
289  const CRConnectivity& faceCells = _mesh.getAllFaceCells();
290  const FaceGroup& interiorFaceGroup = _mesh.getInteriorFaceGroup();
291  const StorageSite& interiorFaceSite = interiorFaceGroup.site;
292  for ( int i = 0; i < interiorFaceSite.getCount(); i++ ){
293  int cell1 = faceCells(i,0);
294  int cell2 = faceCells(i,1);
295  int meshID1 = _globalCellToMeshID[cell1];
296  int meshID2 = _globalCellToMeshID[cell2];
297  if ( meshID1 == meshID2 ){ //it means this face interior face
298  _faceCells.at( meshID1 )->add( faceID[meshID1], _globalCellToLocal[cell1] );
299  _faceCells.at( meshID2 )->add( faceID[meshID2], _globalCellToLocal[cell2] );
300  faceID[meshID1]++;
301  }
302  }
303 }
const FaceGroup & getInteriorFaceGroup() const
Definition: Mesh.h:181
Definition: Mesh.h:28
vector< int > _globalCellToMeshID
const CRConnectivity & getAllFaceCells() const
Definition: Mesh.cpp:378
vector< int > _globalCellToLocal
int getCount() const
Definition: StorageSite.h:39
vector< CRConnectivityPtr > _faceCells
const Mesh & _mesh
StorageSite site
Definition: Mesh.h:40
void MeshDismantler::faceCellsAddMeshInterfaces ( vector< int > &  faceID,
vector< int > &  localCellID 
)
private

Definition at line 356 of file MeshDismantler.cpp.

References _faceCells, _faceIdentifierList, _globalCellToLocal, _globalCellToMeshID, _globalToLocalFaces, _interfaceID, _interfaceOffset, _interfaceSize, _mesh, _nmesh, Mesh::getAllFaceCells(), StorageSite::getCount(), Mesh::getInteriorFaceGroup(), and FaceGroup::site.

Referenced by setFaceCells().

357 {
358  //loop over interfaces to see color difference
359  const CRConnectivity& faceCells = _mesh.getAllFaceCells();
360  const FaceGroup& interiorFaceGroup = _mesh.getInteriorFaceGroup();
361  const StorageSite& interiorFaceSite = interiorFaceGroup.site;
362 
363  vector<int> countMeshInterface(_nmesh,0);
364  for ( int i = 0; i < interiorFaceSite.getCount(); i++ ){
365  int cell1 = faceCells(i,0);
366  int cell2 = faceCells(i,1);
367  int meshID1 = _globalCellToMeshID[cell1];
368  int meshID2 = _globalCellToMeshID[cell2];
369  if ( meshID1 != meshID2 ){ //it means this face is mesh interface
370  countMeshInterface[meshID1]++;
371  countMeshInterface[meshID2]++;
372  }
373  }
374 
375  //allocate memory
376  _faceIdentifierList.resize( _nmesh );
377  //only sweep interior face to find mesh interface
378  for ( int i = 0; i < interiorFaceSite.getCount(); i++ ){
379  int cell1 = faceCells(i,0);
380  int cell2 = faceCells(i,1);
381  int meshID1 = _globalCellToMeshID[cell1];
382  int meshID2 = _globalCellToMeshID[cell2];
383  if ( meshID1 != meshID2 ){ //it means this face is mesh interface
384  _faceIdentifierList[meshID1].insert( pair<int,int>(meshID2,i) );
385  _faceIdentifierList[meshID2].insert( pair<int,int>(meshID1,i) );
386  }
387  }
388 
389  //loop over meshes
390  for ( int id = 0 ; id < _nmesh ; id++ ){
391  const multimap<int,int>& faceIdentifier = _faceIdentifierList[id];
392  //loop over all meshinterfaces
393  for ( int key = 0; key < _nmesh; key++ ){
394  //filling faceOffset, ID and sizes
395  int nface = faceIdentifier.count(key);
396  if ( nface > 0 ){
397  _interfaceOffset[id].push_back( faceID[id] );
398  _interfaceID [id].push_back( key );
399  _interfaceSize [id].push_back( nface );
400  }
401 
402  multimap<int,int>::const_iterator it;
403  for ( it = faceIdentifier.equal_range(key).first; it != faceIdentifier.equal_range(key).second; it++ ){
404  int glblFaceID = it->second;
405  int cell1 = faceCells(glblFaceID,0);
406  int cell2 = faceCells(glblFaceID,1);
407  int meshID1 = _globalCellToMeshID[cell1];
408 // int meshID2 = _globalCellToMeshID[cell2];
409  if ( id == meshID1 ){
410  _faceCells.at(id)->add( faceID[id], _globalCellToLocal[cell1] );
411  _faceCells.at(id)->add( faceID[id], localCellID[id]);
412  _globalToLocalFaces[id][glblFaceID] = faceID[id];
413  localCellID[id]++;
414  faceID[id]++;
415  } else {
416  _faceCells.at(id)->add( faceID[id], _globalCellToLocal[cell2] );
417  _faceCells.at(id)->add( faceID[id], localCellID[id] );
418  _globalToLocalFaces[id][glblFaceID] = faceID[id];
419  localCellID[id]++;
420  faceID[id]++;
421  }
422  }
423  }
424  }
425 
426 }
const FaceGroup & getInteriorFaceGroup() const
Definition: Mesh.h:181
Definition: Mesh.h:28
map< int, vector< int > > _interfaceOffset
vector< int > _globalCellToMeshID
const CRConnectivity & getAllFaceCells() const
Definition: Mesh.cpp:378
vector< int > _globalCellToLocal
map< int, vector< int > > _interfaceID
vector< map< int, int > > _globalToLocalFaces
int getCount() const
Definition: StorageSite.h:39
vector< CRConnectivityPtr > _faceCells
const Mesh & _mesh
vector< multimap< int, int > > _faceIdentifierList
map< int, vector< int > > _interfaceSize
StorageSite site
Definition: Mesh.h:40
void MeshDismantler::faceCellsAddPartitionInterfaces ( vector< int > &  faceID,
vector< int > &  localCellID 
)
private

Definition at line 306 of file MeshDismantler.cpp.

References _faceCells, _globalCellToLocal, _globalCellToMeshID, _globalToLocalFaces, _interfaceID, _interfaceOffset, _interfaceSize, _mesh, _nmesh, Mesh::getAllFaceCells(), Mesh::getCells(), StorageSite::getCount(), Mesh::getInterfaceGroupCount(), Mesh::getInterfaceGroups(), StorageSite::getOffset(), and StorageSite::getSelfCount().

Referenced by setFaceCells().

307 {
308  //add partition interfaces
309  int cellSelfCount = _mesh.getCells().getSelfCount();
310  int interfaceCount = _mesh.getInterfaceGroupCount();
311  const CRConnectivity& faceCells = _mesh.getAllFaceCells();
312  const FaceGroupList& interfaceGroupList = _mesh.getInterfaceGroups();
313  //loop over partition faces (
314  for ( int i = 0; i < interfaceCount; i++ ){
315  const StorageSite& interiorFaceSite = interfaceGroupList[i]->site;
316  int offset = interiorFaceSite.getOffset(); //where to begin face
317  int nBeg = offset;
318  int nEnd = nBeg + interiorFaceSite.getCount();
319 
320  //filling faceOffset and ID
321  for ( int id = 0; id < _nmesh; id++ ){
322  _interfaceOffset[id].push_back( faceID[id] );
323  _interfaceID [id].push_back( -interfaceGroupList[i]->id );
324  }
325 
326  for ( int n = nBeg; n < nEnd; n++ ){
327  int cell1 = faceCells(n,0);
328  int cell2 = faceCells(n,1);
329  //if inner cells take it first, second one ghost cell
330  if ( cell1 < cellSelfCount ){
331  int meshID = _globalCellToMeshID[ cell1 ];
332  _faceCells.at( meshID )->add( faceID[meshID], _globalCellToLocal[cell1] );
333  _faceCells.at( meshID )->add( faceID[meshID], localCellID[meshID] );
334  _globalToLocalFaces[meshID][n] = faceID[meshID];
335  localCellID[meshID]++;
336  faceID[meshID]++;
337  } else {
338  int meshID = _globalCellToMeshID[ cell2 ];
339  _faceCells.at( meshID )->add( faceID[meshID], _globalCellToLocal[cell2] );
340  _faceCells.at( meshID )->add( faceID[meshID], localCellID[meshID] );
341  _globalToLocalFaces[meshID][n] = faceID[meshID];
342  localCellID[meshID]++;
343  faceID[meshID]++;
344  }
345  }
346 
347  //filling sizes ( if this interface doesn't involve a mesh, following size will be zero for that mesh
348  for ( int id = 0; id < _nmesh; id++ )
349  _interfaceSize[id].push_back( faceID[id] - _interfaceOffset[id][i] );
350 
351  }
352 
353 }
int getSelfCount() const
Definition: StorageSite.h:40
map< int, vector< int > > _interfaceOffset
int getInterfaceGroupCount() const
Definition: Mesh.h:185
vector< int > _globalCellToMeshID
const CRConnectivity & getAllFaceCells() const
Definition: Mesh.cpp:378
vector< int > _globalCellToLocal
vector< FaceGroupPtr > FaceGroupList
Definition: Mesh.h:47
map< int, vector< int > > _interfaceID
const StorageSite & getCells() const
Definition: Mesh.h:109
vector< map< int, int > > _globalToLocalFaces
int getOffset() const
Definition: StorageSite.h:87
int getCount() const
Definition: StorageSite.h:39
vector< CRConnectivityPtr > _faceCells
const FaceGroupList & getInterfaceGroups() const
Definition: Mesh.h:190
const Mesh & _mesh
map< int, vector< int > > _interfaceSize
void MeshDismantler::faceCellsFinishAdd ( )
private

Definition at line 475 of file MeshDismantler.cpp.

References _faceCells, and _nmesh.

Referenced by setFaceCells().

476 {
477  //init count and finishCount;
478  for ( int id = 0; id < _nmesh; id++ )
479  _faceCells.at(id)->finishAdd();
480 }
vector< CRConnectivityPtr > _faceCells
void MeshDismantler::faceCellsInit ( vector< int > &  localCellID)
private

Definition at line 263 of file MeshDismantler.cpp.

References _cellSite, _faceCells, _meshList, _nmesh, and StorageSite::getCount().

Referenced by setFaceCells().

264 {
265  //initalize local cellID
266  for ( int id = 0; id < _nmesh; id++ )
267  localCellID[id] = _cellSite[id]->getSelfCount();
268 
269  //init count and finishCount;
270  for ( int id = 0; id < _nmesh; id++ ){
271  const StorageSite& faceSite = _meshList.at(id)->getFaces();
272  const StorageSite& cellSite = _meshList.at(id)->getCells();
273  _faceCells.push_back( CRConnectivityPtr( new CRConnectivity( faceSite, cellSite ) ) );
274  _faceCells.at(id)->initCount();
275 
276  //addCount, each face share only two cells
277  const int cellCount = 2;
278  for ( int i = 0; i < faceSite.getCount(); i++ )
279  _faceCells.at(id)->addCount(i, cellCount); // face has always two cells
280  //finish count
281  _faceCells.at(id)->finishCount();
282  }
283 }
vector< StorageSitePtr > _cellSite
shared_ptr< CRConnectivity > CRConnectivityPtr
MeshList _meshList
int getCount() const
Definition: StorageSite.h:39
vector< CRConnectivityPtr > _faceCells
void MeshDismantler::faceNodesAddBoundaryInterfaces ( vector< int > &  faceID)
private

Definition at line 677 of file MeshDismantler.cpp.

References _faceNodes, _globalCellToMeshID, _globalToLocalNodes, _mesh, Mesh::getAllFaceCells(), Mesh::getAllFaceNodes(), Mesh::getBoundaryFaceGroups(), Mesh::getBoundaryGroupCount(), StorageSite::getCount(), CRConnectivity::getCount(), and StorageSite::getOffset().

Referenced by setFaceNodes().

678 {
679  int boundaryCount = _mesh.getBoundaryGroupCount();
680  const CRConnectivity& faceCells = _mesh.getAllFaceCells();
681  const CRConnectivity& faceNodes = _mesh.getAllFaceNodes();
682  const FaceGroupList& boundaryGroupList = _mesh.getBoundaryFaceGroups();
683  //loop over partition faces (
684  for ( int i = 0; i < boundaryCount; i++ ){
685  const StorageSite& boundaryFaceSite = boundaryGroupList[i]->site;
686  int offset = boundaryFaceSite.getOffset(); //where to begin face
687  int nBeg = offset;
688  int nEnd = nBeg + boundaryFaceSite.getCount();
689  for ( int n = nBeg; n < nEnd; n++ ){
690  int cell1 = faceCells(n,0);
691  int meshID = _globalCellToMeshID[ cell1 ];
692  const int nodeCount = faceCells.getCount(n);
693  for ( int j = 0; j < nodeCount; j++ ){
694  int glbNodeID = faceNodes(n,j);
695  int lclNodeID = _globalToLocalNodes[glbNodeID][meshID]; //gives local id
696  _faceNodes.at( meshID )->add( faceID[meshID], lclNodeID );
697  }
698  faceID[meshID]++;
699  }
700  }
701 }
const CRConnectivity & getAllFaceNodes() const
Definition: Mesh.cpp:368
const FaceGroupList & getBoundaryFaceGroups() const
Definition: Mesh.h:187
int getCount(const int i) const
int getBoundaryGroupCount() const
Definition: Mesh.h:184
vector< CRConnectivityPtr > _faceNodes
vector< int > _globalCellToMeshID
const CRConnectivity & getAllFaceCells() const
Definition: Mesh.cpp:378
vector< FaceGroupPtr > FaceGroupList
Definition: Mesh.h:47
vector< map< int, int > > _globalToLocalNodes
int getOffset() const
Definition: StorageSite.h:87
int getCount() const
Definition: StorageSite.h:39
const Mesh & _mesh
void MeshDismantler::faceNodesAddInteriorFaces ( vector< int > &  faceID)
private

Definition at line 586 of file MeshDismantler.cpp.

References _faceNodes, _globalCellToMeshID, _globalToLocalNodes, _mesh, Mesh::getAllFaceCells(), Mesh::getAllFaceNodes(), StorageSite::getCount(), CRConnectivity::getCount(), Mesh::getInteriorFaceGroup(), and FaceGroup::site.

Referenced by setFaceNodes().

587 {
588  //first add interior faces
589  const CRConnectivity& faceCells = _mesh.getAllFaceCells();
590  const CRConnectivity& faceNodes = _mesh.getAllFaceNodes();
591  const FaceGroup& interiorFaceGroup = _mesh.getInteriorFaceGroup();
592  const StorageSite& interiorFaceSite = interiorFaceGroup.site;
593  for ( int n = 0; n < interiorFaceSite.getCount(); n++ ){
594  int cell1 = faceCells(n,0);
595  int cell2 = faceCells(n,1);
596  int meshID1 = _globalCellToMeshID[cell1];
597  int meshID2 = _globalCellToMeshID[cell2];
598  if ( meshID1 == meshID2 ){ //it means this face interior face
599  const int nodeCount = faceCells.getCount(n);
600  for ( int i = 0; i < nodeCount; i++ ){
601  int glbNodeID = faceNodes(n,i);
602  int lclNodeID = _globalToLocalNodes[glbNodeID][meshID1]; //gives local id
603  _faceNodes.at( meshID1 )->add( faceID[meshID1], lclNodeID );
604  }
605  faceID[meshID1]++;
606  }
607  }
608 }
const CRConnectivity & getAllFaceNodes() const
Definition: Mesh.cpp:368
int getCount(const int i) const
const FaceGroup & getInteriorFaceGroup() const
Definition: Mesh.h:181
Definition: Mesh.h:28
vector< CRConnectivityPtr > _faceNodes
vector< int > _globalCellToMeshID
const CRConnectivity & getAllFaceCells() const
Definition: Mesh.cpp:378
vector< map< int, int > > _globalToLocalNodes
int getCount() const
Definition: StorageSite.h:39
const Mesh & _mesh
StorageSite site
Definition: Mesh.h:40
void MeshDismantler::faceNodesAddMeshInterfaces ( vector< int > &  faceID)
private

Definition at line 642 of file MeshDismantler.cpp.

References _faceNodes, _globalCellToMeshID, _globalToLocalNodes, _mesh, Mesh::getAllFaceCells(), Mesh::getAllFaceNodes(), StorageSite::getCount(), CRConnectivity::getCount(), Mesh::getInteriorFaceGroup(), and FaceGroup::site.

Referenced by setFaceNodes().

643 {
644  //loop over interfaces to see color difference
645  const CRConnectivity& faceCells = _mesh.getAllFaceCells();
646  const CRConnectivity& faceNodes = _mesh.getAllFaceNodes();
647  const FaceGroup& interiorFaceGroup = _mesh.getInteriorFaceGroup();
648  const StorageSite& interiorFaceSite = interiorFaceGroup.site;
649  //all interior face to search mesh interface
650  for ( int n = 0; n < interiorFaceSite.getCount(); n++ ){
651  int cell1 = faceCells(n,0);
652  int cell2 = faceCells(n,1);
653  int meshID1 = _globalCellToMeshID[cell1];
654  int meshID2 = _globalCellToMeshID[cell2];
655  if ( meshID1 != meshID2 ){ //it means this face is mesh interface
656  const int nodeCount = faceCells.getCount(n);
657  //face in meshID1
658  for ( int i = 0; i < nodeCount; i++ ){
659  int glblNodeID = faceNodes(n,i);
660  int lclNodeID = _globalToLocalNodes[glblNodeID][meshID1]; //gives local id
661  _faceNodes.at ( meshID1 )->add( faceID[meshID1], lclNodeID );
662  }
663  //face in meshID2 (consistent with global faceNodes connectivity)
664  for ( int i = nodeCount-1; i >= 0; i-- ){
665  int glblNodeID = faceNodes(n,i);
666  int lclNodeID = _globalToLocalNodes[glblNodeID][meshID2]; //gives local id
667  _faceNodes.at ( meshID2 )->add( faceID[meshID2], lclNodeID );
668  }
669  faceID[meshID1]++;
670  faceID[meshID2]++;
671  }
672  }
673 }
const CRConnectivity & getAllFaceNodes() const
Definition: Mesh.cpp:368
int getCount(const int i) const
const FaceGroup & getInteriorFaceGroup() const
Definition: Mesh.h:181
Definition: Mesh.h:28
vector< CRConnectivityPtr > _faceNodes
vector< int > _globalCellToMeshID
const CRConnectivity & getAllFaceCells() const
Definition: Mesh.cpp:378
vector< map< int, int > > _globalToLocalNodes
int getCount() const
Definition: StorageSite.h:39
const Mesh & _mesh
StorageSite site
Definition: Mesh.h:40
void MeshDismantler::faceNodesAddPartitionInterfaces ( vector< int > &  faceID)
private

Definition at line 611 of file MeshDismantler.cpp.

References _faceNodes, _globalCellToMeshID, _globalToLocalNodes, _mesh, Mesh::getAllFaceCells(), Mesh::getAllFaceNodes(), StorageSite::getCount(), CRConnectivity::getCount(), Mesh::getInterfaceGroupCount(), Mesh::getInterfaceGroups(), and StorageSite::getOffset().

Referenced by setFaceNodes().

612 {
613  //add partition interfaces
614  int interfaceCount = _mesh.getInterfaceGroupCount();
615  const CRConnectivity& faceCells = _mesh.getAllFaceCells();
616  const CRConnectivity& faceNodes = _mesh.getAllFaceNodes();
617  const FaceGroupList& interfaceGroupList = _mesh.getInterfaceGroups();
618  //loop over partition faces (
619  for ( int i = 0; i < interfaceCount; i++ ){
620  const StorageSite& interiorFaceSite = interfaceGroupList[i]->site;
621  int offset = interiorFaceSite.getOffset(); //where to begin face
622  int nBeg = offset;
623  int nEnd = nBeg + interiorFaceSite.getCount();
624  //loop over faces
625  for ( int n = nBeg; n < nEnd; n++ ){
626  //loop over nodes
627  int cell1 = faceCells(n,0);
628  int meshID = _globalCellToMeshID[ cell1 ];
629  const int nodeCount = faceCells.getCount(n);
630  for ( int j = 0; j < nodeCount; j++ ){
631  int glbNodeID = faceNodes(n,j);
632  int lclNodeID = _globalToLocalNodes[glbNodeID][meshID]; //gives local id
633  _faceNodes.at( meshID )->add( faceID[meshID], lclNodeID );
634  }
635  faceID[meshID]++;
636  }
637  }
638 
639 }
const CRConnectivity & getAllFaceNodes() const
Definition: Mesh.cpp:368
int getCount(const int i) const
vector< CRConnectivityPtr > _faceNodes
int getInterfaceGroupCount() const
Definition: Mesh.h:185
vector< int > _globalCellToMeshID
const CRConnectivity & getAllFaceCells() const
Definition: Mesh.cpp:378
vector< FaceGroupPtr > FaceGroupList
Definition: Mesh.h:47
vector< map< int, int > > _globalToLocalNodes
int getOffset() const
Definition: StorageSite.h:87
int getCount() const
Definition: StorageSite.h:39
const FaceGroupList & getInterfaceGroups() const
Definition: Mesh.h:190
const Mesh & _mesh
void MeshDismantler::faceNodesFinishAdd ( )
private

Definition at line 704 of file MeshDismantler.cpp.

References _faceNodes, and _nmesh.

Referenced by setFaceNodes().

705 {
706  //init count and finishCount;
707  for ( int id = 0; id < _nmesh; id++ )
708  _faceNodes.at(id)->finishAdd();
709 }
vector< CRConnectivityPtr > _faceNodes
void MeshDismantler::faceNodesInit ( )
private

Definition at line 498 of file MeshDismantler.cpp.

References _faceNodes, _globalCellToMeshID, _mesh, _meshList, _nmesh, Mesh::getAllFaceCells(), Mesh::getAllFaceNodes(), Mesh::getBoundaryFaceGroups(), Mesh::getBoundaryGroupCount(), StorageSite::getCount(), CRConnectivity::getCount(), Mesh::getInterfaceGroupCount(), Mesh::getInterfaceGroups(), Mesh::getInteriorFaceGroup(), StorageSite::getOffset(), and FaceGroup::site.

Referenced by setFaceNodes().

499 {
500  //init count and finishCount;
501  for ( int id = 0; id < _nmesh; id++ ){
502  const StorageSite& faceSite = _meshList.at(id)->getFaces();
503  const StorageSite& nodeSite = _meshList.at(id)->getNodes();
504  _faceNodes.push_back( CRConnectivityPtr( new CRConnectivity( faceSite, nodeSite ) ) );
505  _faceNodes.at(id)->initCount();
506  }
507 
508 
509  //first add interior faces addCounts
510  vector<int> faceIndx(_nmesh,0);
511  const CRConnectivity& faceCells = _mesh.getAllFaceCells();
512  const CRConnectivity& faceNodes = _mesh.getAllFaceNodes();
513  const FaceGroup& interiorFaceGroup = _mesh.getInteriorFaceGroup();
514  const StorageSite& interiorFaceSite = interiorFaceGroup.site;
515  for ( int n = 0; n < interiorFaceSite.getCount(); n++ ){
516  int cell1 = faceCells(n,0);
517  int cell2 = faceCells(n,1);
518  int meshID1 = _globalCellToMeshID[cell1];
519  int meshID2 = _globalCellToMeshID[cell2];
520  if ( meshID1 == meshID2 ){ //it means this face interior face
521  const int nodeCount = faceNodes.getCount(n);
522  _faceNodes.at( meshID1 )->addCount( faceIndx[meshID1]++, nodeCount );
523  }
524  }
525 
526  //add partition interfaces to addCount
527  const int interfaceCount = _mesh.getInterfaceGroupCount();
528  const FaceGroupList& interfaceGroupList = _mesh.getInterfaceGroups();
529  //loop over partition faces (
530  for ( int i = 0; i < interfaceCount; i++ ){
531  const StorageSite& interiorFaceSite = interfaceGroupList[i]->site;
532  int offset = interiorFaceSite.getOffset(); //where to begin face
533  int nBeg = offset;
534  int nEnd = nBeg + interiorFaceSite.getCount();
535  //loop over faces
536  for ( int n = nBeg; n < nEnd; n++ ){
537  //loop over nodes
538  const int cell1 = faceCells(n,0);
539  const int meshID = _globalCellToMeshID[ cell1 ];
540  const int nodeCount = faceNodes.getCount(n);
541  _faceNodes.at( meshID )->addCount( faceIndx[meshID]++, nodeCount );
542  }
543  }
544 
545  //loop over mesh interfaces to addCounts
546  //all interior face to search mesh interface
547  for ( int n = 0; n < interiorFaceSite.getCount(); n++ ){
548  int cell1 = faceCells(n,0);
549  int cell2 = faceCells(n,1);
550  int meshID1 = _globalCellToMeshID[cell1];
551  int meshID2 = _globalCellToMeshID[cell2];
552  if ( meshID1 != meshID2 ){ //it means this face is mesh interface
553  //face in meshID1
554  const int nodeCount = faceCells.getCount(n);
555  _faceNodes.at ( meshID1 )->addCount( faceIndx[meshID1]++, nodeCount );
556  //face in meshID2
557  _faceNodes.at ( meshID2 )->addCount( faceIndx[meshID2]++, nodeCount );
558  }
559  }
560 
561  //loop over boundary faces to addCount
562  const int boundaryCount = _mesh.getBoundaryGroupCount();
563  const FaceGroupList& boundaryGroupList = _mesh.getBoundaryFaceGroups();
564  //loop boundary faces to addCount
565  for ( int i = 0; i < boundaryCount; i++ ){
566  const StorageSite& boundaryFaceSite = boundaryGroupList[i]->site;
567  const int offset = boundaryFaceSite.getOffset(); //where to begin face
568  const int nBeg = offset;
569  const int nEnd = nBeg + boundaryFaceSite.getCount();
570  for ( int n = nBeg; n < nEnd; n++ ){
571  const int cell1 = faceCells(n,0);
572  const int meshID = _globalCellToMeshID[ cell1 ];
573  const int nodeCount = faceNodes.getCount(n);
574  _faceNodes.at( meshID )->addCount( faceIndx[meshID]++, nodeCount );
575  }
576  }
577 
578 
579  //finish count
580  for ( int id = 0; id < _nmesh; id++ )
581  _faceNodes.at(id)->finishCount();
582 
583 }
const CRConnectivity & getAllFaceNodes() const
Definition: Mesh.cpp:368
const FaceGroupList & getBoundaryFaceGroups() const
Definition: Mesh.h:187
int getCount(const int i) const
const FaceGroup & getInteriorFaceGroup() const
Definition: Mesh.h:181
int getBoundaryGroupCount() const
Definition: Mesh.h:184
Definition: Mesh.h:28
vector< CRConnectivityPtr > _faceNodes
int getInterfaceGroupCount() const
Definition: Mesh.h:185
vector< int > _globalCellToMeshID
const CRConnectivity & getAllFaceCells() const
Definition: Mesh.cpp:378
vector< FaceGroupPtr > FaceGroupList
Definition: Mesh.h:47
shared_ptr< CRConnectivity > CRConnectivityPtr
int getOffset() const
Definition: StorageSite.h:87
MeshList _meshList
int getCount() const
Definition: StorageSite.h:39
const FaceGroupList & getInterfaceGroups() const
Definition: Mesh.h:190
const Mesh & _mesh
StorageSite site
Definition: Mesh.h:40
void MeshDismantler::getGatherArrays ( const Array< int > &  gatherArray,
EntryVecMap gatherArrayLocal,
const StorageSite site 
)
private

Definition at line 982 of file MeshDismantler.cpp.

References _faceCells, _globalToLocalFaces, _mesh, Mesh::getAllFaceCells(), Mesh::getCellColors(), Mesh::getCellColorsOther(), Array< T >::getLength(), and StorageSite::getOffset().

Referenced by partitionInterfaceMappers().

983 {
984  // get counts for each mesh
985  EntryMap sizeScatter;
986  int offset = site.getOffset(); //where to begin face
987  int iBeg = offset;
988  const CRConnectivity& faceCells = _mesh.getAllFaceCells();
989  const Array<int>& color = _mesh.getCellColors();
990  const Array<int>& colorOther = _mesh.getCellColorsOther();
991  //loop over partition faces
992  for ( int i = 0; i < gatherArray.getLength(); i++ ){
993  const int faceIndx = iBeg+i;
994  //check gather cellColor
995  const int cell0 = faceCells(faceIndx,0); //outside cell
996  const int thisMeshID = color[ cell0 ];
997  const int otherMeshID = colorOther[ gatherArray[i] ];
998  EntryIndex eIndex = make_pair<int,int>(thisMeshID, otherMeshID);
999  const int glblFaceID = (*_cellFaces)(gatherArray[i],0);
1000  const int localFaceID = _globalToLocalFaces[thisMeshID][glblFaceID];
1001  const int cellID = (*_faceCells[thisMeshID])(localFaceID,1); // 0 inner , 1 ghost cells
1002  gatherArrayLocal[eIndex].push_back(cellID);
1003  }
1004 
1005 }
Array< int > & getCellColors()
Definition: Mesh.h:228
const CRConnectivity & getAllFaceCells() const
Definition: Mesh.cpp:378
map< EntryIndex, int > EntryMap
pair< int, int > EntryIndex
Array< int > & getCellColorsOther()
Definition: Mesh.h:231
vector< map< int, int > > _globalToLocalFaces
int getOffset() const
Definition: StorageSite.h:87
vector< CRConnectivityPtr > _faceCells
const Mesh & _mesh
int getLength() const
Definition: Array.h:87
void MeshDismantler::getScatterArrays ( const Array< int > &  scatterArray,
EntryVecMap scatterArrayLocal,
const StorageSite site 
)
private

Definition at line 955 of file MeshDismantler.cpp.

References _globalCellToLocal, _mesh, Mesh::getAllFaceCells(), Mesh::getCellColors(), Mesh::getCellColorsOther(), Array< T >::getLength(), and StorageSite::getOffset().

Referenced by partitionInterfaceMappers().

956 {
957  // get counts for each mesh
958  EntryMap sizeScatter;
959  int offset = site.getOffset(); //where to begin face
960  int iBeg = offset;
961  const CRConnectivity& faceCells = _mesh.getAllFaceCells();
962  const Array<int>& color = _mesh.getCellColors();
963  const Array<int>& colorOther = _mesh.getCellColorsOther();
964  //loop over partition faces
965  for ( int i = 0; i < scatterArray.getLength(); i++ ){
966  const int faceIndx = iBeg+i;
967  //check gather cellColor
968  const int cell1 = faceCells(faceIndx,1); //outside cell
969  const int thisMeshID = color[ scatterArray[i] ];
970  const int otherMeshID = colorOther[ cell1 ];
971  EntryIndex eIndex = make_pair<int,int>(thisMeshID, otherMeshID);
972  //sizeScatter[eIndex]++;
973  const int cellID = _globalCellToLocal [ scatterArray[i] ];
974 
975  scatterArrayLocal[eIndex].push_back(cellID);
976  }
977 
978 }
Array< int > & getCellColors()
Definition: Mesh.h:228
const CRConnectivity & getAllFaceCells() const
Definition: Mesh.cpp:378
map< EntryIndex, int > EntryMap
pair< int, int > EntryIndex
Array< int > & getCellColorsOther()
Definition: Mesh.h:231
vector< int > _globalCellToLocal
int getOffset() const
Definition: StorageSite.h:87
const Mesh & _mesh
int getLength() const
Definition: Array.h:87
int MeshDismantler::global_offset ( )
private

Definition at line 1126 of file MeshDismantler.cpp.

References _meshList, _nPart, _procID, Mesh::getBoundaryFaceGroups(), Mesh::getBoundaryGroupCount(), Mesh::getCells(), and StorageSite::getSelfCount().

Referenced by set_local_global().

1127 {
1128  const int nmesh = int( _meshList.size() );
1129  int count = 0;
1130  //get offsets for
1131  for ( int id = 0; id < nmesh; id++ ){
1132  const Mesh& mesh = *_meshList.at(id);
1133  const StorageSite& cellSite = mesh.getCells();
1134  const FaceGroupList& bounGroupList = mesh.getBoundaryFaceGroups();
1135  int bounCount = 0;
1136  for ( int i = 0; i < mesh.getBoundaryGroupCount(); i++ )
1137  bounCount += bounGroupList[i]->site.getCount();
1138  const int selfCount = cellSite.getSelfCount();
1139  count += selfCount + bounCount;
1140  }
1141 
1142 
1143  //allocation holding each partiton offset
1144  int *counts = new int[ _nPart ];
1145  //MPI calls allgather to know offsets
1146 #ifdef FVM_PARALLEL
1147  MPI::COMM_WORLD.Allgather( &count, 1, MPI::INT, counts, 1, MPI::INT);
1148 #endif
1149 
1150  //compute offsets for each partition
1151  int offset = 0;
1152  for ( int i = 0; i < _procID; i++ )
1153  offset += counts[i];
1154 
1155  //delete allocation counts
1156  delete [] counts;
1157  return offset;
1158 
1159 }
const FaceGroupList & getBoundaryFaceGroups() const
Definition: Mesh.h:187
int getBoundaryGroupCount() const
Definition: Mesh.h:184
int getSelfCount() const
Definition: StorageSite.h:40
Definition: Mesh.h:49
vector< FaceGroupPtr > FaceGroupList
Definition: Mesh.h:47
const StorageSite & getCells() const
Definition: Mesh.h:109
MeshList _meshList
void MeshDismantler::init ( )
private

Definition at line 40 of file MeshDismantler.cpp.

References _cellFaces, _mesh, _meshList, _nmesh, _nPart, _procID, Mesh::getAllFaceCells(), Mesh::getDimension(), Mesh::getNumOfAssembleMesh(), CRConnectivity::getTranspose(), set_local_global(), setCellCellsGhostExt(), setCellsMapper(), setCellsSite(), setCoord(), setFaceCells(), setFaceNodes(), setFacesSite(), setMappers(), setMesh(), setNodesMapper(), setNodesSite(), and setSites().

Referenced by MeshDismantler().

41 {
42 
44 #ifdef FVM_PARALLEL
45  _procID = MPI::COMM_WORLD.Get_rank();
46  _nPart = MPI::COMM_WORLD.Get_size();
47 #endif
48  //number of meshes
50  //giving mesh ids
51  int dim = _mesh.getDimension();
52  //construct meshes
53  for ( int n = 0; n < _nmesh; n++ )
54  _meshList.push_back( new Mesh( dim) );
55 
56 
57  setCellsSite();
58  setFacesSite();
59  setNodesSite();
60  setSites();
62  setFaceCells();
64  setFaceNodes();
65  setCoord();
66  setMesh();
67  setMappers();
69 
70  for ( int n = 0; n < _nmesh; n++ ){
71  const StorageSite& cellSite = _meshList.at(n)->getCells();
72  const StorageSite& faceSite = _meshList.at(n)->getFaces();
73  _meshList.at(n)->eraseConnectivity(cellSite, cellSite);
74  _meshList.at(n)->eraseConnectivity(cellSite, faceSite);
75  //uniquie
76  _meshList.at(n)->uniqueFaceCells();
77  }
78 
79 
81 
82 
83 }
int getNumOfAssembleMesh() const
Definition: Mesh.h:251
CRConnectivityPtr _cellFaces
Definition: Mesh.h:49
const CRConnectivity & getAllFaceCells() const
Definition: Mesh.cpp:378
MeshList _meshList
shared_ptr< CRConnectivity > getTranspose() const
int getDimension() const
Definition: Mesh.h:105
const Mesh & _mesh
void MeshDismantler::meshInterfaceMappers ( )
private

Definition at line 1010 of file MeshDismantler.cpp.

References _faceCells, _faceIdentifierList, _globalToLocalFaces, _meshList, and _nmesh.

Referenced by setMappers().

1011 {
1012  //loop over meshes
1013  for ( int id = 0 ; id < _nmesh ; id++ ){
1014  const multimap<int,int>& faceIdentifier = _faceIdentifierList[id];
1015  StorageSite::GatherMap & gatherMapLocal = _meshList.at(id)->getCells().getGatherMap();
1016  const StorageSite* thisSite = &_meshList.at(id)->getCells();
1017  //loop over all meshinterfaces (key = all other meshes)
1018  for ( int key = 0; key < _nmesh; key++ ){
1019  //filling scatter (on this mesh) and gather Array (on other mesh)
1020  int nface = faceIdentifier.count(key);
1021  if ( nface > 0 ){
1022  StorageSite::ScatterMap& scatterMapLocal = _meshList.at(key)->getCells().getScatterMap();
1023  const StorageSite* otherSite = &_meshList.at(key)->getCells();
1024  ArrayIntPtr scatterArrayLocal( new Array<int>( nface ) ); //for other side mesh
1025  ArrayIntPtr gatherArrayLocal ( new Array<int>( nface ) ); //for this side mesh
1026  multimap<int,int>::const_iterator it;
1027  int indx = 0;
1028  for ( it = faceIdentifier.equal_range(key).first; it != faceIdentifier.equal_range(key).second; it++ ){
1029  //fill this mesh gather
1030  const int glblFaceID = it->second;
1031  int localFaceID = _globalToLocalFaces[id][glblFaceID];
1032  const int gatherCellID = (*_faceCells[id])(localFaceID,1);
1033  (*gatherArrayLocal)[indx] = gatherCellID;
1034  //now other mesh to fill scatter arrays
1035  localFaceID = _globalToLocalFaces[key][glblFaceID];
1036  const int scatterCellID = (*_faceCells[key])(localFaceID,0);
1037  (*scatterArrayLocal)[indx] = scatterCellID;
1038  indx++;
1039  }
1040  gatherMapLocal.insert ( make_pair(otherSite, gatherArrayLocal ) ); //gather this side mesh, so we key with other site StorageSite*
1041  scatterMapLocal.insert( make_pair(thisSite , scatterArrayLocal) ); //scatter other side mesh, so we key with this site StorageSite*
1042  }
1043  }
1044  }
1045 
1046 
1047 }
shared_ptr< Array< int > > ArrayIntPtr
vector< map< int, int > > _globalToLocalFaces
map< const StorageSite *, shared_ptr< Array< int > > > ScatterMap
Definition: StorageSite.h:23
MeshList _meshList
vector< CRConnectivityPtr > _faceCells
map< const StorageSite *, shared_ptr< Array< int > > > GatherMap
Definition: StorageSite.h:24
vector< multimap< int, int > > _faceIdentifierList
const MeshList& MeshDismantler::meshList ( ) const
inline

Definition at line 40 of file MeshDismantler.h.

References _meshList.

40 { return _meshList;}
MeshList _meshList
void MeshDismantler::partitionInterfaceMappers ( )
private

Definition at line 884 of file MeshDismantler.cpp.

References _mesh, _meshList, Mesh::getCells(), getGatherArrays(), StorageSite::getGatherMap(), Mesh::getGhostCellSiteScatter(), Mesh::getInterfaceGroupCount(), Mesh::getInterfaceGroups(), getScatterArrays(), StorageSite::getScatterMap(), max(), and min().

Referenced by setMappers().

885 {
886  //mappers
887  const StorageSite::ScatterMap& scatterMap = _mesh.getCells().getScatterMap();
888  const StorageSite::GatherMap& gatherMap = _mesh.getCells().getGatherMap ();
889  //interfaceList
890  const FaceGroupList& faceGroupList = _mesh.getInterfaceGroups();
891  //interfacecount
892  int interfaceGroupCount = _mesh.getInterfaceGroupCount();
893  //loop over interfaces (only partition interfaces)
894  for ( int i = 0; i < interfaceGroupCount; i++ ) {
895  //get key for f
896  int interfaceID = -faceGroupList[i]->id;
897  //mappers in Storagesite is held by the same storage site, so this site
898  //can be used to in scatterMap and gatherMap
899  const StorageSite& interfaceSite = faceGroupList[i]->site;
900  //from intrface ID and meshID (since this is from meshID), we can get that specific storagesite
901  const int meshID0 = 0;
902  Mesh::PartIDMeshIDPair pairID = make_pair<int,int>( interfaceID, meshID0 );
903  const StorageSite* ghostSite = _mesh.getGhostCellSiteScatter( pairID );
904  //get mapper arrays
905  const Array<int>& scatterArray = *scatterMap.find(ghostSite)->second;
906  const Array<int>& gatherArray = *gatherMap.find(ghostSite)->second;
907  EntryVecMap scatterArrayMap;
908  EntryVecMap gatherArrayMap;
909  getGatherArrays ( gatherArray , gatherArrayMap , interfaceSite );
910  getScatterArrays( scatterArray, scatterArrayMap, interfaceSite );
911 
912  //get scatterArrayMap
913  foreach ( const EntryVecMap::value_type& pos, scatterArrayMap ){
914  const pair<int,int>& entry = pos.first;
915  const int meshID = entry.first;
916  const int otherMeshID = entry.second;
917  const int size = int(pos.second.size());
918  //reference ot mappers to fill in
919  StorageSite::ScatterMap& scatterMapLocal = _meshList.at(meshID)->getCells().getScatterMap();
920  StorageSite::GatherMap& gatherMapLocal = _meshList.at(meshID)->getCells().getGatherMap();
921  //storagesite (used for both scatter and gathersites), pass parent (getCells())
922  shared_ptr<StorageSite> siteScatterLocal( new StorageSite(size) );
923 
924  //copy scatterArray to Array<int>
925  int scatterSize = int(scatterArrayMap[entry].size());
926  ArrayIntPtr scatterArrayLocal( new Array<int>( scatterSize ) );
927  for ( int i = 0; i < scatterSize; i++ )
928  (*scatterArrayLocal)[i] = scatterArrayMap[entry][i];
929  //copy gatherArray to Array<int>
930  int gatherSize = int(gatherArrayMap[entry].size());
931  ArrayIntPtr gatherArrayLocal( new Array<int>( gatherSize ) );
932  for ( int i = 0; i < gatherSize; i++ )
933  (*gatherArrayLocal)[i] = gatherArrayMap[entry][i];
934 
935  //setting scatterID and gatherID
936  siteScatterLocal->setScatterProcID( ghostSite->getScatterProcID() );
937  siteScatterLocal->setGatherProcID ( ghostSite->getGatherProcID() );
938  //setting tag (shifting 16 bits to left)
939  int packed_info = (std::max(meshID,otherMeshID) << 16 ) | ( std::min(meshID,otherMeshID) );
940  siteScatterLocal->setTag( packed_info );
941 
942  Mesh::PartIDMeshIDPair pairID = make_pair<int,int>( ghostSite->getGatherProcID(), otherMeshID);
943  _meshList.at(meshID)->createGhostCellSiteScatter( pairID, siteScatterLocal );
944  _meshList.at(meshID)->createGhostCellSiteGather ( pairID, siteScatterLocal );
945  scatterMapLocal[ siteScatterLocal.get() ] = scatterArrayLocal;
946  gatherMapLocal [ siteScatterLocal.get() ] = gatherArrayLocal;
947  }
948  }
949 
950 
951 }
map< EntryIndex, vector< int > > EntryVecMap
double max(double x, double y)
Definition: Octree.cpp:18
int getInterfaceGroupCount() const
Definition: Mesh.h:185
const StorageSite * getGhostCellSiteScatter(const PartIDMeshIDPair &id) const
Definition: Mesh.h:113
void getGatherArrays(const Array< int > &gatherArray, EntryVecMap &gatherArrayLocal, const StorageSite &site)
vector< FaceGroupPtr > FaceGroupList
Definition: Mesh.h:47
pair< int, int > PartIDMeshIDPair
Definition: Mesh.h:62
shared_ptr< Array< int > > ArrayIntPtr
const StorageSite & getCells() const
Definition: Mesh.h:109
const ScatterMap & getScatterMap() const
Definition: StorageSite.h:58
map< const StorageSite *, shared_ptr< Array< int > > > ScatterMap
Definition: StorageSite.h:23
const GatherMap & getGatherMap() const
Definition: StorageSite.h:59
MeshList _meshList
map< const StorageSite *, shared_ptr< Array< int > > > GatherMap
Definition: StorageSite.h:24
const FaceGroupList & getInterfaceGroups() const
Definition: Mesh.h:190
void getScatterArrays(const Array< int > &scatterArray, EntryVecMap &scatterArrayLocal, const StorageSite &site)
double min(double x, double y)
Definition: Octree.cpp:23
const Mesh & _mesh
void MeshDismantler::set_local_global ( )
private

Definition at line 1051 of file MeshDismantler.cpp.

References _meshList, Mesh::createLocalGlobalArray(), Mesh::getAllFaceCells(), Mesh::getBoundaryFaceGroups(), Mesh::getBoundaryGroupCount(), CRConnectivity::getCount(), StorageSite::getCountLevel1(), Mesh::getGlobalToLocal(), Mesh::getLocalToGlobal(), StorageSite::getSelfCount(), and global_offset().

Referenced by init().

1052 {
1053  const int nmesh = int( _meshList.size() );
1054  //creating cellID MultiField to use sync() operation
1055  shared_ptr<MultiField> cellMultiField = shared_ptr<MultiField>( new MultiField() );
1056  shared_ptr<Field> cellField = shared_ptr<Field> ( new Field("globalcellID") );
1057 
1058  for ( int id = 0; id < nmesh; id++ ){
1059  const StorageSite* site = &_meshList[id]->getCells();
1060  MultiField::ArrayIndex ai( cellField.get(), site );
1061  shared_ptr<Array<int> > cIndex(new Array<int>(site->getCountLevel1()));
1062  *cIndex = -1;
1063  cellMultiField->addArray(ai,cIndex);
1064  }
1065 
1066  //global numbering
1067  const int globalOffset = global_offset();
1068  int offset = globalOffset;
1069  for ( int id = 0; id < nmesh; id++ ){
1070  const Mesh& mesh = *_meshList.at(id);
1071  const StorageSite* site = &_meshList[id]->getCells();
1072  MultiField::ArrayIndex ai( cellField.get(), site );
1073  Array<int>& localCell = dynamic_cast< Array<int>& >( (*cellMultiField)[ai] );
1074  //global numbering inner cells
1075  const int selfCount = site->getSelfCount();
1076  for ( int i = 0; i < selfCount; i++ )
1077  localCell[i] = offset + i;
1078  //update offset
1079  offset += selfCount;
1080  //loop over boundaries and global number boundary cells
1081  const FaceGroupList& bounGroupList = mesh.getBoundaryFaceGroups();
1082  const CRConnectivity& faceCells = mesh.getAllFaceCells();
1083  for ( int i = 0; i < mesh.getBoundaryGroupCount(); i++ ){
1084  const int ibeg = bounGroupList[i]->site.getOffset();
1085  const int iend = ibeg + bounGroupList[i]->site.getCount();
1086  int indx=0;
1087  for ( int ii = ibeg; ii < iend; ii++ ){
1088  localCell[ faceCells(ii,1)] = offset + indx;
1089  indx++;
1090  }
1091  //update offset
1092  offset += iend-ibeg;
1093  }
1094 
1095  }
1096 
1097  //sync opeartion
1098  cellMultiField->sync();
1099 
1100  //create localToGlobal array and assign it in Mesh
1101  for ( int id = 0; id < nmesh; id++ ){
1102  Mesh& mesh = *_meshList.at(id);
1103  mesh.createLocalGlobalArray();
1104  const StorageSite* site = &_meshList[id]->getCells();
1105  MultiField::ArrayIndex ai( cellField.get(), site );
1106  const Array<int>& localCell = dynamic_cast< const Array<int>& >( (*cellMultiField)[ai] );
1107  Array<int>& localToGlobal = mesh.getLocalToGlobal();
1108  for ( int i = 0; i < localCell.getLength(); i++ ){
1109  localToGlobal[i] = localCell[i];
1110  assert( localCell[i] != -1 );
1111  }
1112 
1113  //copying GlobalToLocal
1114  map<int,int>& globalToLocal = mesh.getGlobalToLocal();
1115  for ( int i = 0; i < localCell.getLength(); i++ ){
1116  globalToLocal[ localToGlobal[i] ] = i;
1117  }
1118  }
1119 
1120 }
const FaceGroupList & getBoundaryFaceGroups() const
Definition: Mesh.h:187
int getCount(const int i) const
int getBoundaryGroupCount() const
Definition: Mesh.h:184
int getSelfCount() const
Definition: StorageSite.h:40
Definition: Field.h:14
Definition: Mesh.h:49
map< int, int > & getGlobalToLocal()
Definition: Mesh.h:243
const CRConnectivity & getAllFaceCells() const
Definition: Mesh.cpp:378
Array< int > & getLocalToGlobal()
Definition: Mesh.h:240
pair< const Field *, const StorageSite * > ArrayIndex
Definition: MultiField.h:21
vector< FaceGroupPtr > FaceGroupList
Definition: Mesh.h:47
void createLocalGlobalArray()
Definition: Mesh.cpp:738
int getCountLevel1() const
Definition: StorageSite.h:72
MeshList _meshList
void MeshDismantler::setCellCellsGhostExt ( )
private

Definition at line 1164 of file MeshDismantler.cpp.

References _meshList, _nmesh, Mesh::createCellCellsGhostExt(), Mesh::createScatterGatherCountsBuffer(), Mesh::createScatterGatherIndicesBuffer(), Mesh::recvScatterGatherCountsBufferLocal(), Mesh::recvScatterGatherIndicesBufferLocal(), Mesh::syncCounts(), and Mesh::syncIndices().

Referenced by init().

1165 {
1166  //create sendCounts
1167  for (int n=0; n<_nmesh; n++ ){
1168  Mesh& mesh = *_meshList[n];
1170  //partitioner interfaces
1171  mesh.syncCounts();
1172  }
1173 
1174  for (int n=0; n<_nmesh; n++ ){
1175  Mesh& mesh = *_meshList[n];
1176  //mesh interfaces
1178  }
1179 
1180 
1181  //create indices
1182  for (int n=0; n<_nmesh; n++ ){
1183  Mesh& mesh = *_meshList[n];
1185  //partitioner interfaces
1186  mesh.syncIndices();
1187  }
1188 
1189  for (int n=0; n<_nmesh; n++ ){
1190  Mesh& mesh = *_meshList[n];
1191  //mesh interfaces
1193  }
1194 
1195  //creaet cellCellsGhostExt
1196  for (int n=0; n<_nmesh; n++ ){
1197  Mesh& mesh = *_meshList[n];
1198  //mesh interfaces
1199  mesh.createCellCellsGhostExt();
1200  }
1201 }
Definition: Mesh.h:49
void recvScatterGatherCountsBufferLocal()
Definition: Mesh.cpp:2050
void syncCounts()
Definition: Mesh.cpp:2072
void createScatterGatherIndicesBuffer()
Definition: Mesh.cpp:2124
void recvScatterGatherIndicesBufferLocal()
Definition: Mesh.cpp:2172
MeshList _meshList
void createScatterGatherCountsBuffer()
Definition: Mesh.cpp:2011
void createCellCellsGhostExt()
Definition: Mesh.cpp:1999
void syncIndices()
Definition: Mesh.cpp:2191
void MeshDismantler::setCellsMapper ( )
private

Definition at line 224 of file MeshDismantler.cpp.

References _cellSite, _globalCellToLocal, _globalCellToMeshID, _localCellToGlobal, _mesh, _nmesh, Mesh::getCellColors(), Mesh::getCells(), and StorageSite::getSelfCount().

Referenced by init().

225 {
226  //lets create copy cellToGlobal for only inner cells
227  for ( int id = 0; id < _nmesh; id++ ){
228  const StorageSite& cellSite = *_cellSite.at(id);
229  _localCellToGlobal.push_back( ArrayIntPtr( new Array<int>( cellSite.getSelfCount() ) ) );
230  Array<int>& localToGlobal = *_localCellToGlobal[id];
231  localToGlobal = -1; //initializer
232  }
233  //global to local map ( only inner cells)
234  int cellSelfCount = _mesh.getCells().getSelfCount();
235  const Array<int>& color = _mesh.getCellColors();
236  _globalCellToLocal.resize ( cellSelfCount, -1);
237  _globalCellToMeshID.resize( cellSelfCount, -1);
238  vector<int> localCellCount(_nmesh,0);
239  for ( int i = 0; i < cellSelfCount; i++ ){
240  _globalCellToMeshID[i] = color[ i ] ;
241  _globalCellToLocal[i] = localCellCount[ color[i] ]++;
242  }
243 
244 }
vector< ArrayIntPtr > _localCellToGlobal
int getSelfCount() const
Definition: StorageSite.h:40
vector< int > _globalCellToMeshID
Array< int > & getCellColors()
Definition: Mesh.h:228
vector< int > _globalCellToLocal
vector< StorageSitePtr > _cellSite
shared_ptr< Array< int > > ArrayIntPtr
const StorageSite & getCells() const
Definition: Mesh.h:109
const Mesh & _mesh
void MeshDismantler::setCellsSite ( )
private

Definition at line 87 of file MeshDismantler.cpp.

References _cellSite, _mesh, _nmesh, Mesh::getAllFaceCells(), Mesh::getCellCellsGlobal(), Mesh::getCellColors(), Mesh::getCells(), StorageSite::getCount(), Mesh::getGlobalToLocal(), Mesh::getInteriorFaceGroup(), StorageSite::getSelfCount(), and FaceGroup::site.

Referenced by init().

88 {
89  vector<int> siteGhostCount(_nmesh,0);
90  vector<int> siteSelfCount (_nmesh,0);
91  //inner cell sweeep
92  const StorageSite& cellSite = _mesh.getCells();
93  const Array<int>& color = _mesh.getCellColors();
94  for ( int n = 0; n < cellSite.getSelfCount(); n++ )
95  siteSelfCount[ color[n] ]++;
96 
97 
98  //ghostcells on partition border and boundary cells sweep
99  for ( int n = cellSite.getSelfCount(); n < cellSite.getCount(); n++ )
100  siteGhostCount[ color[n] ]++;
101 
102  //now find newly emerged ghost cells between meshes
103  //loop over inner faces, if they have two different cell colors, add one ghost cell for each side;
104  const CRConnectivity& faceCells = _mesh.getAllFaceCells();
105  const StorageSite& faceSite = _mesh.getInteriorFaceGroup().site;
106  for ( int n = 0; n < faceSite.getCount(); n++ ){
107  int cell1 = faceCells(n,0);
108  int cell2 = faceCells(n,1);
109  //check if they are different colors, if so, it is mesh boundary, increment ghostCount for both meshes
110  if ( color[ cell1 ] != color[ cell2 ] ){
111  siteGhostCount[ color[cell1] ]++;
112  siteGhostCount[ color[cell2] ]++;
113  }
114  }
115  //forming cellSites
116  for ( int id = 0; id < _nmesh; id++ )
117  _cellSite.push_back( StorageSitePtr( new StorageSite(siteSelfCount[id], siteGhostCount[id] ) ) );
118 
119  //we will first identify newly emerged cellcell2 cells
120  vector< set<int> > gatherCells(_nmesh);
121  for ( int n = 0; n < faceSite.getCount(); n++ ){
122  int cell1 = faceCells(n,0);
123  int cell2 = faceCells(n,1);
124  //check if they are different colors, if so, it is mesh boundary, increment ghostCount for both meshes
125  if ( color[ cell1 ] != color[ cell2 ] ){
126  gatherCells[ color[cell1] ].insert(cell2);
127  gatherCells[ color[cell2] ].insert(cell1);
128  }
129  }
130  //now loop over gather cells and check its global cellCells connectivity
131  const multimap<int,int>& cellCellsGlobal = _mesh.getCellCellsGlobal();
132  const map<int,int>& globalToLocal = _mesh.getGlobalToLocal();
133  for ( int id = 0; id < _nmesh; id++ ){
134  const set<int>& cells = gatherCells[id];
135  set<int> cells2; //storing cellCells2 cells
136  int countLevel1 = _cellSite[id]->getCount();
137  //loop over gather cells
138  foreach(const set<int>::value_type& mpos, cells){
139  int cellID = mpos;
140  multimap<int,int>::const_iterator it;
141  for ( it = cellCellsGlobal.equal_range(cellID).first; it != cellCellsGlobal.equal_range(cellID).second; it++ ){
142  const int localID = globalToLocal.find(it->second)->second;
143  //if it is not gathercells, we accep it, and color[localID] make sure that it doesn't pick inner cells
144  //and cells2 make sure that this is not counted twice
145  if ( cells.count(localID) == 0 && color[localID] != id && cells2.count(localID) == 0){
146  countLevel1++;
147  cells2.insert(localID);
148  }
149  }
150  }
151  //update countLevel1
152  // _cellSite[id]->setCountLevel1(countLevel1);
153  }
154 
155 
156 }
const FaceGroup & getInteriorFaceGroup() const
Definition: Mesh.h:181
int getSelfCount() const
Definition: StorageSite.h:40
multiMap & getCellCellsGlobal()
Definition: Mesh.h:247
shared_ptr< StorageSite > StorageSitePtr
Definition: NcDataReader.h:18
map< int, int > & getGlobalToLocal()
Definition: Mesh.h:243
Array< int > & getCellColors()
Definition: Mesh.h:228
const CRConnectivity & getAllFaceCells() const
Definition: Mesh.cpp:378
vector< StorageSitePtr > _cellSite
const StorageSite & getCells() const
Definition: Mesh.h:109
int getCount() const
Definition: StorageSite.h:39
const Mesh & _mesh
StorageSite site
Definition: Mesh.h:40
void MeshDismantler::setCoord ( )
private

Definition at line 751 of file MeshDismantler.cpp.

References _coord, _globalToLocalNodes, _mesh, _nmesh, _nodeSite, StorageSite::getCount(), Mesh::getNodeCoordinates(), and Mesh::getNodes().

Referenced by init().

752 {
753  //allocation memory for coord
754  for ( int id = 0; id < _nmesh; id++ )
755  _coord.push_back( ArrayVecD3Ptr(new Array<Mesh::VecD3>(_nodeSite.at(id)->getCount())) );
756 
757  const StorageSite& nodeSiteGlbl = _mesh.getNodes();
758  const Array<Mesh::VecD3>& coordGlbl = _mesh.getNodeCoordinates();
759  for ( int i = 0; i < nodeSiteGlbl.getCount(); i++ ){
760  const map<int,int>& colorIDToLocalNode = _globalToLocalNodes[i];
761  foreach(const IntMap::value_type& mpos, colorIDToLocalNode){
762  int colorID = mpos.first;
763  int localNodeID = mpos.second;
764  (*_coord[colorID])[localNodeID] = coordGlbl[i];
765  }
766  }
767 }
const StorageSite & getNodes() const
Definition: Mesh.h:110
vector< ArrayVecD3Ptr > _coord
shared_ptr< Array< Mesh::VecD3 > > ArrayVecD3Ptr
const Array< VecD3 > & getNodeCoordinates() const
Definition: Mesh.h:218
vector< StorageSitePtr > _nodeSite
vector< map< int, int > > _globalToLocalNodes
Definition: Array.h:14
int getCount() const
Definition: StorageSite.h:39
const Mesh & _mesh
void MeshDismantler::setFaceCells ( )
private

Definition at line 248 of file MeshDismantler.cpp.

References _nmesh, faceCellsAddBoundaryInterfaces(), faceCellsAddInteriorFaces(), faceCellsAddMeshInterfaces(), faceCellsAddPartitionInterfaces(), faceCellsFinishAdd(), and faceCellsInit().

Referenced by init().

249 {
250  vector<int> localCellID(_nmesh,0); //track local mesh cell ids
251  vector<int> localFaceID(_nmesh,0); //track local mesh face ids
252 
253  faceCellsInit( localCellID );
254  faceCellsAddInteriorFaces ( localFaceID );
255  faceCellsAddBoundaryInterfaces ( localFaceID, localCellID );
256  faceCellsAddMeshInterfaces ( localFaceID, localCellID );
257  faceCellsAddPartitionInterfaces( localFaceID, localCellID );
259 
260 }
void faceCellsAddPartitionInterfaces(vector< int > &faceID, vector< int > &localCellID)
void faceCellsInit(vector< int > &localCellID)
void faceCellsAddInteriorFaces(vector< int > &faceID)
void faceCellsAddMeshInterfaces(vector< int > &faceID, vector< int > &localCellID)
void faceCellsAddBoundaryInterfaces(vector< int > &faceID, vector< int > &localCellID)
void MeshDismantler::setFaceNodes ( )
private

Definition at line 485 of file MeshDismantler.cpp.

References _nmesh, faceNodesAddBoundaryInterfaces(), faceNodesAddInteriorFaces(), faceNodesAddMeshInterfaces(), faceNodesAddPartitionInterfaces(), faceNodesFinishAdd(), and faceNodesInit().

Referenced by init().

486 {
487  vector<int> faceID(_nmesh,0); //track local mesh face ids
488  faceNodesInit();
489  faceNodesAddInteriorFaces ( faceID );
491  faceNodesAddMeshInterfaces ( faceID );
494 }
void faceNodesAddBoundaryInterfaces(vector< int > &faceID)
void faceNodesAddPartitionInterfaces(vector< int > &faceID)
void faceNodesAddMeshInterfaces(vector< int > &faceID)
void faceNodesAddInteriorFaces(vector< int > &faceID)
void MeshDismantler::setFacesSite ( )
private

Definition at line 160 of file MeshDismantler.cpp.

References _faceSite, _mesh, _nmesh, Mesh::getAllFaceCells(), Mesh::getCellColors(), StorageSite::getCount(), and Mesh::getFaces().

Referenced by init().

161 {
162  //loop over all faces, if cells connected to a face has the same color, just add that face to corresponding mesh.
163  // if has different colors, that face is counted to add both sharing meshes
164  vector<int> faceCount(_nmesh,0);
165  const CRConnectivity& faceCells = _mesh.getAllFaceCells();
166  const StorageSite& faceSite = _mesh.getFaces();
167  const Array<int>& color = _mesh.getCellColors();
168  for ( int n = 0; n < faceSite.getCount(); n++ ){
169  int cell1 = faceCells(n,0);
170  int cell2 = faceCells(n,1);
171  //check if they are different colors, if so, it is mesh boundary, increment ghostCount for both meshes
172  if ( color[ cell1 ] != color[ cell2 ] ){
173  faceCount[ color[cell1] ]++;
174  faceCount[ color[cell2] ]++;
175  } else {
176  faceCount[ color[cell2] ]++; // or cell1, cell1 == cell2 in here
177  }
178  }
179  //forming faceSites
180  for( int id = 0; id < _nmesh; id++ )
181  _faceSite.push_back( StorageSitePtr( new StorageSite(faceCount[id]) ) );
182 
183 
184 }
shared_ptr< StorageSite > StorageSitePtr
Definition: NcDataReader.h:18
Array< int > & getCellColors()
Definition: Mesh.h:228
const CRConnectivity & getAllFaceCells() const
Definition: Mesh.cpp:378
const StorageSite & getFaces() const
Definition: Mesh.h:108
int getCount() const
Definition: StorageSite.h:39
vector< StorageSitePtr > _faceSite
const Mesh & _mesh
void MeshDismantler::setMappers ( )
private

Definition at line 875 of file MeshDismantler.cpp.

References meshInterfaceMappers(), and partitionInterfaceMappers().

Referenced by init().

876 {
879 
880 }
void partitionInterfaceMappers()
void MeshDismantler::setMesh ( )
private

Definition at line 771 of file MeshDismantler.cpp.

References createBoundaryFaceGroup(), createCoords(), createFaceCells(), createFaceNodes(), createInterFaceGroup(), and createInteriorFaceGroup().

Referenced by init().

772 {
773  //interior face group
775  //boundary face group
777  //interface group
779  //setting coordinates
780  createCoords();
781  //setting faceNodes CRConnecitivty
782  createFaceNodes();
783  //setting faceCells CRConnectivity
784  createFaceCells();
785 
786 }
void createInterFaceGroup()
void createInteriorFaceGroup()
void createBoundaryFaceGroup()
void MeshDismantler::setNodesMapper ( )
private

Definition at line 714 of file MeshDismantler.cpp.

References _globalToLocalNodes, _mesh, _nmesh, Mesh::getCellColors(), Mesh::getCellNodes(), Mesh::getCells(), StorageSite::getCount(), CRConnectivity::getCount(), Mesh::getNodes(), and StorageSite::getSelfCount().

Referenced by init().

715 {
716  //count inner nodes for assembly
717  vector<int> nodeCount(_nmesh,0);
718  const StorageSite& nodeSite = _mesh.getNodes();
719  //allocate globalToLocaNodes
720  _globalToLocalNodes.resize( nodeSite.getCount() );
721  //allocating glblNOdeIDs for each mesh
722  vector< vector<int> > globalNodeIDs(_nmesh);
723  for ( int id = 0; id < _nmesh; id++ )
724  globalNodeIDs[id].resize(nodeSite.getCount(),-1);
725 
726  const StorageSite& cellSite = _mesh.getCells();
727  const CRConnectivity& cellNodes = _mesh.getCellNodes();
728  const Array<int>& color = _mesh.getCellColors();
729  //loop over only inner cells nodes
730  for ( int n = 0; n < cellSite.getSelfCount(); n++ ) {
731  int nnodes = cellNodes.getCount(n);
732  int colorID = color[n];
733  for ( int i = 0; i < nnodes; i++ ){
734  int glblNodeID = cellNodes(n,i);
735  //if it is not visited (=-1)
736  if ( globalNodeIDs[colorID][glblNodeID] == -1 ) {
737  map<int,int>& nodeMap = _globalToLocalNodes[glblNodeID];
738  nodeMap[colorID] = nodeCount[colorID];
739  globalNodeIDs[colorID][glblNodeID] = 1;
740  nodeCount[colorID]++;
741  }
742  }
743  }
744 
745 }
int getCount(const int i) const
int getSelfCount() const
Definition: StorageSite.h:40
const StorageSite & getNodes() const
Definition: Mesh.h:110
Array< int > & getCellColors()
Definition: Mesh.h:228
const StorageSite & getCells() const
Definition: Mesh.h:109
vector< map< int, int > > _globalToLocalNodes
int getCount() const
Definition: StorageSite.h:39
const Mesh & _mesh
const CRConnectivity & getCellNodes() const
Definition: Mesh.cpp:426
void MeshDismantler::setNodesSite ( )
private

Definition at line 188 of file MeshDismantler.cpp.

References _mesh, _nmesh, _nodeSite, Mesh::getCellColors(), Mesh::getCellNodes(), Mesh::getCells(), StorageSite::getCount(), CRConnectivity::getCount(), Mesh::getNodes(), and StorageSite::getSelfCount().

Referenced by init().

189 {
190  //get nodeCells and look at colors of the cells and incremet nodeCount for each mesh
191  //count inner nodes for assembly
192  vector<int> nodeCount(_nmesh,0);
193  const StorageSite& nodeSite = _mesh.getNodes();
194  //storing glblNOdeIDs for each mesh
195  vector< vector<int> > globalNodeIDs(_nmesh);
196  for ( int id = 0; id < _nmesh; id++ )
197  globalNodeIDs[id].resize(nodeSite.getCount(),-1);
198 
199 
200  const StorageSite& cellSite = _mesh.getCells();
201  const CRConnectivity& cellNodes = _mesh.getCellNodes();
202  const Array<int>& color = _mesh.getCellColors();
203  //loop over only inner cells nodes
204  for ( int n = 0; n < cellSite.getSelfCount(); n++ ) {
205  int nnodes = cellNodes.getCount(n);
206  int colorID = color[n];
207  for ( int i = 0; i < nnodes; i++ ){
208  int glblNodeID = cellNodes(n,i);
209  //if it is not visited (=-1)
210  if ( globalNodeIDs[colorID][glblNodeID] == -1 ) {
211  globalNodeIDs[colorID][glblNodeID] = 1; //(=1) means visited
212  nodeCount[colorID]++;
213  }
214  }
215  }
216  //pushin in vector field
217  for ( int id = 0; id < _nmesh; id++ )
218  _nodeSite.push_back( StorageSitePtr( new StorageSite(nodeCount[id]) ) );
219 
220 }
int getCount(const int i) const
int getSelfCount() const
Definition: StorageSite.h:40
const StorageSite & getNodes() const
Definition: Mesh.h:110
shared_ptr< StorageSite > StorageSitePtr
Definition: NcDataReader.h:18
Array< int > & getCellColors()
Definition: Mesh.h:228
const StorageSite & getCells() const
Definition: Mesh.h:109
vector< StorageSitePtr > _nodeSite
int getCount() const
Definition: StorageSite.h:39
const Mesh & _mesh
const CRConnectivity & getCellNodes() const
Definition: Mesh.cpp:426
void MeshDismantler::setSites ( )
private

Definition at line 790 of file MeshDismantler.cpp.

References _cellSite, _faceSite, _meshList, _nmesh, _nodeSite, StorageSite::setCount(), and StorageSite::setCountLevel1().

Referenced by init().

791 {
792  for ( int id = 0; id < _nmesh; id++ ){
793  StorageSite& faceSite = _meshList.at(id)->getFaces();
794  StorageSite& cellSite = _meshList.at(id)->getCells();
795  StorageSite& nodeSite = _meshList.at(id)->getNodes();
796  //setCounts
797  faceSite.setCount( _faceSite.at(id)->getCount() );
798  int nGhost = _cellSite.at(id)->getCount()-_cellSite.at(id)->getSelfCount();
799  cellSite.setCount( _cellSite.at(id)->getSelfCount(), nGhost );
800  cellSite.setCountLevel1( _cellSite.at(id)->getCountLevel1() );
801  nodeSite.setCount( _nodeSite.at(id)->getCount() );
802  }
803 }
void setCount(const int selfCount, const int nGhost=0)
Definition: StorageSite.h:42
vector< StorageSitePtr > _cellSite
vector< StorageSitePtr > _nodeSite
MeshList _meshList
vector< StorageSitePtr > _faceSite
void setCountLevel1(const int countLevel1)
Definition: StorageSite.h:69

Member Data Documentation

map< int, vector<int> > MeshDismantler::_boundaryID
private

Definition at line 140 of file MeshDismantler.h.

Referenced by createBoundaryFaceGroup(), and faceCellsAddBoundaryInterfaces().

map< int, vector<int> > MeshDismantler::_boundaryOffset
private

Definition at line 139 of file MeshDismantler.h.

Referenced by createBoundaryFaceGroup(), and faceCellsAddBoundaryInterfaces().

map< int, vector<int> > MeshDismantler::_boundarySize
private

Definition at line 138 of file MeshDismantler.h.

Referenced by createBoundaryFaceGroup(), and faceCellsAddBoundaryInterfaces().

map< int,vector<string> > MeshDismantler::_boundaryType
private

Definition at line 141 of file MeshDismantler.h.

Referenced by createBoundaryFaceGroup(), and faceCellsAddBoundaryInterfaces().

CRConnectivityPtr MeshDismantler::_cellFaces
private

Definition at line 113 of file MeshDismantler.h.

Referenced by init().

vector<StorageSitePtr> MeshDismantler::_cellSite
private
vector<ArrayVecD3Ptr> MeshDismantler::_coord
private

Definition at line 132 of file MeshDismantler.h.

Referenced by createCoords(), and setCoord().

vector< multimap<int,int> > MeshDismantler::_faceIdentifierList
private

Definition at line 128 of file MeshDismantler.h.

Referenced by faceCellsAddMeshInterfaces(), and meshInterfaceMappers().

vector<StorageSitePtr> MeshDismantler::_faceSite
private
vector< map<int,int> > MeshDismantler::_globalToLocalFaces
private
vector< map<int,int> > MeshDismantler::_globalToLocalNodes
private
map< int, vector<int> > MeshDismantler::_interfaceID
private
map< int, vector<int> > MeshDismantler::_interfaceOffset
private
map< int, vector<int> > MeshDismantler::_interfaceSize
private
int MeshDismantler::_interiorFaceSize
private

Definition at line 144 of file MeshDismantler.h.

vector< ArrayIntPtr > MeshDismantler::_localCellToGlobal
private

Definition at line 120 of file MeshDismantler.h.

Referenced by setCellsMapper().

map<int, ArrayIntPtr > MeshDismantler::_localNodeToGlobal
private

Definition at line 125 of file MeshDismantler.h.

int MeshDismantler::_nInterfaceNodes
private

Definition at line 143 of file MeshDismantler.h.

vector<StorageSitePtr> MeshDismantler::_nodeSite
private

Definition at line 117 of file MeshDismantler.h.

Referenced by debug_node_site(), setCoord(), setNodesSite(), and setSites().

int MeshDismantler::_nPart
private

Definition at line 148 of file MeshDismantler.h.

Referenced by global_offset(), and init().

int MeshDismantler::_procID
private

The documentation for this class was generated from the following files: