9 #include <fei_macros.hpp>
13 #include <fei_Pattern.hpp>
15 #include <fei_ConnectivityBlock.hpp>
18 #define fei_file "fei_ConnectivityBlock.cpp"
19 #include <fei_ErrMacros.hpp>
24 int numConnectivities)
31 connectivityOffsets_(),
32 numRecordsPerConnectivity_(pattern->getNumIDs()),
33 connectivities_(pattern->getNumIDs()*numConnectivities),
34 numRecordsPerColConnectivity_(0),
45 int numConnectivities)
48 colPattern_(colpattern),
52 connectivityOffsets_(),
53 numRecordsPerConnectivity_(rowpattern->getNumIDs()),
54 connectivities_(rowpattern->getNumIDs()*numConnectivities),
55 numRecordsPerColConnectivity_(colpattern->getNumIDs()),
56 colConnectivities_(colpattern->getNumIDs()*numConnectivities),
65 const int* rowOffsets,
66 bool offsets_are_lengths)
73 connectivityOffsets_(),
74 numRecordsPerConnectivity_(0),
76 numRecordsPerColConnectivity_(0),
81 connectivities_.resize(numRowIDs);
82 connectivityOffsets_.resize(numRowIDs+1);
85 if (offsets_are_lengths) {
87 for(
int ii=0; ii<numRowIDs; ++ii) {
88 sum += rowOffsets[ii];
92 else clen = rowOffsets[numRowIDs];
94 colConnectivities_.resize(clen);
97 if (offsets_are_lengths) {
99 for(i=0; i<numRowIDs; ++i) {
100 connIDsOffsetMap_[rowIDs[i]] = i;
101 connectivityOffsets_[i] = offset;
102 offset += rowOffsets[i];
104 connectivityOffsets_[numRowIDs] = offset;
107 for(i=0; i<numRowIDs; ++i) {
108 connIDsOffsetMap_[rowIDs[i]] = i;
109 connectivityOffsets_[i] = rowOffsets[i];
111 connectivityOffsets_[numRowIDs] = rowOffsets[numRowIDs];
119 const int* rowOffsets,
120 bool offsets_are_lengths)
127 connectivityOffsets_(),
128 numRecordsPerConnectivity_(0),
130 numRecordsPerColConnectivity_(0),
131 colConnectivities_(),
135 connectivities_.resize(numRowIDs);
136 connectivityOffsets_.resize(numRowIDs+1);
139 if (offsets_are_lengths) {
141 for(
int ii=0; ii<numRowIDs; ++ii) {
142 sum += rowOffsets[ii];
146 else clen = rowOffsets[numRowIDs];
148 colConnectivities_.resize(clen);
151 if (offsets_are_lengths) {
153 for(i=0; i<numRowIDs; ++i) {
154 connIDsOffsetMap_[rowIDs[i]] = i;
155 connectivityOffsets_[i] = offset;
156 offset += rowOffsets[i];
158 connectivityOffsets_[numRowIDs] = offset;
161 for(i=0; i<numRowIDs+1; ++i) {
162 connIDsOffsetMap_[rowIDs[i]] = i;
163 connectivityOffsets_[i] = rowOffsets[i];
165 connectivityOffsets_[numRowIDs] = rowOffsets[numRowIDs];
177 std::map<int,int>::const_iterator
178 iter = connIDsOffsetMap_.find(ID);
179 if (iter == connIDsOffsetMap_.end()) {
183 int ind = iter->second;
184 const int* ptr = &connectivities_[0];
185 return( ptr + ind*numRecordsPerConnectivity_);
191 std::map<int,int>::const_iterator
192 iter = connIDsOffsetMap_.find(ID);
193 if (iter == connIDsOffsetMap_.end()) {
197 int ind = iter->second;
198 int* ptr = &connectivities_[0];
199 return( ptr + ind*numRecordsPerConnectivity_);
205 std::map<int,int>::const_iterator
206 iter = connIDsOffsetMap_.find(ID);
207 if (iter == connIDsOffsetMap_.end()) {
211 int ind = iter->second;
212 const int* ptr = &colConnectivities_[0];
213 return(ptr+ind*numRecordsPerColConnectivity_);
219 std::map<int,int>::const_iterator
220 iter = connIDsOffsetMap_.find(ID);
221 if (iter == connIDsOffsetMap_.end()) {
225 int ind = iter->second;
226 int* ptr = &colConnectivities_[0];
227 return(ptr+ind*numRecordsPerColConnectivity_);
const int * getRowConnectivity(int ID) const
virtual ~ConnectivityBlock()
ConnectivityBlock(int blockID, fei::Pattern *pattern, int numConnectivities)
const int * getColConnectivity(int ID) const