Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Partition.H
Go to the documentation of this file.
1 /* *******************************************************************
2  * Rocstar Simulation Suite *
3  * Copyright@2015, Illinois Rocstar LLC. All rights reserved. *
4  * *
5  * Illinois Rocstar LLC *
6  * Champaign, IL *
7  * www.illinoisrocstar.com *
8  * sales@illinoisrocstar.com *
9  * *
10  * License: See LICENSE file in top level of distribution package or *
11  * http://opensource.org/licenses/NCSA *
12  *********************************************************************/
13 /* *******************************************************************
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, *
15  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES *
16  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND *
17  * NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR *
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
20  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
21  * USE OR OTHER DEALINGS WITH THE SOFTWARE. *
22  *********************************************************************/
23 #ifndef _GEM_PARTITION_H_
24 #define _GEM_PARTITION_H_
25 
26 
27 // Partition boundary refers to an interface between two partitions
28 // where communication is needed
30 public:
31  unsigned int _mypart;
32  unsigned int _rbid;
33  vector< pair<unsigned int,unsigned int> > _bnodes;
34  unsigned int _ngnodes;
35  vector< pair<unsigned int,unsigned int> > _btets;
36  unsigned int _ngtets;
37  vector< pair<unsigned int, unsigned int> > _bhex;
38  unsigned int _nghex;
39  vector< pair<unsigned int, unsigned int> > _bpyr;
40  unsigned int _ngpyr;
41  vector< pair<unsigned int, unsigned int> > _bpris;
42  unsigned int _ngpris;
43  vector<unsigned int> _belem_send[4];
44  vector<unsigned int> _belem_recv[4];
47  {};
50  {
51  _mypart = 0;
52  _rbid = 0;
53  _ngnodes = pb._recvnodes.size();
54  };
55  bool ReadPartitionBoundary(ifstream &Inf);
56  bool ReadPartitionBoundaryASCII(ifstream &Inf);
57  bool WritePartitionBoundaryASCII(ofstream &Ouf);
58  unsigned int MyRank(void) const { return _mypart; };
59  void MyRank(unsigned int n) {_mypart = n;};
62  GEM_Partition &gp);
63  // void populate_element_arrays(const GEM_Partition &);
64 };
65 
66 // Partition patch refers to the solver's domain boundary - or it's
67 // interface to the rest of the physical universe.
69 public:
70  unsigned int _nfaces;
71  unsigned int _ngfaces;
72  vector<unsigned int> _faceconn;
73  bool ReadPartitionPatchASCII(ifstream &Inf);
74  bool WritePartitionPatchASCII(ofstream &Ouf);
75  bool ReadPartitionPatch(ifstream &Inf);
78  {
79  _nfaces = 0;
80  _ngfaces = 0;
81  };
83  : GEM_DomainBoundary(db)
84  {
85  _nfaces = db._triconn.size()/3 + db._quadconn.size()/4;
86  _ngfaces = db._ngtri + db._ngquad;
87  };
88 };
89 
90 // A partition is whole or part of a mesh representing a solver's domain
91 class Partition : public GEM_Partition {
92 public:
93  unsigned int _nnodes;
94  unsigned int _nelem;
95  unsigned int _ntet;
96  unsigned int _nhex;
97  unsigned int _npyr;
98  unsigned int _npris;
99  unsigned int _npatch;
100  vector<PartitionBoundary> _boundaries;
101  vector<PartitionPatch> _patches;
102  bool ReadPartition(const string &pre,unsigned int rank);
103  bool ReadPartitionBoundaries(ifstream &Inf);
104  bool ReadPartitionPatches(ifstream &Inf);
105  bool ReadPartitionASCII(const string &pre,unsigned int rank);
106  bool ReadPartitionBoundariesASCII(ifstream &Inf);
107  bool ReadPartitionPatchesASCII(ifstream &Inf);
108  bool WritePartitionASCII(const string &pre);
109  bool WritePartitionBoundariesASCII(ofstream &Ouf);
110  bool WritePartitionPatchesASCII(ofstream &Ouf);
111  bool BuildPartitionBoundaries(const vector<int> &Pconn);
112  Partition(const GEM_Partition &gp);
114  {};
115 };
116 
117 #endif
118 
119 
120 
121 
122 
123 
bool WritePartitionPatchASCII(ofstream &Ouf)
Definition: Partition.C:96
unsigned int _nnodes
Definition: Partition.H:93
bool ReadPartitionPatches(ifstream &Inf)
Definition: Partition.C:125
unsigned int _ngpyr
Definition: Partition.H:40
unsigned int _npyr
Definition: Partition.H:97
std::vector< unsigned int > _recvnodes
Definition: GEM.H:230
vector< pair< unsigned int, unsigned int > > _bnodes
Definition: Partition.H:33
vector< PartitionPatch > _patches
Definition: Partition.H:101
unsigned int _ngtets
Definition: Partition.H:36
bool WritePartitionPatchesASCII(ofstream &Ouf)
Definition: Partition.C:159
std::vector< unsigned int > _quadconn
Definition: GEM.H:132
bool WritePartitionBoundariesASCII(ofstream &Ouf)
Definition: Partition.C:374
unsigned int _npatch
Definition: Partition.H:99
bool ReadPartitionBoundaryASCII(ifstream &Inf)
Definition: Partition.C:248
vector< PartitionBoundary > _boundaries
Definition: Partition.H:100
vector< pair< unsigned int, unsigned int > > _btets
Definition: Partition.H:35
unsigned int _ngpris
Definition: Partition.H:42
vector< pair< unsigned int, unsigned int > > _bhex
Definition: Partition.H:37
unsigned int _npris
Definition: Partition.H:98
unsigned int MyRank(void) const
Definition: Partition.H:58
void MyRank(unsigned int n)
Definition: Partition.H:59
bool ReadPartitionPatchesASCII(ifstream &Inf)
Definition: Partition.C:143
std::vector< unsigned int > _triconn
Definition: GEM.H:131
unsigned int _nhex
Definition: Partition.H:96
unsigned int _ngquad
Definition: GEM.H:129
vector< pair< unsigned int, unsigned int > > _bpyr
Definition: Partition.H:39
vector< pair< unsigned int, unsigned int > > _bpris
Definition: Partition.H:41
bool BuildPartitionBoundaries(const vector< int > &Pconn)
Definition: Partition.C:523
bool ReadPartitionBoundariesASCII(ifstream &Inf)
Definition: Partition.C:360
bool ReadPartitionPatchASCII(ifstream &Inf)
Definition: Partition.C:57
bool ReadPartitionBoundaries(ifstream &Inf)
Definition: Partition.C:387
const NT & n
bool ReadPartitionPatch(ifstream &Inf)
Definition: Partition.C:42
vector< unsigned int > _belem_recv[4]
Definition: Partition.H:44
PartitionPatch(const GEM_DomainBoundary &db)
Definition: Partition.H:82
bool ReadPartition(const string &pre, unsigned int rank)
Definition: Partition.C:402
unsigned int _ngnodes
Definition: Partition.H:34
bool WritePartitionBoundaryASCII(ofstream &Ouf)
Definition: Partition.C:301
unsigned int _ngfaces
Definition: Partition.H:71
void populate_local_arrays(const PartitionBoundary &)
Definition: Partition.C:1004
bool ReadPartitionASCII(const string &pre, unsigned int rank)
Definition: Partition.C:452
vector< unsigned int > _belem_send[4]
Definition: Partition.H:43
unsigned int _nelem
Definition: Partition.H:94
unsigned int _nghex
Definition: Partition.H:38
unsigned int _ntet
Definition: Partition.H:95
unsigned int _rbid
Definition: Partition.H:32
static int rank
Definition: advectest.C:66
bool WritePartitionASCII(const string &pre)
Definition: Partition.C:691
unsigned int _mypart
Definition: Partition.H:31
vector< unsigned int > _faceconn
Definition: Partition.H:72
unsigned int _nfaces
Definition: Partition.H:70
bool ReadPartitionBoundary(ifstream &Inf)
Definition: Partition.C:172
unsigned int _ngtri
Definition: GEM.H:128
PartitionBoundary(const GEM_PartitionBoundary &pb)
Definition: Partition.H:48