Changeset 621 for XIOS/trunk/src/node
- Timestamp:
- 06/22/15 13:36:21 (9 years ago)
- Location:
- XIOS/trunk/src/node
- Files:
-
- 4 added
- 1 deleted
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/node/axis.cpp
r620 r621 18 18 , CAxisAttributes(), isChecked(false), relFiles(), baseRefObject(), areClientAttributesChecked_(false) 19 19 , isDistributed_(false) 20 { /* Ne rien faire de plus */ } 20 , transformationMap_() 21 { 22 } 21 23 22 24 CAxis::CAxis(const StdString & id) … … 24 26 , CAxisAttributes(), isChecked(false), relFiles(), baseRefObject(), areClientAttributesChecked_(false) 25 27 , isDistributed_(false) 26 { /* Ne rien faire de plus */ } 28 , transformationMap_() 29 { 30 } 27 31 28 32 CAxis::~CAxis(void) … … 308 312 bool CAxis::hasTransformation() 309 313 { 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 } 324 339 } 325 340 … … 350 365 if (node.goToChildElement()) 351 366 { 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"); 353 371 do 354 372 { 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; 357 381 } 358 382 } while (node.goToNextElement()) ; 359 383 node.goToParentElement(); 360 384 } 361 setTransformations(this->getVirtualTransformationGroup()->getAllChildren());362 385 } 363 386 -
XIOS/trunk/src/node/axis.hpp
r620 r621 16 16 #include "transformation.hpp" 17 17 #include "transformation_enum.hpp" 18 #include "inverse_axis.hpp" 19 #include "zoom_axis.hpp" 18 20 19 21 namespace xios { … … 23 25 class CAxisAttributes; 24 26 class CAxis; 25 class CTransformationGroup;26 class CVirtualTransformationGroup;27 27 28 DECLARE_VIRTUAL_NODE(TransformationGroup);29 28 ///-------------------------------------------------------------- 30 29 … … 39 38 : public CObjectTemplate<CAxis> 40 39 , public CAxisAttributes 41 , public CVirtualTransformationGroup42 40 { 43 41 enum EEventId … … 54 52 typedef CAxisAttributes RelAttributes; 55 53 typedef CAxisGroup RelGroup; 54 typedef CTransformation<CAxis>::TransformationMapTypes TransMapTypes; 56 55 56 public: 57 57 /// Constructeurs /// 58 58 CAxis(void); … … 96 96 bool hasTransformation(); 97 97 void solveInheritanceTransformation(); 98 std::vector<CTransformation*>getAllTransformations();98 TransMapTypes getAllTransformations(); 99 99 100 100 public: … … 106 106 void checkMask(); 107 107 void checkZoom(); 108 void checkTransformations(); 109 void computeServerIndex(const std::vector<int>& globalDim, int orderPositionInGrid, 110 CServerDistributionDescription::ServerDistributionType disType); 108 111 109 112 110 111 void setTransformations(const std::vector<CTransformation*>&); 113 void setTransformations(const TransMapTypes&); 112 114 private: 113 115 bool isChecked; 114 116 bool areClientAttributesChecked_; 115 117 std::set<StdString> relFiles; 116 std::vector<CTransformation*> transformations_;118 TransMapTypes transformationMap_; 117 119 bool isDistributed_; 118 120 -
XIOS/trunk/src/node/field.cpp
r620 r621 31 31 , processed(false), domAxisIds_("", ""), areAllReferenceSolved(false), areAllExpressionBuilt(false), filter(0) 32 32 , isReadDataRequestPending(false) 33 , filterSources_(), algorithms_() 33 34 { setVirtualVariableGroup(); } 34 35 … … 44 45 , processed(false), domAxisIds_("", ""), areAllReferenceSolved(false), areAllExpressionBuilt(false), filter(0) 45 46 , isReadDataRequestPending(false) 47 , filterSources_(), algorithms_() 46 48 { setVirtualVariableGroup(); } 47 49 … … 804 806 gridRefOfFieldRef->transformGrid(relGridRef); 805 807 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();816 808 } 817 809 } 818 810 } 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 // }841 811 842 812 const std::vector<CField*>& CField::getFilterSources() … … 857 827 const std::map<int, CArray<int,1>* >& localIndexToSend = (*itFilterSrc)->grid->getTransformations()->getLocalIndexToSendFromGridSource(); 858 828 const std::map<int, std::vector<CArray<int,1>* > > localIndexToReceive = (*itFilterSrc)->grid->getTransformations()->getLocalIndexToReceiveOnGridDest(); 829 859 830 sendAndReceiveTransformedData(localIndexToSend, dataToSend, 860 831 localIndexToReceive, dataToReceive); … … 862 833 863 834 } 864 865 // std::cout << "it data " << (*it)->data << std::endl;866 // std::cout << "it filtered data " << (*it)->filteredData << std::endl;867 835 } 868 836 } -
XIOS/trunk/src/node/field.hpp
r620 r621 232 232 std::vector<CField*> filterSources_; 233 233 std::vector<CGenericAlgorithm*> algorithms_; 234 std::vector<ETransformationType> transformations_;235 234 DECLARE_REF_FUNC(Field,field) 236 235 -
XIOS/trunk/src/node/field_impl.hpp
r620 r621 38 38 { 39 39 (*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 } 41 44 (*it)->applyFilter((*itFilterSrc)->data, (*it)->filteredData); 42 45 } 43 46 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);50 47 } 51 48 else … … 54 51 if (hasOutputFile || hasFieldOut) updateData(_data); 55 52 } 56 57 53 } 58 54 -
XIOS/trunk/src/node/grid.cpp
r620 r621 1152 1152 transformations_ = new CGridTransformation(transformedGrid, this); 1153 1153 transformations_->computeTransformationMapping(); 1154 std::cout << "send index " << *(transformations_->getLocalIndexToSendFromGridSource()[0]) << std::endl;1155 std::cout << "receive index " << *(transformations_->getLocalIndexToReceiveOnGridDest()[0][0]) << std::endl;1156 1154 } 1157 1155 -
XIOS/trunk/src/node/node_enum.hpp
r619 r621 19 19 eContext,gContext, 20 20 eCalendarWrapper, 21 eTransformation 22 21 eTransformation, 22 eInverseAxis, 23 eZoomAxis 23 24 //#include "node_type.conf" 24 25 -
XIOS/trunk/src/node/node_type.hpp
r619 r621 10 10 #include "context.hpp" 11 11 #include "transformation.hpp" 12 #include "inverse_axis.hpp" 13 #include "zoom_axis.hpp" 12 14 13 15 #endif // __XIOS_NODE_TYPE__ -
XIOS/trunk/src/node/transformation.hpp
r619 r621 2 2 #define __XMLIO_CTransformation__ 3 3 4 /// xios headers ///5 4 #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" 13 6 14 7 namespace xios { 15 16 /// ////////////////////// Déclarations ////////////////////// ///17 class CTransformationGroup;18 class CTransformationAttributes;19 class CTransformation;20 ///--------------------------------------------------------------21 22 // Declare/Define CFileAttribute23 BEGIN_DECLARE_ATTRIBUTE_MAP(CTransformation)24 #include "transformation_attribute.conf"25 END_DECLARE_ATTRIBUTE_MAP(CTransformation)26 8 27 9 ///-------------------------------------------------------------- 28 10 /*! 29 11 \class CTransformation 30 This class describes transformationin xml file.12 This class describes inverse_axis in xml file. 31 13 */ 14 template<typename T> 32 15 class CTransformation 33 : public CObjectTemplate<CTransformation>34 , public CTransformationAttributes35 16 { 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; 43 20 44 21 public : 45 22 /// Constructeurs /// 46 CTransformation(void) ;47 explicit CTransformation(const StdString& id);23 CTransformation(void) {} 24 virtual void checkValid(T* dest) = 0; 48 25 49 26 /// 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) {} 69 28 }; // class CTransformation 70 29 71 DECLARE_GROUP(CTransformation);72 30 } // namespace xios 73 31 -
XIOS/trunk/src/node/transformation_enum.hpp
r619 r621 8 8 { 9 9 /// ////////////////////// Définitions ////////////////////// /// 10 typedef enum transformation Type10 typedef enum transformation_type 11 11 { 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; 19 15 20 16 } // namespace xios
Note: See TracChangeset
for help on using the changeset viewer.