Changeset 887
- Timestamp:
- 07/05/16 15:59:02 (9 years ago)
- Location:
- XIOS/trunk/src
- Files:
-
- 5 added
- 33 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/config/field_attribute.conf
r790 r887 18 18 DECLARE_ATTRIBUTE(StdString, domain_ref) 19 19 DECLARE_ATTRIBUTE(StdString, axis_ref) 20 DECLARE_ATTRIBUTE(StdString, scalar_ref) 20 21 DECLARE_ATTRIBUTE(StdString, grid_ref) 21 22 DECLARE_ATTRIBUTE(StdString, field_ref) -
XIOS/trunk/src/config/grid_attribute.conf
r817 r887 12 12 13 13 // An array contains order of axis and domains composing of the grid 14 DECLARE_ARRAY_PRIVATE(bool, 1, axis_domain_order) 14 // Value of element: domain 2, axis 1 and sclar 0 15 DECLARE_ARRAY_PRIVATE(int, 1, axis_domain_order) -
XIOS/trunk/src/config/node_type.conf
r689 r887 55 55 #endif //__XIOS_CGenerateRectilinearDomain__ 56 56 57 #ifdef __XIOS_CScalar__ 58 DECLARE_NODE(Scalar, scalar) 59 #endif //__XIOS_CScalar__ 57 60 58 61 #ifdef __XIOS_CContext__ -
XIOS/trunk/src/context_server.cpp
r851 r887 184 184 // The best way to properly solve this problem will be to use the event scheduler also in attached mode 185 185 // for now just set up a MPI barrier 186 if (!CServer::eventScheduler) MPI_Barrier(intraComm) ; 186 if (!CServer::eventScheduler) MPI_Barrier(intraComm) ; 187 187 188 188 CTimer::get("Process events").resume(); … … 238 238 else if (event.classId==CAxis::GetType()) CAxis::dispatchEvent(event); 239 239 else if (event.classId==CAxisGroup::GetType()) CAxisGroup::dispatchEvent(event); 240 else if (event.classId==CScalar::GetType()) CScalar::dispatchEvent(event); 241 else if (event.classId==CScalarGroup::GetType()) CScalarGroup::dispatchEvent(event); 240 242 else if (event.classId==CGrid::GetType()) CGrid::dispatchEvent(event); 241 243 else if (event.classId==CGridGroup::GetType()) CGridGroup::dispatchEvent(event); -
XIOS/trunk/src/data_output.cpp
r676 r887 16 16 void CDataOutput::writeGrid(CGrid* grid, bool allowCompressedOutput /*= false*/) 17 17 { 18 this->writeGrid(grid->getDomains(), grid->getAxis() );18 this->writeGrid(grid->getDomains(), grid->getAxis(), grid->getScalars()); 19 19 20 20 if (allowCompressedOutput) … … 58 58 for (int i = 0; i < domSize; ++i) this->writeDomain_(domains[i]); 59 59 for (int i = 0; i < aSize; ++i) this->writeAxis_(axis[i]); 60 } 61 62 void CDataOutput::writeGrid(std::vector<CDomain*> domains, std::vector<CAxis*> axis, std::vector<CScalar*> scalars) 63 { 64 int domSize = domains.size(); 65 int aSize = axis.size(); 66 int sSize = scalars.size(); 67 for (int i = 0; i < domSize; ++i) this->writeDomain_(domains[i]); 68 for (int i = 0; i < aSize; ++i) this->writeAxis_(axis[i]); 69 for (int i = 0; i < sSize; ++i) this->writeScalar_(scalars[i]); 60 70 } 61 71 -
XIOS/trunk/src/data_output.hpp
r676 r887 44 44 void writeGrid(CDomain* domain); 45 45 void writeGrid(std::vector<CDomain*> domain, std::vector<CAxis*> axis); 46 void writeGrid(std::vector<CDomain*> domains, std::vector<CAxis*> axis, std::vector<CScalar*> scalars); 46 47 47 48 virtual void writeFile_ (CFile* file) = 0; … … 53 54 virtual void writeDomain_ (CDomain* domain) = 0; 54 55 virtual void writeAxis_ (CAxis* axis) = 0; 56 virtual void writeScalar_ (CScalar* scalar) = 0; 55 57 virtual void writeGridCompressed_(CGrid* grid) = 0; 56 58 virtual void writeTimeDimension_(void) = 0; -
XIOS/trunk/src/distribution.cpp
r653 r887 21 21 { /* Nothing to do */ } 22 22 23 const CArray<size_t,1>& CDistribution::getGlobalIndex() const24 {25 return globalIndex_;26 }27 28 23 int CDistribution::getDims() const 29 24 { -
XIOS/trunk/src/distribution.hpp
r653 r887 32 32 int getRank() const; //! Get rank of current process 33 33 34 //! Get global index35 const CArray<size_t,1>& getGlobalIndex() const;36 34 protected: 37 virtual void createGlobalIndex() = 0; 35 virtual void createGlobalIndex() {}; 36 38 37 protected: 39 38 CArray<size_t,1> globalIndex_; -
XIOS/trunk/src/distribution_client.cpp
r874 r887 56 56 std::vector<CDomain*> domList = grid->getDomains(); 57 57 std::vector<CAxis*> axisList = grid->getAxis(); 58 CArray<bool,1> axisDomainOrder = grid->axis_domain_order; 59 60 std::vector<CDomain*>::iterator itbDom, iteDom, itDom; 61 std::vector<CAxis*>::iterator itbAxis, iteAxis, itAxis; 62 63 itbDom = itDom = domList.begin(); iteDom = domList.end(); 64 itbAxis = itAxis = axisList.begin(); iteAxis = axisList.end(); 65 66 readDistributionInfo(domList, axisList, axisDomainOrder); 58 std::vector<CScalar*> scalarList = grid->getScalars(); 59 CArray<int,1> axisDomainOrder = grid->axis_domain_order; 60 61 readDistributionInfo(domList, axisList, scalarList, axisDomainOrder); 67 62 68 63 // Then check mask of grid … … 92 87 \param [in] domList List of domains of grid 93 88 \param [in] axisList List of axis of grid 94 \param [in] axisDomainOrder order of axis and domain inside a grid. True if domain, false if axis 89 \param [in] scalarList List of scalar of grid 90 \param [in] axisDomainOrder order of axis and domain inside a grid. 2 if domain, 1 if axis and zero if scalar 95 91 // \param [in] gridMask Mask of grid, for now, keep it 3 dimension, but it needs changing 96 92 */ 97 93 void CDistributionClient::readDistributionInfo(const std::vector<CDomain*>& domList, 98 94 const std::vector<CAxis*>& axisList, 99 const CArray<bool,1>& axisDomainOrder) 95 const std::vector<CScalar*>& scalarList, 96 const CArray<int,1>& axisDomainOrder) 100 97 { 101 98 domainNum_ = domList.size(); … … 129 126 { 130 127 indexMap_[i] = idx; 131 if ( true== axisDomainOrder(i))128 if (2 == axisDomainOrder(i)) 132 129 { 133 130 ++(this->dims_); … … 155 152 156 153 // A trick to determine position of each domain in domainList 157 int domIndex = 0, axisIndex = 0 ;154 int domIndex = 0, axisIndex = 0, scalarIndex = 0; 158 155 idx = 0; 159 156 … … 172 169 for (idx = 0; idx < numElement_; ++idx) 173 170 { 174 bool isDomain= axisDomainOrder(idx);171 int eleDim = axisDomainOrder(idx); 175 172 elementNLocal_[idx] = localSize; 176 173 elementNGlobal_[idx] = globalSize; 177 174 178 175 // If this is a domain 179 if ( isDomain)176 if (2 == eleDim) 180 177 { 181 178 // On the j axis … … 188 185 189 186 dataBegin_.at(indexMap_[idx]+1) = domList[domIndex]->data_jbegin.getValue(); //(2 == domList[domIndex]->data_dim) ? domList[domIndex]->data_jbegin.getValue() : -1; 190 dataIndex_.at(indexMap_[idx]+1) = &(domList[domIndex]->data_j_index); 191 infoIndex_.at(indexMap_[idx]+1) = &(domList[domIndex]->j_index); 187 // dataIndex_.at(indexMap_[idx]+1) = &(domList[domIndex]->data_j_index); 188 // infoIndex_.at(indexMap_[idx]+1) = &(domList[domIndex]->j_index); 189 dataIndex_.at(indexMap_[idx]+1).reference(domList[domIndex]->data_j_index); 190 infoIndex_.at(indexMap_[idx]+1).reference(domList[domIndex]->j_index); 192 191 193 192 // On the i axis … … 200 199 201 200 dataBegin_.at(indexMap_[idx]) = domList[domIndex]->data_ibegin.getValue(); 202 dataIndex_.at(indexMap_[idx]) = &(domList[domIndex]->data_i_index); 203 infoIndex_.at(indexMap_[idx]) = &(domList[domIndex]->i_index); 201 // dataIndex_.at(indexMap_[idx]) = &(domList[domIndex]->data_i_index); 202 // infoIndex_.at(indexMap_[idx]) = &(domList[domIndex]->i_index); 203 dataIndex_.at(indexMap_[idx]).reference(domList[domIndex]->data_i_index); 204 infoIndex_.at(indexMap_[idx]).reference(domList[domIndex]->i_index); 204 205 205 206 dataNIndex_.at(idx) = domList[domIndex]->data_i_index.numElements(); … … 212 213 ++domIndex; 213 214 } 214 else // So it's an axis215 else if (1 == eleDim)// So it's an axis 215 216 { 216 217 nLocal_.at(indexMap_[idx]) = axisList[axisIndex]->n.getValue(); … … 222 223 223 224 dataBegin_.at(indexMap_[idx]) = axisList[axisIndex]->data_begin.getValue(); 224 dataIndex_.at(indexMap_[idx]) = &(axisList[axisIndex]->data_index); 225 infoIndex_.at(indexMap_[idx]) = &(axisList[axisIndex]->index); 225 // dataIndex_.at(indexMap_[idx]) = &(axisList[axisIndex]->data_index); 226 // infoIndex_.at(indexMap_[idx]) = &(axisList[axisIndex]->index); 227 dataIndex_.at(indexMap_[idx]).reference(axisList[axisIndex]->data_index); 228 infoIndex_.at(indexMap_[idx]).reference(axisList[axisIndex]->index); 226 229 dataNIndex_.at(idx) = axisList[axisIndex]->data_index.numElements(); 227 230 dataDims_.at(idx) = 1; … … 233 236 234 237 ++axisIndex; 238 } 239 else // scalar 240 { 241 nLocal_.at(indexMap_[idx]) = 1; 242 nGlob_.at(indexMap_[idx]) = 1; 243 nBeginLocal_.at(indexMap_[idx]) = 0; 244 nBeginGlobal_.at(indexMap_[idx]) = 1; 245 nZoomBegin_.at((indexMap_[idx])) = 0; 246 nZoomEnd_.at((indexMap_[idx])) = 0; 247 248 dataBegin_.at(indexMap_[idx]) = 0; 249 dataIndex_.at(indexMap_[idx]).resize(1); dataIndex_.at(indexMap_[idx])(0) = 0; 250 infoIndex_.at(indexMap_[idx]).resize(1); infoIndex_.at(indexMap_[idx])(0) = 0; 251 dataNIndex_.at(idx) = 1; 252 dataDims_.at(idx) = 1; 253 254 isDataDistributed_ |= false; 255 256 localSize *= nLocal_.at(indexMap_[idx]); 257 globalSize *= nGlob_.at(indexMap_[idx]); 258 259 ++scalarIndex; 235 260 } 236 261 } … … 248 273 for (int i = 0; i < axisDomainOrder_.numElements(); ++i) 249 274 { 250 if ( axisDomainOrder_(i))275 if (2 == axisDomainOrder_(i)) 251 276 { 252 277 elementIndexData_[i].resize(dataNIndex_[i]); … … 255 280 for (int j = 0; j < dataNIndex_[i]; ++j) 256 281 { 257 iIdx = getDomainIndex(( *dataIndex_[indexMap_[i]])(j), (*dataIndex_[indexMap_[i]+1])(j),282 iIdx = getDomainIndex((dataIndex_[indexMap_[i]])(j), (dataIndex_[indexMap_[i]+1])(j), 258 283 dataBegin_[indexMap_[i]], dataBegin_[indexMap_[i]+1], 259 284 dataDims_[i], nLocal_[indexMap_[i]], jIdx); … … 281 306 if (tmpIndexElementData(j)) 282 307 { 283 iIdx = getDomainIndex(( *dataIndex_[indexMap_[i]])(j), (*dataIndex_[indexMap_[i]+1])(j),308 iIdx = getDomainIndex((dataIndex_[indexMap_[i]])(j), (dataIndex_[indexMap_[i]+1])(j), 284 309 dataBegin_[indexMap_[i]], dataBegin_[indexMap_[i]+1], 285 310 dataDims_[i], nLocal_[indexMap_[i]], jIdx); 286 311 localIndex = tmpLocalElementIndex(count) = iIdx + jIdx * nLocal_[indexMap_[i]]; 287 tmpGlobalElementIndex(count) = ( *infoIndex_[indexMap_[i]])(localIndex) + ((*infoIndex_[indexMap_[i]+1])(localIndex))*nGlob_[indexMap_[i]];288 if (((( *infoIndex_[indexMap_[i]])(localIndex)) <= nZoomEnd_[indexMap_[i]])289 && (nZoomBegin_[indexMap_[i]] <= (( *infoIndex_[indexMap_[i]])(localIndex)))290 && ((( *infoIndex_[indexMap_[i]+1])(localIndex)) <= nZoomEnd_[indexMap_[i]+1])291 && (nZoomBegin_[indexMap_[i]+1] <= (( *infoIndex_[indexMap_[i]+1])(localIndex))))312 tmpGlobalElementIndex(count) = (infoIndex_[indexMap_[i]])(localIndex) + ((infoIndex_[indexMap_[i]+1])(localIndex))*nGlob_[indexMap_[i]]; 313 if ((((infoIndex_[indexMap_[i]])(localIndex)) <= nZoomEnd_[indexMap_[i]]) 314 && (nZoomBegin_[indexMap_[i]] <= ((infoIndex_[indexMap_[i]])(localIndex))) 315 && (((infoIndex_[indexMap_[i]+1])(localIndex)) <= nZoomEnd_[indexMap_[i]+1]) 316 && (nZoomBegin_[indexMap_[i]+1] <= ((infoIndex_[indexMap_[i]+1])(localIndex)))) 292 317 { 293 318 tmpZoomMaskElement(count) = true; … … 309 334 for (int i = 0; i < axisDomainOrder_.numElements(); ++i) 310 335 { 311 if ( !axisDomainOrder_(i))336 if (1 == axisDomainOrder_(i)) 312 337 { 313 338 elementIndexData_[i].resize(dataNIndex_[i]); … … 316 341 for (int j = 0; j < dataNIndex_[i]; ++j) 317 342 { 318 iIdx = getAxisIndex(( *dataIndex_[indexMap_[i]])(j), dataBegin_[indexMap_[i]], nLocal_[indexMap_[i]]);343 iIdx = getAxisIndex((dataIndex_[indexMap_[i]])(j), dataBegin_[indexMap_[i]], nLocal_[indexMap_[i]]); 319 344 if ((iIdx >= nBeginLocal_[indexMap_[i]]) && 320 345 (iIdx < nLocal_[indexMap_[i]]) && (axisMasks_[idxAxis](iIdx))) … … 338 363 if (tmpIndexElementData(j)) 339 364 { 340 iIdx = tmpLocalElementIndex(count) = getAxisIndex(( *dataIndex_[indexMap_[i]])(j), dataBegin_[indexMap_[i]], nLocal_[indexMap_[i]]);341 tmpGlobalElementIndex(count) = ( *infoIndex_[indexMap_[i]])(iIdx);342 if (((( *infoIndex_[indexMap_[i]])(iIdx)) <= nZoomEnd_[indexMap_[i]])343 && (nZoomBegin_[indexMap_[i]] <= (( *infoIndex_[indexMap_[i]])(iIdx))))365 iIdx = tmpLocalElementIndex(count) = getAxisIndex((dataIndex_[indexMap_[i]])(j), dataBegin_[indexMap_[i]], nLocal_[indexMap_[i]]); 366 tmpGlobalElementIndex(count) = (infoIndex_[indexMap_[i]])(iIdx); 367 if ((((infoIndex_[indexMap_[i]])(iIdx)) <= nZoomEnd_[indexMap_[i]]) 368 && (nZoomBegin_[indexMap_[i]] <= ((infoIndex_[indexMap_[i]])(iIdx)))) 344 369 { 345 370 tmpZoomMaskElement(count) = true; … … 349 374 } 350 375 ++idxAxis; 376 } 377 } 378 } 379 380 /*! 381 Create local index of scalar. 382 */ 383 void CDistributionClient::createLocalScalarDataIndex() 384 { 385 int idxAxis = 0; 386 for (int i = 0; i < axisDomainOrder_.numElements(); ++i) 387 { 388 if (0 == axisDomainOrder_(i)) 389 { 390 elementIndexData_[i].resize(dataNIndex_[i]); 391 elementIndexData_[i] = true; 392 int count = 1; 393 394 elementLocalIndex_[i].resize(count); 395 elementLocalIndex_[i] = 0; 396 elementGlobalIndex_[i].resize(count); 397 elementGlobalIndex_[i] = 0; 398 elementZoomMask_[i].resize(count); 399 elementZoomMask_[i] = true; 351 400 } 352 401 } … … 530 579 void CDistributionClient::createGlobalIndex() 531 580 { 532 size_t ssize = 1, idx = 0; 533 for (int i = 0; i < this->dims_; ++i) 534 ssize *= nLocal_[i]; 535 536 this->globalIndex_.resize(ssize); 537 std::vector<int> idxLoop(this->numElement_,0); 538 int innnerLoopSize = (*infoIndex_[0]).numElements(); 539 while (idx < ssize) 540 { 541 for (int i = 0; i < this->numElement_; ++i) 542 { 543 if (idxLoop[i] == (*infoIndex_[indexMap_[i]]).numElements()) 544 { 545 idxLoop[i] = 0; 546 ++idxLoop[i+1]; 547 } 548 } 549 550 for (int i = 0; i < innnerLoopSize; ++i) 551 { 552 size_t globalIndex = (*infoIndex_[0])(idxLoop[0]); 553 size_t mulDim = 1; 554 for (int idxElement = 0; idxElement < this->numElement_; ++idxElement) 555 { 556 if (axisDomainOrder_(idxElement)) 557 { 558 int jb = (0 == idxElement) ? 1 : 0; 559 for (int j = jb; j <= 1; ++j) 560 { 561 mulDim *= nGlob_[indexMap_[idxElement]+j-1]; 562 globalIndex += ((*infoIndex_[indexMap_[idxElement]+j])(idxLoop[idxElement]))*mulDim; 563 } 564 } 565 else 566 { 567 if (0 != idxElement) 568 { 569 mulDim *= nGlob_[indexMap_[idxElement]-1]; 570 globalIndex += ((*infoIndex_[indexMap_[idxElement]])(idxLoop[idxElement]))*mulDim; 571 } 572 } 573 } 574 575 this->globalIndex_(idx) = globalIndex; 576 ++idxLoop[0]; 577 ++idx; 578 } 579 } 580 581 // size_t ssize = 1, idx = 0; 582 // for (int i = 0; i < this->dims_; ++i) 583 // ssize *= nLocal_[i]; 584 // 585 // this->globalIndex_.resize(ssize); 586 // std::vector<int> idxLoop(this->numElement_,0); 587 // int innnerLoopSize = (infoIndex_[0]).numElements(); 588 // while (idx < ssize) 589 // { 590 // for (int i = 0; i < this->numElement_; ++i) 591 //// { 592 // if (idxLoop[i] == (infoIndex_[indexMap_[i]]).numElements()) 593 // { 594 // idxLoop[i] = 0; 595 // ++idxLoop[i+1]; 596 // } 597 // } 598 // 599 // for (int i = 0; i < innnerLoopSize; ++i) 600 // { 601 // size_t globalIndex = (infoIndex_[0])(idxLoop[0]); 602 // size_t mulDim = 1; 603 // for (int idxElement = 0; idxElement < this->numElement_; ++idxElement) 604 // { 605 // if (axisDomainOrder_(idxElement)) 606 // { 607 // int jb = (0 == idxElement) ? 1 : 0; 608 // for (int j = jb; j <= 1; ++j) 609 // { 610 // mulDim *= nGlob_[indexMap_[idxElement]+j-1]; 611 // globalIndex += ((infoIndex_[indexMap_[idxElement]+j])(idxLoop[idxElement]))*mulDim; 612 // } 613 // } 614 // else 615 // { 616 // if (0 != idxElement) 617 // { 618 // mulDim *= nGlob_[indexMap_[idxElement]-1]; 619 // globalIndex += ((infoIndex_[indexMap_[idxElement]])(idxLoop[idxElement]))*mulDim; 620 // } 621 // } 622 // } 623 // 624 // this->globalIndex_(idx) = globalIndex; 625 // ++idxLoop[0]; 626 // ++idx; 627 // } 628 // } 581 629 } 582 630 -
XIOS/trunk/src/distribution_client.hpp
r861 r887 21 21 class CDomain; 22 22 class CAxis; 23 class CScalar; 23 24 24 25 /*! … … 61 62 void readDistributionInfo(const std::vector<CDomain*>& domList, 62 63 const std::vector<CAxis*>& axisList, 63 const CArray<bool,1>& axisDomainOrder); 64 const std::vector<CScalar*>& scalarList, 65 const CArray<int,1>& axisDomainOrder); 64 66 private: 65 67 //! Create local index of a domain … … 68 70 //! Create local index of an axis 69 71 void createLocalAxisDataIndex(); 72 73 //! Create local index of a scalar 74 void createLocalScalarDataIndex(); 70 75 71 76 template<int N> … … 82 87 * A grid composed of 1 domain and 1 axis has 2 elements */ 83 88 int numElement_; 84 CArray< bool,1> axisDomainOrder_; //!< Order of axis and domain of a grid89 CArray<int,1> axisDomainOrder_; //!< Order of axis and domain of a grid 85 90 86 91 std::vector<int> nLocal_; //!< Local size of each dimension (ni, nj, etc, ...) … … 95 100 std::vector<int> dataDims_; //!< Data_dim, domain can have data_dim == 1 or 2 96 101 std::vector<int> dataBegin_; //!< Data begin (data_ibegin, data_jbegin, etc) 97 std::vector<CArray<int,1> *> dataIndex_; //!< Data index98 std::vector<CArray<int,1> *> infoIndex_; //!< i_index, j_index102 std::vector<CArray<int,1> > dataIndex_; //!< Data index 103 std::vector<CArray<int,1> > infoIndex_; //!< i_index, j_index 99 104 100 105 std::vector<CArray<bool,1> > domainMasks_; //!< Domain mask -
XIOS/trunk/src/group_factory_decl.cpp
r689 r887 31 31 macro(CInterpolateDomainGroup) 32 32 macro(CGenerateRectilinearDomainGroup) 33 macro(CScalarGroup) 33 34 } -
XIOS/trunk/src/group_template_decl.cpp
r689 r887 20 20 macro(InterpolateDomain) 21 21 macro(GenerateRectilinearDomain) 22 macro(Scalar) 22 23 23 24 } -
XIOS/trunk/src/io/nc4_data_input.cpp
r850 r887 82 82 std::vector<StdSize> start, count; 83 83 84 CArray< bool,1> axisDomainOrder = grid->axis_domain_order;84 CArray<int,1> axisDomainOrder = grid->axis_domain_order; 85 85 std::vector<StdString> domainList = grid->getDomainList(); 86 86 std::vector<StdString> axisList = grid->getAxisList(); … … 94 94 for (int i = numElement - 1; i >= 0; --i) 95 95 { 96 if ( axisDomainOrder(i))96 if (2 == axisDomainOrder(i)) 97 97 { 98 98 CDomain* domain = CDomain::get(domainList[idxDomain]); … … 108 108 --idxDomain; 109 109 } 110 else 110 else if (1 == axisDomainOrder(i)) 111 111 { 112 112 start.push_back(nZoomBeginServer[idx] - nZoomBeginGlobal[idx]); … … 173 173 174 174 // Now process domain and axis 175 CArray< bool,1> axisDomainOrder = grid->axis_domain_order;175 CArray<int,1> axisDomainOrder = grid->axis_domain_order; 176 176 int numElement = domainP.size() + axisP.size(); 177 177 int elementPosition = 0; … … 181 181 for (int i = 0; i < numElement; ++i) 182 182 { 183 if( axisDomainOrder(i))183 if(2 == axisDomainOrder(i)) 184 184 { 185 185 if (readAttributeValues) … … 197 197 else elementPosition += 2; 198 198 } 199 else 199 else if (1 == axisDomainOrder(i)) 200 200 { 201 201 if (readAttributeValues) -
XIOS/trunk/src/io/nc4_data_output.cpp
r881 r887 1014 1014 } 1015 1015 1016 void CNc4DataOutput::writeScalar_(CScalar* scalar) 1017 { 1018 if (scalar->IsWritten(this->filename)) return; 1019 scalar->checkAttributes(); 1020 int scalarSize = 1; 1021 1022 StdString scalaId = scalar->getScalarOutputName(); 1023 if (isWrittenAxis(scalaId)) return ; 1024 else setWrittenAxis(scalaId); 1025 1026 try 1027 { 1028 if (!scalar->value.isEmpty()) 1029 { 1030 // dims.push_back(scalaId); 1031 std::vector<StdString> dims; 1032 SuperClassWriter::addVariable(scalaId, NC_FLOAT, dims); 1033 1034 if (!scalar->name.isEmpty()) 1035 SuperClassWriter::addAttribute("name", scalar->name.getValue(), &scalaId); 1036 1037 if (!scalar->standard_name.isEmpty()) 1038 SuperClassWriter::addAttribute("standard_name", scalar->standard_name.getValue(), &scalaId); 1039 1040 if (!scalar->long_name.isEmpty()) 1041 SuperClassWriter::addAttribute("long_name", scalar->long_name.getValue(), &scalaId); 1042 1043 if (!scalar->unit.isEmpty()) 1044 SuperClassWriter::addAttribute("units", scalar->unit.getValue(), &scalaId); 1045 1046 SuperClassWriter::definition_end(); 1047 1048 switch (SuperClass::type) 1049 { 1050 case MULTI_FILE: 1051 { 1052 CArray<double,1> scalarValue(scalarSize); 1053 scalarValue(0) = scalar->value; 1054 SuperClassWriter::writeData(scalarValue, scalaId, isCollective, 0); 1055 SuperClassWriter::definition_start(); 1056 1057 break; 1058 } 1059 case ONE_FILE: 1060 { 1061 CArray<double,1> scalarValue(scalarSize); 1062 scalarValue(0) = scalar->value; 1063 1064 std::vector<StdSize> start(1); 1065 std::vector<StdSize> count(1); 1066 start[0] = 0; 1067 count[0] = 1; 1068 SuperClassWriter::writeData(scalarValue, scalaId, isCollective, 0, &start, &count); 1069 SuperClassWriter::definition_start(); 1070 1071 break; 1072 } 1073 default : 1074 ERROR("CNc4DataOutput::writeAxis_(CAxis* scalar)", 1075 << "[ type = " << SuperClass::type << "]" 1076 << " not implemented yet !"); 1077 } 1078 } 1079 } 1080 catch (CNetCdfException& e) 1081 { 1082 StdString msg("On writing the scalar : "); 1083 msg.append(scalaId); msg.append("\n"); 1084 msg.append("In the context : "); 1085 CContext* context = CContext::getCurrent() ; 1086 msg.append(context->getId()); msg.append("\n"); 1087 msg.append(e.what()); 1088 ERROR("CNc4DataOutput::writeScalar_(CScalar* scalar)", << msg); 1089 } 1090 scalar->addRelFile(this->filename); 1091 } 1092 1016 1093 //-------------------------------------------------------------- 1017 1094 … … 1022 1099 try 1023 1100 { 1024 CArray< bool,1> axisDomainOrder = grid->axis_domain_order;1101 CArray<int,1> axisDomainOrder = grid->axis_domain_order; 1025 1102 std::vector<StdString> domainList = grid->getDomainList(); 1026 1103 std::vector<StdString> axisList = grid->getAxisList(); 1027 int numElement = axisDomainOrder.numElements(), idxDomain = 0, idxAxis = 0; 1104 std::vector<StdString> scalarList = grid->getScalarList(); 1105 int numElement = axisDomainOrder.numElements(), idxDomain = 0, idxAxis = 0, idxScalar = 0; 1028 1106 1029 1107 std::vector<StdString> dims; … … 1042 1120 for (int i = numElement - 1; i >= 0; --i) 1043 1121 { 1044 if ( axisDomainOrder(i))1122 if (2 == axisDomainOrder(i)) 1045 1123 { 1046 1124 CDomain* domain = CDomain::get(domainList[domainList.size() - idxDomain - 1]); … … 1062 1140 ++idxDomain; 1063 1141 } 1064 else 1142 else if (1 == axisDomainOrder(i)) 1065 1143 { 1066 1144 CAxis* axis = CAxis::get(axisList[axisList.size() - idxAxis - 1]); 1067 1145 compress << axis->getAxisOutputName(); 1068 1146 ++idxAxis; 1147 } 1148 else 1149 { 1150 CScalar* scalar = CScalar::get(scalarList[scalarList.size() - idxScalar - 1]); 1151 compress << scalar->getScalarOutputName(); 1152 ++idxScalar; 1069 1153 } 1070 1154 … … 1115 1199 int firstGlobalIndex; 1116 1200 1117 if ( axisDomainOrder(i))1201 if (2 == axisDomainOrder(i)) 1118 1202 { 1119 1203 CDomain* domain = CDomain::get(domainList[idxDomain]); … … 1154 1238 ++idxDomain; 1155 1239 } 1156 else 1240 else if (1 == axisDomainOrder(i)) 1157 1241 { 1158 1242 CAxis* axis = CAxis::get(axisList[idxAxis]); … … 1181 1265 setWrittenCompressedAxis(axisId); 1182 1266 ++idxAxis; 1267 } 1268 else 1269 { 1183 1270 } 1184 1271 … … 1263 1350 if (SuperClass::type==MULTI_FILE) return ; 1264 1351 1265 CArray< bool,1> axisDomainOrder = grid->axis_domain_order;1266 int numElement = axisDomainOrder.numElements(), idxDomain = 0, idxAxis = 0 ;1352 CArray<int,1> axisDomainOrder = grid->axis_domain_order; 1353 int numElement = axisDomainOrder.numElements(), idxDomain = 0, idxAxis = 0, idxScalar = 0; 1267 1354 std::vector<StdString> domainList = grid->getDomainList(); 1268 1355 std::vector<StdString> axisList = grid->getAxisList(); 1356 std::vector<StdString> scalarList = grid->getScalarList(); 1269 1357 1270 1358 StdString timeid = getTimeCounterName(); … … 1277 1365 for (int i = 0; i < numElement; ++i) 1278 1366 { 1279 if ( axisDomainOrder(i))1367 if (2 == axisDomainOrder(i)) 1280 1368 { 1281 1369 CDomain* domain = CDomain::get(domainList[idxDomain]); … … 1355 1443 ++idxDomain; 1356 1444 } 1357 else 1445 else if (1 == axisDomainOrder(i)) 1358 1446 { 1359 1447 CAxis* axis = CAxis::get(axisList[idxAxis]); … … 1370 1458 dimCoordList.push_back(axisId); 1371 1459 ++idxAxis; 1460 } 1461 else // scalar 1462 { 1463 /* Do nothing here */ 1372 1464 } 1373 1465 } … … 1382 1474 */ 1383 1475 StdString fieldid = field->getFieldOutputName(); 1384 1385 // unsigned int ssize = domain->zoom_ni_loc.getValue() * domain->zoom_nj_loc.getValue();1386 // bool isCurvilinear = (domain->lonvalue.getValue()->size() == ssize);1387 // bool isCurvilinear = domain->isCurvilinear ;1388 1476 1389 1477 nc_type type ; … … 1839 1927 else 1840 1928 { 1841 CArray< bool,1> axisDomainOrder = grid->axis_domain_order;1929 CArray<int,1> axisDomainOrder = grid->axis_domain_order; 1842 1930 std::vector<StdString> domainList = grid->getDomainList(); 1843 1931 std::vector<StdString> axisList = grid->getAxisList(); … … 1852 1940 for (int i = numElement - 1; i >= 0; --i) 1853 1941 { 1854 if ( axisDomainOrder(i))1942 if (2 == axisDomainOrder(i)) 1855 1943 { 1856 1944 CDomain* domain = CDomain::get(domainList[idxDomain]); … … 1876 1964 --idxDomain; 1877 1965 } 1878 else 1966 else if (1 == axisDomainOrder(i)) 1879 1967 { 1880 1968 CAxis* axis = CAxis::get(axisList[idxAxis]); … … 1900 1988 { 1901 1989 1902 CArray< bool,1> axisDomainOrder = grid->axis_domain_order;1990 CArray<int,1> axisDomainOrder = grid->axis_domain_order; 1903 1991 std::vector<StdString> domainList = grid->getDomainList(); 1904 1992 std::vector<StdString> axisList = grid->getAxisList(); … … 1912 2000 for (int i = numElement - 1; i >= 0; --i) 1913 2001 { 1914 if ( axisDomainOrder(i))2002 if (2 == axisDomainOrder(i)) 1915 2003 { 1916 2004 CDomain* domain = CDomain::get(domainList[idxDomain]); … … 1926 2014 --idxDomain; 1927 2015 } 1928 else 2016 else if (1 == axisDomainOrder(i)) 1929 2017 { 1930 2018 start.push_back(nZoomBeginServer[idx] - nZoomBeginGlobal[idx]); 1931 2019 count.push_back(nZoomSizeServer[idx]); 1932 2020 --idx; 1933 } 2021 } 2022 else 2023 { 2024 if (1 == axisDomainOrder.numElements()) 2025 { 2026 start.push_back(0); 2027 count.push_back(1); 2028 } 2029 --idx; 2030 } 1934 2031 } 1935 2032 } … … 2322 2419 } 2323 2420 2421 bool CNc4DataOutput::isWrittenScalar(const std::string& scalarName) const 2422 { 2423 return (this->writtenScalar.find(scalarName) != this->writtenScalar.end()); 2424 } 2425 2324 2426 void CNc4DataOutput::setWrittenDomain(const std::string& domainName) 2325 2427 { … … 2341 2443 this->writtenCompressedAxis.insert(axisName); 2342 2444 } 2445 2446 void CNc4DataOutput::setWrittenScalar(const std::string& scalarName) 2447 { 2448 this->writtenScalar.insert(scalarName); 2449 } 2343 2450 } // namespace xios -
XIOS/trunk/src/io/nc4_data_output.hpp
r878 r887 49 49 virtual void writeDomain_ (CDomain* domain); 50 50 virtual void writeAxis_ (CAxis* axis); 51 virtual void writeScalar_ (CScalar* scalar); 51 52 virtual void writeGridCompressed_(CGrid* grid); 52 53 virtual void writeTimeDimension_(void); … … 106 107 bool isWrittenAxis(const std::string& axisName) const; 107 108 bool isWrittenCompressedAxis(const std::string& axisName) const; 109 bool isWrittenScalar(const std::string& scalarName) const; 108 110 109 111 void setWrittenDomain(const std::string& domainName); … … 111 113 void setWrittenAxis(const std::string& axisName); 112 114 void setWrittenCompressedAxis(const std::string& axisName); 115 void setWrittenScalar(const std::string& scalarName); 113 116 114 117 /// Propriétés privées /// … … 119 122 std::set<std::string> writtenDomains, writtenCompressedDomains; 120 123 std::set<std::string> writtenAxis, writtenCompressedAxis; 124 std::set<std::string> writtenScalar; 121 125 }; // class CNc4DataOutput 122 126 -
XIOS/trunk/src/node/context.cpp
r823 r887 1027 1027 CGrid::get(*it)->sendAllDomains(); 1028 1028 CGrid::get(*it)->sendAllAxis(); 1029 CGrid::get(*it)->sendAllScalars(); 1029 1030 } 1030 1031 } … … 1034 1035 void CContext::sendRefDomainsAxis() 1035 1036 { 1036 std::set<StdString> domainIds; 1037 std::set<StdString> axisIds; 1037 std::set<StdString> domainIds, axisIds, scalarIds; 1038 1038 1039 1039 // Find all reference domain and axis of all active fields … … 1045 1045 for (int j = 0; j < numEnabledFields; ++j) 1046 1046 { 1047 const std::pair<StdString, StdString>& prDomAxisId = enabledFields[j]->getRefDomainAxisIds(); 1048 if ("" != prDomAxisId.first) domainIds.insert(prDomAxisId.first); 1049 if ("" != prDomAxisId.second) axisIds.insert(prDomAxisId.second); 1047 const std::vector<StdString>& prDomAxisScalarId = enabledFields[j]->getRefDomainAxisIds(); 1048 if ("" != prDomAxisScalarId[0]) domainIds.insert(prDomAxisScalarId[0]); 1049 if ("" != prDomAxisScalarId[1]) axisIds.insert(prDomAxisScalarId[1]); 1050 if ("" != prDomAxisScalarId[2]) scalarIds.insert(prDomAxisScalarId[2]); 1050 1051 } 1051 1052 } 1052 1053 1053 1054 // Create all reference axis on server side 1054 std::set<StdString>::iterator itDom, itAxis ;1055 std::set<StdString>::iterator itDom, itAxis, itScalar; 1055 1056 std::set<StdString>::const_iterator itE; 1057 1058 StdString scalarDefRoot("scalar_definition"); 1059 CScalarGroup* scalarPtr = CScalarGroup::get(scalarDefRoot); 1060 itE = scalarIds.end(); 1061 for (itScalar = scalarIds.begin(); itScalar != itE; ++itScalar) 1062 { 1063 if (!itScalar->empty()) 1064 { 1065 scalarPtr->sendCreateChild(*itScalar); 1066 CScalar::get(*itScalar)->sendAllAttributesToServer(); 1067 } 1068 } 1056 1069 1057 1070 StdString axiDefRoot("axis_definition"); -
XIOS/trunk/src/node/field.cpp
r873 r887 34 34 , nstep(0), nstepMax(0) 35 35 , hasOutputFile(false) 36 , domAxis Ids_("", ""), areAllReferenceSolved(false), isReferenceSolved(false)36 , domAxisScalarIds_(vector<StdString>(3,"")), areAllReferenceSolved(false), isReferenceSolved(false) 37 37 , useCompressedOutput(false) 38 38 , isReadDataRequestPending(false) … … 45 45 , nstep(0), nstepMax(0) 46 46 , hasOutputFile(false) 47 , domAxis Ids_("", ""), areAllReferenceSolved(false), isReferenceSolved(false)47 , domAxisScalarIds_(vector<StdString>(3,"")), areAllReferenceSolved(false), isReferenceSolved(false) 48 48 , useCompressedOutput(false) 49 49 , isReadDataRequestPending(false) … … 889 889 void CField::solveGridReference(void) 890 890 { 891 if (grid_ref.isEmpty() && domain_ref.isEmpty() && axis_ref.isEmpty() )891 if (grid_ref.isEmpty() && domain_ref.isEmpty() && axis_ref.isEmpty() && scalar_ref.isEmpty()) 892 892 { 893 893 ERROR("CField::solveGridReference(void)", 894 894 << "A grid must be defined for field '" << getFieldOutputName() << "' ."); 895 895 } 896 else if (!grid_ref.isEmpty() && (!domain_ref.isEmpty() || !axis_ref.isEmpty() ))896 else if (!grid_ref.isEmpty() && (!domain_ref.isEmpty() || !axis_ref.isEmpty() || !scalar_ref.isEmpty())) 897 897 { 898 898 ERROR("CField::solveGridReference(void)", 899 << "Field '" << getFieldOutputName() << "' has both a grid and a domain/axis ." << std::endl900 << "Please define either 'grid_ref' or 'domain_ref'/'axis_ref' .");899 << "Field '" << getFieldOutputName() << "' has both a grid and a domain/axis/scalar." << std::endl 900 << "Please define either 'grid_ref' or 'domain_ref'/'axis_ref'/'scalar_ref'."); 901 901 } 902 902 … … 905 905 std::vector<CDomain*> vecDom; 906 906 std::vector<CAxis*> vecAxis; 907 std::vector<CScalar*> vecScalar; 907 908 908 909 if (!domain_ref.isEmpty()) … … 925 926 } 926 927 928 if (!scalar_ref.isEmpty()) 929 { 930 if (CScalar::has(scalar_ref)) 931 vecScalar.push_back(CScalar::get(scalar_ref)); 932 else 933 ERROR("CField::solveGridReference(void)", 934 << "Invalid reference to scalar '" << scalar_ref.getValue() << "'."); 935 } 936 927 937 // Warning: the gridId shouldn't be set as the grid_ref since it could be inherited 928 StdString gridId = CGrid::generateId(vecDom, vecAxis );938 StdString gridId = CGrid::generateId(vecDom, vecAxis, vecScalar); 929 939 if (CGrid::has(gridId)) 930 940 this->grid = CGrid::get(gridId); 931 941 else 932 this->grid = CGrid::createGrid(gridId, vecDom, vecAxis );942 this->grid = CGrid::createGrid(gridId, vecDom, vecAxis, vecScalar); 933 943 } 934 944 else … … 1138 1148 \return pair of Domain and Axis id 1139 1149 */ 1140 const std:: pair<StdString,StdString>& CField::getRefDomainAxisIds()1150 const std::vector<StdString>& CField::getRefDomainAxisIds() 1141 1151 { 1142 1152 CGrid* cgPtr = getRelGrid(); … … 1148 1158 std::vector<StdString> domainList = cgPtr->getDomainList(); 1149 1159 it = std::find(domainList.begin(), domainList.end(), domain_ref.getValue()); 1150 if (domainList.end() != it) domAxis Ids_.first= *it;1160 if (domainList.end() != it) domAxisScalarIds_[0] = *it; 1151 1161 } 1152 1162 … … 1155 1165 std::vector<StdString> axisList = cgPtr->getAxisList(); 1156 1166 it = std::find(axisList.begin(), axisList.end(), axis_ref.getValue()); 1157 if (axisList.end() != it) domAxisIds_.second = *it; 1158 } 1159 } 1160 return (domAxisIds_); 1167 if (axisList.end() != it) domAxisScalarIds_[1] = *it; 1168 } 1169 1170 if (!scalar_ref.isEmpty()) 1171 { 1172 std::vector<StdString> scalarList = cgPtr->getScalarList(); 1173 it = std::find(scalarList.begin(), scalarList.end(), scalar_ref.getValue()); 1174 if (scalarList.end() != it) domAxisScalarIds_[2] = *it; 1175 } 1176 } 1177 return (domAxisScalarIds_); 1161 1178 } 1162 1179 -
XIOS/trunk/src/node/field.hpp
r823 r887 177 177 178 178 179 const std:: pair<StdString,StdString>& getRefDomainAxisIds();179 const std::vector<StdString>& getRefDomainAxisIds(); 180 180 181 181 public: … … 201 201 bool areAllReferenceSolved; 202 202 bool isReferenceSolved; 203 std:: pair<StdString,StdString> domAxisIds_;203 std::vector<StdString> domAxisScalarIds_; 204 204 bool isReadDataRequestPending; 205 205 bool useCompressedOutput; -
XIOS/trunk/src/node/grid.cpp
r865 r887 26 26 : CObjectTemplate<CGrid>(), CGridAttributes() 27 27 , isChecked(false), isDomainAxisChecked(false) 28 , vDomainGroup_(), vAxisGroup_(), axisList_(), isAxisListSet(false), isDomListSet(false) 28 , vDomainGroup_(), domList_(), isDomListSet(false) 29 , vAxisGroup_(), axisList_(), isAxisListSet(false) 30 , vScalarGroup_(), scalarList_(), isScalarListSet(false) 29 31 , clientDistribution_(0), isIndexSent(false) , serverDistribution_(0), clientServerMap_(0) 30 32 , writtenDataSize_(0), numberWrittenIndexes_(0), totalNumberWrittenIndexes_(0), offsetWrittenIndexes_(0) … … 36 38 setVirtualDomainGroup(); 37 39 setVirtualAxisGroup(); 40 setVirtualScalarGroup(); 38 41 } 39 42 … … 41 44 : CObjectTemplate<CGrid>(id), CGridAttributes() 42 45 , isChecked(false), isDomainAxisChecked(false) 43 , vDomainGroup_(), vAxisGroup_(), axisList_(), isAxisListSet(false), isDomListSet(false) 46 , vDomainGroup_(), domList_(), isDomListSet(false) 47 , vAxisGroup_(), axisList_(), isAxisListSet(false) 48 , vScalarGroup_(), scalarList_(), isScalarListSet(false) 44 49 , clientDistribution_(0), isIndexSent(false) , serverDistribution_(0), clientServerMap_(0) 45 50 , writtenDataSize_(0), numberWrittenIndexes_(0), totalNumberWrittenIndexes_(0), offsetWrittenIndexes_(0) … … 51 56 setVirtualDomainGroup(); 52 57 setVirtualAxisGroup(); 58 setVirtualScalarGroup(); 53 59 } 54 60 … … 201 207 if (this->isDomainAxisChecked) return; 202 208 209 this->solveScalarRef(areAttributesChecked); 203 210 this->solveAxisRef(areAttributesChecked); 204 211 this->solveDomainRef(areAttributesChecked); 205 computeGridGlobalDimension(getDomains(), getAxis(), axis_domain_order);212 computeGridGlobalDimension(getDomains(), getAxis(), getScalars(), axis_domain_order); 206 213 this->isDomainAxisChecked = areAttributesChecked; 207 214 } … … 210 217 { 211 218 if (this->hasDomainAxisBaseRef_) return; 219 // Account for the scalar attributes 220 std::vector<CScalar*> scalarList = getScalars(); 221 for (size_t i = 0; i < scalarList.size(); ++i) 222 { 223 scalarList[i]->setAttributesReference(); 224 } 225 212 226 // Account for the axis attributes 213 227 std::vector<CAxis*> axisList = getAxis(); … … 223 237 domList[i]->setAttributesReference(); 224 238 } 239 225 240 this->hasDomainAxisBaseRef_ = true; 226 241 } … … 383 398 for (int i = 0; i < axis_domain_order.numElements(); ++i) 384 399 { 385 if (false == axis_domain_order(i)) 400 int elementDimension = axis_domain_order(i); 401 if (1 == elementDimension) 386 402 { 387 403 axisPositionInGrid_.push_back(idx); 388 404 ++idx; 389 405 } 390 else i dx += 2;406 else if (2 == elementDimension) idx += 2; 391 407 } 392 408 … … 397 413 else 398 414 axisListP[i]->checkAttributesOnClient(); 399 ++idx; 415 } 416 } 417 } 418 419 //--------------------------------------------------------------- 420 421 void CGrid::solveScalarRef(bool sendAtt) 422 { 423 setScalarList(); 424 std::vector<CScalar*> scalarListP = this->getScalars(); 425 if (!scalarListP.empty()) 426 { 427 for (int i = 0; i < scalarListP.size(); ++i) 428 { 429 /*Nothing to do for now */ 430 // if (sendAtt) scalarListP[i]->sendCheckedAttributes(); 431 // else scalarListP[i]->checkAttributesOnClient(); 400 432 } 401 433 } … … 502 534 int nbElement = axis_domain_order.numElements(); 503 535 std::vector<CArray<size_t,1> > globalIndexElement(nbElement); 504 int domainIdx = 0, axisIdx = 0 ;536 int domainIdx = 0, axisIdx = 0, scalarIdx = 0; 505 537 std::vector<size_t> elementNGlobal(nbElement); 506 538 elementNGlobal[0] = 1; … … 511 543 size_t elementSize; 512 544 size_t elementGlobalSize = 1; 513 if ( axis_domain_order(idx))545 if (2 == axis_domain_order(idx)) 514 546 { 515 547 elementSize = domList[domainIdx]->i_index.numElements(); … … 522 554 ++domainIdx; 523 555 } 524 else 556 else if (1 == axis_domain_order(idx)) 525 557 { 526 558 elementSize = axisList[axisIdx]->index.numElements(); … … 532 564 elementGlobalSize = axisList[axisIdx]->n_glo.getValue(); 533 565 ++axisIdx; 566 } 567 else 568 { 569 globalIndexElement[idx].resize(1); 570 globalIndexElement[idx](0) = 0; 571 elementGlobalSize = 1; 534 572 } 535 573 globalSize *= elementGlobalSize; … … 657 695 658 696 CGrid* CGrid::createGrid(const std::vector<CDomain*>& domains, const std::vector<CAxis*>& axis, 659 const CArray<bool,1>& axisDomainOrder) 660 { 661 return createGrid(generateId(domains, axis, axisDomainOrder), domains, axis, axisDomainOrder); 662 } 697 const CArray<int,1>& axisDomainOrder) 698 { 699 std::vector<CScalar*> vecScalar; 700 return createGrid(generateId(domains, axis, vecScalar, axisDomainOrder), domains, axis, vecScalar, axisDomainOrder); 701 } 702 703 CGrid* CGrid::createGrid(const std::vector<CDomain*>& domains, const std::vector<CAxis*>& axis, 704 const std::vector<CScalar*>& scalars, const CArray<int,1>& axisDomainOrder) 705 { 706 return createGrid(generateId(domains, axis, scalars, axisDomainOrder), domains, axis, scalars, axisDomainOrder); 707 } 708 709 // CGrid* CGrid::createGrid(StdString id, const std::vector<CDomain*>& domains, const std::vector<CAxis*>& axis, 710 // const CArray<int,1>& axisDomainOrder) 711 // { 712 // if (axisDomainOrder.numElements() > 0 && axisDomainOrder.numElements() != (domains.size() + axis.size())) 713 // ERROR("CGrid* CGrid::createGrid(...)", 714 // << "The size of axisDomainOrder (" << axisDomainOrder.numElements() 715 // << ") is not coherent with the number of elements (" << domains.size() + axis.size() <<")."); 716 // 717 // CGrid* grid = CGridGroup::get("grid_definition")->createChild(id); 718 // grid->setDomainList(domains); 719 // grid->setAxisList(axis); 720 // 721 // // By default, domains are always the first elements of a grid 722 // if (0 == axisDomainOrder.numElements()) 723 // { 724 // int size = domains.size() + axis.size(); 725 // grid->axis_domain_order.resize(size); 726 // for (int i = 0; i < size; ++i) 727 // { 728 // if (i < domains.size()) grid->axis_domain_order(i) = 2; 729 // else grid->axis_domain_order(i) = 1; 730 // } 731 // } 732 // else 733 // { 734 // grid->axis_domain_order.resize(axisDomainOrder.numElements()); 735 // grid->axis_domain_order = axisDomainOrder; 736 // } 737 // 738 // grid->solveDomainAxisRefInheritance(true); 739 // 740 // return grid; 741 // } 663 742 664 743 CGrid* CGrid::createGrid(StdString id, const std::vector<CDomain*>& domains, const std::vector<CAxis*>& axis, 665 const CArray<bool,1>& axisDomainOrder)666 { 667 if (axisDomainOrder.numElements() > 0 && axisDomainOrder.numElements() != (domains.size() + axis.size() ))744 const std::vector<CScalar*>& scalars, const CArray<int,1>& axisDomainOrder) 745 { 746 if (axisDomainOrder.numElements() > 0 && axisDomainOrder.numElements() != (domains.size() + axis.size() + scalars.size())) 668 747 ERROR("CGrid* CGrid::createGrid(...)", 669 748 << "The size of axisDomainOrder (" << axisDomainOrder.numElements() … … 673 752 grid->setDomainList(domains); 674 753 grid->setAxisList(axis); 754 grid->setScalarList(scalars); 675 755 676 756 // By default, domains are always the first elements of a grid 677 757 if (0 == axisDomainOrder.numElements()) 678 758 { 679 int size = domains.size() + axis.size(); 759 int size = domains.size() + axis.size() + scalars.size(); 760 int nb = 0; 680 761 grid->axis_domain_order.resize(size); 681 762 for (int i = 0; i < size; ++i) 682 763 { 683 if (i < domains.size()) grid->axis_domain_order(i) = true; 684 else grid->axis_domain_order(i) = false; 764 if (i < domains.size()) { 765 grid->axis_domain_order(i) = 2; 766 767 } 768 else if ((scalars.size() < (size-nb)) < size) { 769 grid->axis_domain_order(i) = 1; 770 } 771 else 772 grid->axis_domain_order(i) = 0; 773 ++nb; 685 774 } 686 775 } … … 698 787 CGrid* CGrid::cloneGrid(const StdString& idNewGrid, CGrid* gridSrc) 699 788 { 789 std::vector<CDomain*> domainSrcTmp = gridSrc->getDomains(), domainSrc; 700 790 std::vector<CAxis*> axisSrcTmp = gridSrc->getAxis(), axisSrc; 701 std::vector<CDomain*> domainSrcTmp = gridSrc->getDomains(), domainSrc; 791 std::vector<CScalar*> scalarSrcTmp = gridSrc->getScalars(), scalarSrc; 792 793 for (int idx = 0; idx < domainSrcTmp.size(); ++idx) 794 { 795 CDomain* domain = CDomain::createDomain(); 796 domain->duplicateAttributes(domainSrcTmp[idx]); 797 domain->duplicateTransformation(domainSrcTmp[idx]); 798 domain->solveRefInheritance(true); 799 domain->solveInheritanceTransformation(); 800 domainSrc.push_back(domain); 801 } 802 702 803 for (int idx = 0; idx < axisSrcTmp.size(); ++idx) 703 804 { … … 710 811 } 711 812 712 for (int idx = 0; idx < domainSrcTmp.size(); ++idx)813 for (int idx = 0; idx < scalarSrcTmp.size(); ++idx) 713 814 { 714 C Domain* domain = CDomain::createDomain();715 domain->duplicateAttributes(domainSrcTmp[idx]);716 domain->duplicateTransformation(domainSrcTmp[idx]);717 domain->solveRefInheritance(true);718 domain->solveInheritanceTransformation();719 domainSrc.push_back(domain);720 } 721 722 CGrid* grid = CGrid::createGrid(idNewGrid, domainSrc, axisSrc, gridSrc->axis_domain_order);815 CScalar* scalar = CScalar::createScalar(); 816 scalar->duplicateAttributes(scalarSrcTmp[idx]); 817 scalar->duplicateTransformation(scalarSrcTmp[idx]); 818 scalar->solveRefInheritance(true); 819 scalar->solveInheritanceTransformation(); 820 scalarSrc.push_back(scalar); 821 } 822 823 CGrid* grid = CGrid::createGrid(idNewGrid, domainSrc, axisSrc, scalarSrc, gridSrc->axis_domain_order); 723 824 724 825 return grid; … … 726 827 727 828 StdString CGrid::generateId(const std::vector<CDomain*>& domains, const std::vector<CAxis*>& axis, 728 const CArray<bool,1>& axisDomainOrder)729 { 730 if (axisDomainOrder.numElements() > 0 && axisDomainOrder.numElements() != (domains.size() + axis.size() ))829 const std::vector<CScalar*>& scalars, const CArray<int,1>& axisDomainOrder) 830 { 831 if (axisDomainOrder.numElements() > 0 && axisDomainOrder.numElements() != (domains.size() + axis.size() + scalars.size())) 731 832 ERROR("CGrid* CGrid::generateId(...)", 732 833 << "The size of axisDomainOrder (" << axisDomainOrder.numElements() … … 735 836 std::ostringstream id; 736 837 737 if (domains.empty() && axis.empty()) 738 id << "__scalar_grid__"; 739 else 838 if (domains.empty() && axis.empty() && !scalars.empty()) 839 id << "__scalar_"; 840 841 if (0 != (domains.size() + axis.size() + scalars.size())) 740 842 { 741 843 id << "__grid"; … … 745 847 for (size_t i = 0; i < domains.size(); ++i) id << "_" << domains[i]->getId(); 746 848 for (size_t i = 0; i < axis.size(); ++i) id << "_" << axis[i]->getId(); 849 for (size_t i = 0; i < scalars.size(); ++i) id << "_" << scalars[i]->getId(); 747 850 } 748 851 else 749 852 { 750 size_t iDomain = 0, iAxis = 0 ;853 size_t iDomain = 0, iAxis = 0, iScalar = 0; 751 854 for (size_t i = 0; i < axisDomainOrder.numElements(); ++i) 752 855 { 753 if ( axisDomainOrder(i))856 if (2 == axisDomainOrder(i)) 754 857 id << "_" << domains[iDomain++]->getId(); 858 else if (1 == axisDomainOrder(i)) 859 id << "_" << axis[iAxis++]->getId(); 755 860 else 756 id << "_" << axis[iAxis++]->getId();861 id << "_" << scalars[iScalar++]->getId(); 757 862 } 758 863 } … … 785 890 { 786 891 return this->vAxisGroup_; 892 } 893 894 CScalarGroup* CGrid::getVirtualScalarGroup() const 895 { 896 return this->vScalarGroup_; 787 897 } 788 898 … … 1037 1147 void CGrid::computeGridGlobalDimension(const std::vector<CDomain*>& domains, 1038 1148 const std::vector<CAxis*>& axis, 1039 const CArray<bool,1>& axisDomainOrder) 1040 { 1041 globalDim_.resize(domains.size()*2+axis.size()); 1042 int idx = 0, idxDomain = 0, idxAxis = 0; 1149 const std::vector<CScalar*>& scalars, 1150 const CArray<int,1>& axisDomainOrder) 1151 { 1152 globalDim_.resize(domains.size()*2+axis.size()+scalars.size()); 1153 int idx = 0, idxDomain = 0, idxAxis = 0, idxScalar = 0; 1043 1154 for (int i = 0; i < axisDomainOrder.numElements(); ++i) 1044 1155 { 1045 if ( axisDomainOrder(i))1156 if (2 == axisDomainOrder(i)) 1046 1157 { 1047 1158 if (!(domains[idxDomain]->type.isEmpty()) && (domains[idxDomain]->type==CDomain::type_attr::unstructured)) … … 1060 1171 idx += 2; 1061 1172 } 1062 else 1173 else if (1 == axisDomainOrder(i)) 1063 1174 { 1064 1175 globalDim_[idx] = axis[idxAxis]->n_glo.getValue(); 1065 1176 ++idxAxis; 1177 ++idx; 1178 } 1179 else 1180 { 1181 globalDim_[idx] = 1; 1182 ++idxScalar; 1066 1183 ++idx; 1067 1184 } … … 1179 1296 { 1180 1297 indexMap[i] = idx; 1181 if ( true== axis_domain_order(i))1298 if (2 == axis_domain_order(i)) 1182 1299 { 1183 1300 ++ssize; … … 1188 1305 } 1189 1306 1190 int axisId = 0, domainId = 0 ;1307 int axisId = 0, domainId = 0, scalarId = 0; 1191 1308 std::vector<CDomain*> domainList = getDomains(); 1192 1309 std::vector<CAxis*> axisList = getAxis(); … … 1194 1311 for (int i = 0; i < numElement; ++i) 1195 1312 { 1196 if ( axis_domain_order(i))1313 if (2 == axis_domain_order(i)) //domain 1197 1314 { 1198 1315 nZoomBegin[indexMap[i]] = domainList[domainId]->zoom_ibegin_srv; … … 1207 1324 ++domainId; 1208 1325 } 1209 else 1326 else if (1 == axis_domain_order(i)) // axis 1210 1327 { 1211 1328 nZoomBegin[indexMap[i]] = axisList[axisId]->zoom_begin_srv; … … 1214 1331 nGlob[indexMap[i]] = axisList[axisId]->n_glo; 1215 1332 ++axisId; 1333 } 1334 else // scalar 1335 { 1336 nZoomBegin[indexMap[i]] = 0; 1337 nZoomSize[indexMap[i]] = 1; 1338 nZoomBeginGlobal[indexMap[i]] = 0; 1339 nGlob[indexMap[i]] = 1; 1340 ++scalarId; 1216 1341 } 1217 1342 } … … 1281 1406 return true; 1282 1407 break; 1408 1409 case EVENT_ID_ADD_SCALAR : 1410 recvAddScalar(event); 1411 return true; 1412 break; 1283 1413 default : 1284 1414 ERROR("bool CDomain::dispatchEvent(CEventServer& event)", … … 1293 1423 CDomain* CGrid::addDomain(const std::string& id) 1294 1424 { 1295 order_.push_back( true);1425 order_.push_back(2); 1296 1426 axis_domain_order.resize(order_.size()); 1297 1427 for (int idx = 0; idx < order_.size(); ++idx) axis_domain_order(idx)=order_[idx]; … … 1301 1431 CAxis* CGrid::addAxis(const std::string& id) 1302 1432 { 1303 order_.push_back( false);1433 order_.push_back(1); 1304 1434 axis_domain_order.resize(order_.size()); 1305 1435 for (int idx = 0; idx < order_.size(); ++idx) axis_domain_order(idx)=order_[idx]; … … 1307 1437 } 1308 1438 1439 CScalar* CGrid::addScalar(const std::string& id) 1440 { 1441 order_.push_back(0); 1442 axis_domain_order.resize(order_.size()); 1443 for (int idx = 0; idx < order_.size(); ++idx) axis_domain_order(idx)=order_[idx]; 1444 return vScalarGroup_->createChild(id); 1445 } 1446 1309 1447 //! Change virtual field group to a new one 1310 1448 void CGrid::setVirtualDomainGroup(CDomainGroup* newVDomainGroup) … … 1317 1455 { 1318 1456 this->vAxisGroup_ = newVAxisGroup; 1457 } 1458 1459 //! Change virtual variable group to new one 1460 void CGrid::setVirtualScalarGroup(CScalarGroup* newVScalarGroup) 1461 { 1462 this->vScalarGroup_ = newVScalarGroup; 1319 1463 } 1320 1464 … … 1330 1474 { 1331 1475 this->setVirtualAxisGroup(CAxisGroup::create()); 1476 } 1477 1478 //! Create virtual variable group, which is done normally on initializing file 1479 void CGrid::setVirtualScalarGroup(void) 1480 { 1481 this->setVirtualScalarGroup(CScalarGroup::create()); 1332 1482 } 1333 1483 … … 1387 1537 1388 1538 /*! 1539 \brief Send a message to create a scalar on server side 1540 \param[in] id String identity of scalar that will be created on server 1541 */ 1542 void CGrid::sendAddScalar(const string& id) 1543 { 1544 CContext* context=CContext::getCurrent(); 1545 1546 if (! context->hasServer ) 1547 { 1548 CContextClient* client=context->client; 1549 1550 CEventClient event(this->getType(),EVENT_ID_ADD_SCALAR); 1551 if (client->isServerLeader()) 1552 { 1553 CMessage msg; 1554 msg<<this->getId(); 1555 msg<<id; 1556 const std::list<int>& ranks = client->getRanksServerLeader(); 1557 for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 1558 event.push(*itRank,1,msg); 1559 client->sendEvent(event); 1560 } 1561 else client->sendEvent(event); 1562 } 1563 } 1564 1565 /*! 1389 1566 \brief Receive a message annoucing the creation of a domain on server side 1390 1567 \param[in] event Received event … … 1432 1609 buffer >> id; 1433 1610 addAxis(id); 1611 } 1612 1613 /*! 1614 \brief Receive a message annoucing the creation of an scalar on server side 1615 \param[in] event Received event 1616 */ 1617 void CGrid::recvAddScalar(CEventServer& event) 1618 { 1619 1620 CBufferIn* buffer = event.subEvents.begin()->buffer; 1621 string id; 1622 *buffer >> id; 1623 get(id)->recvAddScalar(*buffer); 1624 } 1625 1626 /*! 1627 \brief Receive a message annoucing the creation of an scalar on server side 1628 \param[in] buffer Buffer containing message 1629 */ 1630 void CGrid::recvAddScalar(CBufferIn& buffer) 1631 { 1632 string id; 1633 buffer >> id; 1634 addScalar(id); 1434 1635 } 1435 1636 … … 1468 1669 } 1469 1670 } 1671 1672 setScalarList(); 1673 it = scalarList_.begin(); itE = scalarList_.end(); 1674 for (; it != itE; ++it) 1675 { 1676 CScalar* pScalar = CScalar::get(*it); 1677 if (context->hasClient) 1678 { 1679 pScalar->solveRefInheritance(apply); 1680 pScalar->solveInheritanceTransformation(); 1681 } 1682 } 1470 1683 } 1471 1684 … … 1513 1726 else 1514 1727 { 1515 int ssize = axis_domain_order.numElements();1516 for (int i = 0; i < ssize; ++i)1517 if (axis_domain_order(i) != (transformGridSrc->axis_domain_order)(i))1518 ERROR("CGrid::completeGrid(CGrid* transformGridSrc)",1519 << "Grids " << this->getId() << " and " << transformGridSrc->getId()1520 << " don't have elements in the same order");1728 // int ssize = axis_domain_order.numElements(); 1729 // for (int i = 0; i < ssize; ++i) 1730 // if (axis_domain_order(i) != (transformGridSrc->axis_domain_order)(i)) 1731 // ERROR("CGrid::completeGrid(CGrid* transformGridSrc)", 1732 // << "Grids " << this->getId() << " and " << transformGridSrc->getId() 1733 // << " don't have elements in the same order"); 1521 1734 } 1522 1735 } … … 1543 1756 else 1544 1757 { 1545 int ssize = axis_domain_order.numElements();1546 for (int i = 0; i < ssize; ++i)1547 if (axis_domain_order(i) != (transformGridSrc->axis_domain_order)(i))1548 ERROR("CGrid::transformGrid(CGrid* transformGridSrc)",1549 << "Grids " << this->getId() << " and " << transformGridSrc->getId()1550 << " don't have elements in the same order");1758 // int ssize = axis_domain_order.numElements(); 1759 // for (int i = 0; i < ssize; ++i) 1760 // if (axis_domain_order(i) != (transformGridSrc->axis_domain_order)(i)) 1761 // ERROR("CGrid::transformGrid(CGrid* transformGridSrc)", 1762 // << "Grids " << this->getId() << " and " << transformGridSrc->getId() 1763 // << " don't have elements in the same order"); 1551 1764 } 1552 1765 … … 1592 1805 1593 1806 /*! 1807 \brief Get the list of axis pointers 1808 \return list of axis pointers 1809 */ 1810 std::vector<CScalar*> CGrid::getScalars() 1811 { 1812 std::vector<CScalar*> sList; 1813 if (!scalarList_.empty()) 1814 for (int i =0; i < scalarList_.size(); ++i) sList.push_back(CScalar::get(scalarList_[i])); 1815 1816 return sList; 1817 } 1818 1819 /*! 1594 1820 \brief Set domain(s) of a grid from a list 1595 1821 \param[in] domains list of domains … … 1647 1873 1648 1874 /*! 1875 \brief Set scalar(s) of a grid from a list 1876 \param[in] scalars list of scalars 1877 */ 1878 void CGrid::setScalarList(const std::vector<CScalar*> scalars) 1879 { 1880 if (isScalarListSet) return; 1881 std::vector<CScalar*> sList = this->getVirtualScalarGroup()->getAllChildren(); 1882 if (!scalars.empty() && sList.empty()) 1883 { 1884 for (int i = 0; i < scalars.size(); ++i) 1885 this->getVirtualScalarGroup()->addChild(scalars[i]); 1886 sList = this->getVirtualScalarGroup()->getAllChildren(); 1887 } 1888 1889 if (!sList.empty()) 1890 { 1891 int sizeScalar = sList.size(); 1892 scalarList_.resize(sizeScalar); 1893 for (int i = 0; i < sizeScalar; ++i) 1894 { 1895 scalarList_[i] = sList[i]->getId(); 1896 } 1897 isScalarListSet = true; 1898 } 1899 } 1900 1901 /*! 1649 1902 \brief Get list of id of domains 1650 1903 \return id list of domains … … 1666 1919 } 1667 1920 1921 /*! 1922 \brief Get list of id of scalar 1923 \return id list of scalar 1924 */ 1925 std::vector<StdString> CGrid::getScalarList() 1926 { 1927 setScalarList(); 1928 return scalarList_; 1929 } 1930 1931 /*! 1932 Send all attributes of domains from client to server 1933 */ 1668 1934 void CGrid::sendAllDomains() 1669 1935 { … … 1677 1943 } 1678 1944 1945 /*! 1946 Send all attributes of axis from client to server 1947 */ 1679 1948 void CGrid::sendAllAxis() 1680 1949 { … … 1689 1958 } 1690 1959 1960 /*! 1961 Send all attributes of scalars from client to server 1962 */ 1963 void CGrid::sendAllScalars() 1964 { 1965 std::vector<CScalar*> sList = this->getVirtualScalarGroup()->getAllChildren(); 1966 int sSize = sList.size(); 1967 1968 for (int i = 0; i < sSize; ++i) 1969 { 1970 sendAddScalar(sList[i]->getId()); 1971 sList[i]->sendAllAttributesToServer(); 1972 } 1973 } 1974 1975 /*! 1976 Parse a grid, for now, it contains only domain, axis and scalar 1977 */ 1691 1978 void CGrid::parse(xml::CXMLNode& node) 1692 1979 { … … 1697 1984 StdString domainName("domain"); 1698 1985 StdString axisName("axis"); 1986 StdString scalarName("scalar"); 1699 1987 do 1700 1988 { 1701 1989 if (node.getElementName() == domainName) { 1702 order_.push_back( true);1990 order_.push_back(2); 1703 1991 this->getVirtualDomainGroup()->parseChild(node); 1704 1992 } 1705 1993 if (node.getElementName() == axisName) { 1706 order_.push_back( false);1994 order_.push_back(1); 1707 1995 this->getVirtualAxisGroup()->parseChild(node); 1996 } 1997 if (node.getElementName() == scalarName) { 1998 order_.push_back(0); 1999 this->getVirtualScalarGroup()->parseChild(node); 1708 2000 } 1709 2001 } while (node.goToNextElement()); … … 1723 2015 setDomainList(); 1724 2016 setAxisList(); 2017 setScalarList(); 1725 2018 } 1726 2019 } // namespace xios -
XIOS/trunk/src/node/grid.hpp
r865 r887 9 9 #include "domain.hpp" 10 10 #include "axis.hpp" 11 #include "scalar.hpp" 11 12 #include "array_new.hpp" 12 13 #include "attribute_array.hpp" … … 24 25 class CDomainGroup; 25 26 class CAxisGroup; 27 class CScalarGroup; 26 28 class CGrid; 27 29 class CDistributionClient; … … 55 57 enum EEventId 56 58 { 57 EVENT_ID_INDEX, EVENT_ID_ADD_DOMAIN, EVENT_ID_ADD_AXIS 58 }; 59 60 enum EElementType 61 { 62 GRID_ONLY_AXIS, GRID_ONLY_DOMAIN, GRID_AXIS_DOMAIN 59 EVENT_ID_INDEX, EVENT_ID_ADD_DOMAIN, EVENT_ID_ADD_AXIS, EVENT_ID_ADD_SCALAR 63 60 }; 64 61 … … 122 119 static CGrid* createGrid(CDomain* domain, CAxis* axis); 123 120 static CGrid* createGrid(const std::vector<CDomain*>& domains, const std::vector<CAxis*>& axis, 124 const CArray<bool,1>& axisDomainOrder = CArray<bool,1>()); 121 const CArray<int,1>& axisDomainOrder = CArray<int,1>()); 122 // static CGrid* createGrid(StdString id, const std::vector<CDomain*>& domains, const std::vector<CAxis*>& axis, 123 // const CArray<int,1>& axisDomainOrder = CArray<int,1>()); 125 124 static CGrid* createGrid(StdString id, const std::vector<CDomain*>& domains, const std::vector<CAxis*>& axis, 126 const CArray<bool,1>& axisDomainOrder = CArray<bool,1>()); 125 const std::vector<CScalar*>& scalars, const CArray<int,1>& axisDomainOrder = CArray<int,1>()); 126 static CGrid* createGrid(const std::vector<CDomain*>& domains, const std::vector<CAxis*>& axis, 127 const std::vector<CScalar*>& scalars, const CArray<int,1>& axisDomainOrder); 128 // static StdString generateId(const std::vector<CDomain*>& domains, const std::vector<CAxis*>& axis, 129 // const std::vector<CScalar*>& scalars, const CArray<int,1>& axisDomainOrder = CArray<int,1>()); 127 130 static StdString generateId(const std::vector<CDomain*>& domains, const std::vector<CAxis*>& axis, 128 const CArray<bool,1>& axisDomainOrder = CArray<bool,1>());131 const std::vector<CScalar*>& scalars, const CArray<int,1>& axisDomainOrder = CArray<int,1>()); 129 132 static StdString generateId(const CGrid* gridSrc, const CGrid* gridDest); 130 133 static CGrid* cloneGrid(const StdString& idNewGrid, CGrid* gridSrc); … … 144 147 void solveDomainRef(bool checkAtt); 145 148 void solveAxisRef(bool checkAtt); 149 void solveScalarRef(bool checkAtt); 146 150 void solveDomainAxisRefInheritance(bool apply = true); 147 151 void solveTransformations(); … … 150 154 CDomain* addDomain(const std::string& id=StdString()); 151 155 CAxis* addAxis(const std::string& id=StdString()); 156 CScalar* addScalar(const std::string& id=StdString()); 152 157 void sendAddDomain(const std::string& id=""); 153 158 void sendAddAxis(const std::string& id=""); 159 void sendAddScalar(const std::string& id=""); 154 160 void sendAllDomains(); 155 161 void sendAllAxis(); 162 void sendAllScalars(); 156 163 157 164 static void recvAddDomain(CEventServer& event); … … 159 166 static void recvAddAxis(CEventServer& event); 160 167 void recvAddAxis(CBufferIn& buffer); 168 static void recvAddScalar(CEventServer& event); 169 void recvAddScalar(CBufferIn& buffer); 161 170 162 171 static bool dispatchEvent(CEventServer& event); … … 172 181 std::vector<StdString> getDomainList(); 173 182 std::vector<StdString> getAxisList(); 183 std::vector<StdString> getScalarList(); 174 184 std::vector<CDomain*> getDomains(); 175 185 std::vector<CAxis*> getAxis(); 186 std::vector<CScalar*> getScalars(); 176 187 std::vector<int> getAxisOrder(); 177 188 std::vector<int> getGlobalDimension(); … … 218 229 void computeGridGlobalDimension(const std::vector<CDomain*>& domains, 219 230 const std::vector<CAxis*>& axis, 220 const CArray<bool,1>& axisDomainOrder); 231 const std::vector<CScalar*>& scalars, 232 const CArray<int,1>& axisDomainOrder); 221 233 222 234 private: … … 225 237 const std::vector<CArray<bool,1>* >& domainMasks, 226 238 const std::vector<CArray<bool,1>* >& axisMasks, 227 const CArray< bool,1>& axisDomainOrder,239 const CArray<int,1>& axisDomainOrder, 228 240 bool createMask = false); 229 241 template<int N> … … 234 246 void setVirtualAxisGroup(CAxisGroup* newVAxisGroup); 235 247 void setVirtualAxisGroup(); 236 248 void setVirtualScalarGroup(CScalarGroup* newVScalarGroup); 249 void setVirtualScalarGroup(); 250 251 void setDomainList(const std::vector<CDomain*> domains = std::vector<CDomain*>()); 237 252 void setAxisList(const std::vector<CAxis*> axis = std::vector<CAxis*>()); 238 void setDomainList(const std::vector<CDomain*> domains = std::vector<CDomain*>()); 239 253 void setScalarList(const std::vector<CScalar*> scalars = std::vector<CScalar*>()); 254 255 CDomainGroup* getVirtualDomainGroup() const; 240 256 CAxisGroup* getVirtualAxisGroup() const; 241 C DomainGroup* getVirtualDomainGroup() const;257 CScalarGroup* getVirtualScalarGroup() const; 242 258 243 259 void checkAttributesAfterTransformation(); … … 246 262 CClientServerMapping::GlobalIndexMap& globalIndexOnServer); 247 263 248 249 264 private: 250 265 CDomainGroup* vDomainGroup_; 251 266 CAxisGroup* vAxisGroup_; 252 std::vector<std::string> axisList_, domList_; 253 bool isAxisListSet, isDomListSet; 267 CScalarGroup* vScalarGroup_; 268 std::vector<std::string> axisList_, domList_, scalarList_; 269 bool isAxisListSet, isDomListSet, isScalarListSet; 254 270 255 271 CDistributionClient* clientDistribution_; … … 275 291 CClientServerMapping::GlobalIndexMap globalIndexOnServer_; 276 292 // List order of axis and domain in a grid, if there is a domain, it will take value 1 (true), axis 0 (false) 277 std::vector< bool> order_;293 std::vector<int> order_; 278 294 }; // class CGrid 279 295 … … 306 322 const std::vector<CArray<bool,1>* >& domainMasks, 307 323 const std::vector<CArray<bool,1>* >& axisMasks, 308 const CArray< bool,1>& axisDomainOrder,324 const CArray<int,1>& axisDomainOrder, 309 325 bool createMask) 310 326 { … … 320 336 { 321 337 indexMap[i] = idx; 322 if ( true== axisDomainOrder(i)) {338 if (2 == axisDomainOrder(i)) { 323 339 eachDimSize[indexMap[i]] = domainP[idxDomain]->ni; 324 340 eachDimSize[indexMap[i]+1] = domainP[idxDomain]->nj; 325 341 idx += 2; ++idxDomain; 326 342 } 327 else {343 else if (1 == axisDomainOrder(i)) { 328 344 eachDimSize[indexMap[i]] = axisMasks[idxAxis]->numElements(); 329 345 ++idx; ++idxAxis; 330 346 } 347 else ++idx; 331 348 } 332 349 … … 365 382 for (int i = 0; i < numElement; ++i) 366 383 { 367 if ( axisDomainOrder(i))384 if (2 == axisDomainOrder(i)) 368 385 { 369 386 maskValue = maskValue && (*domainMasks[idxDomain])(idxLoop[indexMap[i]] + idxLoop[indexMap[i]+1] * eachDimSize[indexMap[i]]); 370 387 ++idxDomain; 371 388 } 372 else 389 else if (1 == axisDomainOrder(i)) 373 390 { 374 391 maskValue = maskValue && (*axisMasks[idxAxis])(idxLoop[indexMap[i]]); -
XIOS/trunk/src/node/node_enum.hpp
r689 r887 25 25 eZoomDomain, 26 26 eInterpolateDomain, 27 eGenerateRectilinearDomain 27 eGenerateRectilinearDomain, 28 eScalar 28 29 29 30 } ENodeType; -
XIOS/trunk/src/node/node_type.hpp
r689 r887 16 16 #include "interpolate_domain.hpp" 17 17 #include "generate_rectilinear_domain.hpp" 18 #include "scalar.hpp" 19 18 20 19 21 #endif // __XIOS_NODE_TYPE__ -
XIOS/trunk/src/object_factory_decl.cpp
r769 r887 32 32 macro(CInterpolateDomain) 33 33 macro(CGenerateRectilinearDomain) 34 macro(CScalar) 34 35 35 36 macro(CFieldGroup) … … 46 47 macro(CInterpolateDomainGroup) 47 48 macro(CGenerateRectilinearDomainGroup) 49 macro(CScalarGroup) 48 50 } -
XIOS/trunk/src/object_template_decl.cpp
r689 r887 19 19 template class CObjectTemplate<CInterpolateDomain>; 20 20 template class CObjectTemplate<CGenerateRectilinearDomain>; 21 template class CObjectTemplate<CScalar>; 21 22 22 23 template class CObjectTemplate<CContextGroup>; … … 33 34 template class CObjectTemplate<CInterpolateDomainGroup>; 34 35 template class CObjectTemplate<CGenerateRectilinearDomainGroup>; 36 template class CObjectTemplate<CScalarGroup>; 35 37 } -
XIOS/trunk/src/server_distribution_description.cpp
r865 r887 169 169 \param [in] clientRank rank of client 170 170 \param [in] clientSize number of client 171 \param [in] axisDomainOrder the order of element in grid ( true for domain, false for axis)171 \param [in] axisDomainOrder the order of element in grid (2 for domain, 1 for axis, 0 for scalar) 172 172 \param [in] positionDimensionDistributed dimension of server on which we make the cut. 173 173 */ … … 175 175 int clientRank, 176 176 int clientSize, 177 const CArray< bool,1>& axisDomainOrder,177 const CArray<int,1>& axisDomainOrder, 178 178 int positionDimensionDistributed) 179 179 { … … 193 193 { 194 194 idxMap[i] = idx; 195 if ( true== axisDomainOrder(i)) idx += 2;195 if (2 == axisDomainOrder(i)) idx += 2; 196 196 else ++idx; 197 197 } … … 203 203 { 204 204 int elementSize = 1; 205 if ( axisDomainOrder(i))205 if (2 == axisDomainOrder(i)) 206 206 { 207 207 elementSize *= dimensionSizes_[idxServer][idxMap[i]] * dimensionSizes_[idxServer][idxMap[i]+1]; … … 212 212 } 213 213 214 else 214 else if (1 == axisDomainOrder(i)) 215 215 { 216 216 elementSize *= dimensionSizes_[idxServer][idxMap[i]]; … … 218 218 elementDimension[1] = 0; 219 219 elementDimension[2] = dimensionSizes_[idxServer][idxMap[i]]; 220 elementDimension[3] = 1; 221 } 222 else 223 { 224 elementSize *= dimensionSizes_[idxServer][idxMap[i]]; 225 elementDimension[0] = 0; 226 elementDimension[1] = 0; 227 elementDimension[2] = 1; 220 228 elementDimension[3] = 1; 221 229 } -
XIOS/trunk/src/server_distribution_description.hpp
r865 r887 42 42 int rank, 43 43 int clientSize, 44 const CArray< bool,1>& axisDomainOrder,44 const CArray<int,1>& axisDomainOrder, 45 45 int positionDimensionDistributed = 1); 46 46 -
XIOS/trunk/src/transformation/generic_algorithm_transformation.cpp
r871 r887 84 84 std::vector<CAxis*> axisListDestP = gridDst->getAxis(); 85 85 std::vector<CDomain*> domainListDestP = gridDst->getDomains(); 86 CArray< bool,1> axisDomainDstOrder = gridDst->axis_domain_order;86 CArray<int,1> axisDomainDstOrder = gridDst->axis_domain_order; 87 87 std::vector<CAxis*> axisListSrcP = gridSrc->getAxis(); 88 88 std::vector<CDomain*> domainListSrcP = gridSrc->getDomains(); … … 96 96 if (idx == elementPositionInGrid) 97 97 computeExchangeGlobalIndex(indexSrc, globalIndexOfTransformedElementOnProc); //globalElementIndexOnProc[idx]); 98 if ( axisDomainDstOrder(idx)) // It's domain98 if (2 == axisDomainDstOrder(idx)) // It's domain 99 99 { 100 100 if (idx != elementPositionInGrid) … … 106 106 107 107 } 108 else //it's an axis108 else if (1 == axisDomainDstOrder(idx))//it's an axis 109 109 { 110 110 if (idx != elementPositionInGrid) … … 226 226 SourceDestinationIndexMap& globaIndexWeightFromSrcToDst) 227 227 { 228 std::vector<CDomain*> domainListSrcP = gridSrc->getDomains(); 229 std::vector<CAxis*> axisListSrcP = gridSrc->getAxis(); 230 std::vector<CScalar*> scalarListSrcP = gridSrc->getScalars(); 231 CArray<int,1> axisDomainSrcOrder = gridSrc->axis_domain_order; 232 233 size_t nbElement = axisDomainSrcOrder.numElements(); 234 std::vector<size_t> nGlobSrc(nbElement); 235 size_t globalSrcSize = 1; 236 int domainIndex = 0, axisIndex = 0, scalarIndex = 0; 237 for (int idx = 0; idx < nbElement; ++idx) 238 { 239 nGlobSrc[idx] = globalSrcSize; 240 int elementDimension = axisDomainSrcOrder(idx); 241 242 // If this is a domain 243 if (2 == elementDimension) 244 { 245 globalSrcSize *= domainListSrcP[domainIndex]->nj_glo.getValue() * domainListSrcP[domainIndex]->ni_glo.getValue(); 246 ++domainIndex; 247 } 248 else if (1 == elementDimension) // So it's an axis 249 { 250 globalSrcSize *= axisListSrcP[axisIndex]->n_glo.getValue(); 251 ++axisIndex; 252 } 253 else 254 { 255 globalSrcSize *= 1; 256 ++scalarIndex; 257 } 258 } 259 260 std::vector<CDomain*> domainListDestP = gridDst->getDomains(); 228 261 std::vector<CAxis*> axisListDestP = gridDst->getAxis(); 229 std::vector<CDomain*> domainListDestP = gridDst->getDomains(); 230 CArray<bool,1> axisDomainDstOrder = gridDst->axis_domain_order; 231 std::vector<CAxis*> axisListSrcP = gridSrc->getAxis(); 232 std::vector<CDomain*> domainListSrcP = gridSrc->getDomains(); 233 CArray<bool,1> axisDomainSrcOrder = gridDst->axis_domain_order; 234 size_t nbElement = axisDomainSrcOrder.numElements(); 235 std::vector<size_t> nGlobSrc(nbElement), nGlobDst(nbElement); 236 size_t globalSrcSize = 1, globalDstSize = 1; 237 int domainIndex = 0; 238 int axisIndex = 0; 262 std::vector<CScalar*> scalarListDestP = gridDst->getScalars(); 263 CArray<int,1> axisDomainDstOrder = gridDst->axis_domain_order; 264 265 std::vector<size_t> nGlobDst(nbElement); 266 size_t globalDstSize = 1; 267 domainIndex = axisIndex = scalarIndex = 0; 239 268 for (int idx = 0; idx < nbElement; ++idx) 240 269 { 241 nGlobSrc[idx] = globalSrcSize;242 270 nGlobDst[idx] = globalDstSize; 243 bool isDomain = axisDomainSrcOrder(idx);271 int elementDimension = axisDomainSrcOrder(idx); 244 272 245 273 // If this is a domain 246 if (isDomain) 247 { 248 globalSrcSize *= domainListSrcP[domainIndex]->nj_glo.getValue() * domainListSrcP[domainIndex]->ni_glo.getValue(); 274 if (2 == elementDimension) 275 { 249 276 globalDstSize *= domainListDestP[domainIndex]->nj_glo.getValue() * domainListDestP[domainIndex]->ni_glo.getValue(); 250 277 ++domainIndex; 251 278 } 252 else // So it's an axis 253 { 254 globalSrcSize *= axisListSrcP[axisIndex]->n_glo.getValue(); 279 else if (1 == elementDimension) // So it's an axis 280 { 255 281 globalDstSize *= axisListDestP[axisIndex]->n_glo.getValue(); 256 282 ++axisIndex; 283 } 284 else 285 { 286 globalDstSize *= 1; 287 ++scalarIndex; 257 288 } 258 289 } -
XIOS/trunk/src/transformation/grid_generate.cpp
r775 r887 3 3 \author Ha NGUYEN 4 4 \since 28 Aug 2015 5 \date 2 8 Aug 20155 \date 23 June 2016 6 6 7 7 \brief A special transformation to generate a grid. 8 8 */ 9 9 #include "grid_generate.hpp" 10 #include "grid.hpp" 10 11 #include "domain_algorithm_generate_rectilinear.hpp" 11 #include "context.hpp"12 #include "context_client.hpp"13 12 #include "generate_rectilinear_domain.hpp" 14 13 15 14 namespace xios { 16 15 CGridGenerate::CGridGenerate(CGrid* destination, CGrid* source) 17 : gridSource_(source), gridDestination_(destination), algoTypes_()16 : CGridTransformationSelector(destination, source) 18 17 { 19 if (0 != source)20 {21 //Verify the compatibity between two grids22 int numElement = gridDestination_->axis_domain_order.numElements();23 if (numElement != gridSource_->axis_domain_order.numElements())24 ERROR("CGridGenerate::CGridGenerate(CGrid* destination, CGrid* source)",25 << "Two grids have different number of elements"26 << "Number of elements of grid source " <<gridSource_->getId() << " is " << gridSource_->axis_domain_order.numElements() << std::endl27 << "Number of elements of grid destination " <<gridDestination_->getId() << " is " << numElement);28 29 for (int i = 0; i < numElement; ++i)30 {31 if (gridDestination_->axis_domain_order(i) != gridSource_->axis_domain_order(i))32 ERROR("CGridGenerate::CGridGenerate(CGrid* destination, CGrid* source)",33 << "Transformed grid and its grid source have incompatible elements"34 << "Grid source " <<gridSource_->getId() << std::endl35 << "Grid destination " <<gridDestination_->getId());36 }37 }38 39 initializeAlgorithms();40 18 } 41 19 42 20 CGridGenerate::~CGridGenerate() 43 21 { 44 std::list<CGenericAlgorithmTransformation*>::const_iterator itb = algoTransformation_.begin(), it,45 ite = algoTransformation_.end();46 for (it = itb; it != ite; ++it) delete (*it);47 22 } 48 23 49 24 /*! 50 Initialize the algorithms (transformations) 51 */ 52 void CGridGenerate::initializeAlgorithms() 53 { 54 std::vector<int> axisPositionInGrid; 55 std::vector<int> domPositionInGrid; 56 std::vector<CAxis*> axisListDestP = gridDestination_->getAxis(); 57 std::vector<CDomain*> domListDestP = gridDestination_->getDomains(); 58 59 int idx = 0; 60 for (int i = 0; i < gridDestination_->axis_domain_order.numElements(); ++i) 61 { 62 if (false == (gridDestination_->axis_domain_order)(i)) 63 { 64 axisPositionInGrid.push_back(idx); 65 ++idx; 66 } 67 else 68 { 69 ++idx; 70 domPositionInGrid.push_back(idx); 71 ++idx; 72 } 73 } 74 75 for (int i = 0; i < axisListDestP.size(); ++i) 76 { 77 elementPosition2AxisPositionInGrid_[axisPositionInGrid[i]] = i; 78 } 79 80 for (int i = 0; i < domListDestP.size(); ++i) 81 { 82 elementPosition2DomainPositionInGrid_[domPositionInGrid[i]] = i; 83 } 84 85 idx = 0; 86 for (int i = 0; i < gridDestination_->axis_domain_order.numElements(); ++i) 87 { 88 if (false == (gridDestination_->axis_domain_order)(i)) 89 { 90 initializeAxisAlgorithms(idx); 91 ++idx; 92 } 93 else 94 { 95 ++idx; 96 initializeDomainAlgorithms(idx); 97 ++idx; 98 } 99 } 100 } 101 102 103 104 /*! 105 Initialize the algorithms corresponding to transformation info contained in each axis. 106 If an axis has transformations, these transformations will be represented in form of vector of CTransformation pointers 107 In general, each axis can have several transformations performed on itself. However, should they be done seperately or combinely (of course in order)? 108 For now, one approach is to do these combinely but maybe this needs changing. 109 \param [in] axisPositionInGrid position of an axis in grid. (for example: a grid with one domain and one axis, position of domain is 1, position of axis is 2) 110 */ 111 void CGridGenerate::initializeAxisAlgorithms(int axisPositionInGrid) 112 { 113 std::vector<CAxis*> axisListDestP = gridDestination_->getAxis(); 114 if (!axisListDestP.empty()) 115 { 116 if (axisListDestP[elementPosition2AxisPositionInGrid_[axisPositionInGrid]]->hasTransformation()) 117 { 118 CAxis::TransMapTypes trans = axisListDestP[elementPosition2AxisPositionInGrid_[axisPositionInGrid]]->getAllTransformations(); 119 CAxis::TransMapTypes::const_iterator itb = trans.begin(), it, 120 ite = trans.end(); 121 int transformationOrder = 0; 122 for (it = itb; it != ite; ++it) 123 { 124 listAlgos_.push_back(std::make_pair(axisPositionInGrid, std::make_pair(it->first, transformationOrder))); 125 algoTypes_.push_back(false); 126 ++transformationOrder; 127 } 128 } 129 } 130 } 131 132 /*! 133 Initialize the algorithms corresponding to transformation info contained in each domain. 134 If a domain has transformations, they will be represented in form of vector of CTransformation pointers 135 In general, each domain can have several transformations performed on itself. 136 \param [in] domPositionInGrid position of a domain in grid. (for example: a grid with one domain and one axis, position of domain is 1, position of axis is 2) 137 */ 138 void CGridGenerate::initializeDomainAlgorithms(int domPositionInGrid) 139 { 140 std::vector<CDomain*> domListDestP = gridDestination_->getDomains(); 141 if (!domListDestP.empty()) 142 { 143 if (domListDestP[elementPosition2DomainPositionInGrid_[domPositionInGrid]]->hasTransformation()) 144 { 145 CDomain::TransMapTypes trans = domListDestP[elementPosition2DomainPositionInGrid_[domPositionInGrid]]->getAllTransformations(); 146 CDomain::TransMapTypes::const_iterator itb = trans.begin(), it, 147 ite = trans.end(); 148 int transformationOrder = 0; 149 for (it = itb; it != ite; ++it) 150 { 151 listAlgos_.push_back(std::make_pair(domPositionInGrid, std::make_pair(it->first, transformationOrder))); 152 algoTypes_.push_back(true); 153 ++transformationOrder; 154 } 155 } 156 } 157 158 } 159 160 /*! 161 Select algorithm correspoding to its transformation type and its position in each element 25 Select algorithm of an axis correspoding to its transformation type and its position in each element 162 26 \param [in] elementPositionInGrid position of element in grid. e.g: a grid has 1 domain and 1 axis, then position of domain is 1 (because it contains 2 basic elements) 163 27 and position of axis is 2 164 28 \param [in] transType transformation type, for now we have Zoom_axis, inverse_axis 165 29 \param [in] transformationOrder position of the transformation in an element (an element can have several transformation) 166 \param [in] isDomainAlgo flag to specify type of algorithm (for domain or axis)167 30 */ 168 void CGridGenerate::select Algo(int elementPositionInGrid, ETranformationType transType, int transformationOrder, bool isDomainAlgo)31 void CGridGenerate::selectScalarAlgo(int elementPositionInGrid, ETranformationType transType, int transformationOrder) 169 32 { 170 if (isDomainAlgo) selectDomainAlgo(elementPositionInGrid, transType, transformationOrder);171 else selectAxisAlgo(elementPositionInGrid, transType, transformationOrder);33 CGenericAlgorithmTransformation* algo = 0; 34 algoTransformation_.push_back(algo); 172 35 } 173 36 … … 181 44 void CGridGenerate::selectAxisAlgo(int elementPositionInGrid, ETranformationType transType, int transformationOrder) 182 45 { 183 std::vector<CAxis*> axisListDestP = gridDestination_->getAxis();184 185 int axisIndex = elementPosition2AxisPositionInGrid_[elementPositionInGrid];186 CAxis::TransMapTypes trans = axisListDestP[axisIndex]->getAllTransformations();187 CAxis::TransMapTypes::const_iterator it = trans.begin();188 189 for (int i = 0; i < transformationOrder; ++i, ++it) {} // Find the correct transformation190 191 46 CGenericAlgorithmTransformation* algo = 0; 192 switch (transType)193 {194 default:195 break;196 }197 47 algoTransformation_.push_back(algo); 198 199 48 } 200 49 … … 212 61 if (0 != gridSource_) domainListSrcP = gridSource_->getDomains(); 213 62 214 int domainIndex = elementPosition 2DomainPositionInGrid_[elementPositionInGrid];63 int domainIndex = elementPositionInGridDst2DomainPosition_[elementPositionInGrid]; 215 64 CDomain::TransMapTypes trans = domainListDestP[domainIndex]->getAllTransformations(); 216 65 CDomain::TransMapTypes::const_iterator it = trans.begin(); … … 246 95 void CGridGenerate::completeGrid() 247 96 { 248 CContext* context = CContext::getCurrent();249 CContextClient* client = context->client;250 251 97 ListAlgoType::const_iterator itb = listAlgos_.begin(), 252 98 ite = listAlgos_.end(), it; -
XIOS/trunk/src/transformation/grid_generate.hpp
r775 r887 12 12 #include "xios_spl.hpp" 13 13 #include "transformation_enum.hpp" 14 #include "g eneric_algorithm_transformation.hpp"14 #include "grid_transformation_selector.hpp" 15 15 16 16 namespace xios { … … 25 25 This class only plays a role of interface between XIOS and specific algorithm of auto filling-in and auto distributing on sub-component 26 26 */ 27 class CGridGenerate 27 class CGridGenerate : public CGridTransformationSelector 28 28 { 29 public:30 typedef std::list<std::pair<int,std::pair<ETranformationType,int> > > ListAlgoType;31 32 29 public: 33 30 /** Default constructor */ … … 36 33 37 34 void completeGrid(); 38 ListAlgoType getAlgoList() const {return listAlgos_; }39 35 40 36 protected: 41 void initializeAlgorithms(); 42 void initializeAxisAlgorithms(int axisPositionInGrid); 43 void initializeDomainAlgorithms(int domPositionInGrid); 44 45 void selectAxisAlgo(int elementPositionInGrid, ETranformationType transType, int transformationOrder); 46 void selectDomainAlgo(int elementPositionInGrid, ETranformationType transType, int transformationOrder); 47 void selectAlgo(int elementPositionInGrid, ETranformationType transType, int transformationOrder, bool isDomainAlgo); 48 49 protected: 50 //! Grid source on transformation 51 CGrid* gridSource_; 52 53 //! Grid destination on transformation 54 CGrid* gridDestination_; 55 56 protected: 57 //! List of algorithm types and their order 58 ListAlgoType listAlgos_; 59 // true if domain algorithm and false if axis algorithm (can be replaced by tuple with listAlgos_ 60 std::vector<bool> algoTypes_; 61 62 // Mapping between position of an element in grid and its transformation (if any) 63 std::list<CGenericAlgorithmTransformation*> algoTransformation_; 64 65 //! Position of axis and domain in grid 66 std::map<int, int> elementPosition2AxisPositionInGrid_, elementPosition2DomainPositionInGrid_; 37 virtual void selectScalarAlgo(int elementPositionInGrid, ETranformationType transType, int transformationOrder); 38 virtual void selectAxisAlgo(int elementPositionInGrid, ETranformationType transType, int transformationOrder); 39 virtual void selectDomainAlgo(int elementPositionInGrid, ETranformationType transType, int transformationOrder); 67 40 }; 68 41 -
XIOS/trunk/src/transformation/grid_transformation.cpp
r873 r887 23 23 namespace xios { 24 24 CGridTransformation::CGridTransformation(CGrid* destination, CGrid* source) 25 : gridSource_(source), gridDestination_(destination), tmpGridDestination_(destination), 26 originalGridSource_(source), algoTypes_(), nbAlgos_(0), tempGridSrcs_(), tempGridDests_(), 27 auxInputs_(), dynamicalTransformation_(false), timeStamp_() 28 29 { 30 //Verify the compatibity between two grids 31 int numElement = gridDestination_->axis_domain_order.numElements(); 32 if (numElement != gridSource_->axis_domain_order.numElements()) 33 ERROR("CGridTransformation::CGridTransformation(CGrid* destination, CGrid* source)", 34 << "Two grids have different number of elements" 35 << "Number of elements of grid source " <<gridSource_->getId() << " is " << gridSource_->axis_domain_order.numElements() << std::endl 36 << "Number of elements of grid destination " <<gridDestination_->getId() << " is " << numElement); 37 38 for (int i = 0; i < numElement; ++i) 39 { 40 if (gridDestination_->axis_domain_order(i) != gridSource_->axis_domain_order(i)) 41 ERROR("CGridTransformation::CGridTransformation(CGrid* destination, CGrid* source)", 42 << "Transformed grid and its grid source have incompatible elements" 43 << "Grid source " <<gridSource_->getId() << std::endl 44 << "Grid destination " <<gridDestination_->getId()); 45 } 46 47 initializeTransformations(); 48 } 49 50 /*! 51 Initialize the mapping between the first grid source and the original one 52 In a series of transformation, for each step, there is a need to "create" a new grid that plays a role of "temporary" source. 53 Because at the end of the series, we need to know about the index mapping between the final grid destination and original grid source, 54 for each transformation, we need to make sure that the current "temporary source" maps its global index correctly to the original one. 55 */ 56 void CGridTransformation::initializeTransformations() 57 { 58 CContext* context = CContext::getCurrent(); 59 CContextClient* client = context->client; 60 61 // Initialize algorithms 62 initializeAlgorithms(); 63 64 ListAlgoType::const_iterator itb = listAlgos_.begin(), 65 ite = listAlgos_.end(), it; 66 67 for (it = itb; it != ite; ++it) 68 { 69 ETranformationType transType = (it->second).first; 70 if (!isSpecialTransformation(transType)) ++nbAlgos_; 71 } 25 : CGridTransformationSelector(destination, source), 26 tmpGridDestination_(destination), originalGridSource_(source), 27 tempGridSrcs_(), tempGridDests_(), 28 dynamicalTransformation_(false), timeStamp_() 29 { 72 30 } 73 31 74 32 CGridTransformation::~CGridTransformation() 75 33 { 76 std::vector<CGenericAlgorithmTransformation*>::const_iterator itb = algoTransformation_.begin(), it, 77 ite = algoTransformation_.end(); 78 for (it = itb; it != ite; ++it) delete (*it); 79 } 80 81 /*! 82 Initialize the algorithms (transformations) 83 */ 84 void CGridTransformation::initializeAlgorithms() 85 { 86 std::vector<int> axisPositionInGrid; 87 std::vector<int> domPositionInGrid; 88 std::vector<CAxis*> axisListDestP = gridDestination_->getAxis(); 89 std::vector<CDomain*> domListDestP = gridDestination_->getDomains(); 90 91 int idx = 0; 92 for (int i = 0; i < gridDestination_->axis_domain_order.numElements(); ++i) 93 { 94 if (false == (gridDestination_->axis_domain_order)(i)) 95 { 96 axisPositionInGrid.push_back(i); 97 } 98 else 99 { 100 domPositionInGrid.push_back(i); 101 } 102 } 103 104 for (int i = 0; i < axisListDestP.size(); ++i) 105 { 106 elementPosition2AxisPositionInGrid_[axisPositionInGrid[i]] = i; 107 } 108 109 for (int i = 0; i < domListDestP.size(); ++i) 110 { 111 elementPosition2DomainPositionInGrid_[domPositionInGrid[i]] = i; 112 } 113 114 idx = 0; 115 for (int i = 0; i < gridDestination_->axis_domain_order.numElements(); ++i) 116 { 117 if (false == (gridDestination_->axis_domain_order)(i)) 118 { 119 initializeAxisAlgorithms(i); 120 } 121 else 122 { 123 initializeDomainAlgorithms(i); 124 } 125 } 126 } 127 128 /*! 129 Initialize the algorithms corresponding to transformation info contained in each axis. 130 If an axis has transformations, these transformations will be represented in form of vector of CTransformation pointers 131 In general, each axis can have several transformations performed on itself. However, should they be done seperately or combinely (of course in order)? 132 For now, one approach is to do these combinely but maybe this needs changing. 133 \param [in] axisPositionInGrid position of an axis in grid. (for example: a grid with one domain and one axis, position of domain is 1, position of axis is 2) 134 */ 135 void CGridTransformation::initializeAxisAlgorithms(int axisPositionInGrid) 34 } 35 36 /*! 37 Select algorithm of a scalar correspoding to its transformation type and its position in each element 38 \param [in] elementPositionInGrid position of element in grid. e.g: a grid has 1 domain and 1 axis, then position of domain is 0 and position of axis is 1 39 \param [in] transType transformation type, for now we have 40 \param [in] transformationOrder position of the transformation in an element (an element can have several transformation) 41 */ 42 void CGridTransformation::selectScalarAlgo(int elementPositionInGrid, ETranformationType transType, int transformationOrder) 43 { 44 45 } 46 47 /*! 48 Select algorithm of an axis correspoding to its transformation type and its position in each element 49 \param [in] elementPositionInGrid position of element in grid. e.g: a grid has 1 domain and 1 axis, then position of domain is 0 and position of axis is 1 50 \param [in] transType transformation type, for now we have zoom_axis, inverse_axis, interpolate_axis 51 \param [in] transformationOrder position of the transformation in an element (an element can have several transformation) 52 */ 53 void CGridTransformation::selectAxisAlgo(int elementPositionInGrid, ETranformationType transType, int transformationOrder) 136 54 { 137 55 std::vector<CAxis*> axisListDestP = gridDestination_->getAxis(); 138 56 std::vector<CAxis*> axisListSrcP = gridSource_->getAxis(); 139 if (!axisListDestP.empty()) 140 { 141 // If source and destination grid share the same axis 142 if (axisListDestP[elementPosition2AxisPositionInGrid_[axisPositionInGrid]] == 143 axisListSrcP[elementPosition2AxisPositionInGrid_[axisPositionInGrid]]) return; 144 145 if (axisListDestP[elementPosition2AxisPositionInGrid_[axisPositionInGrid]]->hasTransformation()) 146 { 147 CAxis::TransMapTypes trans = axisListDestP[elementPosition2AxisPositionInGrid_[axisPositionInGrid]]->getAllTransformations(); 148 CAxis::TransMapTypes::const_iterator itb = trans.begin(), it, 149 ite = trans.end(); 150 int transformationOrder = 0; 151 for (it = itb; it != ite; ++it) 152 { 153 listAlgos_.push_back(std::make_pair(axisPositionInGrid, std::make_pair(it->first, transformationOrder))); 154 algoTypes_.push_back(false); 155 ++transformationOrder; 156 std::vector<StdString> auxInput = (it->second)->checkAuxInputs(); 157 for (int idx = 0; idx < auxInput.size(); ++idx) auxInputs_.push_back(auxInput[idx]); 158 } 159 } 160 } 161 } 162 163 /*! 164 Initialize the algorithms corresponding to transformation info contained in each domain. 165 If a domain has transformations, they will be represented in form of vector of CTransformation pointers 166 In general, each domain can have several transformations performed on itself. 167 \param [in] domPositionInGrid position of a domain in grid. (for example: a grid with one domain and one axis, position of domain is 1, position of axis is 2) 168 */ 169 void CGridTransformation::initializeDomainAlgorithms(int domPositionInGrid) 170 { 171 std::vector<CDomain*> domListDestP = gridDestination_->getDomains(); 172 std::vector<CDomain*> domListSrcP = gridSource_->getDomains(); 173 if (!domListDestP.empty()) 174 { 175 // If source and destination grid share the same domain 176 if (domListDestP[elementPosition2DomainPositionInGrid_[domPositionInGrid]] == 177 domListSrcP[elementPosition2DomainPositionInGrid_[domPositionInGrid]]) return; 178 179 if (domListDestP[elementPosition2DomainPositionInGrid_[domPositionInGrid]]->hasTransformation()) 180 { 181 CDomain::TransMapTypes trans = domListDestP[elementPosition2DomainPositionInGrid_[domPositionInGrid]]->getAllTransformations(); 182 CDomain::TransMapTypes::const_iterator itb = trans.begin(), it, 183 ite = trans.end(); 184 int transformationOrder = 0; 185 for (it = itb; it != ite; ++it) 186 { 187 listAlgos_.push_back(std::make_pair(domPositionInGrid, std::make_pair(it->first, transformationOrder))); 188 algoTypes_.push_back(true); 189 ++transformationOrder; 190 std::vector<StdString> auxInput = (it->second)->checkAuxInputs(); 191 for (int idx = 0; idx < auxInput.size(); ++idx) auxInputs_.push_back(auxInput[idx]); 192 } 193 } 194 } 195 196 } 197 198 /*! 199 Select algorithm correspoding to its transformation type and its position in each element 200 \param [in] elementPositionInGrid position of element in grid. e.g: a grid has 1 domain and 1 axis, then position of domain is 1 (because it contains 2 basic elements) 201 and position of axis is 2 202 \param [in] transType transformation type, for now we have Zoom_axis, inverse_axis 203 \param [in] transformationOrder position of the transformation in an element (an element can have several transformation) 204 \param [in] isDomainAlgo flag to specify type of algorithm (for domain or axis) 205 */ 206 void CGridTransformation::selectAlgo(int elementPositionInGrid, ETranformationType transType, int transformationOrder, bool isDomainAlgo) 207 { 208 if (isDomainAlgo) selectDomainAlgo(elementPositionInGrid, transType, transformationOrder); 209 else selectAxisAlgo(elementPositionInGrid, transType, transformationOrder); 210 } 211 212 /*! 213 Select algorithm of an axis correspoding to its transformation type and its position in each element 214 \param [in] elementPositionInGrid position of element in grid. e.g: a grid has 1 domain and 1 axis, then position of domain is 1 (because it contains 2 basic elements) 215 and position of axis is 2 216 \param [in] transType transformation type, for now we have Zoom_axis, inverse_axis 217 \param [in] transformationOrder position of the transformation in an element (an element can have several transformation) 218 */ 219 void CGridTransformation::selectAxisAlgo(int elementPositionInGrid, ETranformationType transType, int transformationOrder) 220 { 221 std::vector<CAxis*> axisListDestP = gridDestination_->getAxis(); 222 std::vector<CAxis*> axisListSrcP = gridSource_->getAxis(); 223 224 int axisIndex = elementPosition2AxisPositionInGrid_[elementPositionInGrid]; 57 58 int axisIndex = elementPositionInGridDst2AxisPosition_[elementPositionInGrid]; 225 59 CAxis::TransMapTypes trans = axisListDestP[axisIndex]->getAllTransformations(); 226 60 CAxis::TransMapTypes::const_iterator it = trans.begin(); … … 248 82 } 249 83 algoTransformation_.push_back(algo); 250 251 84 } 252 85 253 86 /*! 254 87 Select algorithm of a domain correspoding to its transformation type and its position in each element 255 \param [in] elementPositionInGrid position of element in grid. e.g: a grid has 1 domain and 1 axis, then position of domain is 1 (because it contains 2 basic elements) 256 and position of axis is 2 257 \param [in] transType transformation type, for now we have Zoom_axis, inverse_axis 88 \param [in] elementPositionInGrid position of element in grid. e.g: a grid has 1 domain and 1 axis, then position of domain is 0 and position of axis is 1 89 \param [in] transType transformation type, for now we have zoom_domain, interpolate_domain 258 90 \param [in] transformationOrder position of the transformation in an element (an element can have several transformation) 259 91 */ … … 263 95 std::vector<CDomain*> domainListSrcP = gridSource_->getDomains(); 264 96 265 int domainIndex = elementPosition 2DomainPositionInGrid_[elementPositionInGrid];97 int domainIndex = elementPositionInGridDst2DomainPosition_[elementPositionInGrid]; 266 98 CDomain::TransMapTypes trans = domainListDestP[domainIndex]->getAllTransformations(); 267 99 CDomain::TransMapTypes::const_iterator it = trans.begin(); … … 302 134 tempGridDests_.resize(0); 303 135 } 136 137 std::vector<CScalar*> scalarListDestP = gridDestination_->getScalars(); 138 std::vector<CScalar*> scalarListSrcP = gridSource_->getScalars(), scalarDst; 139 304 140 std::vector<CAxis*> axisListDestP = gridDestination_->getAxis(); 305 141 std::vector<CAxis*> axisListSrcP = gridSource_->getAxis(), axisDst; … … 308 144 std::vector<CDomain*> domListSrcP = gridSource_->getDomains(), domainDst; 309 145 310 int axisIndex = -1, domainIndex = -1; 146 CArray<int,1> axisDomainOrderSrc = gridSource_->axis_domain_order; 147 CArray<int,1> axisDomainOrderDst = gridDestination_->axis_domain_order; 148 149 int scalarIndex = -1, axisIndex = -1, domainIndex = -1; 311 150 switch (transType) 312 151 { 313 152 case TRANS_INTERPOLATE_DOMAIN: 314 153 case TRANS_ZOOM_DOMAIN: 315 domainIndex = elementPosition 2DomainPositionInGrid_[elementPositionInGrid];154 domainIndex = elementPositionInGridDst2DomainPosition_[elementPositionInGrid]; 316 155 break; 317 156 … … 319 158 case TRANS_ZOOM_AXIS: 320 159 case TRANS_INVERSE_AXIS: 321 axisIndex = elementPosition 2AxisPositionInGrid_[elementPositionInGrid];160 axisIndex = elementPositionInGridDst2AxisPosition_[elementPositionInGrid]; 322 161 break; 323 162 default: … … 325 164 } 326 165 327 for (int idx = 0; idx < axisListSrcP.size(); ++idx) 328 { 329 CAxis* axis = (axisIndex != idx) ? axisListSrcP[idx] : axisListDestP[idx]; 330 axisDst.push_back(axis); 331 } 332 333 for (int idx = 0; idx < domListSrcP.size(); ++idx) 334 { 335 CDomain* domain = (domainIndex != idx) ? domListSrcP[idx] : domListDestP[idx]; 336 domainDst.push_back(domain); 337 } 338 339 tmpGridDestination_ = CGrid::createGrid(domainDst, axisDst, gridDestination_->axis_domain_order); 340 tmpGridDestination_->computeGridGlobalDimension(domainDst, axisDst, gridDestination_->axis_domain_order); 166 for (int idx = 0; idx < axisDomainOrderDst.numElements(); ++idx) 167 { 168 int dimElementDst = axisDomainOrderDst(idx); 169 if (2 == dimElementDst) 170 { 171 if (elementPositionInGrid == idx) 172 domainDst.push_back(domListDestP[domainIndex]); 173 else 174 domainDst.push_back(domListSrcP[elementPositionInGridSrc2DomainPosition_[elementPositionInGrid]]); 175 } 176 else if (1 == dimElementDst) 177 { 178 if (elementPositionInGrid == idx) 179 axisDst.push_back(axisListDestP[axisIndex]); 180 else 181 axisDst.push_back(axisListSrcP[elementPositionInGridSrc2AxisPosition_[elementPositionInGrid]]); 182 } 183 else 184 { 185 if (elementPositionInGrid == idx) 186 scalarDst.push_back(scalarListDestP[scalarIndex]); 187 else 188 scalarDst.push_back(scalarListSrcP[elementPositionInGridSrc2ScalarPosition_[elementPositionInGrid]]); 189 } 190 } 191 192 tmpGridDestination_ = CGrid::createGrid(domainDst, axisDst, scalarDst, gridDestination_->axis_domain_order); 193 tmpGridDestination_->computeGridGlobalDimension(domainDst, axisDst, scalarDst, gridDestination_->axis_domain_order); 341 194 tempGridDests_.push_back(tmpGridDestination_); 342 195 } … … 356 209 } 357 210 211 std::vector<CScalar*> scalarListDestP = tmpGridDestination_->getScalars(); 212 std::vector<CScalar*> scalarListSrcP = gridSource_->getScalars(), scalarSrc; 213 358 214 std::vector<CAxis*> axisListDestP = tmpGridDestination_->getAxis(); 359 215 std::vector<CAxis*> axisListSrcP = gridSource_->getAxis(), axisSrc; … … 362 218 std::vector<CDomain*> domListSrcP = gridSource_->getDomains(), domainSrc; 363 219 364 int axisIndex = -1, domainIndex = -1; 220 CArray<int,1> axisDomainOrderDst = gridDestination_->axis_domain_order; 221 222 int axisIndex = -1, domainIndex = -1, scalarIndex = -1; 223 int axisListIndex = 0, domainListIndex = 0, scalarListIndex = 0; 365 224 switch (transType) 366 225 { 367 226 case TRANS_INTERPOLATE_DOMAIN: 368 227 case TRANS_ZOOM_DOMAIN: 369 domainIndex = elementPosition 2DomainPositionInGrid_[elementPositionInGrid];228 domainIndex = elementPositionInGridDst2DomainPosition_[elementPositionInGrid]; 370 229 break; 371 230 … … 373 232 case TRANS_ZOOM_AXIS: 374 233 case TRANS_INVERSE_AXIS: 375 axisIndex = elementPosition 2AxisPositionInGrid_[elementPositionInGrid];234 axisIndex = elementPositionInGridDst2AxisPosition_[elementPositionInGrid]; 376 235 break; 377 236 default: … … 379 238 } 380 239 381 for (int idx = 0; idx < axisListSrcP.size(); ++idx) 382 { 383 if (axisIndex != idx) 384 { 385 CAxis* axis = axisListDestP[idx]; 386 axisSrc.push_back(axis); 240 for (int idx = 0; idx < axisDomainOrderDst.numElements(); ++idx) 241 { 242 int dimElementDst = axisDomainOrderDst(idx); 243 if (2 == dimElementDst) 244 { 245 if (elementPositionInGrid == idx) 246 domainSrc.push_back(domListDestP[domainIndex]); 247 else 248 { 249 CDomain* domain = CDomain::createDomain(); 250 domain->domain_ref.setValue(domListDestP[domainListIndex]->getId()); 251 domain->solveRefInheritance(true); 252 domain->checkAttributesOnClient(); 253 domainSrc.push_back(domain); 254 } 255 ++domainListIndex; 256 } 257 else if (1 == dimElementDst) 258 { 259 if (elementPositionInGrid == idx) 260 axisSrc.push_back(axisListDestP[axisIndex]); 261 else 262 { 263 CAxis* axis = CAxis::createAxis(); 264 axis->axis_ref.setValue(axisListDestP[axisListIndex]->getId()); 265 axis->solveRefInheritance(true); 266 axis->checkAttributesOnClient(); 267 axisSrc.push_back(axis); 268 } 269 ++axisListIndex; 387 270 } 388 271 else 389 272 { 390 CAxis* axis = CAxis::createAxis(); 391 axis->axis_ref.setValue(axisListDestP[idx]->getId()); 392 axis->solveRefInheritance(true); 393 axis->checkAttributesOnClient(); 394 axisSrc.push_back(axis); 395 } 396 } 397 398 for (int idx = 0; idx < domListSrcP.size(); ++idx) 399 { 400 if (domainIndex != idx) 401 { 402 CDomain* domain = domListDestP[idx]; 403 domainSrc.push_back(domain); 404 } 405 else 406 { 407 CDomain* domain = CDomain::createDomain(); 408 domain->domain_ref.setValue(domListDestP[idx]->getId()); 409 domain->solveRefInheritance(true); 410 domain->checkAttributesOnClient(); 411 domainSrc.push_back(domain); 412 } 413 } 414 415 gridSource_ = CGrid::createGrid(domainSrc, axisSrc, tmpGridDestination_->axis_domain_order); 416 gridSource_->computeGridGlobalDimension(domainSrc, axisSrc, tmpGridDestination_->axis_domain_order); 273 if (elementPositionInGrid == idx) 274 scalarSrc.push_back(scalarListDestP[scalarIndex]); 275 else 276 { 277 CScalar* scalar = CScalar::createScalar(); 278 scalar->scalar_ref.setValue(scalarListDestP[scalarListIndex]->getId()); 279 scalar->solveRefInheritance(true); 280 scalar->checkAttributesOnClient(); 281 scalarSrc.push_back(scalar); 282 } 283 ++scalarListIndex; 284 } 285 } 286 287 gridSource_ = CGrid::createGrid(domainSrc, axisSrc, scalarSrc, tmpGridDestination_->axis_domain_order); 288 gridSource_->computeGridGlobalDimension(domainSrc, axisSrc, scalarSrc, tmpGridDestination_->axis_domain_order); 417 289 418 290 tempGridSrcs_.push_back(gridSource_); … … 429 301 void CGridTransformation::computeAll(const std::vector<CArray<double,1>* >& dataAuxInputs, Time timeStamp) 430 302 { 431 if (nb Algos_ < 1) return;303 if (nbNormalAlgos_ < 1) return; 432 304 if (!auxInputs_.empty() && !dynamicalTransformation_) { dynamicalTransformation_ = true; return; } 433 305 if (dynamicalTransformation_) … … 486 358 computeTransformationMapping(globaIndexWeightFromSrcToDst); 487 359 488 if (1 < nb Algos_)360 if (1 < nbNormalAlgos_) 489 361 { 490 362 // Now grid destination becomes grid source in a new transformation 491 if (nbAgloTransformation != (nb Algos_-1)) setUpGridSource(elementPositionInGrid, transType, nbAgloTransformation);363 if (nbAgloTransformation != (nbNormalAlgos_-1)) setUpGridSource(elementPositionInGrid, transType, nbAgloTransformation); 492 364 } 493 365 ++nbAgloTransformation; … … 725 597 } 726 598 727 bool CGridTransformation::isSpecialTransformation(ETranformationType transType)728 {729 bool res;730 switch (transType)731 {732 case TRANS_GENERATE_RECTILINEAR_DOMAIN:733 res = true;734 break;735 default:736 res = false;737 break;738 }739 740 return res;741 }742 743 599 /*! 744 600 Local index of data which need sending from the grid source -
XIOS/trunk/src/transformation/grid_transformation.hpp
r871 r887 15 15 #include "transformation_enum.hpp" 16 16 #include "duration.hpp" 17 #include "grid_transformation_selector.hpp" 17 18 18 19 namespace xios { … … 30 31 the grid destination of current transformation will be grid source of the next transformation 31 32 */ 32 class CGridTransformation 33 class CGridTransformation : public CGridTransformationSelector 33 34 { 34 35 public: 35 typedef std::list<std::pair<int,std::pair<ETranformationType,int> > > ListAlgoType;36 typedef boost::unordered_map<size_t, std::vector<std::pair<int, std::pair<size_t,double> > > > DestinationIndexMap;37 36 typedef std::map<int, CArray<int,1> > SendingIndexGridSourceMap; 38 37 typedef std::map<int,std::vector<std::pair<int,double> > > RecvIndexGridDestinationMap; … … 53 52 CGrid* getGridSource() { return originalGridSource_; } 54 53 CGrid* getGridDestination() { return gridDestination_; } 55 ListAlgoType getAlgoList() const {return listAlgos_; }56 int getNbAlgo() { return nbAlgos_; }57 const std::vector<StdString>& getAuxInputs() const { return auxInputs_; }58 54 59 55 protected: 60 56 void computeTransformation(); 61 void initializeAlgorithms();62 void initializeAxisAlgorithms(int axisPositionInGrid);63 void initializeDomainAlgorithms(int domPositionInGrid);64 void initializeTransformations();65 57 66 void selectAxisAlgo(int elementPositionInGrid, ETranformationType transType, int transformationOrder); 67 void selectDomainAlgo(int elementPositionInGrid, ETranformationType transType, int transformationOrder); 68 void selectAlgo(int elementPositionInGrid, ETranformationType transType, int transformationOrder, bool isDomainAlgo); 58 virtual void selectScalarAlgo(int elementPositionInGrid, ETranformationType transType, int transformationOrder); 59 virtual void selectAxisAlgo(int elementPositionInGrid, ETranformationType transType, int transformationOrder); 60 virtual void selectDomainAlgo(int elementPositionInGrid, ETranformationType transType, int transformationOrder); 61 69 62 void setUpGridSource(int elementPositionInGrid, ETranformationType transType, int nbTransformation); 70 63 void setUpGridDestination(int elementPositionInGrid, ETranformationType transType, int nbTransformation); 71 64 void computeTransformationMapping(const SourceDestinationIndexMap& globalIndexWeightFromSrcToDest); 72 bool isSpecialTransformation(ETranformationType transType);73 65 74 66 protected: 75 //! Grid source on transformation76 CGrid* gridSource_;77 78 //! Grid destination on transformation79 CGrid* gridDestination_, *tmpGridDestination_;80 81 67 //! The grid source of the first transformation (original grid source) 68 CGrid* tmpGridDestination_; 82 69 CGrid* originalGridSource_; 70 std::vector<CGrid*> tempGridSrcs_, tempGridDests_; 83 71 84 72 protected: 85 //! List of algorithm types and their order86 ListAlgoType listAlgos_;87 88 //! Number of algorithm89 int nbAlgos_;90 91 // true if domain algorithm and false if axis algorithm (can be replaced by tuple with listAlgos_92 std::vector<bool> algoTypes_;93 94 // Mapping between position of an element in grid and its transformation (if any)95 std::vector<CGenericAlgorithmTransformation*> algoTransformation_;96 97 73 //! Mapping of (grid) global index representing tranformation. 98 74 std::map<size_t, std::set<size_t> > globaIndexMapFromDestToSource_; … … 108 84 std::list<std::vector<bool> > localMaskOnGridDest_; 109 85 110 //! Position of axis and domain in grid111 std::map<int, int> elementPosition2AxisPositionInGrid_, elementPosition2DomainPositionInGrid_;112 113 std::vector<CGrid*> tempGridSrcs_, tempGridDests_;114 std::vector<StdString> auxInputs_;115 86 bool dynamicalTransformation_; 116 117 87 std::set<Time> timeStamp_; //! Time stamps for auxillary inputs 118 88 }; -
XIOS/trunk/src/type/type_util.hpp
r689 r887 32 32 class CGenerateRectilinearDomain; 33 33 class CGenerateRectilinearDomainGroup; 34 class CScalar; 35 class CScalarGroup; 34 36 35 37 template <typename T> inline string getStrType(void); … … 80 82 macro(CGenerateRectilinearDomain) 81 83 macro(CGenerateRectilinearDomainGroup) 84 macro(CScalar) 85 macro(CScalarGroup) 82 86 #undef macro 83 87 } -
XIOS/trunk/src/xml_parser_decl.cpp
r689 r887 25 25 macro( InterpolateDomain ) 26 26 macro( GenerateRectilinearDomain ) 27 macro( Scalar ) 27 28 } 28 29 }
Note: See TracChangeset
for help on using the changeset viewer.