Changeset 621


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

Implementing generic transformation algorithm (local commit)

+) Change a little bit to make sure everything work in order

Test
+) test_new_features passe with inverse

Location:
XIOS/trunk
Files:
8 added
1 deleted
26 edited
4 moved

Legend:

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

    r620 r621  
    1111     <field id="field_Axis"  operation="average" freq_op="3600s" grid_ref="grid_Axis" /> 
    1212     <field id="field_Two_Axis"  operation="average" freq_op="3600s" grid_ref="grid_Two_Axis" /> 
    13      <field id="field_Axis_transformed"  operation="average" freq_op="3600s" field_ref="field_Axis" grid_ref="grid_Axis_tranformed" /> 
     13     <field id="field_Axis_transformed"  operation="average" freq_op="3600s" field_ref="field_A" grid_ref="grid_Axis_tranformed" /> 
    1414     <field id="field_All_Axis" operation="average" freq_op="3600s" grid_ref="grid_All_Axis" /> 
    1515     <field id="field_Scalar" operation="average" freq_op="3600s" grid_ref="ScalarGrid" /> 
     
    3939     <axis id="axis_A" /> 
    4040     <axis id="axis_B" /> 
    41      <axis id="axis_C" zoom_size="2" zoom_end="2"/> 
     41     <axis id="axis_C" /> 
    4242     <axis id="axis_D" /> 
    43      <axis id="axis_E" axis_ref="axis_D"> 
    44         <transformation type="inverse" /> 
     43     <axis id="axis_E" axis_ref="axis_C"> 
    4544<!--        <transformation type="zoom" />--> 
     45        <inverse_axis /> 
     46<!--        <zoom_axis zoom_begin=1 zoom_size=1 />--> 
    4647     </axis> 
    4748   </axis_definition> 
     
    6566       </grid> 
    6667       <grid id="grid_Axis_tranformed"> 
     68         <domain domain_ref="domain_A" /> 
    6769<!--         <axis axis_ref="axis_A" />--> 
     70<!--         <axis axis_ref="axis_B" />--> 
    6871         <axis axis_ref="axis_E" /> 
    6972       </grid> 
  • XIOS/trunk/src/config/node_type.conf

    r619 r621  
    3131#endif //__XIOS_CCalendarWrapper__ 
    3232 
    33 #ifdef __XIOS_CTransformation__ 
    34    DECLARE_NODE(Transformation, transformation) 
    35 #endif //__XIOS_CTransformation__ 
     33#ifdef __XIOS_CInverseAxis__ 
     34   DECLARE_NODE(InverseAxis, inverse_axis) 
     35#endif //__XIOS_CInverseAxis__ 
     36 
     37#ifdef __XIOS_CZoomAxis__ 
     38   DECLARE_NODE(ZoomAxis, zoom_axis) 
     39#endif //__XIOS_CZoomAxis__ 
    3640 
    3741#ifdef __XIOS_CContext__ 
  • XIOS/trunk/src/filter/axis_algorithm_transformation.cpp

    r620 r621  
    11#include "axis_algorithm_transformation.hpp" 
     2#include "axis_inverse.hpp" 
     3#include "axis_zoom.hpp" 
    24 
    35namespace xios { 
    46 
    5 CAxisAlgorithmTransformation::CAxisAlgorithmTransformation(CAxis* axisDestination) 
     7CAxisAlgorithmTransformation::CAxisAlgorithmTransformation(CAxis* axisDestination, CAxis* axisSource, std::vector<ETranformationType>& algos) 
    68 : CGenericAlgorithmTransformation() 
    79{ 
    8   int niDest = axisDestination->ni.getValue(); 
    9   int ibeginDest = axisDestination->ibegin.getValue(); 
     10  for (int idx = 0; idx < algos.size(); ++idx) 
     11  { 
     12    switch (algos[idx]) 
     13    { 
     14      case TRANS_ZOOM_AXIS: 
     15        algosOfAnAxis_.push_back(new CAxisZoom(axisDestination, axisSource)); 
     16        break; 
     17      case TRANS_INVERSE_AXIS: 
     18        algosOfAnAxis_.push_back(new CAxisInverse(axisDestination, axisSource)); 
     19        break; 
     20      default: 
     21        break; 
     22    } 
     23  } 
     24  computeIndexSourceMapping(); 
     25} 
    1026 
    11   for (int idx = 0; idx < niDest; ++idx) axisDestGlobalIndex_.push_back(ibeginDest+idx); 
     27CAxisAlgorithmTransformation::~CAxisAlgorithmTransformation() 
     28{ 
     29  for (int idx = 0; idx < algosOfAnAxis_.size(); ++idx) delete algosOfAnAxis_[idx]; 
     30} 
     31 
     32void CAxisAlgorithmTransformation::computeIndexSourceMapping() 
     33{ 
     34  if (!algosOfAnAxis_.empty()) 
     35  { 
     36    algosOfAnAxis_[0]->computeIndexSourceMapping(this->transformationMapping_); 
     37    for (int idx = 1; idx < algosOfAnAxis_.size(); ++idx) 
     38    { 
     39      algosOfAnAxis_[idx]->computeIndexSourceMapping(algosOfAnAxis_[idx-1]->getTransformationMapping()); 
     40    } 
     41    this->transformationMapping_ = algosOfAnAxis_[algosOfAnAxis_.size()-1]->getTransformationMapping(); 
     42  } 
    1243} 
    1344 
  • XIOS/trunk/src/filter/axis_algorithm_transformation.hpp

    r620 r621  
    44#include "generic_algorithm_transformation.hpp" 
    55#include "axis.hpp" 
     6#include "concrete_algo.hpp" 
    67 
    78namespace xios { 
     
    1011{ 
    1112public: 
    12   CAxisAlgorithmTransformation(CAxis* axisDestination); 
    13   virtual ~CAxisAlgorithmTransformation() {} 
     13  CAxisAlgorithmTransformation(CAxis* axisDestination, CAxis* axisSource, std::vector<ETranformationType>&); 
     14 
     15  virtual ~CAxisAlgorithmTransformation(); 
    1416 
    1517protected: 
     
    2123                                                        CArray<size_t,1>& globalIndexDestGrid, 
    2224                                                        std::vector<CArray<size_t,1> >& globalIndexSrcGrid); 
    23   virtual void computeIndexSourceMapping() = 0; 
    24  
     25  void computeIndexSourceMapping(); 
    2526protected: 
    26   std::vector<int> axisDestGlobalIndex_; 
     27  std::vector<CConcreteAlgo*> algosOfAnAxis_; 
    2728 
    2829}; 
  • XIOS/trunk/src/filter/axis_inverse.cpp

    r620 r621  
    44 
    55CAxisInverse::CAxisInverse(CAxis* axisDestination, CAxis* axisSource) 
    6  : CAxisAlgorithmTransformation(axisDestination) 
     6 : CConcreteAlgo() 
    77{ 
    88  if (axisDestination->size.getValue() != axisSource->size.getValue()) 
     
    1414  } 
    1515 
     16 
    1617  axisDestGlobalSize_ = axisDestination->size.getValue(); 
     18  int niDest = axisDestination->ni.getValue(); 
     19  int ibeginDest = axisDestination->ibegin.getValue(); 
    1720 
    18   this->computeIndexSourceMapping(); 
     21  for (int idx = 0; idx < niDest; ++idx) axisDestGlobalIndex_.push_back(ibeginDest+idx); 
    1922} 
    2023 
    21 void CAxisInverse::computeIndexSourceMapping() 
     24void CAxisInverse::computeIndexSourceMapping(const std::map<int, std::vector<int> >& transformationMappingOfPreviousAlgo) 
    2225{ 
    2326  std::map<int, std::vector<int> >& transMap = this->transformationMapping_; 
    24   if (!transMap.empty()) transMap.clear(); 
    25  
    26   int globalIndexSize = axisDestGlobalIndex_.size(); 
    27   for (int idx = 0; idx < globalIndexSize; ++idx) 
    28     transMap[axisDestGlobalIndex_[idx]].push_back(axisDestGlobalSize_-axisDestGlobalIndex_[idx]-1); 
     27  if (transformationMappingOfPreviousAlgo.empty()) 
     28  { 
     29    int globalIndexSize = axisDestGlobalIndex_.size(); 
     30    for (int idx = 0; idx < globalIndexSize; ++idx) 
     31      transMap[axisDestGlobalIndex_[idx]].push_back(axisDestGlobalSize_-axisDestGlobalIndex_[idx]-1); 
     32  } 
     33  else 
     34  { 
     35    std::map<int, std::vector<int> >::const_iterator itb = transformationMappingOfPreviousAlgo.begin(), it, 
     36                                                     ite = transformationMappingOfPreviousAlgo.end(); 
     37    for (it = itb; it != ite; ++it) 
     38    { 
     39      transMap[it->first].push_back(axisDestGlobalSize_-it->first-1); 
     40    } 
     41  } 
    2942} 
    3043 
    31  
    3244} 
  • XIOS/trunk/src/filter/axis_inverse.hpp

    r620 r621  
    22#define __XIOS_AXIS_ALGORITHM_INVERSE_HPP__ 
    33 
    4 #include "axis_algorithm_transformation.hpp" 
     4#include "concrete_algo.hpp" 
    55#include "axis.hpp" 
    66 
    77namespace xios { 
    88 
    9 class CAxisInverse : public CAxisAlgorithmTransformation 
     9class CAxisInverse : public CConcreteAlgo 
    1010{ 
    1111public: 
     
    1313 
    1414  virtual ~CAxisInverse() {} 
     15 
     16  virtual void computeIndexSourceMapping(const std::map<int, std::vector<int> >& transformationMappingOfPreviousAlgo); 
     17 
    1518protected: 
    16   virtual void computeIndexSourceMapping(); 
     19  std::vector<int> axisDestGlobalIndex_; 
    1720 
    1821private: 
  • XIOS/trunk/src/filter/grid_transformation.cpp

    r620 r621  
    22#include "axis_inverse.hpp" 
    33#include "transformation_mapping.hpp" 
     4#include "transformation_enum.hpp" 
     5#include "axis_algorithm_transformation.hpp" 
    46 
    57namespace xios { 
     
    8688      if (axisListDestP[i]->hasTransformation()) 
    8789      { 
    88         CGenericAlgorithmTransformation* algo = new CAxisInverse(axisListDestP[i], axisListSrcP[i]); 
     90        CGenericAlgorithmTransformation* algo = 0; 
     91        CAxis::TransMapTypes trans = axisListDestP[i]->getAllTransformations(); 
     92        CAxis::TransMapTypes::const_iterator itb = trans.begin(), it, 
     93                                             ite = trans.end(); 
     94        std::vector<ETranformationType> algoAxis; 
     95        for (it = itb; it != ite; ++it) 
     96        { 
     97          algoAxis.push_back(it->first); 
     98        } 
     99        algo = new CAxisAlgorithmTransformation(axisListDestP[i], axisListSrcP[i], algoAxis); 
    89100        algoTransformation_[axisPositionInGrid[i]].push_back(algo); 
    90101      } 
     
    98109} 
    99110 
     111/*! 
     112  Compute index mapping representing transformation between two grids 
     113  Each domain and each axis can contain some information of transformation, these information are then converted into 
     114form of global index mapping reprensenting transformation between two grids. 
     115*/ 
    100116void CGridTransformation::computeTransformation() 
    101117{ 
     
    122138} 
    123139 
     140/*! 
     141  Compute transformation mapping between grid source and grid destination 
     142  The transformation between grid source and grid destination is represented in form of mapping between global index 
     143of two grids. Then local index mapping between data on each grid will be found out thanks to these global indexes 
     144*/ 
    124145void CGridTransformation::computeTransformationMapping() 
    125146{ 
     
    141162  CArray<size_t,1> globalIndexOnClientSrc = gridSource_->getDistributionClient()->getGlobalDataIndexSendToServer(); 
    142163 
    143  
    144164  std::vector<size_t>::const_iterator itbVec, itVec, iteVec; 
    145165  CArray<size_t, 1>::iterator itbArr, itArr, iteArr; 
    146166 
    147167  std::map<int,std::vector<std::vector<size_t> > >::const_iterator itbMapRecv, itMapRecv, iteMapRecv; 
     168 
    148169  // Find out local index on grid destination (received) 
    149170  itbMapRecv = globalIndexToReceive.begin(); 
     
    166187        { 
    167188          int localIdx = std::distance(itbArr, itArr); 
    168           (*localIndexToReceiveOnGridDest_[sourceRank][i])(idx) = localIndexOnClientDest(localIdx); 
     189//          (*localIndexToReceiveOnGridDest_[sourceRank][i])(idx) = localIndexOnClientDest(localIdx); // Local index of un-extracted data (only domain) 
     190          (*localIndexToReceiveOnGridDest_[sourceRank][i])(idx) = (localIdx); // Local index of extracted data 
    169191        } 
    170192      } 
    171193    } 
    172  
    173194  } 
    174195 
     
    183204    CArray<int,1>* ptr = new CArray<int,1>((itMap->second).size()); 
    184205    localIndexToSendFromGridSource_[itMap->first] = ptr; 
     206    int destRank = itMap->first; 
    185207    int vecSize = (itMap->second).size(); 
    186208    for (int idx = 0; idx < vecSize; ++idx) 
     
    190212      { 
    191213        int localIdx = std::distance(itbArr, itArr); 
    192         (*localIndexToSendFromGridSource_[itMap->first])(idx) = localIndexOnClientSrc(localIdx); 
    193       } 
    194     } 
    195   } 
    196 } 
    197  
     214//        (*localIndexToSendFromGridSource_[destRank])(idx) = localIndexOnClientSrc(localIdx); 
     215        (*localIndexToSendFromGridSource_[destRank])(idx) = (localIdx); 
     216      } 
     217    } 
     218  } 
     219} 
     220 
     221/*! 
     222  Local index of data which need sending from the grid source 
     223  \return local index of data 
     224*/ 
    198225std::map<int, CArray<int,1>* > CGridTransformation::getLocalIndexToSendFromGridSource() 
    199226{ 
     
    201228} 
    202229 
     230/*! 
     231  Local index of data which will be received on the grid destination 
     232  \return local index of data 
     233*/ 
    203234std::map<int, std::vector<CArray<int,1>* > > CGridTransformation::getLocalIndexToReceiveOnGridDest() 
    204235{ 
  • XIOS/trunk/src/filter/transformation_mapping.cpp

    r620 r621  
    3333/*! 
    3434  Suppose that we have transformations between two grids, which are represented in form of mapping between global indexes of these two grids, 
    35 this function tries to find out which clients a client need to send and receive these global indexes to accomplish the transformations. 
     35this function tries to find out which clients a client needs to send and receive these global indexes to accomplish the transformations. 
    3636  The grid destination is the grid whose global indexes demande global indexes from the grid source 
    3737  Grid destination and grid source are also distributed among clients but in a different manner. 
  • XIOS/trunk/src/group_factory_decl.cpp

    r619 r621  
    2525  macro(CContextGroup) 
    2626  macro(CVariableGroup) 
    27   macro(CTransformationGroup) 
     27  macro(CInverseAxisGroup) 
     28  macro(CZoomAxisGroup) 
    2829} 
  • XIOS/trunk/src/group_template_decl.cpp

    r619 r621  
    1414  macro(Axis) 
    1515  macro(Variable) 
    16   macro(Transformation) 
     16  macro(InverseAxis) 
     17  macro(ZoomAxis) 
    1718 
    1819 
  • XIOS/trunk/src/node/axis.cpp

    r620 r621  
    1818      , CAxisAttributes(), isChecked(false), relFiles(), baseRefObject(), areClientAttributesChecked_(false) 
    1919      , isDistributed_(false) 
    20    { /* Ne rien faire de plus */ } 
     20      , transformationMap_() 
     21   { 
     22   } 
    2123 
    2224   CAxis::CAxis(const StdString & id) 
     
    2426      , CAxisAttributes(), isChecked(false), relFiles(), baseRefObject(), areClientAttributesChecked_(false) 
    2527      , isDistributed_(false) 
    26    { /* Ne rien faire de plus */ } 
     28      , transformationMap_() 
     29   { 
     30   } 
    2731 
    2832   CAxis::~CAxis(void) 
     
    308312  bool CAxis::hasTransformation() 
    309313  { 
    310     return (!transformations_.empty()); 
    311   } 
    312  
    313   void CAxis::setTransformations(const std::vector<CTransformation*>& transformations) 
    314   { 
    315     transformations_ = transformations; 
    316   } 
    317  
    318   std::vector<CTransformation*> CAxis::getAllTransformations(void) 
    319   { 
    320     if (!hasTransformation()) 
    321       setTransformations(this->getVirtualTransformationGroup()->getAllChildren()); 
    322  
    323     return transformations_; 
     314    return (!transformationMap_.empty()); 
     315  } 
     316 
     317  void CAxis::setTransformations(const TransMapTypes& axisTrans) 
     318  { 
     319    transformationMap_ = axisTrans; 
     320  } 
     321 
     322  CAxis::TransMapTypes CAxis::getAllTransformations(void) 
     323  { 
     324    return transformationMap_; 
     325  } 
     326 
     327  /*! 
     328    Check the validity of all transformations applied on axis 
     329  This functions is called AFTER all inherited attributes are solved 
     330  */ 
     331  void CAxis::checkTransformations() 
     332  { 
     333    TransMapTypes::const_iterator itb = transformationMap_.begin(), it, 
     334                                  ite = transformationMap_.end(); 
     335    for (it = itb; it != ite; ++it) 
     336    { 
     337      (it->second)->checkValid(this); 
     338    } 
    324339  } 
    325340 
     
    350365    if (node.goToChildElement()) 
    351366    { 
    352       StdString tranformation("transformation"); 
     367      StdString inverseAxisDefRoot("inverse_axis_definition"); 
     368      StdString inverse("inverse_axis"); 
     369      StdString zoomAxisDefRoot("zoom_axis_definition"); 
     370      StdString zoom("zoom_axis"); 
    353371      do 
    354372      { 
    355         if (node.getElementName() == tranformation) { 
    356            this->getVirtualTransformationGroup()->parseChild(node); 
     373        if (node.getElementName() == inverse) { 
     374          CInverseAxis* tmp = (CInverseAxisGroup::get(inverseAxisDefRoot))->createChild(); 
     375          tmp->parse(node); 
     376          transformationMap_[TRANS_INVERSE_AXIS] = tmp; 
     377        } else if (node.getElementName() == zoom) { 
     378          CZoomAxis* tmp = (CZoomAxisGroup::get(zoomAxisDefRoot))->createChild(); 
     379          tmp->parse(node); 
     380          transformationMap_[TRANS_ZOOM_AXIS] = tmp; 
    357381        } 
    358382      } while (node.goToNextElement()) ; 
    359383      node.goToParentElement(); 
    360384    } 
    361     setTransformations(this->getVirtualTransformationGroup()->getAllChildren()); 
    362385  } 
    363386 
  • XIOS/trunk/src/node/axis.hpp

    r620 r621  
    1616#include "transformation.hpp" 
    1717#include "transformation_enum.hpp" 
     18#include "inverse_axis.hpp" 
     19#include "zoom_axis.hpp" 
    1820 
    1921namespace xios { 
     
    2325   class CAxisAttributes; 
    2426   class CAxis; 
    25    class CTransformationGroup; 
    26    class CVirtualTransformationGroup; 
    2727 
    28    DECLARE_VIRTUAL_NODE(TransformationGroup); 
    2928   ///-------------------------------------------------------------- 
    3029 
     
    3938      : public CObjectTemplate<CAxis> 
    4039      , public CAxisAttributes 
    41       , public CVirtualTransformationGroup 
    4240   { 
    4341         enum EEventId 
     
    5452         typedef CAxisAttributes RelAttributes; 
    5553         typedef CAxisGroup      RelGroup; 
     54         typedef CTransformation<CAxis>::TransformationMapTypes TransMapTypes; 
    5655 
     56      public: 
    5757         /// Constructeurs /// 
    5858         CAxis(void); 
     
    9696         bool hasTransformation(); 
    9797         void solveInheritanceTransformation(); 
    98          std::vector<CTransformation*> getAllTransformations(); 
     98         TransMapTypes getAllTransformations(); 
    9999 
    100100      public: 
     
    106106         void checkMask(); 
    107107         void checkZoom(); 
     108         void checkTransformations(); 
     109         void computeServerIndex(const std::vector<int>& globalDim, int orderPositionInGrid, 
     110                                 CServerDistributionDescription::ServerDistributionType disType); 
    108111 
    109112 
    110  
    111          void setTransformations(const std::vector<CTransformation*>&); 
     113         void setTransformations(const TransMapTypes&); 
    112114      private: 
    113115         bool isChecked; 
    114116         bool areClientAttributesChecked_; 
    115117         std::set<StdString> relFiles; 
    116          std::vector<CTransformation*> transformations_; 
     118         TransMapTypes transformationMap_; 
    117119         bool isDistributed_; 
    118120 
  • XIOS/trunk/src/node/field.cpp

    r620 r621  
    3131      , processed(false), domAxisIds_("", ""), areAllReferenceSolved(false), areAllExpressionBuilt(false), filter(0) 
    3232      , isReadDataRequestPending(false) 
     33      , filterSources_(), algorithms_() 
    3334      { setVirtualVariableGroup(); } 
    3435 
     
    4445      , processed(false), domAxisIds_("", ""), areAllReferenceSolved(false), areAllExpressionBuilt(false), filter(0) 
    4546      , isReadDataRequestPending(false) 
     47      , filterSources_(), algorithms_() 
    4648   { setVirtualVariableGroup(); } 
    4749 
     
    804806         gridRefOfFieldRef->transformGrid(relGridRef); 
    805807         filterSources_.push_back(fieldRef); 
    806 //         transformations_ = relGridRef->getTransformations(); 
    807 //         switch (gridRefOfFieldRef->getGridElementType()) { 
    808 //         case CGrid::GRID_ONLY_AXIS: 
    809 ////           filter = new CAxisFilter(gridRefOfFieldRef, relGridRef); 
    810 ////           break; 
    811 //         default: 
    812 //           filter = new CAxisFilter(gridRefOfFieldRef, relGridRef); 
    813 //           break; 
    814 //         } 
    815 //         setAlgorithms(); 
    816808       } 
    817809     } 
    818810   } 
    819  
    820  
    821 //  void CField::setAlgorithms() 
    822 //  { 
    823 //    std::vector<ETransformationType>::iterator itTrans  = transformations_.begin(), 
    824 //                                               iteTrans = transformations_.end(); 
    825 //    std::set<ETransformationType> tmp; 
    826 //    for (; itTrans != iteTrans; ++itTrans) 
    827 //    { 
    828 //      if (tmp.end() == tmp.find(*itTrans)) 
    829 //      { 
    830 //        switch (*itTrans) { 
    831 //        case eInverse: 
    832 //          algorithms_.push_back(new CInvertAlgorithm()); 
    833 //          break; 
    834 //        default: 
    835 //          break; 
    836 //        } 
    837 //      } 
    838 //      tmp.insert(*itTrans); 
    839 //    } 
    840 //  } 
    841811 
    842812   const std::vector<CField*>& CField::getFilterSources() 
     
    857827             const std::map<int, CArray<int,1>* >& localIndexToSend = (*itFilterSrc)->grid->getTransformations()->getLocalIndexToSendFromGridSource(); 
    858828             const std::map<int, std::vector<CArray<int,1>* > > localIndexToReceive = (*itFilterSrc)->grid->getTransformations()->getLocalIndexToReceiveOnGridDest(); 
     829 
    859830             sendAndReceiveTransformedData(localIndexToSend, dataToSend, 
    860831                                           localIndexToReceive, dataToReceive); 
     
    862833 
    863834        } 
    864  
    865 //        std::cout << "it data " << (*it)->data << std::endl; 
    866 //        std::cout << "it filtered data " << (*it)->filteredData << std::endl; 
    867835     } 
    868836   } 
  • XIOS/trunk/src/node/field.hpp

    r620 r621  
    232232         std::vector<CField*> filterSources_; 
    233233         std::vector<CGenericAlgorithm*> algorithms_; 
    234          std::vector<ETransformationType> transformations_; 
    235234         DECLARE_REF_FUNC(Field,field) 
    236235 
  • XIOS/trunk/src/node/field_impl.hpp

    r620 r621  
    3838          { 
    3939            (*itFilterSrc)->updateDataWithoutOperation(_data, (*itFilterSrc)->data); 
    40             (*it)->updateDataWithoutOperation(_data, (*it)->filteredData); 
     40            if ((*it)->filteredData.numElements() != (*it)->grid->storeIndex_client.numElements()) 
     41            { 
     42               (*it)->filteredData.resize((*it)->grid->storeIndex_client.numElements()); 
     43            } 
    4144            (*it)->applyFilter((*itFilterSrc)->data, (*it)->filteredData); 
    4245          } 
    4346          if ((*it)->hasOutputFile || (*it)->hasFieldOut) (*it)->updateFilteredData((*it)->filteredData); 
    44 //          itFilterSrc = fieldFilterSources.begin(); iteFilterSrc = fieldFilterSources.end(); 
    45 //          for (; itFilterSrc != iteFilterSrc; ++itFilterSrc) (*itFilterSrc)->updateDataWithoutOperation(_data); 
    46 //          (*it)->applyFilter(); 
    47 //          std::cout << "it data " << (*it)->data << std::endl; 
    48 //          std::cout << "it filtered data " << (*it)->filteredData << std::endl; 
    49 //          if ((*it)->hasOutputFile || (*it)->hasFieldOut) (*it)->updateFilteredData((*it)->filteredData); 
    5047        } 
    5148        else 
     
    5451          if (hasOutputFile || hasFieldOut) updateData(_data); 
    5552        } 
    56  
    5753      } 
    5854 
  • XIOS/trunk/src/node/grid.cpp

    r620 r621  
    11521152    transformations_ = new CGridTransformation(transformedGrid, this); 
    11531153    transformations_->computeTransformationMapping(); 
    1154     std::cout << "send index " << *(transformations_->getLocalIndexToSendFromGridSource()[0]) << std::endl; 
    1155     std::cout << "receive index " << *(transformations_->getLocalIndexToReceiveOnGridDest()[0][0]) << std::endl; 
    11561154  } 
    11571155 
  • XIOS/trunk/src/node/node_enum.hpp

    r619 r621  
    1919         eContext,gContext, 
    2020         eCalendarWrapper, 
    21          eTransformation 
    22  
     21         eTransformation, 
     22         eInverseAxis, 
     23         eZoomAxis 
    2324//#include "node_type.conf" 
    2425 
  • XIOS/trunk/src/node/node_type.hpp

    r619 r621  
    1010#include "context.hpp" 
    1111#include "transformation.hpp" 
     12#include "inverse_axis.hpp" 
     13#include "zoom_axis.hpp" 
    1214 
    1315#endif // __XIOS_NODE_TYPE__ 
  • XIOS/trunk/src/node/transformation.hpp

    r619 r621  
    22#define __XMLIO_CTransformation__ 
    33 
    4 /// xios headers /// 
    54#include "xmlioserver_spl.hpp" 
    6 #include "attribute_enum.hpp" 
    7 #include "attribute_enum_impl.hpp" 
    8 #include "attribute_array.hpp" 
    9 #include "declare_attribute.hpp" 
    10 #include "object_template.hpp" 
    11 #include "group_factory.hpp" 
    12 #include "declare_group.hpp" 
     5#include "transformation_enum.hpp" 
    136 
    147namespace xios { 
    15  
    16   /// ////////////////////// Déclarations ////////////////////// /// 
    17   class CTransformationGroup; 
    18   class CTransformationAttributes; 
    19   class CTransformation; 
    20   ///-------------------------------------------------------------- 
    21  
    22   // Declare/Define CFileAttribute 
    23   BEGIN_DECLARE_ATTRIBUTE_MAP(CTransformation) 
    24 #include "transformation_attribute.conf" 
    25   END_DECLARE_ATTRIBUTE_MAP(CTransformation) 
    268 
    279  ///-------------------------------------------------------------- 
    2810  /*! 
    2911    \class CTransformation 
    30     This class describes transformation in xml file. 
     12    This class describes inverse_axis in xml file. 
    3113  */ 
     14  template<typename T> 
    3215  class CTransformation 
    33     : public CObjectTemplate<CTransformation> 
    34     , public CTransformationAttributes 
    3516  { 
    36     public : 
    37       enum TransformationId 
    38       { 
    39         TRANS_ID_ZOOM, TRANS_ID_INVERSE 
    40       }; 
    41       typedef CObjectTemplate<CTransformation> SuperClass; 
    42       typedef CTransformationAttributes SuperClassAttribute; 
     17  public: 
     18    typedef typename boost::unordered_map<ETranformationType, CTransformation<T>*, boost::hash<int> > TransformationMapTypes; 
     19    typedef TransformationMapTypes TransMapTypes; 
    4320 
    4421    public : 
    4522      /// Constructeurs /// 
    46       CTransformation(void); 
    47       explicit CTransformation(const StdString& id); 
     23      CTransformation(void) {} 
     24      virtual void checkValid(T* dest) = 0; 
    4825 
    4926      /// Destructeur /// 
    50       virtual ~CTransformation(void); 
    51  
    52       /// Accesseurs statiques /// 
    53       static StdString GetName(void); 
    54       static StdString GetDefName(void); 
    55       static ENodeType GetType(void); 
    56     private: 
    57       static std::vector<StdString> TransformationTypes; 
    58       static std::vector<TransformationId> TransformationTypeIds; 
    59  
    60     public : 
    61       void checkAttributes(); 
    62  
    63     private: 
    64       void checkAttributesType(TransformationId& transType); 
    65       void checkAttributesZoomType(); 
    66       void checkAttributesInverseType(); 
    67  
    68     private: 
     27      virtual ~CTransformation(void) {} 
    6928  }; // class CTransformation 
    7029 
    71   DECLARE_GROUP(CTransformation); 
    7230} // namespace xios 
    7331 
  • XIOS/trunk/src/node/transformation_enum.hpp

    r619 r621  
    88{ 
    99      /// ////////////////////// Définitions ////////////////////// /// 
    10       typedef enum transformationType 
     10      typedef enum transformation_type 
    1111      { 
    12          UnknownTransformation = 0, 
    13          eInverse, 
    14          eZoom 
    15  
    16 //#include "node_type.conf" 
    17  
    18       } ETransformationType; 
     12        TRANS_ZOOM_AXIS, 
     13        TRANS_INVERSE_AXIS 
     14      } ETranformationType; 
    1915 
    2016} // namespace xios 
  • XIOS/trunk/src/object_factory_decl.cpp

    r619 r621  
    2424  macro(CCalendarWrapper) 
    2525  macro(CVariable) 
    26   macro(CTransformation) 
     26  macro(CInverseAxis) 
     27  macro(CZoomAxis) 
    2728 
    2829  macro(CFieldGroup) 
     
    3334  macro(CContextGroup) 
    3435  macro(CVariableGroup) 
    35   macro(CTransformationGroup) 
     36  macro(CInverseAxisGroup) 
     37  macro(CZoomAxisGroup) 
    3638} 
  • XIOS/trunk/src/object_template_decl.cpp

    r619 r621  
    99#include "variable.hpp" 
    1010#include "transformation.hpp" 
    11  
     11#include "inverse_axis.hpp" 
     12#include "zoom_axis.hpp" 
    1213 
    1314namespace xios 
     
    2122  template class CObjectTemplate<CAxis>; 
    2223  template class CObjectTemplate<CVariable>; 
    23   template class CObjectTemplate<CTransformation>; 
     24  template class CObjectTemplate<CInverseAxis>; 
     25  template class CObjectTemplate<CZoomAxis>; 
    2426 
    2527  template class CObjectTemplate<CContextGroup>; 
     
    3032  template class CObjectTemplate<CAxisGroup>; 
    3133  template class CObjectTemplate<CVariableGroup>; 
    32   template class CObjectTemplate<CTransformationGroup>; 
     34  template class CObjectTemplate<CInverseAxisGroup>; 
     35  template class CObjectTemplate<CZoomAxisGroup>; 
    3336} 
  • XIOS/trunk/src/test/test_new_features.f90

    r620 r621  
    1717  INTEGER,PARAMETER :: ni_glo=5 
    1818  INTEGER,PARAMETER :: nj_glo=5 
    19   INTEGER,PARAMETER :: llm=5 
     19  INTEGER,PARAMETER :: llm=2 
    2020  DOUBLE PRECISION  :: lval(llm)=1, tsTemp 
    2121  TYPE(xios_field) :: field_hdl 
     
    155155  DO ts=1,24*10 
    156156    CALL xios_update_calendar(ts) 
    157 !    CALL xios_send_field("field_A",field_A) 
     157    CALL xios_send_field("field_A",field_A) 
    158158    CALL xios_send_field("field_Axis",field_Axis) 
    159159 
    160160    CALL xios_send_field("field_Two_Axis",field_Two_Axis) 
    161 !    CALL xios_send_field("field_All_Axis",field_All_Axis) 
     161    CALL xios_send_field("field_All_Axis",field_All_Axis) 
    162162!    tsTemp = ts 
    163163!    CALL xios_send_scalar("field_Scalar", tsTemp) 
  • XIOS/trunk/src/type/type_util.hpp

    r619 r621  
    2020    class CVariable; 
    2121    class CVariableGroup; 
    22     class CTransformation; 
    23     class CTransformationGroup; 
     22    class CInverseAxis; 
     23    class CInverseAxisGroup; 
     24    class CZoomAxis; 
     25    class CZoomAxisGroup; 
    2426 
    2527  template <typename T> inline string getStrType(void); 
     
    5860  macro(CVariable) 
    5961  macro(CVariableGroup) 
    60   macro(CTransformation) 
    61   macro(CTransformationGroup) 
    62  
     62  macro(CInverseAxis) 
     63  macro(CInverseAxisGroup) 
     64  macro(CZoomAxis) 
     65  macro(CZoomAxisGroup) 
    6366#undef macro 
    6467} 
  • XIOS/trunk/src/xios_spl.hpp

    r591 r621  
    2828 
    2929/// boost headers /// 
    30 //#include <boost/unordered_map.hpp> 
     30#include <boost/unordered_map.hpp> 
    3131#include <boost/shared_ptr.hpp> 
    3232#include <boost/cast.hpp> 
  • XIOS/trunk/src/xml_parser_decl.cpp

    r619 r621  
    2525    macro( File ) 
    2626    macro( Variable ) 
    27     macro( Transformation ) 
     27    macro( InverseAxis ) 
     28    macro( ZoomAxis ) 
    2829  } 
    2930} 
Note: See TracChangeset for help on using the changeset viewer.