-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathprpl-subCellspaceInfo.h
144 lines (128 loc) · 5.74 KB
/
prpl-subCellspaceInfo.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#ifndef PRPL_SUBCELLSPACEINFO_H
#define PRPL_SUBCELLSPACEINFO_H
/***************************************************************************
* prpl-subCellspaceInfo.h
*
* Project: pRPL, v 2.2
* Purpose: Header file for class pRPL::SubCellspaceInfo
* Author: Qingfeng (Gene) Guan
* E-mail: guanqf {at} gmail.com
****************************************************************************
* Copyright (c) 2008, Qingfeng Guan
* NOTE: this library can ONLY be used for EDUCATIONAL and SCIENTIFIC
* purposes, NO COMMERCIAL usages are allowed unless the author is
* contacted and a permission is granted
*
****************************************************************************/
#include "prpl-basicTypes.h"
#include "prpl-neighborhood.h"
namespace pRPL {
class SubCellspaceInfo {
public:
SubCellspaceInfo();
SubCellspaceInfo(int id,
pRPL::DomDcmpType domDcmpType,
const pRPL::SpaceDims &glbDims,
const pRPL::CoordBR &MBR,
const pRPL::CoordBR &workBR,
const vector<pRPL::IntVect> &mNbrSpcIDs);
SubCellspaceInfo(const pRPL::SubCellspaceInfo &rhs);
SubCellspaceInfo(const pRPL::IntVect &vInfoPack,
pRPL::IntVctItr &iVal);
~SubCellspaceInfo() {}
pRPL::SubCellspaceInfo& operator=(const pRPL::SubCellspaceInfo &rhs);
bool operator==(const pRPL::SubCellspaceInfo &rhs) const;
bool operator!=(const pRPL::SubCellspaceInfo &rhs) const;
int id() const;
pRPL::DomDcmpType domDcmpType() const;
long nGlbRows() const;
long nGlbCols() const;
const pRPL::SpaceDims& glbDims() const;
long nRows() const;
long nCols() const;
const pRPL::SpaceDims& dims() const;
long iRowBegin() const;
long iColBegin() const;
long iRowEnd() const;
long iColEnd() const;
const pRPL::CoordBR& MBR() const;
long iRowWorkBegin() const;
long iColWorkBegin() const;
long iRowWorkEnd() const;
long iColWorkEnd() const;
const pRPL::CoordBR& workBR() const;
double sizeRatio() const;
bool validGlbIdx(long glbIdx,
bool warning = true) const;
bool validGlbCoord(const pRPL::CellCoord &glbCoord,
bool warning = true) const;
bool validGlbCoord(long iRowGlb, long iColGlb,
bool warning = true) const;
const pRPL::CellCoord glbIdx2glbCoord(long glbIdx) const;
long glbCoord2glbIdx(const pRPL::CellCoord &glbCoord) const;
long glbCoord2glbIdx(long iRowGlb, long iColGlb) const;
bool validIdx(long idx,
bool warning = true) const;
bool validCoord(const pRPL::CellCoord &coord,
bool warning = true) const;
bool validCoord(long iRow, long iCol,
bool warning = true) const;
long coord2idx(const pRPL::CellCoord &coord) const;
long coord2idx(long iRow, long iCol) const;
const pRPL::CellCoord idx2coord(long idx) const;
const pRPL::CellCoord lclCoord2glbCoord(const pRPL::CellCoord& lclCoord) const;
const pRPL::CellCoord lclCoord2glbCoord(long iRowLcl, long iColLcl) const;
const pRPL::CellCoord glbCoord2lclCoord(const pRPL::CellCoord& glbCoord) const;
const pRPL::CellCoord glbCoord2lclCoord(long iRowGlb, long iColGlb) const;
long lclCoord2glbIdx(const pRPL::CellCoord &lclCoord) const;
long lclCoord2glbIdx(long iRowLcl, long iColLcl) const;
const pRPL::CellCoord glbIdx2lclCoord(long glbIdx) const;
long glbIdx2lclIdx(long glbIdx) const;
long lclIdx2glbIdx(long lclIdx) const;
int nNbrDirs() const;
int nEdges() const;
int nTotNbrs() const;
bool validSpcDir(int iDir) const;
bool hasNbrs(int iDir) const;
int nNbrs(int iDir) const;
const pRPL::IntVect& nbrSubSpcIDs(int iDir) const;
int nbrDir(int nbrID) const;
pRPL::MeshDir spcDir2MeshDir(int iDir) const;
int oppositeDir(int iDir) const;
bool calcBRs(bool onlyUpdtCtrCell = true,
const pRPL::Neighborhood *pNbrhd = NULL,
const list<pRPL::SubCellspaceInfo> *plSubspcInfos = NULL);
const pRPL::CoordBR* interiorBR() const;
const pRPL::CoordBR* edgeBR(int iDir) const;
const pRPL::CoordBR* sendBR(int iDir,
int iNbr = 0) const;
/*
void add2IntVect(pRPL::IntVect &vInfoPack) const;
bool fromIntVect(const pRPL::IntVect &vInfoPack,
pRPL::IntVctItr &iVal);
*/
protected:
void _initBRs();
bool _rowwiseBRs(bool onlyUpdtCtrCell = true,
const pRPL::Neighborhood *pNbrhd = NULL);
bool _colwiseBRs(bool onlyUpdtCtrCell = true,
const pRPL::Neighborhood *pNbrhd = NULL);
bool _blockwiseBRs(bool onlyUpdtCtrCell = true,
const pRPL::Neighborhood *pNbrhd = NULL,
const list<pRPL::SubCellspaceInfo> *plSubspcInfos = NULL);
const pRPL::SubCellspaceInfo* _findSubspcInfo(const list<pRPL::SubCellspaceInfo> *plSubspcInfos,
int subspcGlbID) const;
protected:
int _id;
pRPL::DomDcmpType _domDcmpType;
pRPL::SpaceDims _glbDims;
pRPL::CoordBR _MBR; /* MBR is in global coordinates */
pRPL::SpaceDims _dims;
pRPL::CoordBR _workBR; /* workBR is in local coordinates */
vector<pRPL::IntVect> _mNbrSpcIDs;
vector<vector<CoordBR> > _mSendBRs;
vector<CoordBR> _vEdgeBRs;
CoordBR _interiorBR;
};
};
#endif