Ignore:
Timestamp:
07/05/16 15:59:10 (8 years ago)
Author:
mhnguyen
Message:

Adding new transformation for scalar: Reducing an axis to a scalar

+) Add new xml node for new transformation
+) Add new algorithms for axis reduction
+) Make change in some place to make sure everything work fine

Test
+) On Curie
+) Tests pass and are correct

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/node/scalar.cpp

    r887 r888  
    2727   { /* Ne rien faire de plus */ } 
    2828 
     29   std::map<StdString, ETranformationType> CScalar::transformationMapList_ = std::map<StdString, ETranformationType>(); 
     30   bool CScalar::dummyTransformationMapList_ = CScalar::initializeTransformationMap(CScalar::transformationMapList_); 
     31   bool CScalar::initializeTransformationMap(std::map<StdString, ETranformationType>& m) 
     32   { 
     33     m["reduce_axis"] = TRANS_REDUCE_AXIS_TO_SCALAR; 
     34   } 
     35 
    2936   StdString CScalar::GetName(void)   { return (StdString("scalar")); } 
    3037   StdString CScalar::GetDefName(void){ return (CScalar::GetName()); } 
     
    4956   void CScalar::checkAttributes(void) 
    5057   { 
    51 //      if (this->value.isEmpty()) 
    52 //      { 
    53 //        this->value.setValue(0); 
    54 //      } 
    5558   } 
    5659 
     
    124127  } 
    125128 
     129  /*! 
     130    Parse children nodes of a scalar in xml file. 
     131    \param node child node to process 
     132  */ 
     133  void CScalar::parse(xml::CXMLNode & node) 
     134  { 
     135    SuperClass::parse(node); 
     136 
     137    if (node.goToChildElement()) 
     138    { 
     139      StdString nodeElementName; 
     140      do 
     141      { 
     142        StdString nodeId(""); 
     143        if (node.getAttributes().end() != node.getAttributes().find("id")) 
     144        { nodeId = node.getAttributes()["id"]; } 
     145 
     146        nodeElementName = node.getElementName(); 
     147        std::map<StdString, ETranformationType>::const_iterator ite = transformationMapList_.end(), it; 
     148        it = transformationMapList_.find(nodeElementName); 
     149        if (ite != it) 
     150        { 
     151          transformationMap_.push_back(std::make_pair(it->second, CTransformation<CScalar>::createTransformation(it->second, 
     152                                                                                                                 nodeId, 
     153                                                                                                                 &node))); 
     154        } 
     155      } while (node.goToNextElement()) ; 
     156      node.goToParentElement(); 
     157    } 
     158  } 
    126159 
    127160  // Definition of some macros 
Note: See TracChangeset for help on using the changeset viewer.