[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 | |
---|
[168] | 95 | void CGrid::solveReference(void) |
---|
| 96 | { |
---|
| 97 | if (this->isChecked) return; |
---|
| 98 | this->solveDomainRef() ; |
---|
| 99 | this->solveAxisRef() ; |
---|
[181] | 100 | if (this->storeIndex.size() == 1) |
---|
[182] | 101 | { |
---|
[181] | 102 | this->computeIndex() ; |
---|
[182] | 103 | } |
---|
| 104 | else |
---|
| 105 | { |
---|
| 106 | this->computeIndexServer(); |
---|
| 107 | } |
---|
[168] | 108 | this->isChecked = true; |
---|
| 109 | } |
---|
| 110 | |
---|
[180] | 111 | //--------------------------------------------------------------- |
---|
| 112 | |
---|
[168] | 113 | void CGrid::solveDomainRef(void) |
---|
| 114 | { |
---|
| 115 | if (!domain_ref.isEmpty()) |
---|
[152] | 116 | { |
---|
[168] | 117 | if (CObjectFactory::HasObject<CDomain>(domain_ref.getValue())) |
---|
[152] | 118 | { |
---|
[168] | 119 | this->domain = CObjectFactory::GetObject<CDomain>(domain_ref.getValue()) ; |
---|
| 120 | domain->checkAttributes() ; |
---|
[152] | 121 | } |
---|
| 122 | else ERROR("CGrid::solveDomainRef(void)", |
---|
[168] | 123 | << "Référence au domaine incorrecte") ; |
---|
[152] | 124 | } |
---|
[168] | 125 | else ERROR("CGrid::solveDomainRef(void)", |
---|
| 126 | << "Domaine non défini") ; |
---|
| 127 | } |
---|
[152] | 128 | |
---|
[180] | 129 | //--------------------------------------------------------------- |
---|
| 130 | |
---|
[168] | 131 | void CGrid::solveAxisRef(void) |
---|
| 132 | { |
---|
| 133 | if (!axis_ref.isEmpty()) |
---|
[152] | 134 | { |
---|
[168] | 135 | this->withAxis = true ; |
---|
| 136 | if (CObjectFactory::GetObject<CAxis>(axis_ref.getValue())) |
---|
[152] | 137 | { |
---|
[168] | 138 | this->axis = CObjectFactory::GetObject<CAxis>(axis_ref.getValue()) ; |
---|
| 139 | axis->checkAttributes() ; |
---|
[152] | 140 | } |
---|
[168] | 141 | else ERROR("CGrid::solveAxisRef(void)", |
---|
| 142 | << "Référence a l'axe incorrecte") ; |
---|
[152] | 143 | } |
---|
[168] | 144 | else withAxis = false ; |
---|
| 145 | } |
---|
[152] | 146 | |
---|
[168] | 147 | //--------------------------------------------------------------- |
---|
[152] | 148 | |
---|
[168] | 149 | void CGrid::computeIndex(void) |
---|
[184] | 150 | { |
---|
[168] | 151 | const int ni = domain->ni.getValue() , |
---|
| 152 | nj = domain->nj.getValue() , |
---|
| 153 | size = (this->hasAxis()) ? axis->size.getValue() : 1 ; |
---|
[152] | 154 | |
---|
[168] | 155 | /*std::cout << ni << " : " |
---|
| 156 | << nj << " : " |
---|
| 157 | << size << std::endl;*/ |
---|
[152] | 158 | |
---|
[168] | 159 | const int data_dim = domain->data_dim.getValue() , |
---|
| 160 | data_n_index = domain->data_n_index.getValue() , |
---|
| 161 | data_ibegin = domain->data_ibegin.getValue() , |
---|
| 162 | data_jbegin = (data_dim == 2) |
---|
| 163 | ? domain->data_jbegin.getValue() : -1; |
---|
[152] | 164 | |
---|
[168] | 165 | ARRAY(int, 1) data_i_index = domain->data_i_index.getValue() , |
---|
| 166 | data_j_index = domain->data_j_index.getValue() ; |
---|
[152] | 167 | |
---|
[180] | 168 | /*std::cout << data_n_index << " : " |
---|
| 169 | << data_i_index << " : " |
---|
| 170 | << data_j_index << std::endl; */ |
---|
[152] | 171 | |
---|
[168] | 172 | ARRAY(bool, 2) mask = domain->mask.getValue() ; |
---|
[152] | 173 | |
---|
[168] | 174 | int indexCount = 0; |
---|
[152] | 175 | |
---|
[168] | 176 | for(int l = 0; l < size ; l++) |
---|
| 177 | { |
---|
| 178 | for(int n = 0, i = 0, j = 0; n < data_n_index; n++) |
---|
[152] | 179 | { |
---|
[168] | 180 | int temp_i = (*data_i_index)[n] + data_ibegin, |
---|
| 181 | temp_j = (data_dim == 1) ? -1 |
---|
| 182 | : (*data_j_index)[n] + data_jbegin; |
---|
| 183 | i = (data_dim == 1) ? (temp_i - 2) % ni |
---|
| 184 | : (temp_i - 1) ; |
---|
| 185 | j = (data_dim == 1) ? (temp_i - 2) / ni |
---|
| 186 | : (temp_j - 1) ; |
---|
[152] | 187 | |
---|
[168] | 188 | if ((i >= 0 && i < ni) && |
---|
| 189 | (j >= 0 && j < nj) && (*mask)[i][j]) |
---|
| 190 | indexCount++ ; |
---|
[152] | 191 | } |
---|
[168] | 192 | } |
---|
| 193 | |
---|
| 194 | //std::cout << indexCount << std::endl; |
---|
[181] | 195 | ARRAY_ASSIGN(this->storeIndex[0] , int, 1, [indexCount]); |
---|
| 196 | ARRAY_ASSIGN(this->out_l_index[0], int, 1, [indexCount]); |
---|
| 197 | ARRAY_ASSIGN(this->out_i_index[0], int, 1, [indexCount]); |
---|
| 198 | ARRAY_ASSIGN(this->out_j_index[0], int, 1, [indexCount]); |
---|
[152] | 199 | |
---|
[168] | 200 | for(int count = 0, indexCount = 0, l = 0; l < size; l++) |
---|
| 201 | { |
---|
| 202 | for(int n = 0, i = 0, j = 0; n < data_n_index; n++, count++) |
---|
[152] | 203 | { |
---|
[168] | 204 | int temp_i = (*data_i_index)[n] + data_ibegin, |
---|
| 205 | temp_j = (data_dim == 1) ? -1 |
---|
| 206 | : (*data_j_index)[n] + data_jbegin; |
---|
| 207 | i = (data_dim == 1) ? (temp_i - 2) % ni |
---|
| 208 | : (temp_i - 1) ; |
---|
| 209 | j = (data_dim == 1) ? (temp_i - 2) / ni |
---|
| 210 | : (temp_j - 1) ; |
---|
| 211 | |
---|
| 212 | if ((i >= 0 && i < ni) && |
---|
| 213 | (j >= 0 && j < nj) && (*mask)[i][j]) |
---|
[152] | 214 | { |
---|
[181] | 215 | (*this->storeIndex[0]) [indexCount] = count ; |
---|
| 216 | (*this->out_l_index[0])[indexCount] = l ; |
---|
| 217 | (*this->out_i_index[0])[indexCount] = i ; |
---|
| 218 | (*this->out_j_index[0])[indexCount] = j ; |
---|
[168] | 219 | indexCount++ ; |
---|
[152] | 220 | } |
---|
| 221 | } |
---|
| 222 | } |
---|
[168] | 223 | } |
---|
[152] | 224 | |
---|
[168] | 225 | //---------------------------------------------------------------- |
---|
[152] | 226 | |
---|
[168] | 227 | boost::shared_ptr<CGrid> |
---|
| 228 | CGrid::CreateGrid(boost::shared_ptr<CDomain> domain) |
---|
| 229 | { |
---|
| 230 | StdString new_id = StdString("__") + domain->getId() + StdString("__") ; |
---|
| 231 | boost::shared_ptr<CGrid> grid = |
---|
| 232 | CGroupFactory::CreateChild(CObjectFactory::GetObject<CGridGroup> ("grid_definition"), new_id); |
---|
| 233 | grid->domain_ref.setValue(domain->getId()); |
---|
| 234 | return (grid); |
---|
| 235 | } |
---|
[152] | 236 | |
---|
[168] | 237 | boost::shared_ptr<CGrid> |
---|
| 238 | CGrid::CreateGrid(boost::shared_ptr<CDomain> domain, boost::shared_ptr<CAxis> axis) |
---|
| 239 | { |
---|
| 240 | StdString new_id = StdString("__") + domain->getId() + |
---|
| 241 | StdString("_") + axis->getId() + StdString("__") ; |
---|
| 242 | boost::shared_ptr<CGrid> grid = |
---|
| 243 | CGroupFactory::CreateChild(CObjectFactory::GetObject<CGridGroup> ("grid_definition"), new_id); |
---|
| 244 | grid->domain_ref.setValue(domain->getId()); |
---|
| 245 | grid->axis_ref.setValue(axis->getId()); |
---|
| 246 | return (grid); |
---|
| 247 | } |
---|
[152] | 248 | |
---|
[168] | 249 | //---------------------------------------------------------------- |
---|
[152] | 250 | |
---|
[168] | 251 | template <> |
---|
| 252 | void CGrid::outputField |
---|
| 253 | (const ARRAY(double, 1) stored, ARRAY(double, 3) field) const |
---|
| 254 | { |
---|
[181] | 255 | for(StdSize n = 0; n < storeIndex[0]->num_elements(); n++) |
---|
| 256 | (*field)[(*out_i_index[0])[n]][(*out_j_index[0])[n]][(*out_l_index[0])[n]] = (*stored)[n] ; |
---|
[168] | 257 | } |
---|
[152] | 258 | |
---|
[180] | 259 | //--------------------------------------------------------------- |
---|
| 260 | |
---|
[168] | 261 | template <> |
---|
| 262 | void CGrid::outputField |
---|
| 263 | (const ARRAY(double, 1) stored, ARRAY(double, 2) field) const |
---|
| 264 | { |
---|
[181] | 265 | for(StdSize n = 0; n < storeIndex[0]->num_elements(); n++) |
---|
| 266 | (*field)[(*out_i_index[0])[n]][(*out_j_index[0])[n]] = (*stored)[n] ; |
---|
[168] | 267 | } |
---|
[152] | 268 | |
---|
[180] | 269 | //--------------------------------------------------------------- |
---|
| 270 | |
---|
[168] | 271 | template <> |
---|
| 272 | void CGrid::outputField |
---|
| 273 | (const ARRAY(double, 1) stored, ARRAY(double, 1) field) const |
---|
| 274 | { |
---|
[181] | 275 | for(StdSize n = 0; n < storeIndex[0]->num_elements(); n++) |
---|
| 276 | (*field)[(*out_i_index[0])[n]] = (*stored)[n] ; |
---|
[168] | 277 | } |
---|
[152] | 278 | |
---|
[168] | 279 | //---------------------------------------------------------------- |
---|
[152] | 280 | |
---|
[168] | 281 | void CGrid::storeField_arr |
---|
| 282 | (const double * const data, ARRAY(double, 1) stored) const |
---|
| 283 | { |
---|
[181] | 284 | const StdSize size = storeIndex[0]->num_elements() ; |
---|
[168] | 285 | stored->resize(boost::extents[size]) ; |
---|
| 286 | for(StdSize i = 0; i < size; i++) |
---|
[181] | 287 | (*stored)[i] = data[(*storeIndex[0])[i]] ; |
---|
[168] | 288 | } |
---|
[180] | 289 | |
---|
| 290 | //--------------------------------------------------------------- |
---|
| 291 | |
---|
| 292 | void CGrid::toBinary (StdOStream & os) const |
---|
| 293 | { |
---|
| 294 | SuperClass::toBinary(os); |
---|
[184] | 295 | |
---|
| 296 | os.write (reinterpret_cast<const char*>(&this->isChecked), sizeof(bool)); |
---|
| 297 | |
---|
| 298 | if (this->isChecked) |
---|
| 299 | { |
---|
| 300 | this->storeIndex [0]->toBinary(os); |
---|
| 301 | this->out_i_index[0]->toBinary(os); |
---|
| 302 | this->out_j_index[0]->toBinary(os); |
---|
| 303 | this->out_l_index[0]->toBinary(os); |
---|
| 304 | } |
---|
[180] | 305 | } |
---|
[168] | 306 | |
---|
[180] | 307 | //--------------------------------------------------------------- |
---|
| 308 | |
---|
| 309 | void CGrid::fromBinary(StdIStream & is) |
---|
| 310 | { |
---|
[184] | 311 | bool hasIndex = false; |
---|
| 312 | SuperClass::fromBinary(is); |
---|
| 313 | is.read (reinterpret_cast<char*>(&hasIndex), sizeof(bool)); |
---|
[180] | 314 | |
---|
[184] | 315 | if (hasIndex) |
---|
| 316 | { |
---|
| 317 | ARRAY_CREATE(storeIndex_ , int, 1, [0]); |
---|
| 318 | ARRAY_CREATE(out_l_index_, int, 1, [0]); |
---|
| 319 | ARRAY_CREATE(out_i_index_, int, 1, [0]); |
---|
| 320 | ARRAY_CREATE(out_j_index_, int, 1, [0]); |
---|
| 321 | |
---|
| 322 | storeIndex_ ->fromBinary(is); |
---|
| 323 | out_i_index_->fromBinary(is); |
---|
| 324 | out_j_index_->fromBinary(is); |
---|
| 325 | out_l_index_->fromBinary(is); |
---|
| 326 | |
---|
| 327 | this->storeIndex .push_back(storeIndex_); |
---|
| 328 | this->out_i_index.push_back(out_i_index_); |
---|
| 329 | this->out_j_index.push_back(out_j_index_); |
---|
| 330 | this->out_l_index.push_back(out_l_index_); |
---|
| 331 | } |
---|
[180] | 332 | } |
---|
[182] | 333 | |
---|
| 334 | //--------------------------------------------------------------- |
---|
| 335 | |
---|
| 336 | void CGrid::computeIndexServer(void) |
---|
| 337 | { |
---|
| 338 | ARRAY(int, 1) storeIndex_srv = this->storeIndex[0]; |
---|
| 339 | ARRAY(int, 1) out_i_index_srv = this->out_i_index[0]; |
---|
| 340 | ARRAY(int, 1) out_j_index_srv = this->out_j_index[0]; |
---|
[200] | 341 | ARRAY(int, 1) out_l_index_srv = this->out_l_index[0]; |
---|
| 342 | |
---|
| 343 | ARRAY(int, 2) local_mask = this->domain->getLocalMask(); |
---|
[182] | 344 | |
---|
| 345 | const std::vector<int> & ibegin = this->domain->getIBeginSub(); |
---|
| 346 | const std::vector<int> & jbegin = this->domain->getJBeginSub(); |
---|
| 347 | |
---|
[183] | 348 | const int ibegin_srv = this->domain->ibegin.getValue(); |
---|
| 349 | const int jbegin_srv = this->domain->jbegin.getValue(); |
---|
[200] | 350 | const int zoom_ni_srv = this->domain->zoom_ni_loc.getValue(); |
---|
| 351 | const int zoom_nj_srv = this->domain->zoom_nj_loc.getValue(); |
---|
[183] | 352 | |
---|
[184] | 353 | const int ibegin_zoom_srv = this->domain->zoom_ibegin_loc.getValue(); |
---|
| 354 | const int jbegin_zoom_srv = this->domain->zoom_jbegin_loc.getValue(); |
---|
| 355 | |
---|
[182] | 356 | StdSize dn = 0; |
---|
| 357 | for (StdSize j = 1; j < this->out_i_index.size(); j++) |
---|
| 358 | dn += this->out_i_index[j]->size(); |
---|
| 359 | |
---|
[184] | 360 | ARRAY_ASSIGN(storeIndex_srv , int, 1, [dn]); |
---|
[182] | 361 | ARRAY_ASSIGN(out_i_index_srv, int, 1, [dn]); |
---|
| 362 | ARRAY_ASSIGN(out_j_index_srv, int, 1, [dn]); |
---|
| 363 | ARRAY_ASSIGN(out_l_index_srv, int, 1, [dn]); |
---|
| 364 | |
---|
| 365 | for (StdSize i = 0, dn = 0; i < ibegin.size(); i++) |
---|
| 366 | { |
---|
[184] | 367 | ARRAY(int, 1) storeIndex_cl = this->storeIndex [i + 1]; |
---|
| 368 | ARRAY(int, 1) out_i_index_cl = this->out_i_index[i + 1]; |
---|
| 369 | ARRAY(int, 1) out_j_index_cl = this->out_j_index[i + 1]; |
---|
| 370 | ARRAY(int, 1) out_l_index_cl = this->out_l_index[i + 1]; |
---|
[182] | 371 | |
---|
| 372 | const int ibegin_cl = ibegin[i]; |
---|
| 373 | const int jbegin_cl = jbegin[i]; |
---|
| 374 | |
---|
| 375 | for (StdSize n = dn, m = 0; n < (dn + storeIndex_cl->size()); n++, m++) |
---|
| 376 | { |
---|
[184] | 377 | (*storeIndex_srv)[n] = (*storeIndex_cl)[m] + dn; // Faux mais inutile dans tous les cas. |
---|
| 378 | (*out_i_index_srv)[n] = (*out_i_index_cl)[m] |
---|
| 379 | + (ibegin_cl - 1) - (ibegin_srv - 1) - (ibegin_zoom_srv - 1); |
---|
| 380 | (*out_j_index_srv)[n] = (*out_j_index_cl)[m] |
---|
| 381 | + (jbegin_cl - 1) - (jbegin_srv - 1) - (jbegin_zoom_srv - 1); |
---|
[182] | 382 | (*out_l_index_srv)[n] = (*out_l_index_cl)[m]; |
---|
| 383 | } |
---|
| 384 | |
---|
[199] | 385 | dn += storeIndex_cl->size(); |
---|
[182] | 386 | } |
---|
[199] | 387 | |
---|
| 388 | if (storeIndex_srv->size() != 0) |
---|
| 389 | { |
---|
| 390 | const int ibegin_t = |
---|
| 391 | *std::min_element(out_i_index_srv->begin(), out_i_index_srv->end()); |
---|
| 392 | const int iend_t = |
---|
| 393 | *std::max_element(out_i_index_srv->begin(), out_i_index_srv->end()); |
---|
| 394 | const int jbegin_t = |
---|
| 395 | *std::min_element(out_j_index_srv->begin(), out_j_index_srv->end()); |
---|
| 396 | const int jend_t = |
---|
| 397 | *std::max_element(out_j_index_srv->begin(), out_j_index_srv->end()); |
---|
| 398 | |
---|
[200] | 399 | if ((ibegin_t < 0) || (jbegin_t < 0) || |
---|
| 400 | (iend_t >= zoom_ni_srv) || (jend_t >= zoom_nj_srv)) |
---|
[199] | 401 | { |
---|
[200] | 402 | ERROR("CGrid::computeIndexServer(void)", |
---|
| 403 | <<"Erreur d'indexation de la grille au niveau du serveur") ; |
---|
[199] | 404 | } |
---|
| 405 | } |
---|
[200] | 406 | |
---|
| 407 | if (storeIndex_srv->size() != 0) |
---|
| 408 | for (StdSize u = 0; u < storeIndex_srv->size(); u++) |
---|
| 409 | (*local_mask)[(*out_i_index_srv)[u]][(*out_j_index_srv)[u]] = 1; |
---|
| 410 | |
---|
[185] | 411 | //~ StdOFStream ofs(this->getId().c_str()); |
---|
| 412 | //~ for (StdSize h = 0; h < storeIndex_srv->size(); h++) |
---|
| 413 | //~ { |
---|
| 414 | //~ ofs << "(" << (*storeIndex_srv)[h] << ";" |
---|
| 415 | //~ << (*out_i_index_srv)[h] << "," |
---|
| 416 | //~ << (*out_j_index_srv)[h] << "," |
---|
| 417 | //~ << (*out_l_index_srv)[h] << ")" << std::endl; |
---|
| 418 | //~ } |
---|
| 419 | //~ ofs.close(); |
---|
[199] | 420 | this->storeIndex.resize(1); |
---|
| 421 | this->out_i_index.resize(1); |
---|
| 422 | this->out_j_index.resize(1); |
---|
| 423 | this->out_l_index.resize(1); |
---|
[182] | 424 | |
---|
| 425 | } |
---|
[183] | 426 | |
---|
| 427 | //---------------------------------------------------------------- |
---|
| 428 | |
---|
| 429 | void CGrid::inputFieldServer |
---|
| 430 | (const std::deque<ARRAY(double, 1)> storedClient, |
---|
| 431 | ARRAY(double, 1) storedServer) const |
---|
| 432 | { |
---|
[185] | 433 | if ((this->storeIndex.size()-1 ) != storedClient.size()) |
---|
[183] | 434 | ERROR("CGrid::inputFieldServer(...)", |
---|
| 435 | << "[ Nombre de tableau attendu = " << (this->storeIndex.size()-1) << ", " |
---|
| 436 | << "[ Nombre de tableau reçu = " << storedClient.size() << "] " |
---|
| 437 | << "Les données d'un client sont manquantes !") ; |
---|
| 438 | if (storedServer.get() != NULL) |
---|
| 439 | storedServer->resize(boost::extents[this->storeIndex.size()-1]); |
---|
| 440 | else |
---|
| 441 | ARRAY_ASSIGN(storedServer, double, 1, [this->storeIndex.size()-1]); |
---|
| 442 | |
---|
| 443 | for (StdSize i = 0, n = 0; i < storedClient.size(); i++) |
---|
| 444 | for (StdSize j = 0; j < storedClient[i]->num_elements(); j++) |
---|
| 445 | (*storedServer)[n++] = (*storedClient[i])[j]; |
---|
| 446 | } |
---|
[180] | 447 | |
---|
[168] | 448 | ///--------------------------------------------------------------- |
---|
| 449 | |
---|
| 450 | } // namespace tree |
---|
[152] | 451 | } // namespace xmlioserver |
---|