[152] | 1 | #include "grid.hpp" |
---|
| 2 | |
---|
| 3 | #include "attribute_template_impl.hpp" |
---|
| 4 | #include "object_template_impl.hpp" |
---|
| 5 | #include "group_template_impl.hpp" |
---|
| 6 | |
---|
[168] | 7 | namespace xmlioserver { |
---|
| 8 | namespace tree { |
---|
[152] | 9 | |
---|
[168] | 10 | /// ////////////////////// Définitions ////////////////////// /// |
---|
[152] | 11 | |
---|
[168] | 12 | CGrid::CGrid(void) |
---|
| 13 | : CObjectTemplate<CGrid>(), CGridAttributes() |
---|
| 14 | , withAxis(false), isChecked(false), axis(), domain() |
---|
[181] | 15 | , storeIndex(1), out_i_index(1), out_j_index(1), out_l_index(1) |
---|
[168] | 16 | { /* Ne rien faire de plus */ } |
---|
[152] | 17 | |
---|
[168] | 18 | CGrid::CGrid(const StdString & id) |
---|
| 19 | : CObjectTemplate<CGrid>(id), CGridAttributes() |
---|
| 20 | , withAxis(false), isChecked(false), axis(), domain() |
---|
[181] | 21 | , storeIndex(1), out_i_index(1), out_j_index(1), out_l_index(1) |
---|
[168] | 22 | { /* Ne rien faire de plus */ } |
---|
[152] | 23 | |
---|
[168] | 24 | CGrid::~CGrid(void) |
---|
[182] | 25 | { |
---|
| 26 | this->axis.reset() ; |
---|
| 27 | this->domain.reset() ; |
---|
| 28 | |
---|
| 29 | for (StdSize i = 0; i < this->storeIndex.size(); i++) |
---|
| 30 | { |
---|
| 31 | this->storeIndex[i].reset(); |
---|
| 32 | this->out_i_index[i].reset(); |
---|
| 33 | this->out_j_index[i].reset(); |
---|
| 34 | this->out_l_index[i].reset(); |
---|
| 35 | } |
---|
| 36 | } |
---|
[152] | 37 | |
---|
[168] | 38 | ///--------------------------------------------------------------- |
---|
[152] | 39 | |
---|
[168] | 40 | StdString CGrid::GetName(void) { return (StdString("grid")); } |
---|
| 41 | StdString CGrid::GetDefName(void) { return (CGrid::GetName()); } |
---|
| 42 | ENodeType CGrid::GetType(void) { return (eGrid); } |
---|
[152] | 43 | |
---|
[168] | 44 | //---------------------------------------------------------------- |
---|
[152] | 45 | |
---|
[181] | 46 | const std::deque<ARRAY(int, 1)> & CGrid::getStoreIndex(void) const |
---|
[180] | 47 | { |
---|
| 48 | return (this->storeIndex ); |
---|
| 49 | } |
---|
| 50 | |
---|
| 51 | //--------------------------------------------------------------- |
---|
| 52 | |
---|
[181] | 53 | const std::deque<ARRAY(int, 1)> & CGrid::getOutIIndex(void) const |
---|
[180] | 54 | { |
---|
| 55 | return (this->out_i_index ); |
---|
| 56 | } |
---|
| 57 | |
---|
| 58 | //--------------------------------------------------------------- |
---|
| 59 | |
---|
[181] | 60 | const std::deque<ARRAY(int, 1)> & CGrid::getOutJIndex(void) const |
---|
[180] | 61 | { |
---|
| 62 | return (this->out_j_index ); |
---|
| 63 | } |
---|
| 64 | |
---|
| 65 | //--------------------------------------------------------------- |
---|
| 66 | |
---|
[181] | 67 | const std::deque<ARRAY(int, 1)> & CGrid::getOutLIndex(void) const |
---|
[180] | 68 | { |
---|
| 69 | return (this->out_l_index ); |
---|
| 70 | } |
---|
[152] | 71 | |
---|
[180] | 72 | //--------------------------------------------------------------- |
---|
| 73 | |
---|
[168] | 74 | const boost::shared_ptr<CAxis> CGrid::getRelAxis (void) const |
---|
[180] | 75 | { |
---|
| 76 | return (this->axis ); |
---|
| 77 | } |
---|
| 78 | |
---|
| 79 | //--------------------------------------------------------------- |
---|
| 80 | |
---|
[168] | 81 | const boost::shared_ptr<CDomain> CGrid::getRelDomain(void) const |
---|
[180] | 82 | { |
---|
| 83 | return (this->domain ); |
---|
| 84 | } |
---|
[152] | 85 | |
---|
[180] | 86 | //--------------------------------------------------------------- |
---|
[152] | 87 | |
---|
[180] | 88 | bool CGrid::hasAxis(void) const |
---|
| 89 | { |
---|
| 90 | return (this->withAxis); |
---|
| 91 | } |
---|
| 92 | |
---|
[168] | 93 | //--------------------------------------------------------------- |
---|
[152] | 94 | |
---|
[205] | 95 | StdSize CGrid::getDimension(void) const |
---|
| 96 | { |
---|
| 97 | return ((this->withAxis)?3:2); |
---|
| 98 | } |
---|
| 99 | |
---|
| 100 | //--------------------------------------------------------------- |
---|
| 101 | |
---|
| 102 | std::vector<StdSize> CGrid::getShape(void) const |
---|
| 103 | { |
---|
| 104 | std::vector<StdSize> retvalue; |
---|
| 105 | retvalue.push_back(this->domain->ni.getValue()); |
---|
| 106 | retvalue.push_back(this->domain->nj.getValue()); |
---|
| 107 | if (this->withAxis) |
---|
| 108 | retvalue.push_back(this->axis->size.getValue()); |
---|
| 109 | return (retvalue); |
---|
| 110 | } |
---|
| 111 | //--------------------------------------------------------------- |
---|
| 112 | |
---|
| 113 | StdSize CGrid::getSize(void) const |
---|
| 114 | { |
---|
| 115 | StdSize retvalue = 1; |
---|
| 116 | std::vector<StdSize> shape_ = this->getShape(); |
---|
| 117 | for (StdSize s = 0; s < shape_.size(); s++) |
---|
| 118 | retvalue *= shape_[s]; |
---|
| 119 | return (retvalue); |
---|
| 120 | } |
---|
| 121 | |
---|
| 122 | //--------------------------------------------------------------- |
---|
| 123 | |
---|
[168] | 124 | void CGrid::solveReference(void) |
---|
| 125 | { |
---|
| 126 | if (this->isChecked) return; |
---|
| 127 | this->solveDomainRef() ; |
---|
| 128 | this->solveAxisRef() ; |
---|
[181] | 129 | if (this->storeIndex.size() == 1) |
---|
[182] | 130 | { |
---|
[181] | 131 | this->computeIndex() ; |
---|
[182] | 132 | } |
---|
| 133 | else |
---|
| 134 | { |
---|
| 135 | this->computeIndexServer(); |
---|
| 136 | } |
---|
[168] | 137 | this->isChecked = true; |
---|
| 138 | } |
---|
| 139 | |
---|
[180] | 140 | //--------------------------------------------------------------- |
---|
| 141 | |
---|
[168] | 142 | void CGrid::solveDomainRef(void) |
---|
| 143 | { |
---|
| 144 | if (!domain_ref.isEmpty()) |
---|
[152] | 145 | { |
---|
[168] | 146 | if (CObjectFactory::HasObject<CDomain>(domain_ref.getValue())) |
---|
[152] | 147 | { |
---|
[168] | 148 | this->domain = CObjectFactory::GetObject<CDomain>(domain_ref.getValue()) ; |
---|
| 149 | domain->checkAttributes() ; |
---|
[152] | 150 | } |
---|
| 151 | else ERROR("CGrid::solveDomainRef(void)", |
---|
[168] | 152 | << "Référence au domaine incorrecte") ; |
---|
[152] | 153 | } |
---|
[168] | 154 | else ERROR("CGrid::solveDomainRef(void)", |
---|
| 155 | << "Domaine non défini") ; |
---|
| 156 | } |
---|
[152] | 157 | |
---|
[180] | 158 | //--------------------------------------------------------------- |
---|
| 159 | |
---|
[168] | 160 | void CGrid::solveAxisRef(void) |
---|
| 161 | { |
---|
| 162 | if (!axis_ref.isEmpty()) |
---|
[152] | 163 | { |
---|
[168] | 164 | this->withAxis = true ; |
---|
| 165 | if (CObjectFactory::GetObject<CAxis>(axis_ref.getValue())) |
---|
[152] | 166 | { |
---|
[168] | 167 | this->axis = CObjectFactory::GetObject<CAxis>(axis_ref.getValue()) ; |
---|
| 168 | axis->checkAttributes() ; |
---|
[152] | 169 | } |
---|
[168] | 170 | else ERROR("CGrid::solveAxisRef(void)", |
---|
| 171 | << "Référence a l'axe incorrecte") ; |
---|
[152] | 172 | } |
---|
[168] | 173 | else withAxis = false ; |
---|
| 174 | } |
---|
[152] | 175 | |
---|
[168] | 176 | //--------------------------------------------------------------- |
---|
[152] | 177 | |
---|
[168] | 178 | void CGrid::computeIndex(void) |
---|
[184] | 179 | { |
---|
[168] | 180 | const int ni = domain->ni.getValue() , |
---|
| 181 | nj = domain->nj.getValue() , |
---|
| 182 | size = (this->hasAxis()) ? axis->size.getValue() : 1 ; |
---|
[152] | 183 | |
---|
[168] | 184 | /*std::cout << ni << " : " |
---|
| 185 | << nj << " : " |
---|
| 186 | << size << std::endl;*/ |
---|
[152] | 187 | |
---|
[168] | 188 | const int data_dim = domain->data_dim.getValue() , |
---|
| 189 | data_n_index = domain->data_n_index.getValue() , |
---|
| 190 | data_ibegin = domain->data_ibegin.getValue() , |
---|
| 191 | data_jbegin = (data_dim == 2) |
---|
| 192 | ? domain->data_jbegin.getValue() : -1; |
---|
[152] | 193 | |
---|
[168] | 194 | ARRAY(int, 1) data_i_index = domain->data_i_index.getValue() , |
---|
| 195 | data_j_index = domain->data_j_index.getValue() ; |
---|
[152] | 196 | |
---|
[180] | 197 | /*std::cout << data_n_index << " : " |
---|
| 198 | << data_i_index << " : " |
---|
| 199 | << data_j_index << std::endl; */ |
---|
[152] | 200 | |
---|
[168] | 201 | ARRAY(bool, 2) mask = domain->mask.getValue() ; |
---|
[152] | 202 | |
---|
[168] | 203 | int indexCount = 0; |
---|
[152] | 204 | |
---|
[168] | 205 | for(int l = 0; l < size ; l++) |
---|
| 206 | { |
---|
| 207 | for(int n = 0, i = 0, j = 0; n < data_n_index; n++) |
---|
[152] | 208 | { |
---|
[168] | 209 | int temp_i = (*data_i_index)[n] + data_ibegin, |
---|
| 210 | temp_j = (data_dim == 1) ? -1 |
---|
| 211 | : (*data_j_index)[n] + data_jbegin; |
---|
| 212 | i = (data_dim == 1) ? (temp_i - 2) % ni |
---|
| 213 | : (temp_i - 1) ; |
---|
| 214 | j = (data_dim == 1) ? (temp_i - 2) / ni |
---|
| 215 | : (temp_j - 1) ; |
---|
[152] | 216 | |
---|
[168] | 217 | if ((i >= 0 && i < ni) && |
---|
| 218 | (j >= 0 && j < nj) && (*mask)[i][j]) |
---|
| 219 | indexCount++ ; |
---|
[152] | 220 | } |
---|
[168] | 221 | } |
---|
| 222 | |
---|
| 223 | //std::cout << indexCount << std::endl; |
---|
[181] | 224 | ARRAY_ASSIGN(this->storeIndex[0] , int, 1, [indexCount]); |
---|
| 225 | ARRAY_ASSIGN(this->out_l_index[0], int, 1, [indexCount]); |
---|
| 226 | ARRAY_ASSIGN(this->out_i_index[0], int, 1, [indexCount]); |
---|
| 227 | ARRAY_ASSIGN(this->out_j_index[0], int, 1, [indexCount]); |
---|
[152] | 228 | |
---|
[168] | 229 | for(int count = 0, indexCount = 0, l = 0; l < size; l++) |
---|
| 230 | { |
---|
| 231 | for(int n = 0, i = 0, j = 0; n < data_n_index; n++, count++) |
---|
[152] | 232 | { |
---|
[168] | 233 | int temp_i = (*data_i_index)[n] + data_ibegin, |
---|
| 234 | temp_j = (data_dim == 1) ? -1 |
---|
| 235 | : (*data_j_index)[n] + data_jbegin; |
---|
| 236 | i = (data_dim == 1) ? (temp_i - 2) % ni |
---|
| 237 | : (temp_i - 1) ; |
---|
| 238 | j = (data_dim == 1) ? (temp_i - 2) / ni |
---|
| 239 | : (temp_j - 1) ; |
---|
| 240 | |
---|
| 241 | if ((i >= 0 && i < ni) && |
---|
| 242 | (j >= 0 && j < nj) && (*mask)[i][j]) |
---|
[152] | 243 | { |
---|
[181] | 244 | (*this->storeIndex[0]) [indexCount] = count ; |
---|
| 245 | (*this->out_l_index[0])[indexCount] = l ; |
---|
| 246 | (*this->out_i_index[0])[indexCount] = i ; |
---|
| 247 | (*this->out_j_index[0])[indexCount] = j ; |
---|
[168] | 248 | indexCount++ ; |
---|
[152] | 249 | } |
---|
| 250 | } |
---|
| 251 | } |
---|
[168] | 252 | } |
---|
[152] | 253 | |
---|
[168] | 254 | //---------------------------------------------------------------- |
---|
[152] | 255 | |
---|
[168] | 256 | boost::shared_ptr<CGrid> |
---|
| 257 | CGrid::CreateGrid(boost::shared_ptr<CDomain> domain) |
---|
| 258 | { |
---|
| 259 | StdString new_id = StdString("__") + domain->getId() + StdString("__") ; |
---|
| 260 | boost::shared_ptr<CGrid> grid = |
---|
| 261 | CGroupFactory::CreateChild(CObjectFactory::GetObject<CGridGroup> ("grid_definition"), new_id); |
---|
| 262 | grid->domain_ref.setValue(domain->getId()); |
---|
| 263 | return (grid); |
---|
| 264 | } |
---|
[152] | 265 | |
---|
[168] | 266 | boost::shared_ptr<CGrid> |
---|
| 267 | CGrid::CreateGrid(boost::shared_ptr<CDomain> domain, boost::shared_ptr<CAxis> axis) |
---|
| 268 | { |
---|
| 269 | StdString new_id = StdString("__") + domain->getId() + |
---|
| 270 | StdString("_") + axis->getId() + StdString("__") ; |
---|
| 271 | boost::shared_ptr<CGrid> grid = |
---|
| 272 | CGroupFactory::CreateChild(CObjectFactory::GetObject<CGridGroup> ("grid_definition"), new_id); |
---|
| 273 | grid->domain_ref.setValue(domain->getId()); |
---|
| 274 | grid->axis_ref.setValue(axis->getId()); |
---|
| 275 | return (grid); |
---|
| 276 | } |
---|
[152] | 277 | |
---|
[168] | 278 | //---------------------------------------------------------------- |
---|
[152] | 279 | |
---|
[168] | 280 | template <> |
---|
| 281 | void CGrid::outputField |
---|
| 282 | (const ARRAY(double, 1) stored, ARRAY(double, 3) field) const |
---|
| 283 | { |
---|
[181] | 284 | for(StdSize n = 0; n < storeIndex[0]->num_elements(); n++) |
---|
| 285 | (*field)[(*out_i_index[0])[n]][(*out_j_index[0])[n]][(*out_l_index[0])[n]] = (*stored)[n] ; |
---|
[168] | 286 | } |
---|
[152] | 287 | |
---|
[180] | 288 | //--------------------------------------------------------------- |
---|
| 289 | |
---|
[168] | 290 | template <> |
---|
| 291 | void CGrid::outputField |
---|
| 292 | (const ARRAY(double, 1) stored, ARRAY(double, 2) field) const |
---|
| 293 | { |
---|
[181] | 294 | for(StdSize n = 0; n < storeIndex[0]->num_elements(); n++) |
---|
| 295 | (*field)[(*out_i_index[0])[n]][(*out_j_index[0])[n]] = (*stored)[n] ; |
---|
[168] | 296 | } |
---|
[152] | 297 | |
---|
[180] | 298 | //--------------------------------------------------------------- |
---|
| 299 | |
---|
[168] | 300 | template <> |
---|
| 301 | void CGrid::outputField |
---|
| 302 | (const ARRAY(double, 1) stored, ARRAY(double, 1) field) const |
---|
| 303 | { |
---|
[181] | 304 | for(StdSize n = 0; n < storeIndex[0]->num_elements(); n++) |
---|
| 305 | (*field)[(*out_i_index[0])[n]] = (*stored)[n] ; |
---|
[168] | 306 | } |
---|
[152] | 307 | |
---|
[168] | 308 | //---------------------------------------------------------------- |
---|
[152] | 309 | |
---|
[168] | 310 | void CGrid::storeField_arr |
---|
| 311 | (const double * const data, ARRAY(double, 1) stored) const |
---|
| 312 | { |
---|
[181] | 313 | const StdSize size = storeIndex[0]->num_elements() ; |
---|
[168] | 314 | stored->resize(boost::extents[size]) ; |
---|
| 315 | for(StdSize i = 0; i < size; i++) |
---|
[181] | 316 | (*stored)[i] = data[(*storeIndex[0])[i]] ; |
---|
[168] | 317 | } |
---|
[180] | 318 | |
---|
| 319 | //--------------------------------------------------------------- |
---|
| 320 | |
---|
| 321 | void CGrid::toBinary (StdOStream & os) const |
---|
| 322 | { |
---|
| 323 | SuperClass::toBinary(os); |
---|
[184] | 324 | |
---|
| 325 | os.write (reinterpret_cast<const char*>(&this->isChecked), sizeof(bool)); |
---|
| 326 | |
---|
| 327 | if (this->isChecked) |
---|
| 328 | { |
---|
| 329 | this->storeIndex [0]->toBinary(os); |
---|
| 330 | this->out_i_index[0]->toBinary(os); |
---|
| 331 | this->out_j_index[0]->toBinary(os); |
---|
| 332 | this->out_l_index[0]->toBinary(os); |
---|
| 333 | } |
---|
[180] | 334 | } |
---|
[168] | 335 | |
---|
[180] | 336 | //--------------------------------------------------------------- |
---|
| 337 | |
---|
| 338 | void CGrid::fromBinary(StdIStream & is) |
---|
| 339 | { |
---|
[184] | 340 | bool hasIndex = false; |
---|
| 341 | SuperClass::fromBinary(is); |
---|
| 342 | is.read (reinterpret_cast<char*>(&hasIndex), sizeof(bool)); |
---|
[180] | 343 | |
---|
[184] | 344 | if (hasIndex) |
---|
| 345 | { |
---|
| 346 | ARRAY_CREATE(storeIndex_ , int, 1, [0]); |
---|
| 347 | ARRAY_CREATE(out_l_index_, int, 1, [0]); |
---|
| 348 | ARRAY_CREATE(out_i_index_, int, 1, [0]); |
---|
| 349 | ARRAY_CREATE(out_j_index_, int, 1, [0]); |
---|
| 350 | |
---|
| 351 | storeIndex_ ->fromBinary(is); |
---|
| 352 | out_i_index_->fromBinary(is); |
---|
| 353 | out_j_index_->fromBinary(is); |
---|
| 354 | out_l_index_->fromBinary(is); |
---|
| 355 | |
---|
| 356 | this->storeIndex .push_back(storeIndex_); |
---|
| 357 | this->out_i_index.push_back(out_i_index_); |
---|
| 358 | this->out_j_index.push_back(out_j_index_); |
---|
| 359 | this->out_l_index.push_back(out_l_index_); |
---|
| 360 | } |
---|
[180] | 361 | } |
---|
[182] | 362 | |
---|
| 363 | //--------------------------------------------------------------- |
---|
| 364 | |
---|
| 365 | void CGrid::computeIndexServer(void) |
---|
| 366 | { |
---|
| 367 | ARRAY(int, 1) storeIndex_srv = this->storeIndex[0]; |
---|
| 368 | ARRAY(int, 1) out_i_index_srv = this->out_i_index[0]; |
---|
| 369 | ARRAY(int, 1) out_j_index_srv = this->out_j_index[0]; |
---|
[200] | 370 | ARRAY(int, 1) out_l_index_srv = this->out_l_index[0]; |
---|
| 371 | |
---|
| 372 | ARRAY(int, 2) local_mask = this->domain->getLocalMask(); |
---|
[182] | 373 | |
---|
| 374 | const std::vector<int> & ibegin = this->domain->getIBeginSub(); |
---|
| 375 | const std::vector<int> & jbegin = this->domain->getJBeginSub(); |
---|
| 376 | |
---|
[183] | 377 | const int ibegin_srv = this->domain->ibegin.getValue(); |
---|
| 378 | const int jbegin_srv = this->domain->jbegin.getValue(); |
---|
[200] | 379 | const int zoom_ni_srv = this->domain->zoom_ni_loc.getValue(); |
---|
| 380 | const int zoom_nj_srv = this->domain->zoom_nj_loc.getValue(); |
---|
[183] | 381 | |
---|
[184] | 382 | const int ibegin_zoom_srv = this->domain->zoom_ibegin_loc.getValue(); |
---|
| 383 | const int jbegin_zoom_srv = this->domain->zoom_jbegin_loc.getValue(); |
---|
| 384 | |
---|
[182] | 385 | StdSize dn = 0; |
---|
| 386 | for (StdSize j = 1; j < this->out_i_index.size(); j++) |
---|
| 387 | dn += this->out_i_index[j]->size(); |
---|
| 388 | |
---|
[184] | 389 | ARRAY_ASSIGN(storeIndex_srv , int, 1, [dn]); |
---|
[182] | 390 | ARRAY_ASSIGN(out_i_index_srv, int, 1, [dn]); |
---|
| 391 | ARRAY_ASSIGN(out_j_index_srv, int, 1, [dn]); |
---|
| 392 | ARRAY_ASSIGN(out_l_index_srv, int, 1, [dn]); |
---|
| 393 | |
---|
| 394 | for (StdSize i = 0, dn = 0; i < ibegin.size(); i++) |
---|
| 395 | { |
---|
[184] | 396 | ARRAY(int, 1) storeIndex_cl = this->storeIndex [i + 1]; |
---|
| 397 | ARRAY(int, 1) out_i_index_cl = this->out_i_index[i + 1]; |
---|
| 398 | ARRAY(int, 1) out_j_index_cl = this->out_j_index[i + 1]; |
---|
| 399 | ARRAY(int, 1) out_l_index_cl = this->out_l_index[i + 1]; |
---|
[182] | 400 | |
---|
| 401 | const int ibegin_cl = ibegin[i]; |
---|
| 402 | const int jbegin_cl = jbegin[i]; |
---|
| 403 | |
---|
| 404 | for (StdSize n = dn, m = 0; n < (dn + storeIndex_cl->size()); n++, m++) |
---|
| 405 | { |
---|
[184] | 406 | (*storeIndex_srv)[n] = (*storeIndex_cl)[m] + dn; // Faux mais inutile dans tous les cas. |
---|
| 407 | (*out_i_index_srv)[n] = (*out_i_index_cl)[m] |
---|
| 408 | + (ibegin_cl - 1) - (ibegin_srv - 1) - (ibegin_zoom_srv - 1); |
---|
| 409 | (*out_j_index_srv)[n] = (*out_j_index_cl)[m] |
---|
| 410 | + (jbegin_cl - 1) - (jbegin_srv - 1) - (jbegin_zoom_srv - 1); |
---|
[182] | 411 | (*out_l_index_srv)[n] = (*out_l_index_cl)[m]; |
---|
| 412 | } |
---|
| 413 | |
---|
[199] | 414 | dn += storeIndex_cl->size(); |
---|
[182] | 415 | } |
---|
[199] | 416 | |
---|
| 417 | if (storeIndex_srv->size() != 0) |
---|
| 418 | { |
---|
| 419 | const int ibegin_t = |
---|
| 420 | *std::min_element(out_i_index_srv->begin(), out_i_index_srv->end()); |
---|
| 421 | const int iend_t = |
---|
| 422 | *std::max_element(out_i_index_srv->begin(), out_i_index_srv->end()); |
---|
| 423 | const int jbegin_t = |
---|
| 424 | *std::min_element(out_j_index_srv->begin(), out_j_index_srv->end()); |
---|
| 425 | const int jend_t = |
---|
| 426 | *std::max_element(out_j_index_srv->begin(), out_j_index_srv->end()); |
---|
| 427 | |
---|
[200] | 428 | if ((ibegin_t < 0) || (jbegin_t < 0) || |
---|
| 429 | (iend_t >= zoom_ni_srv) || (jend_t >= zoom_nj_srv)) |
---|
[199] | 430 | { |
---|
[200] | 431 | ERROR("CGrid::computeIndexServer(void)", |
---|
| 432 | <<"Erreur d'indexation de la grille au niveau du serveur") ; |
---|
[199] | 433 | } |
---|
| 434 | } |
---|
[200] | 435 | |
---|
| 436 | if (storeIndex_srv->size() != 0) |
---|
| 437 | for (StdSize u = 0; u < storeIndex_srv->size(); u++) |
---|
| 438 | (*local_mask)[(*out_i_index_srv)[u]][(*out_j_index_srv)[u]] = 1; |
---|
| 439 | |
---|
[185] | 440 | //~ StdOFStream ofs(this->getId().c_str()); |
---|
| 441 | //~ for (StdSize h = 0; h < storeIndex_srv->size(); h++) |
---|
| 442 | //~ { |
---|
| 443 | //~ ofs << "(" << (*storeIndex_srv)[h] << ";" |
---|
| 444 | //~ << (*out_i_index_srv)[h] << "," |
---|
| 445 | //~ << (*out_j_index_srv)[h] << "," |
---|
| 446 | //~ << (*out_l_index_srv)[h] << ")" << std::endl; |
---|
| 447 | //~ } |
---|
| 448 | //~ ofs.close(); |
---|
[199] | 449 | this->storeIndex.resize(1); |
---|
| 450 | this->out_i_index.resize(1); |
---|
| 451 | this->out_j_index.resize(1); |
---|
| 452 | this->out_l_index.resize(1); |
---|
[182] | 453 | |
---|
| 454 | } |
---|
[183] | 455 | |
---|
| 456 | //---------------------------------------------------------------- |
---|
| 457 | |
---|
| 458 | void CGrid::inputFieldServer |
---|
| 459 | (const std::deque<ARRAY(double, 1)> storedClient, |
---|
| 460 | ARRAY(double, 1) storedServer) const |
---|
| 461 | { |
---|
[185] | 462 | if ((this->storeIndex.size()-1 ) != storedClient.size()) |
---|
[183] | 463 | ERROR("CGrid::inputFieldServer(...)", |
---|
| 464 | << "[ Nombre de tableau attendu = " << (this->storeIndex.size()-1) << ", " |
---|
| 465 | << "[ Nombre de tableau reçu = " << storedClient.size() << "] " |
---|
| 466 | << "Les données d'un client sont manquantes !") ; |
---|
| 467 | if (storedServer.get() != NULL) |
---|
| 468 | storedServer->resize(boost::extents[this->storeIndex.size()-1]); |
---|
| 469 | else |
---|
| 470 | ARRAY_ASSIGN(storedServer, double, 1, [this->storeIndex.size()-1]); |
---|
| 471 | |
---|
| 472 | for (StdSize i = 0, n = 0; i < storedClient.size(); i++) |
---|
| 473 | for (StdSize j = 0; j < storedClient[i]->num_elements(); j++) |
---|
| 474 | (*storedServer)[n++] = (*storedClient[i])[j]; |
---|
| 475 | } |
---|
[180] | 476 | |
---|
[168] | 477 | ///--------------------------------------------------------------- |
---|
| 478 | |
---|
| 479 | } // namespace tree |
---|
[152] | 480 | } // namespace xmlioserver |
---|