9 #include <fei_macros.hpp>
11 #include <snl_fei_PointBlockMap.hpp>
12 #include <fei_ctg_set.hpp>
14 #define fei_file "snl_fei_PointBlockMap.cpp"
15 #include <fei_ErrMacros.hpp>
24 ptEqns_ =
new std::map<int,int>;
25 blkEqns_ =
new std::map<int,std::pair<int,int> >;
44 return( setEqn(ptEqn, blkEqn, 1) );
50 if (ptEqualBlk_ ==
true) {
51 if (ptEqn != blkEqn)
return(-1);
55 ptEqns_->insert(std::pair<int,int>(ptEqn, blkEqn));
63 std::pair<int, int> newpair;
64 std::map<int,std::pair<int,int> >::iterator
65 b_iter = blkEqns_->find(blkEqn);
67 if (b_iter == blkEqns_->end()) {
68 newpair.first = ptEqn;
69 newpair.second = blkSize;
70 blkEqns_->insert(std::pair<
int,std::pair<int,int> >(blkEqn, newpair));
73 newpair = (*b_iter).second;
74 if (newpair.first > ptEqn) {
75 newpair.first = ptEqn;
76 newpair.second = blkSize;
77 (*b_iter).second = newpair;
87 if (ptEqualBlk_ ==
true)
return(0);
89 std::pair<int,int> newpair;
90 std::map<int,std::pair<int,int> >::iterator
91 b_iter = blkEqns_->find(blkEqn);
92 if (b_iter == blkEqns_->end()) {
96 newpair = (*b_iter).second;
97 newpair.second = size;
98 (*b_iter).second = newpair;
100 if (maxSize_ < size) maxSize_ = size;
108 if (ptEqualBlk_ ==
true)
return(1);
110 std::map<int,std::pair<int,int> >::iterator
111 b_iter = blkEqns_->find(blkEqn);
113 if (b_iter != blkEqns_->end()) {
114 return((*b_iter).second.second);
123 if (ptEqualBlk_ ==
true)
return(eqn);
126 std::map<int,int>::iterator p_iter = ptEqns_->find(eqn);
127 if (p_iter != ptEqns_->end()) blkEqn = (*p_iter).second;
135 if (ptEqualBlk_ ==
true)
return(blkEqn);
138 std::map<int,std::pair<int,int> >::iterator
139 b_iter = blkEqns_->find(blkEqn);
140 if (b_iter == blkEqns_->end()) {
144 return((*b_iter).second.first);
150 if (ptEqualBlk_ ==
true) {
156 std::map<int,std::pair<int,int> >::iterator
157 b_iter = blkEqns_->find(blkEqn);
158 if (b_iter == blkEqns_->end()) {
162 ptEqn = (*b_iter).second.first;
163 blkSize = (*b_iter).second.second;
173 if (ptEqualBlk_ ==
true) {
179 std::map<int,int>::iterator
180 p_iter = ptEqns_->find(ptEqn);
181 if (p_iter == ptEqns_->end()) {
185 blkEqn = (*p_iter).second;
187 std::map<int,std::pair<int,int> >::iterator
188 b_iter = blkEqns_->find(blkEqn);
190 std::pair<int,int> bpair = (*b_iter).second;
192 blkOffset = ptEqn - bpair.first;
200 if (ptEqualBlk_ ==
true)
return(0);
203 int err = getPtEqnInfo(eqn, blkEqn, blkOffset);
204 if (err != 0)
return(err);
212 if (ptEqualBlk_==
true)
return(
true);
214 std::map<int,int>::iterator
215 p_iter = ptEqns_->find(ptEqn);
216 if (p_iter == ptEqns_->end()) {
220 return( getBlkEqnOffset((*p_iter).first, ptEqn) == 0 );
bool isExactlyBlkEqn(int ptEqn)
int setBlkEqnSize(int blkEqn, int size)
int getBlkEqnOffset(int blkEqn, int ptEqn)
int setEqn(int ptEqn, int blkEqn)
int eqnToBlkEqn(int eqn) const
int getBlkEqnSize(int blkEqn)
int getPtEqnInfo(int ptEqn, int &blkEqn, int &blkOffset)
int blkEqnToPtEqn(int blkEqn) const
int getBlkEqnInfo(int blkEqn, int &ptEqn, int &blkSize)