Changeset 623


Ignore:
Timestamp:
06/22/15 13:36:31 (9 years ago)
Author:
mhnguyen
Message:

Implementing transformation algorithm: zoom axis (local commit)

+) Implement zoom axis: zoomed points are points not masked
+) Correct some minor bugs

Test
+) Ok with normal cases: zoom in the last of transformation list
+) There is still a bug in case of zoom then inverse

Location:
XIOS/trunk
Files:
1 added
2 deleted
20 edited
3 moved

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/inputs/Version2/iodef.xml

    r622 r623  
    4343     <axis id="axis_E" axis_ref="axis_B"> 
    4444        <inverse_axis /> 
    45         <inverse_axis /> 
    46 <!--        <zoom_axis zoom_begin="1" zoom_size="3" />--> 
     45 
     46        <zoom_axis zoom_begin="0" zoom_size="4" /> 
     47<!--        <inverse_axis />--> 
    4748     </axis> 
    4849     <axis id="axis_F" axis_ref="axis_A"> 
    49        <inverse_axis /> 
     50<!--       <inverse_axis />--> 
    5051     </axis> 
    5152   </axis_definition> 
     
    6364       <grid id="grid_Axis"> 
    6465         <axis axis_ref="axis_D" /> 
     66 
    6567       </grid> 
    6668       <grid id="grid_Two_Axis"> 
     
    7072       <grid id="grid_Axis_tranformed"> 
    7173<!--         <domain domain_ref="domain_A" />--> 
    72 <!--         <axis axis_ref="axis_E" />--> 
    7374         <axis axis_ref="axis_F" /> 
    7475         <axis axis_ref="axis_E" /> 
    75  
    7676       </grid> 
    7777       <grid id="grid_All_Axis"> 
  • XIOS/trunk/src/attribute_map.cpp

    r591 r623  
    144144      } 
    145145 
     146      void CAttributeMap::duplicateAttributes(const CAttributeMap* const srcAttr) 
     147      { 
     148         typedef std::pair<StdString, CAttribute*> StdStrAttPair; 
     149 
     150         SuperClassMap::const_iterator it = srcAttr->begin(), end = srcAttr->end(); 
     151         for (; it != end; it++) 
     152         { 
     153            const StdStrAttPair& el = *it; 
     154            if (this->hasAttribute(el.first)) 
     155            { 
     156               if (!el.second->isEmpty()) 
     157               { 
     158                 this->setAttribute(el.first, el.second); 
     159               } 
     160            } 
     161         } 
     162      } 
     163 
    146164      //--------------------------------------------------------------- 
    147165/* 
  • XIOS/trunk/src/attribute_map.hpp

    r591 r623  
    3030            void setAttributes(const xml::THashAttributes & attributes); 
    3131            void setAttributes(const CAttributeMap * const _parent, bool apply=true); 
    32  
     32            void duplicateAttributes(const CAttributeMap* const _parent); 
    3333            void clearAllAttributes(void); 
    3434 
  • XIOS/trunk/src/client_server_mapping_distributed.cpp

    r585 r623  
    3737   \param [in] localIndexOnClient local index on client 
    3838*/ 
    39 //void CClientServerMappingDistributed::computeServerIndexMapping(const CArray<size_t,1>& globalIndexOnClient, 
    40 //                                                                const CArray<int,1>& localIndexOnClient) 
    4139void CClientServerMappingDistributed::computeServerIndexMapping(const CArray<size_t,1>& globalIndexOnClient) 
    4240{ 
     
    180178  } 
    181179 
    182   if (0 != recvBuffIndexGlobal) delete recvBuffIndexGlobal; 
    183   if (0 != recvBuffIndexServer) delete recvBuffIndexServer; 
     180  if (0 != maxNbIndexDemandedFromOthers) delete [] recvBuffIndexGlobal; 
     181  if (0 != nbIndexReceivedFromOthers) delete [] recvBuffIndexServer; 
    184182  delete [] sendBuff; 
    185183  delete [] recvBuff; 
  • XIOS/trunk/src/distribution_client.cpp

    r621 r623  
    1313CDistributionClient::CDistributionClient(int rank, int dims, CArray<size_t,1>* globalIndex) 
    1414   : CDistribution(rank, dims, globalIndex), 
    15    localDataIndex_(0), axisDomainOrder_(), 
     15   globalDataSendToServer_(0), localDataIndex_(0), localDataIndexSendToServer_(0), localMaskIndex_(0), 
     16   axisDomainOrder_(), 
    1617   nLocal_(), nGlob_(), nBeginLocal_(), nBeginGlobal_(),nZoomBegin_(), nZoomEnd_(), 
    1718   dataNIndex_(), dataDims_(), dataBegin_(), dataIndex_(), domainMasks_(), axisMasks_(), 
    1819   gridMask_(), localDomainIndex_(), localAxisIndex_(), indexMap_(), indexDomainData_(), indexAxisData_(), 
    19    isDataDistributed_(true), axisNum_(0), domainNum_(0), localDataIndexSendToServer_(0), nIndexDomain_(), nIndexAxis_() 
     20   isDataDistributed_(true), axisNum_(0), domainNum_(0), nIndexDomain_(), nIndexAxis_() 
    2021{ 
    2122} 
     
    2324CDistributionClient::CDistributionClient(int rank, CGrid* grid) 
    2425   : CDistribution(rank, 0, 0), 
    25    localDataIndex_(0), axisDomainOrder_(), 
     26   globalDataSendToServer_(0), localDataIndex_(0), localDataIndexSendToServer_(0), localMaskIndex_(0), 
     27   axisDomainOrder_(), 
    2628   nLocal_(), nGlob_(), nBeginLocal_(), nBeginGlobal_(),nZoomBegin_(), nZoomEnd_(), 
    2729   dataNIndex_(), dataDims_(), dataBegin_(), dataIndex_(), domainMasks_(), axisMasks_(), 
    2830   gridMask_(), localDomainIndex_(), localAxisIndex_(), indexMap_(), indexDomainData_(), indexAxisData_(), 
    29    isDataDistributed_(true), axisNum_(0), domainNum_(0), localDataIndexSendToServer_(0), nIndexDomain_(), nIndexAxis_() 
     31   isDataDistributed_(true), axisNum_(0), domainNum_(0), nIndexDomain_(), nIndexAxis_() 
    3032{ 
    3133  readDistributionInfo(grid); 
     
    3941  if (0 != localDataIndex_) delete localDataIndex_; 
    4042  if (0 != localDataIndexSendToServer_) delete localDataIndexSendToServer_; 
     43  if (0 != localMaskIndex_) delete localMaskIndex_; 
    4144} 
    4245 
     
    145148    axisMasks_[i].resize(axisList[i]->mask.numElements()); 
    146149    axisMasks_[i] = axisList[i]->mask; 
     150    std::cout << "axisMask " << axisMasks_[i] << std::endl; 
    147151  } 
    148152 
     
    197201      nBeginLocal_.at(indexMap_[idx]+1) = 0; 
    198202      nBeginGlobal_.at(indexMap_[idx]+1) = domList[domIndex]->jbegin; 
    199       nZoomBegin_.at((indexMap_[idx]+1)) = domList[domIndex]->zoom_jbegin; 
    200       nZoomEnd_.at((indexMap_[idx]+1))   = domList[domIndex]->zoom_jbegin + domList[domIndex]->zoom_nj-1; 
     203//      nZoomBegin_.at((indexMap_[idx]+1)) = domList[domIndex]->zoom_jbegin; 
     204//      nZoomEnd_.at((indexMap_[idx]+1))   = domList[domIndex]->zoom_jbegin + domList[domIndex]->zoom_nj-1; 
    201205 
    202206      dataBegin_.at(indexMap_[idx]+1) = (2 == domList[domIndex]->data_dim) ? domList[domIndex]->data_jbegin.getValue() : -1; 
     
    209213      nBeginLocal_.at(indexMap_[idx]) = 0; 
    210214      nBeginGlobal_.at(indexMap_[idx]) = domList[domIndex]->ibegin; 
    211       nZoomBegin_.at((indexMap_[idx])) = domList[domIndex]->zoom_ibegin; 
    212       nZoomEnd_.at((indexMap_[idx]))   = domList[domIndex]->zoom_ibegin + domList[domIndex]->zoom_ni-1; 
     215//      nZoomBegin_.at((indexMap_[idx])) = domList[domIndex]->zoom_ibegin; 
     216//      nZoomEnd_.at((indexMap_[idx]))   = domList[domIndex]->zoom_ibegin + domList[domIndex]->zoom_ni-1; 
    213217 
    214218      dataBegin_.at(indexMap_[idx]) = domList[domIndex]->data_ibegin.getValue(); 
     
    229233      nBeginLocal_.at(indexMap_[idx]) = 0; 
    230234      nBeginGlobal_.at(indexMap_[idx]) = axisList[axisIndex]->ibegin.getValue(); 
    231       nZoomBegin_.at((indexMap_[idx])) = axisList[axisIndex]->zoom_begin; 
    232       nZoomEnd_.at((indexMap_[idx])) = axisList[axisIndex]->zoom_begin + axisList[axisIndex]->zoom_size-1; 
     235      nZoomBegin_.at((indexMap_[idx])) = axisList[axisIndex]->global_zoom_begin; 
     236      nZoomEnd_.at((indexMap_[idx])) = axisList[axisIndex]->global_zoom_begin + axisList[axisIndex]->global_zoom_size-1; 
    233237 
    234238      dataBegin_.at(indexMap_[idx]) = axisList[axisIndex]->data_begin.getValue(); 
     
    393397 
    394398  //   Compute size of the global index on client 
    395   std::vector<int> idxLoop(numElement_,0); 
    396   std::vector<int> currentIndex(this->dims_); 
     399  std::vector<StdSize> idxLoop(numElement_,0); 
     400  std::vector<StdSize> currentIndex(this->dims_,0); 
    397401  int innerLoopSize = eachElementSize[0]; 
    398402  size_t idx = 0, indexLocalDataOnClientCount = 0, indexSend2ServerCount = 0; 
     
    445449      else currentIndex[0]   = localAxisIndex_[idxAxis][i]; 
    446450 
    447       int gridMaskIndex = currentIndex[0]; 
     451      StdSize gridMaskIndex = currentIndex[0]; 
    448452      int mulDimMask = 1; 
    449453      for (int k = 1; k < this->dims_; ++k) 
     
    473477  localDataIndex_ = new CArray<int,1>(indexLocalDataOnClientCount); 
    474478  localDataIndexSendToServer_ = new CArray<int,1>(indexSend2ServerCount); 
     479  localMaskIndex_ = new CArray<int,1>(indexSend2ServerCount); 
    475480 
    476481  // We need to loop with data index 
     
    481486  int countLocalData = 0; 
    482487  std::vector<int> correctOuterIndex(numElement_,0); 
     488  bool isOuterIndexCorrect = true; 
    483489  while (idx < ssize) 
    484490  { 
     
    490496        correctOuterIndex[i] = 0; 
    491497        ++idxLoop[i+1]; 
    492         ++correctOuterIndex[i+1]; 
     498        if (isOuterIndexCorrect) ++correctOuterIndex[i+1]; 
    493499      } 
    494500    } 
     
    510516          currentIndex[indexMap_[i]]   = localDomainIndex_[idxDomain][correctOuterIndex[i]]; 
    511517          currentIndex[indexMap_[i]+1] = localDomainIndex_[idxDomain*2+1][correctOuterIndex[i]]; 
     518          isIndexDomainDataCorrect &= true; 
    512519        } 
    513520        else isIndexDomainDataCorrect = false; 
     
    519526        { 
    520527          currentIndex[indexMap_[i]]   = localAxisIndex_[idxAxis][correctOuterIndex[i]]; 
     528          isIndexAxisDataCorrect &= true; 
    521529        } 
    522530        else isIndexAxisDataCorrect = false; 
     
    524532      } 
    525533    } 
     534 
     535    isOuterIndexCorrect = (isIndexAxisDataCorrect) && (isIndexDomainDataCorrect); 
    526536 
    527537    // Inner most index 
     
    530540    for (int i = 0; i < innerLoopSize; ++i) 
    531541    { 
     542      bool isCurrentIndexDomainDataCorrect = isIndexDomainDataCorrect; 
     543      bool isCurrentIndexAxisDataCorrect = isIndexAxisDataCorrect; 
     544 
    532545      if (axisDomainOrder_(0)) 
    533546      { 
     
    536549          currentIndex[0] = localDomainIndex_[idxDomain][correctIndexDomain]; 
    537550          currentIndex[1] = localDomainIndex_[idxDomain+1][correctIndexDomain]; 
    538           isIndexDomainDataCorrect = true; 
     551          isCurrentIndexDomainDataCorrect &= true; 
    539552          ++correctIndexDomain; 
    540553        } 
    541         else isIndexDomainDataCorrect = false; 
     554        else isCurrentIndexDomainDataCorrect = false; 
    542555      } 
    543556      else 
     
    546559        { 
    547560          currentIndex[0] = localAxisIndex_[idxAxis][correctIndexAxis]; 
    548           isIndexAxisDataCorrect = true; 
     561          isCurrentIndexAxisDataCorrect &= true; 
    549562          ++correctIndexAxis; 
    550563        } 
    551         else isIndexAxisDataCorrect = false; 
     564        else isCurrentIndexAxisDataCorrect = false; 
    552565      } 
    553566 
     
    560573      } 
    561574 
    562       if (isIndexDomainDataCorrect && 
    563           isIndexAxisDataCorrect && 
     575      if (isCurrentIndexDomainDataCorrect && 
     576          isCurrentIndexAxisDataCorrect && 
    564577          gridMask_(gridMaskIndex)) 
    565578      { 
     
    582595          (*this->globalDataSendToServer_)(indexSend2ServerCount) = globalIndex; 
    583596          (*localDataIndexSendToServer_)(indexSend2ServerCount) = indexLocalDataOnClientCount; 
     597          (*localMaskIndex_)(indexSend2ServerCount) = gridMaskIndex; 
    584598          ++indexSend2ServerCount; 
    585599        } 
     
    649663 
    650664/*! 
     665  Return local mask index of client 
     666*/ 
     667const CArray<int,1>& CDistributionClient::getLocalMaskIndexOnClient() const 
     668{ 
     669  return (*localMaskIndex_); 
     670} 
     671 
     672/*! 
    651673  Return local data index on client which are sent to servers 
    652674*/ 
  • XIOS/trunk/src/distribution_client.hpp

    r621 r623  
    3939    virtual const CArray<int,1>& getLocalDataIndexSendToServer() const; 
    4040    const CArray<size_t,1>& getGlobalDataIndexSendToServer() const; 
     41    const CArray<int,1>& getLocalMaskIndexOnClient() const; 
    4142 
    4243    std::vector<int> getNGlob() { return nGlob_; } 
    4344    std::vector<int> getDataNIndex() { return dataNIndex_; } 
     45 
    4446    bool isDataDistributed() { return isDataDistributed_; } 
    4547 
     
    7375    CArray<int,1>* localDataIndex_; 
    7476    CArray<int,1>* localDataIndexSendToServer_; 
     77    CArray<int,1>* localMaskIndex_; 
    7578 
    7679  private: 
  • XIOS/trunk/src/filter/axis_algorithm_inverse.cpp

    r622 r623  
    1 #include "axis_inverse.hpp" 
     1#include "axis_algorithm_inverse.hpp" 
    22 
    33namespace xios { 
    44 
    5 CAxisInverse::CAxisInverse(CAxis* axisDestination, CAxis* axisSource) 
     5CAxisAlgorithmInverse::CAxisAlgorithmInverse(CAxis* axisDestination, CAxis* axisSource) 
    66 : CAxisAlgorithmTransformation(axisDestination, axisSource) 
    77{ 
    88  if (axisDestination->size.getValue() != axisSource->size.getValue()) 
    99  { 
    10     ERROR("CAxisInverse::CAxisInverse(CAxis* axisDestination, CAxis* axisSource)", 
     10    ERROR("CAxisAlgorithmInverse::CAxisAlgorithmInverse(CAxis* axisDestination, CAxis* axisSource)", 
    1111           << "Two axis have different size" 
    1212           << "Size of axis source " <<axisSource->getId() << " is " << axisSource->size.getValue()  << std::endl 
     
    1919  int ibeginDest = axisDestination->ibegin.getValue(); 
    2020 
    21   for (int idx = 0; idx < niDest; ++idx) axisDestGlobalIndex_.push_back(ibeginDest+idx); 
     21  for (int idx = 0; idx < niDest; ++idx) 
     22    if ((axisDestination->mask)(idx)) axisDestGlobalIndex_.push_back(ibeginDest+idx); 
    2223  this->computeIndexSourceMapping(); 
    2324} 
    2425 
    25 void CAxisInverse::computeIndexSourceMapping() 
     26void CAxisAlgorithmInverse::computeIndexSourceMapping() 
    2627{ 
    2728  std::map<int, std::vector<int> >& transMap = this->transformationMapping_; 
  • XIOS/trunk/src/filter/axis_algorithm_inverse.hpp

    r622 r623  
    77namespace xios { 
    88 
    9 class CAxisInverse : public CAxisAlgorithmTransformation //public CConcreteAlgo 
     9class CAxisAlgorithmInverse : public CAxisAlgorithmTransformation 
    1010{ 
    1111public: 
    12   CAxisInverse(CAxis* axisDestination, CAxis* axisSource); 
     12  CAxisAlgorithmInverse(CAxis* axisDestination, CAxis* axisSource); 
    1313 
    14   virtual ~CAxisInverse() {} 
     14  virtual ~CAxisAlgorithmInverse() {} 
    1515 
    1616  virtual void computeIndexSourceMapping(); 
  • XIOS/trunk/src/filter/axis_algorithm_zoom.hpp

    r622 r623  
    88namespace xios { 
    99 
    10 class CAxisZoom : public CAxisAlgorithmTransformation 
     10class CAxisAlgorithmZoom : public CAxisAlgorithmTransformation 
    1111{ 
    1212public: 
    13   CAxisZoom(CAxis* axisDestination, CAxis* axisSource, CZoomAxis* zoomAxis); 
     13  CAxisAlgorithmZoom(CAxis* axisDestination, CAxis* axisSource, CZoomAxis* zoomAxis); 
    1414 
    15   virtual ~CAxisZoom() {} 
     15  virtual ~CAxisAlgorithmZoom() {} 
    1616 
    1717  virtual void computeIndexSourceMapping(); 
    1818 
     19private: 
     20  void updateAxisDestinationMask(); 
     21  void updateZoom(); 
    1922private: 
    2023  StdSize zoomBegin_; 
  • XIOS/trunk/src/filter/generic_algorithm_transformation.hpp

    r622 r623  
    2020                                std::map<size_t, std::set<size_t> >& globaIndexMapFromDestToSource); 
    2121 
    22                                   /*! 
     22  /*! 
    2323  Compute global index mapping from one element of destination grid to the corresponding element of source grid 
    2424  */ 
  • XIOS/trunk/src/filter/grid_transformation.cpp

    r622 r623  
     1/*! 
     2   \file grid_transformation.cpp 
     3   \author Ha NGUYEN 
     4   \since 14 May 2015 
     5   \date 09 June 2015 
     6 
     7   \brief Interface for all transformations. 
     8 */ 
    19#include "grid_transformation.hpp" 
    2 #include "axis_inverse.hpp" 
    3 #include "axis_zoom.hpp" 
     10#include "axis_algorithm_inverse.hpp" 
     11#include "axis_algorithm_zoom.hpp" 
    412#include "context.hpp" 
    513#include "context_client.hpp" 
     
    3543  { 
    3644    CAxis* axis = CAxis::createAxis(); 
    37     axisSrcTmp[idx]->duplicateAttributes(axis); 
     45    axis->setAttributes(axisSrcTmp[idx]); 
    3846    axisSrc.push_back(axis); 
    3947  } 
     
    4250  { 
    4351    CDomain* domain = CDomain::createDomain(); 
    44     domainSrcTmp[idx]->duplicateAttributes(domain); 
     52    domain->setAttributes(domainSrcTmp[idx]); 
    4553    domainSrc.push_back(domain); 
    4654  } 
     
    168176    case TRANS_ZOOM_AXIS: 
    169177      zoomAxis = dynamic_cast<CZoomAxis*> (it->second); 
    170       algo = new CAxisZoom(axisListDestP[axisIndex], axisListSrcP[axisIndex], zoomAxis); 
     178      algo = new CAxisAlgorithmZoom(axisListDestP[axisIndex], axisListSrcP[axisIndex], zoomAxis); 
    171179      break; 
    172180    case TRANS_INVERSE_AXIS: 
    173       algo = new CAxisInverse(axisListDestP[axisIndex], axisListSrcP[axisIndex]); 
     181      algo = new CAxisAlgorithmInverse(axisListDestP[axisIndex], axisListSrcP[axisIndex]); 
    174182      break; 
    175183    default: 
     
    196204    case TRANS_INVERSE_AXIS: 
    197205      axisIndex =  elementPosition2AxisPositionInGrid_[elementPositionInGrid]; 
    198       axisListDestP[axisIndex]->duplicateAttributes(axisListSrcP[axisIndex]); 
     206      axisListSrcP[axisIndex]->duplicateAttributes(axisListDestP[axisIndex]); 
    199207      break; 
    200208    default: 
     
    226234    const CArray<size_t,1>& globalIndexGridDestSendToServer = distributionClientDest.getGlobalDataIndexSendToServer(); 
    227235 
     236   std::cout << "global index grid  dest send to server " << globalIndexGridDestSendToServer << std::endl; 
    228237    // ComputeTransformation of global index of each element 
    229238    std::vector<int> gridDestinationDimensionSize = gridDestination_->getGlobalDimension(); 
     
    241250  } 
    242251 
    243  std::cout << "global index destination 0 " << *globalIndexOfCurrentGridSource_ << std::endl; 
    244  std::cout << "global index destination 1 " << *globalIndexOfOriginalGridSource_ << std::endl; 
     252 std::cout << "global index destination 0 final " << *globalIndexOfCurrentGridSource_ << std::endl; 
     253 std::cout << "global index destination 1 final " << *globalIndexOfOriginalGridSource_ << std::endl; 
     254  updateFinalGridDestination(); 
    245255  computeFinalTransformationMapping(); 
    246256} 
     
    248258 
    249259/*! 
    250   Compute index mapping representing transformation between two grids 
    251   Each domain and each axis can contain some information of transformation, these information are then converted into 
    252 form of global index mapping reprensenting transformation between two grids. 
     260  After applying the algorithms, there are some informations on grid destination needing change, for now, there are: 
     261   +) mask 
    253262*/ 
    254 void CGridTransformation::computeTransformation() 
    255 { 
    256 //  const CArray<size_t,1>& globalIndexGridDestSendToServer = gridDestination_->getDistributionClient()->getGlobalDataIndexSendToServer(); 
    257 //  std::list<std::pair<int,CGenericAlgorithmTransformation*> >::const_iterator itbMap, itMap, iteMap; 
    258 //  itbMap = algoTransformation_.begin(); 
    259 //  iteMap = algoTransformation_.end(); 
    260 // 
    261 //  std::vector<CGenericAlgorithmTransformation*>::const_iterator itbVec, itVec, iteVec; 
    262 // 
    263 //  for (itMap = itbMap; itMap != iteMap; ++itMap) 
    264 //  { 
    265 //    int elementPosition = itMap->first; 
    266 //    itbVec = (itMap->second).begin(); 
    267 //    iteVec = (itMap->second).end(); 
    268 //    for (itVec = itbVec; itVec != iteVec; ++itVec) 
    269 //    { 
    270 //      (*itVec)->computeGlobalSourceIndex(elementPosition, 
    271 //                                         gridDestinationDimensionSize_, 
    272 //                                         globalIndexGridDestSendToServer, 
    273 //                                         globaIndexMapFromDestToSource_); 
    274 //    } 
    275 //  } 
     263void CGridTransformation::updateFinalGridDestination() 
     264{ 
     265  CContext* context = CContext::getCurrent(); 
     266  CContextClient* client=context->client; 
     267 
     268  //First of all, retrieve info of local mask of grid destination 
     269  CDistributionClient distributionClientDest(client->clientRank, gridDestination_); 
     270  const CArray<int, 1>& localMaskIndexOnClientDest = distributionClientDest.getLocalMaskIndexOnClient(); 
     271  std::cout << "local mask " << localMaskIndexOnClientDest << std::endl; 
     272 
     273  const CArray<size_t,1>& globalIndexOnClientDest = distributionClientDest.getGlobalDataIndexSendToServer(); 
     274  std::cout << "global index " << globalIndexOnClientDest <<  std::endl; 
     275  CArray<size_t, 1>::const_iterator itbArr, itArr, iteArr; 
     276  itbArr = globalIndexOnClientDest.begin(); 
     277  iteArr = globalIndexOnClientDest.end(); 
     278 
     279  // Then find out which index became invalid (become masked after being applied the algorithms, or demande some masked points from grid source) 
     280  int num = globalIndexOfOriginalGridSource_->numElements(); 
     281  const size_t sfmax = NumTraits<unsigned long>::sfmax(); 
     282  int maskIndexNum = 0; 
     283  for (int idx = 0; idx < num; ++idx) 
     284  { 
     285    if (sfmax == (*globalIndexOfOriginalGridSource_)(idx)) 
     286    { 
     287      size_t maskedGlobalIndex = (*globalIndexOfCurrentGridSource_)(idx); 
     288      itArr = std::find(itbArr, iteArr, maskedGlobalIndex); 
     289      if (iteArr != itArr) ++maskIndexNum; 
     290    } 
     291  } 
     292 
     293  CArray<int,1>* maskIndexToModify = new CArray<int,1>(maskIndexNum); 
     294  maskIndexNum = 0; 
     295  for (int idx = 0; idx < num; ++idx) 
     296  { 
     297    if (sfmax == (*globalIndexOfOriginalGridSource_)(idx)) 
     298    { 
     299      size_t maskedGlobalIndex = (*globalIndexOfCurrentGridSource_)(idx); 
     300      itArr = std::find(itbArr, iteArr, maskedGlobalIndex); 
     301      if (iteArr != itArr) 
     302      { 
     303        int localIdx = std::distance(itbArr, itArr); 
     304        (*maskIndexToModify)(maskIndexNum) = (localMaskIndexOnClientDest)(localIdx); 
     305        ++maskIndexNum; 
     306      } 
     307    } 
     308  } 
     309 
     310  std::cout << "index to modify " << *maskIndexToModify << std::endl; 
     311  gridDestination_->modifyMask(*maskIndexToModify); 
     312 
     313  delete maskIndexToModify; 
    276314} 
    277315 
     
    302340 for (itSend = itbSend; itSend != iteSend; ++itSend) sendBuffSize += (itSend->second).size(); 
    303341 
     342 std::cout << "global index destination 0 before" << *globalIndexOfCurrentGridSource_ << std::endl; 
     343 std::cout << "global index destination 1 before" << *globalIndexOfOriginalGridSource_ << std::endl; 
     344 
     345 typedef unsigned long Scalar; 
    304346 unsigned long* sendBuff, *currentSendBuff; 
    305347 if (0 != sendBuffSize) sendBuff = new unsigned long [sendBuffSize]; 
     348 for (StdSize idx = 0; idx < sendBuffSize; ++idx) sendBuff[idx] = NumTraits<Scalar>::sfmax(); 
     349 
    306350 int currentBuffPosition = 0; 
    307351 for (itSend = itbSend; itSend != iteSend; ++itSend) 
     
    332376 unsigned long* recvBuff, *currentRecvBuff; 
    333377 if (0 != recvBuffSize) recvBuff = new unsigned long [recvBuffSize]; 
     378 for (StdSize idx = 0; idx < recvBuffSize; ++idx) recvBuff[idx] = NumTraits<Scalar>::sfmax(); 
     379 
    334380 int currentRecvBuffPosition = 0; 
    335381 for (itRecv = itbRecv; itRecv != iteRecv; ++itRecv) 
     
    353399 } 
    354400 
    355  globalIndexOfCurrentGridSource_->resize(nbCurrentGridSource); 
    356  globalIndexOfOriginalGridSource_->resize(nbCurrentGridSource); 
     401 if (globalIndexOfCurrentGridSource_->numElements()  != nbCurrentGridSource) 
     402 { 
     403   if ((0 != nbCurrentGridSource) && (0 != globalIndexOfCurrentGridSource_)) 
     404   { 
     405     delete globalIndexOfCurrentGridSource_; 
     406     globalIndexOfCurrentGridSource_ = new CArray<size_t,1>(nbCurrentGridSource); 
     407   } 
     408 } 
     409 
     410 if (globalIndexOfOriginalGridSource_->numElements() != nbCurrentGridSource) 
     411 { 
     412   if ((0 != nbCurrentGridSource) && (0 != globalIndexOfOriginalGridSource_)) 
     413   { 
     414     delete globalIndexOfOriginalGridSource_; 
     415     globalIndexOfOriginalGridSource_ = new CArray<size_t,1>(nbCurrentGridSource); 
     416   } 
     417 } 
     418 
    357419 int k = 0; 
    358420 currentRecvBuff = recvBuff; 
     
    372434 } 
    373435 
     436 std::cout << "global index destination 0 after " << *globalIndexOfCurrentGridSource_ << std::endl; 
     437 std::cout << "global index destination 1 after " << *globalIndexOfOriginalGridSource_ << std::endl; 
    374438 if (0 != sendBuffSize) delete [] sendBuff; 
    375439 if (0 != recvBuffSize) delete [] recvBuff; 
     
    391455 
    392456  int nb = globalIndexOfCurrentGridSource_->numElements(); 
     457  const size_t sfmax = NumTraits<unsigned long>::sfmax(); 
    393458  for (int idx = 0; idx < nb; ++idx) 
    394459  { 
    395     globaIndexMapFromDestToSource[(*globalIndexOfCurrentGridSource_)(idx)].insert((*globalIndexOfOriginalGridSource_)(idx)); 
     460    if (sfmax != (*globalIndexOfOriginalGridSource_)(idx)) 
     461      globaIndexMapFromDestToSource[(*globalIndexOfCurrentGridSource_)(idx)].insert((*globalIndexOfOriginalGridSource_)(idx)); 
    396462  } 
    397463 
     
    403469 
    404470  CDistributionClient distributionClientDest(client->clientRank, gridDestination_); 
    405   CDistributionClient distributionClientSrc(client->clientRank, gridSource_); 
    406  
    407   CArray<int, 1> localIndexOnClientDest = distributionClientDest.getLocalDataIndexOnClient(); //gridDestination_->getDistributionClient()->getLocalDataIndexOnClient(); 
    408   CArray<size_t,1> globalIndexOnClientDest = distributionClientDest.getGlobalDataIndexSendToServer(); //gridDestination_->getDistributionClient()->getGlobalDataIndexSendToServer(); 
     471  CDistributionClient distributionClientSrc(client->clientRank, originalGridSource_); 
     472 
     473//  const CArray<int, 1>& localIndexOnClientDest = distributionClientDest.getLocalDataIndexOnClient(); //gridDestination_->getDistributionClient()->getLocalDataIndexOnClient(); 
     474  const CArray<int, 1>& localIndexOnClientDest = distributionClientDest.getLocalDataIndexSendToServer(); 
     475  const CArray<size_t,1>& globalIndexOnClientDest = distributionClientDest.getGlobalDataIndexSendToServer(); //gridDestination_->getDistributionClient()->getGlobalDataIndexSendToServer(); 
    409476 
    410477 std::cout << "dest: local index " << localIndexOnClientDest << std::endl; 
    411478 std::cout << "dest: global index " << globalIndexOnClientDest << std::endl; 
    412   CArray<int, 1> localIndexOnClientSrc = distributionClientSrc.getLocalDataIndexOnClient(); //gridSource_->getDistributionClient()->getLocalDataIndexOnClient(); 
    413   CArray<size_t,1> globalIndexOnClientSrc = distributionClientSrc.getGlobalDataIndexSendToServer(); //gridSource_->getDistributionClient()->getGlobalDataIndexSendToServer(); 
     479  const CArray<int, 1>& localIndexOnClientSrc = distributionClientSrc.getLocalDataIndexOnClient(); //gridSource_->getDistributionClient()->getLocalDataIndexOnClient(); 
     480  const CArray<size_t,1>& globalIndexOnClientSrc = distributionClientSrc.getGlobalDataIndexSendToServer(); //gridSource_->getDistributionClient()->getGlobalDataIndexSendToServer(); 
    414481 std::cout << "src: local index " << localIndexOnClientSrc << std::endl; 
    415482 std::cout << "src: global index " << globalIndexOnClientSrc << std::endl; 
    416483  std::vector<size_t>::const_iterator itbVec, itVec, iteVec; 
    417   CArray<size_t, 1>::iterator itbArr, itArr, iteArr; 
     484  CArray<size_t, 1>::const_iterator itbArr, itArr, iteArr; 
    418485 
    419486  std::map<int,std::vector<std::vector<size_t> > >::const_iterator itbMapRecv, itMapRecv, iteMapRecv; 
     
    439506        { 
    440507          int localIdx = std::distance(itbArr, itArr); 
    441 //          (*localIndexToReceiveOnGridDest_[sourceRank][i])(idx) = localIndexOnClientDest(localIdx); // Local index of un-extracted data (only domain) 
    442           (*localIndexToReceiveOnGridDest_[sourceRank][i])(idx) = (localIdx); // Local index of extracted data 
     508          (*localIndexToReceiveOnGridDest_[sourceRank][i])(idx) = localIndexOnClientDest(localIdx); // Local index of un-extracted data (only domain) 
     509//          (*localIndexToReceiveOnGridDest_[sourceRank][i])(idx) = (localIdx); // Local index of extracted data 
    443510        } 
    444511      } 
    445512    } 
     513//    std::cout << "local index to receive from source Rank = " << sourceRank << (*localIndexToReceiveOnGridDest_[sourceRank][i]) << std::endl; 
    446514  } 
    447515 
     
    468536      } 
    469537    } 
     538    std::cout << "local index to send to dest Rank = " << destRank << (*localIndexToSendFromGridSource_[destRank]) << std::endl; 
    470539  } 
    471540} 
  • XIOS/trunk/src/filter/grid_transformation.hpp

    r622 r623  
     1/*! 
     2   \file grid_transformation.hpp 
     3   \author Ha NGUYEN 
     4   \since 14 May 2015 
     5   \date 09 June 2015 
     6 
     7   \brief Interface for all transformations. 
     8 */ 
    19#ifndef __XIOS_GRID_TRANSFORMATION_HPP__ 
    210#define __XIOS_GRID_TRANSFORMATION_HPP__ 
     
    1220class CGrid; 
    1321 
     22/*! 
     23  \class CGridTransformation 
     24  This class is an interface for all transformations to interact with the rest of XIOS. 
     25The class, firstly, tries to get all information relating to requested transformations by retrieving directly from grid. 
     26Then with all these information, all necessary transformations will be be created by generic class \class CGenericAlgorithmTransformation. 
     27Because there are information exchange among clients to accomplish the transformations (e.g: some index need retrieving from other clients), 
     28this class uses class \class CTransformationMapping to fulfill this demand. 
     29For each transformation, a new temporary grid source is created. 
     30For a consequential transformations (e.g: inversing -> zoom -> inversing -> ...), 
     31the grid destination of current transformation will be grid source of the next transformation 
     32*/ 
    1433class CGridTransformation 
    1534{ 
     
    3857  void computeFinalTransformationMapping(); 
    3958  void computeTransformationFromOriginalGridSource(const std::map<size_t, std::set<size_t> >& globaIndexMapFromDestToSource); 
     59  void updateFinalGridDestination(); 
    4060 
    4161private: 
     62  //! Grid source on transformation 
    4263  CGrid* gridSource_; 
     64 
     65  //! Grid destination on transformation 
    4366  CGrid* gridDestination_; 
     67 
     68  //! The grid source of the first transformation (original grid source) 
    4469  CGrid* originalGridSource_; 
    4570 
     71  //! Grid source dimension size 
    4672  std::vector<int> gridSourceDimensionSize_; 
     73 
     74  //! Grid destination dimension size 
    4775  std::vector<int> gridDestinationDimensionSize_; 
    4876 
    4977private: 
    5078  typedef std::list<std::pair<int,std::pair<ETranformationType,int> > > ListAlgoType; 
     79  //! List of algorithm types and their order 
     80  ListAlgoType listAlgos_; 
    5181 
    5282  // Mapping between position of an element in grid and its transformation (if any) 
    5383  std::list<CGenericAlgorithmTransformation*> algoTransformation_; 
    54   ListAlgoType listAlgos_; 
     84 
     85  //! Mapping of (grid) global index representing tranformation. 
    5586  std::map<size_t, std::set<size_t> > globaIndexMapFromDestToSource_; 
    5687 
     88  //! Local index of data to send from grid source 
    5789  std::map<int, CArray<int,1>* > localIndexToSendFromGridSource_; 
     90 
     91  //! Local index of data to receive on grid destination 
    5892  std::map<int, std::vector<CArray<int,1>* > > localIndexToReceiveOnGridDest_; 
    5993 
     94  //! Position of axis and domain in grid 
    6095  std::map<int, int> elementPosition2AxisPositionInGrid_, elementPosition2DomainPositionInGrid_; 
    6196 
     97  //! (Grid) Global index of grid source 
    6298  CArray<size_t,1>* globalIndexOfCurrentGridSource_; 
    6399  CArray<size_t,1>* globalIndexOfOriginalGridSource_; 
  • XIOS/trunk/src/filter/transformation_mapping.cpp

    r622 r623  
     1/*! 
     2   \file transformation_mapping.cpp 
     3   \author Ha NGUYEN 
     4   \since 14 May 2015 
     5   \date 09 June 2015 
     6 
     7   \brief Take charge of communication among clients to exchange transformed data. 
     8 */ 
     9 
    110#include "transformation_mapping.hpp" 
    211#include <boost/unordered_map.hpp> 
     
    1423  int clientRank = client->clientRank; 
    1524 
    16   CDistributionClient distributionClientDest(client->clientRank, gridSource_); 
     25  CDistributionClient distributionClientSrc(client->clientRank, gridSource_); 
    1726 
    18   const CArray<size_t,1>& globalIndexGridSrc = distributionClientDest.getGlobalDataIndexSendToServer(); //gridSource_->getDistributionClient()->getGlobalDataIndexSendToServer(); 
     27  const CArray<size_t,1>& globalIndexGridSrc = distributionClientSrc.getGlobalDataIndexSendToServer(); //gridSource_->getDistributionClient()->getGlobalDataIndexSendToServer(); 
    1928  boost::unordered_map<size_t,int> globalIndexOfServer; 
    2029  int globalIndexSize = globalIndexGridSrc.numElements(); 
     
    2433  } 
    2534 
     35  std::cout << "global index grid src " << globalIndexGridSrc << std::endl; 
    2636  gridIndexClientClientMapping_ = new CClientServerMappingDistributed(globalIndexOfServer, 
    2737                                                                      client->intraComm, 
     
    151161} 
    152162 
     163/*! 
     164  Return (grid) global index on grid destination. This mapping contains the rank of client source (that sends info to grid destination) 
     165and the corresponding global index to write on grid destination. 
     166  \return global index mapping to receive on grid destination 
     167*/ 
    153168const std::map<int,std::vector<std::vector<size_t> > >& CTransformationMapping::getGlobalIndexReceivedOnGridDestMapping() const 
    154169{ 
     
    156171} 
    157172 
     173/*! 
     174  Return (grid) global index on grid source. This mapping contains the rank of client destination (which receives transformation info) and 
     175the corresponding global index to send 
     176  \return global index mapping to send on grid source 
     177*/ 
    158178const std::map<int,std::vector<size_t> >& CTransformationMapping::getGlobalIndexSendToGridDestMapping() const 
    159179{ 
  • XIOS/trunk/src/filter/transformation_mapping.hpp

    r620 r623  
     1/*! 
     2   \file transformation_mapping.hpp 
     3   \author Ha NGUYEN 
     4   \since 14 May 2015 
     5   \date 09 June 2015 
     6 
     7   \brief Take charge of communication among clients to exchange transformed data. 
     8 */ 
    19#ifndef __XIOS_TRANSFORMATION_MAPPING_HPP__ 
    210#define __XIOS_TRANSFORMATION_MAPPING_HPP__ 
  • XIOS/trunk/src/node/axis.cpp

    r622 r623  
    1818      , CAxisAttributes(), isChecked(false), relFiles(), baseRefObject(), areClientAttributesChecked_(false) 
    1919      , isDistributed_(false) 
    20       , transformationMap_() 
     20      , transformationMap_(), global_zoom_begin(0), global_zoom_size(0) 
    2121   { 
    2222   } 
     
    2626      , CAxisAttributes(), isChecked(false), relFiles(), baseRefObject(), areClientAttributesChecked_(false) 
    2727      , isDistributed_(false) 
    28       , transformationMap_() 
     28      , transformationMap_(), global_zoom_begin(0), global_zoom_size(0) 
    2929   { 
    3030   } 
     
    6767     CAxis* axis = CAxisGroup::get("axis_definition")->createChild(); 
    6868     return axis; 
    69    } 
    70  
    71    void CAxis::duplicateAttributes(CAxis* axis) 
    72    { 
    73      axis->setAttributes(this); 
    7469   } 
    7570 
     
    10196      else this->ni.setValue(size); 
    10297      std::cout <<  "value " <<  value <<  std::endl; 
    103       StdSize true_size = value.numElements(); 
    104       if (this->ni.getValue() != true_size) 
    105          ERROR("CAxis::checkAttributes(void)", 
    106                << "The array \'value\' of axis [ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] has a different size that the one defined by the \'size\' attribute"); 
    107  
     98//      StdSize true_size = value.numElements(); 
     99//      if (this->ni.getValue() != true_size) 
     100//         ERROR("CAxis::checkAttributes(void)", 
     101//               << "The array \'value\' of axis [ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] has a different size that the one defined by the \'size\' attribute"); 
     102 
     103      if (0 == global_zoom_size) global_zoom_size = size; 
    108104      this->checkData(); 
    109105      this->checkMask(); 
    110       this->checkZoom(); 
     106//      this->checkZoom(); 
    111107 
    112108      if (!bounds.isEmpty()) 
     
    281277        msg << this->getId(); 
    282278        msg << ni << begin << end; 
     279        msg<<global_zoom_begin<<global_zoom_size; 
    283280 
    284281        event.push(*itRank,1,msg); 
     
    299296  void CAxis::recvServerAttribut(CBufferIn& buffer) 
    300297  { 
    301     int zoom_end = zoom_begin.getValue()+zoom_size.getValue()-1; 
    302     int ni_srv, begin_srv, end_srv; 
    303  
    304     buffer>>ni_srv>>begin_srv>>end_srv; 
    305  
    306     zoom_begin_srv = zoom_begin.getValue() > begin_srv ? zoom_begin.getValue() : begin_srv; 
    307     zoom_end_srv   = zoom_end < end_srv ? zoom_end : end_srv; 
     298    int ni_srv, begin_srv, end_srv, global_zoom_begin_tmp, global_zoom_size_tmp; 
     299 
     300    buffer>>ni_srv>>begin_srv>>end_srv>>global_zoom_begin_tmp>>global_zoom_size_tmp; 
     301    global_zoom_begin = global_zoom_begin_tmp; 
     302    global_zoom_size  = global_zoom_size_tmp; 
     303    int global_zoom_end = global_zoom_begin + global_zoom_size - 1; 
     304 
     305    zoom_begin_srv = global_zoom_begin > begin_srv ? global_zoom_begin : begin_srv ; 
     306    zoom_end_srv   = global_zoom_end < end_srv ? global_zoom_end : end_srv ; 
    308307    zoom_size_srv  = zoom_end_srv - zoom_begin_srv + 1; 
    309308 
     
    315314    if (size == ni) 
    316315    { 
    317       zoom_begin_srv = zoom_begin.getValue(); 
    318       zoom_end_srv   = zoom_end; 
     316      zoom_begin_srv = global_zoom_begin; 
     317      zoom_end_srv   = global_zoom_end; //zoom_end; 
    319318      zoom_size_srv  = zoom_end_srv - zoom_begin_srv + 1; 
    320319    } 
  • XIOS/trunk/src/node/axis.hpp

    r622 r623  
    6565         /// Accesseurs /// 
    6666         const std::set<StdString> & getRelFiles(void) const; 
    67          void duplicateAttributes(CAxis* axis); 
    6867 
    6968         /// Test /// 
     
    104103        int zoom_begin_srv, zoom_end_srv, zoom_size_srv; 
    105104        int ni_srv, begin_srv, end_srv; 
    106  
     105        int global_zoom_begin, global_zoom_size;  // The real global zoom begin and zoom size after axis is transformed (zoomed) 
    107106      private : 
    108107         void checkData(); 
  • XIOS/trunk/src/node/field.cpp

    r621 r623  
    551551     } 
    552552     solveGridDomainAxisRef(doSending2Sever); 
    553      solveCheckMaskIndex(doSending2Sever); 
    554553     if (context->hasClient) 
    555554     { 
    556555       solveTransformedGrid(); 
    557556     } 
     557     solveCheckMaskIndex(doSending2Sever); 
    558558   } 
    559559 
     
    784784           fieldRef->addReference(this); 
    785785           fieldRef->solveGridDomainAxisRef(false); 
    786            fieldRef->solveCheckMaskIndex(false); 
     786//           fieldRef->solveCheckMaskIndex(false); 
    787787           break; 
    788788         } 
     
    798798         fieldRef->addReference(this); 
    799799         fieldRef->solveGridDomainAxisRef(false); 
    800          fieldRef->solveCheckMaskIndex(false); 
     800//         fieldRef->solveCheckMaskIndex(false); 
    801801       } 
    802802 
     
    857857       CArray<int,1>* localIndex_p = itSend->second; 
    858858       int countSize = localIndex_p->numElements(); 
     859       std::cout << "Data Source " <<  dataSrc <<  std::endl; 
    859860       for (int idx = 0; idx < countSize; ++idx) 
    860861       { 
     
    887888         } 
    888889       } 
     890       std::cout << "Data Destination " <<  dataDest <<  std::endl; 
    889891     } 
    890892 
  • XIOS/trunk/src/node/grid.cpp

    r622 r623  
    298298      } 
    299299   } 
     300 
     301   void CGrid::modifyMask(const CArray<int,1>& indexToModify) 
     302   { 
     303      using namespace std; 
     304      std::vector<CDomain*> domainP = this->getDomains(); 
     305      std::vector<CAxis*> axisP = this->getAxis(); 
     306      int dim = domainP.size() * 2 + axisP.size(); 
     307 
     308      switch (dim) { 
     309        case 1: 
     310          modifyGridMask(mask1, indexToModify); 
     311          break; 
     312        case 2: 
     313          modifyGridMask(mask2, indexToModify); 
     314          break; 
     315        case 3: 
     316          modifyGridMask(mask3, indexToModify); 
     317          break; 
     318 
     319        default: 
     320          break; 
     321      } 
     322   } 
     323 
    300324   //--------------------------------------------------------------- 
    301325 
     
    850874            nZoomBegin[indexMap[i]] = axisList[axisId]->zoom_begin_srv; 
    851875            nZoomSize[indexMap[i]]  = axisList[axisId]->zoom_size_srv; 
    852             nZoomBeginGlobal[indexMap[i]] = axisList[axisId]->zoom_begin; 
     876            nZoomBeginGlobal[indexMap[i]] = axisList[axisId]->global_zoom_begin; 
    853877            nGlob[indexMap[i]] = axisList[axisId]->size; 
    854878            ++axisId; 
     
    11581182    transformations_ = new CGridTransformation(transformedGrid, this); 
    11591183    transformations_->computeAll(); 
     1184 
     1185    // Ok, now need to compute index of grid source 
     1186    checkMaskIndex(false); 
    11601187  } 
    11611188 
  • XIOS/trunk/src/node/grid.hpp

    r622 r623  
    190190         bool isTransformed(); 
    191191         void setTransformed(); 
    192 //         EElementType getGridElementType(); 
    193 // 
    194 //         std::vector<ETransformationType> getTransformations(); 
    195 //         const std::vector<CGenericAlgorithm*>& getTransformationAlgo(); 
    196192 
    197193      public: 
     
    210206         map<int, CArray<size_t, 1>* > outIndexFromClient; 
    211207         void checkMask(void) ; 
     208         void modifyMask(const CArray<int,1>& indexToModify); 
    212209 
    213210      private: 
     
    217214                          const std::vector<CArray<bool,1>* >& axisMasks, 
    218215                          const CArray<bool,1>& axisDomainOrder); 
     216        template<int N> 
     217        void modifyGridMask(CArray<bool,N>& gridMask, const CArray<int,1>& indexToModify); 
     218 
    219219        void setVirtualDomainGroup(CDomainGroup* newVDomainGroup); 
    220220        void setVirtualDomainGroup(); 
     
    366366        maskIndex += idxLoop[k]*mulDim; 
    367367      } 
    368       *(gridMask.dataFirst()+maskIndex) = maskValue; 
     368      *(gridMask.dataFirst()+maskIndex) &= maskValue; 
    369369 
    370370      ++idxLoop[0]; 
     
    374374   } 
    375375 
     376   /*! 
     377     Modify the current mask of grid, the local index to be modified will take value false 
     378     \param [in/out] gridMask current mask of grid 
     379     \param [in] indexToModify local index to modify 
     380   */ 
     381   template<int N> 
     382   void CGrid::modifyGridMask(CArray<bool,N>& gridMask, const CArray<int,1>& indexToModify) 
     383   { 
     384     bool valueToModify = false; 
     385     int num = indexToModify.numElements(); 
     386     for (int idx = 0; idx < num; ++idx) 
     387     { 
     388       *(gridMask.dataFirst()+indexToModify(idx)) = valueToModify; 
     389     } 
     390   } 
    376391   ///-------------------------------------------------------------- 
    377392 
  • XIOS/trunk/src/node/zoom_axis.cpp

    r622 r623  
    2525  void CZoomAxis::checkValid(CAxis* axisDest) 
    2626  { 
    27     StdSize axisIBegin, axisNi, axisSize; 
    28     StdSize zoom_begin, zoom_end, zoom_size; 
     27    int axisIBegin, axisNi, axisSize; 
     28    int zoom_begin, zoom_end, zoom_size; 
    2929 
    3030    axisIBegin = axisDest->ibegin.getValue(); 
     
    3636    zoom_end   = (this->zoom_end.isEmpty()) ?  (axisSize - 1) : this->zoom_end.getValue() ; 
    3737 
    38     if (this->zoom_begin.isEmpty()) zoom_begin=zoom_end-zoom_size+1 ; 
    39     if (this->zoom_end.isEmpty()) zoom_end=zoom_begin+zoom_size-1 ; 
    40     if (this->zoom_size.isEmpty()) zoom_size=zoom_end-zoom_begin+1 ; 
     38    if (this->zoom_begin.isEmpty()) zoom_begin=zoom_end-zoom_size+1; 
     39    if (this->zoom_size.isEmpty()) zoom_size=zoom_end-zoom_begin+1; 
     40    if (this->zoom_end.isEmpty()) zoom_end=zoom_begin+zoom_size-1; 
    4141 
    4242    if ((zoom_begin < 0) || (zoom_begin > axisSize-1) || (zoom_end<0) || (zoom_end>axisSize-1) || (zoom_size<1) || (zoom_size>axisSize) || (zoom_begin>zoom_end)) 
  • XIOS/trunk/src/output/nc4_data_output.cpp

    • Property svn:executable set to *
    r618 r623  
    600600        int zoom_begin_srv = axis->zoom_begin_srv; 
    601601        int zoom_size  = (MULTI_FILE == SuperClass::type) ? zoom_size_srv : axis->zoom_size; 
    602         int zoom_begin = (MULTI_FILE == SuperClass::type) ? zoom_begin_srv : axis->zoom_begin; 
     602                                                              : axis->global_zoom_size; 
     603                                                              : axis->global_zoom_begin; 
    603604 
    604605 
     
    13611362           if (!field->prec.isEmpty() && field->prec==2) fieldData=round(fieldData) ; 
    13621363 
     1364           std::cout << "fieldData "<< fieldData << std::endl; 
    13631365           switch (SuperClass::type) 
    13641366           { 
  • XIOS/trunk/src/test/test_new_features.f90

    r621 r623  
    2323  TYPE(xios_file) :: file_hdl 
    2424  LOGICAL :: ok 
     25  LOGICAL,ALLOCATABLE :: mask_glo(:),mask(:) 
    2526 
    2627  DOUBLE PRECISION,DIMENSION(ni_glo,nj_glo) :: lon_glo,lat_glo 
     
    8182 
    8283  ALLOCATE(lon(ni,nj),lat(ni,nj),field_A(0:ni+1,-1:nj+2,llm),lonvalue(ni*nj), field_Axis(nAxis), field_All_Axis(1:ni,1:nj,llm), lvaln(nAxis), lval_ni(ni), lval_nj(nj), field_Two_Axis(ni_glo,1:nj)) 
     84  ALLOCATE(mask(nj)) 
     85  DO i = 1, nj 
     86!    IF (MOD(i,2)>=0) THEN 
     87!      mask(i)=.FALSE. 
     88!    ELSE 
     89      mask(i)=.TRUE. 
     90!    ENDIF 
     91  ENDDO 
    8392  lon(:,:)=lon_glo(ibegin+1:iend+1,jbegin+1:jend+1) 
    8493  lat(:,:)=lat_glo(ibegin+1:iend+1,jbegin+1:jend+1) 
     
    99108 
    100109  CALL xios_set_axis_attr("axis_A", size=ni_glo, ibegin=ibegin, ni=ni, value=lval_ni) 
    101   CALL xios_set_axis_attr("axis_B", size=nj_glo, ibegin=jbegin, ni=nj, value=lval_nj) 
     110  CALL xios_set_axis_attr("axis_B", size=nj_glo, ibegin=jbegin, ni=nj, value=lval_nj, mask=mask) 
    102111  CALL xios_set_axis_attr("axis_C", size=llm, value=lval) 
    103112  CALL xios_set_axis_attr("axis_D", size=llm, ibegin=axisBegin, ni=nAxis, value=lvaln) 
  • XIOS/trunk/src/utils.hpp

    r584 r623  
    1313 
    1414#include <vector> 
     15#include <limits> 
    1516#include "array_new.hpp" 
    1617#include "exception.hpp" 
     
    187188    } 
    188189  }; 
     190 
     191template<typename K> 
     192struct NumTraits { 
     193    typedef K Type; 
     194}; 
     195 
     196template<> 
     197struct NumTraits<unsigned long> 
     198{ 
     199  typedef unsigned long Scalar; 
     200  typedef Scalar magnitudeType; 
     201 
     202  static inline Scalar sfmin() { 
     203    return std::numeric_limits<Scalar>::min(); 
     204  } 
     205  static inline Scalar sfmax() { 
     206    return std::numeric_limits<Scalar>::max(); 
     207  } 
     208}; 
    189209} 
    190210 
Note: See TracChangeset for help on using the changeset viewer.