Changeset 2011 for XIOS/dev/dev_ym
- Timestamp:
- 01/12/21 23:05:02 (4 years ago)
- Location:
- XIOS/dev/dev_ym/XIOS_COUPLING/src
- Files:
-
- 2 added
- 14 deleted
- 83 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/gatherer_connector.hpp
r1995 r2011 110 110 } 111 111 112 // hook for transfering mask in grid connector, maybe find an other way to doing that... 113 void transfer_or(int rank, CGathererConnector** connectors, int nConnectors, const bool* input, bool* output) 114 { 115 auto& connector = connector_[rank] ; // probably costly, find a better way to avoid the map 116 auto& mask = mask_[rank] ; 117 int srcSize = mask.size() ; 118 119 if (nConnectors==0) 120 { 121 for(int i=0, j=0; i<srcSize; i++) 122 if (mask[i]) 123 { 124 *(output+connector[j]) |= *(input + i) ; 125 j++ ; 126 } 127 128 } 129 else 130 { 131 int srcSliceSize = (*(connectors-1))->getSrcSliceSize(rank, connectors-1, nConnectors-1) ; 132 int dstSliceSize = (*(connectors-1))->getDstSliceSize(connectors-1, nConnectors-1) ; 133 134 const bool* in = input ; 135 for(int i=0,j=0;i<srcSize;i++) 136 { 137 if (mask[i]) 138 { 139 (*(connectors-1))->transfer_or(rank, connectors-1, nConnectors-1, in, output+connector[j]*dstSliceSize) ; // the multiplication must be avoid in further optimization 140 j++ ; 141 } 142 in += srcSliceSize ; 143 } 144 } 145 146 } 147 148 112 149 113 150 template<typename T> -
XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/grid_gatherer_connector.hpp
r1943 r2011 65 65 transfer(dataIn, dataOut) ; 66 66 } 67 67 68 69 void transfer_or(CEventServer& event, CArray<bool,1>& dataOut) 70 { 71 map<int, CArray<bool,1>> dataIn ; 72 for (auto& subEvent : event.subEvents) 73 { 74 auto& data = dataIn[subEvent.rank]; 75 (*subEvent.buffer) >> data ; 76 } 77 transfer_or(dataIn, dataOut) ; 78 } 79 68 80 template<typename T> 69 81 void transfer(CEventServer& event, CArray<T,1>& dataOut, T missingValue) … … 78 90 } 79 91 92 void transfer_or(const map<int, CArray<bool,1>>& input, CArray<bool,1>& output) 93 { 94 int n = elementsConnector_.size()-1 ; 95 CGathererConnector** connector = elementsConnector_.data() + n ; 96 output.resize(dstSize_) ; 97 output = false ; 98 for(auto& rankDataIn : input) 99 { 100 elementsConnector_[n]->transfer_or(rankDataIn.first, connector, n, rankDataIn.second.dataFirst(), output.dataFirst()) ; 101 } 102 } 103 80 104 }; 81 105 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/filter/temporal_transform_filter.cpp
r2007 r2011 4 4 { 5 5 6 CTemporalTransformFilter::CTemporalTransformFilter(CGarbageCollector& gc, CGridAlgorithm* algo, int nrecords, bool detectMissingValues, double defaultValue)7 : CTransformFilter(gc, algo, detectMissingValues, defaultValue), nrecords_(nrecords)6 CTemporalTransformFilter::CTemporalTransformFilter(CGarbageCollector& gc, int slots, CGridAlgorithm* algo, int nrecords, bool detectMissingValues, double defaultValue) 7 : CTransformFilter(gc, slots, algo, detectMissingValues, defaultValue), nrecords_(nrecords) 8 8 { 9 9 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/filter/temporal_transform_filter.hpp
r2007 r2011 14 14 public: 15 15 16 CTemporalTransformFilter(CGarbageCollector& gc, CGridAlgorithm* algo, int nrecords, bool detectMissingValues, double defaultValue) ;16 CTemporalTransformFilter(CGarbageCollector& gc, int slots, CGridAlgorithm* algo, int nrecords, bool detectMissingValues, double defaultValue) ; 17 17 18 18 protected: -
XIOS/dev/dev_ym/XIOS_COUPLING/src/filter/transform_filter.cpp
r1999 r2011 5 5 { 6 6 7 CTransformFilter::CTransformFilter( CGarbageCollector& gc, CGridAlgorithm* algo, bool detectMissingValues, double defaultValue)8 : CFilter(gc, 1, this), algorithm_(algo),7 CTransformFilter::CTransformFilter( CGarbageCollector& gc, int slots, CGridAlgorithm* algo, bool detectMissingValues, double defaultValue) 8 : CFilter(gc, slots, this), algorithm_(algo), 9 9 detectMissingValues_(detectMissingValues), defaultValue_(defaultValue) 10 10 { … … 20 20 packet->status = data[0]->status; 21 21 22 if (packet->status == CDataPacket::NO_ERROR) algorithm_->apply(data[0]->data, packet->data); 22 if (packet->status == CDataPacket::NO_ERROR) 23 { 24 if (data.size()>1) 25 { 26 vector<CArray<double,1>> auxData(data.size()-1); 27 for(int i=0;i<data.size()-1 ;i++) auxData[i].reference(data[i+1]->data) ; 28 algorithm_->apply(data[0]->data, auxData, packet->data); 29 } 30 else algorithm_->apply(data[0]->data, packet->data); 31 } 23 32 return packet; 24 33 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/filter/transform_filter.hpp
r2007 r2011 15 15 public: 16 16 17 CTransformFilter(CGarbageCollector& gc, CGridAlgorithm* algo, bool detectMissingValues, double defaultValue) ;17 CTransformFilter(CGarbageCollector& gc, int slots, CGridAlgorithm* algo, bool detectMissingValues, double defaultValue) ; 18 18 19 19 protected: -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/compute_connectivity_domain.cpp
r1984 r2011 1 1 #include "compute_connectivity_domain.hpp" 2 #include "domain_algorithm_compute_connectivity.hpp" 2 3 #include "type.hpp" 3 4 … … 51 52 } 52 53 54 CGenericAlgorithmTransformation* CComputeConnectivityDomain::createAlgorithm(bool isSource, 55 CGrid* gridDst, CGrid* gridSrc, 56 int elementPositionInGrid, 57 std::map<int, int>& elementPositionInGridSrc2ScalarPosition, 58 std::map<int, int>& elementPositionInGridSrc2AxisPosition, 59 std::map<int, int>& elementPositionInGridSrc2DomainPosition, 60 std::map<int, int>& elementPositionInGridDst2ScalarPosition, 61 std::map<int, int>& elementPositionInGridDst2AxisPosition, 62 std::map<int, int>& elementPositionInGridDst2DomainPosition) 63 { 64 return CDomainAlgorithmComputeConnectivity::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, 65 elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, 66 elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition) ; 67 } 53 68 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/compute_connectivity_domain.hpp
r1984 r2011 20 20 class CComputeConnectivityDomain; 21 21 class CDomain; 22 class CGenericAlgorithmTransformation ; 23 class CGrid; 22 24 23 25 ///-------------------------------------------------------------- … … 62 64 static CTransformation<CDomain>* getTransformation(const StdString& id) { return SuperClass::get(id);} 63 65 virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} 66 virtual CGenericAlgorithmTransformation* createAlgorithm(bool isSource, 67 CGrid* gridDst, CGrid* gridSrc, 68 int elementPositionInGrid, 69 std::map<int, int>& elementPositionInGridSrc2ScalarPosition, 70 std::map<int, int>& elementPositionInGridSrc2AxisPosition, 71 std::map<int, int>& elementPositionInGridSrc2DomainPosition, 72 std::map<int, int>& elementPositionInGridDst2ScalarPosition, 73 std::map<int, int>& elementPositionInGridDst2AxisPosition, 74 std::map<int, int>& elementPositionInGridDst2DomainPosition) ; 64 75 private: 65 76 static bool registerTrans(); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/duplicate_scalar_to_axis.cpp
r1984 r2011 1 1 #include "duplicate_scalar_to_axis.hpp" 2 #include "axis_algorithm_duplicate_scalar.hpp" 2 3 #include "type.hpp" 3 4 #include "axis.hpp" … … 43 44 44 45 } 45 46 47 CGenericAlgorithmTransformation* CDuplicateScalarToAxis::createAlgorithm(bool isSource, 48 CGrid* gridDst, CGrid* gridSrc, 49 int elementPositionInGrid, 50 std::map<int, int>& elementPositionInGridSrc2ScalarPosition, 51 std::map<int, int>& elementPositionInGridSrc2AxisPosition, 52 std::map<int, int>& elementPositionInGridSrc2DomainPosition, 53 std::map<int, int>& elementPositionInGridDst2ScalarPosition, 54 std::map<int, int>& elementPositionInGridDst2AxisPosition, 55 std::map<int, int>& elementPositionInGridDst2DomainPosition) 56 { 57 return CAxisAlgorithmDuplicateScalar::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, 58 elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, 59 elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition) ; 60 } 46 61 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/duplicate_scalar_to_axis.hpp
r1984 r2011 20 20 class CAxis; 21 21 class CScalar; 22 class CGenericAlgorithmTransformation ; 23 class CGrid; 22 24 23 25 ///-------------------------------------------------------------- … … 62 64 static CTransformation<CAxis>* getTransformation(const StdString& id) { return SuperClass::get(id);} 63 65 virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} 66 virtual CGenericAlgorithmTransformation* createAlgorithm(bool isSource, 67 CGrid* gridDst, CGrid* gridSrc, 68 int elementPositionInGrid, 69 std::map<int, int>& elementPositionInGridSrc2ScalarPosition, 70 std::map<int, int>& elementPositionInGridSrc2AxisPosition, 71 std::map<int, int>& elementPositionInGridSrc2DomainPosition, 72 std::map<int, int>& elementPositionInGridDst2ScalarPosition, 73 std::map<int, int>& elementPositionInGridDst2AxisPosition, 74 std::map<int, int>& elementPositionInGridDst2DomainPosition) ; 64 75 private: 65 76 static bool registerTrans(); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/expand_domain.cpp
r1984 r2011 1 1 #include "expand_domain.hpp" 2 #include "domain_algorithm_expand.hpp" 2 3 #include "type.hpp" 3 4 … … 47 48 if (this->type.isEmpty()) this->type.setValue(CExpandDomain::type_attr::edge); 48 49 } 49 50 51 CGenericAlgorithmTransformation* CExpandDomain::createAlgorithm(bool isSource, 52 CGrid* gridDst, CGrid* gridSrc, 53 int elementPositionInGrid, 54 std::map<int, int>& elementPositionInGridSrc2ScalarPosition, 55 std::map<int, int>& elementPositionInGridSrc2AxisPosition, 56 std::map<int, int>& elementPositionInGridSrc2DomainPosition, 57 std::map<int, int>& elementPositionInGridDst2ScalarPosition, 58 std::map<int, int>& elementPositionInGridDst2AxisPosition, 59 std::map<int, int>& elementPositionInGridDst2DomainPosition) 60 { 61 return CDomainAlgorithmExpand::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, 62 elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, 63 elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition) ; 64 } 50 65 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/expand_domain.hpp
r1984 r2011 20 20 class CExpandDomain; 21 21 class CDomain; 22 class CGenericAlgorithmTransformation ; 23 class CGrid; 22 24 23 25 ///-------------------------------------------------------------- … … 62 64 static CTransformation<CDomain>* getTransformation(const StdString& id) { return SuperClass::get(id);} 63 65 virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} 66 virtual CGenericAlgorithmTransformation* createAlgorithm(bool isSource, 67 CGrid* gridDst, CGrid* gridSrc, 68 int elementPositionInGrid, 69 std::map<int, int>& elementPositionInGridSrc2ScalarPosition, 70 std::map<int, int>& elementPositionInGridSrc2AxisPosition, 71 std::map<int, int>& elementPositionInGridSrc2DomainPosition, 72 std::map<int, int>& elementPositionInGridDst2ScalarPosition, 73 std::map<int, int>& elementPositionInGridDst2AxisPosition, 74 std::map<int, int>& elementPositionInGridDst2DomainPosition) ; 64 75 private: 65 76 static bool registerTrans(); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/extract_axis.cpp
r1984 r2011 1 1 #include "extract_axis.hpp" 2 #include "axis_algorithm_extract.hpp" 2 3 #include "type.hpp" 3 4 … … 77 78 } 78 79 80 CGenericAlgorithmTransformation* CExtractAxis::createAlgorithm(bool isSource, 81 CGrid* gridDst, CGrid* gridSrc, 82 int elementPositionInGrid, 83 std::map<int, int>& elementPositionInGridSrc2ScalarPosition, 84 std::map<int, int>& elementPositionInGridSrc2AxisPosition, 85 std::map<int, int>& elementPositionInGridSrc2DomainPosition, 86 std::map<int, int>& elementPositionInGridDst2ScalarPosition, 87 std::map<int, int>& elementPositionInGridDst2AxisPosition, 88 std::map<int, int>& elementPositionInGridDst2DomainPosition) 89 { 90 return CAxisAlgorithmExtract::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, 91 elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, 92 elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition); 93 } 79 94 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/extract_axis.hpp
r1984 r2011 20 20 class CExtractAxis; 21 21 class CAxis; 22 22 class CGenericAlgorithmTransformation ; 23 class CGrid; 23 24 ///-------------------------------------------------------------- 24 25 … … 62 63 static CTransformation<CAxis>* getTransformation(const StdString& id) { return SuperClass::get(id);} 63 64 virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} 65 virtual CGenericAlgorithmTransformation* createAlgorithm(bool isSource, 66 CGrid* gridDst, CGrid* gridSrc, 67 int elementPositionInGrid, 68 std::map<int, int>& elementPositionInGridSrc2ScalarPosition, 69 std::map<int, int>& elementPositionInGridSrc2AxisPosition, 70 std::map<int, int>& elementPositionInGridSrc2DomainPosition, 71 std::map<int, int>& elementPositionInGridDst2ScalarPosition, 72 std::map<int, int>& elementPositionInGridDst2AxisPosition, 73 std::map<int, int>& elementPositionInGridDst2DomainPosition) ; 64 74 private: 65 75 static bool registerTrans(); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/extract_axis_to_scalar.cpp
r1984 r2011 1 1 #include "extract_axis_to_scalar.hpp" 2 #include "scalar_algorithm_extract_axis.hpp" 3 2 4 #include "type.hpp" 3 5 #include "axis.hpp" … … 57 59 } 58 60 61 CGenericAlgorithmTransformation* CExtractAxisToScalar::createAlgorithm(bool isSource, 62 CGrid* gridDst, CGrid* gridSrc, 63 int elementPositionInGrid, 64 std::map<int, int>& elementPositionInGridSrc2ScalarPosition, 65 std::map<int, int>& elementPositionInGridSrc2AxisPosition, 66 std::map<int, int>& elementPositionInGridSrc2DomainPosition, 67 std::map<int, int>& elementPositionInGridDst2ScalarPosition, 68 std::map<int, int>& elementPositionInGridDst2AxisPosition, 69 std::map<int, int>& elementPositionInGridDst2DomainPosition) 70 { 71 return CScalarAlgorithmExtractAxis::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, 72 elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, 73 elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition) ; 74 } 59 75 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/extract_axis_to_scalar.hpp
r1984 r2011 20 20 class CAxis; 21 21 class CScalar; 22 22 class CGenericAlgorithmTransformation ; 23 class CGrid; 23 24 ///-------------------------------------------------------------- 24 25 … … 62 63 static CTransformation<CScalar>* getTransformation(const StdString& id) { return SuperClass::get(id);} 63 64 virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} 65 virtual CGenericAlgorithmTransformation* createAlgorithm(bool isSource, 66 CGrid* gridDst, CGrid* gridSrc, 67 int elementPositionInGrid, 68 std::map<int, int>& elementPositionInGridSrc2ScalarPosition, 69 std::map<int, int>& elementPositionInGridSrc2AxisPosition, 70 std::map<int, int>& elementPositionInGridSrc2DomainPosition, 71 std::map<int, int>& elementPositionInGridDst2ScalarPosition, 72 std::map<int, int>& elementPositionInGridDst2AxisPosition, 73 std::map<int, int>& elementPositionInGridDst2DomainPosition) ; 64 74 private: 65 75 static bool registerTrans(); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/extract_domain.cpp
r1984 r2011 1 1 #include "extract_domain.hpp" 2 #include "domain_algorithm_extract.hpp" 2 3 #include "type.hpp" 3 4 … … 72 73 } 73 74 75 CGenericAlgorithmTransformation* CExtractDomain::createAlgorithm(bool isSource, 76 CGrid* gridDst, CGrid* gridSrc, 77 int elementPositionInGrid, 78 std::map<int, int>& elementPositionInGridSrc2ScalarPosition, 79 std::map<int, int>& elementPositionInGridSrc2AxisPosition, 80 std::map<int, int>& elementPositionInGridSrc2DomainPosition, 81 std::map<int, int>& elementPositionInGridDst2ScalarPosition, 82 std::map<int, int>& elementPositionInGridDst2AxisPosition, 83 std::map<int, int>& elementPositionInGridDst2DomainPosition) 84 { 85 return CDomainAlgorithmExtract::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, 86 elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, 87 elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition); 88 } 74 89 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/extract_domain.hpp
r1984 r2011 20 20 class CExtractDomain; 21 21 class CDomain; 22 22 class CGenericAlgorithmTransformation ; 23 class CGrid; 23 24 ///-------------------------------------------------------------- 24 25 … … 62 63 static CTransformation<CDomain>* getTransformation(const StdString& id) { return SuperClass::get(id);} 63 64 virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} 65 virtual CGenericAlgorithmTransformation* createAlgorithm(bool isSource, 66 CGrid* gridDst, CGrid* gridSrc, 67 int elementPositionInGrid, 68 std::map<int, int>& elementPositionInGridSrc2ScalarPosition, 69 std::map<int, int>& elementPositionInGridSrc2AxisPosition, 70 std::map<int, int>& elementPositionInGridSrc2DomainPosition, 71 std::map<int, int>& elementPositionInGridDst2ScalarPosition, 72 std::map<int, int>& elementPositionInGridDst2AxisPosition, 73 std::map<int, int>& elementPositionInGridDst2DomainPosition) ; 64 74 private: 65 75 static bool registerTrans(); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/extract_domain_to_axis.cpp
r1984 r2011 1 1 #include "extract_domain_to_axis.hpp" 2 #include "axis_algorithm_extract_domain.hpp" 2 3 #include "type.hpp" 3 4 #include "axis.hpp" … … 98 99 } 99 100 101 CGenericAlgorithmTransformation* CExtractDomainToAxis::createAlgorithm(bool isSource, 102 CGrid* gridDst, CGrid* gridSrc, 103 int elementPositionInGrid, 104 std::map<int, int>& elementPositionInGridSrc2ScalarPosition, 105 std::map<int, int>& elementPositionInGridSrc2AxisPosition, 106 std::map<int, int>& elementPositionInGridSrc2DomainPosition, 107 std::map<int, int>& elementPositionInGridDst2ScalarPosition, 108 std::map<int, int>& elementPositionInGridDst2AxisPosition, 109 std::map<int, int>& elementPositionInGridDst2DomainPosition) 110 { 111 return CAxisAlgorithmExtractDomain::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, 112 elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, 113 elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition); 114 } 100 115 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/extract_domain_to_axis.hpp
r1984 r2011 20 20 class CAxis; 21 21 class CDomain; 22 22 class CGenericAlgorithmTransformation ; 23 class CGrid; 23 24 ///-------------------------------------------------------------- 24 25 … … 62 63 static CTransformation<CAxis>* getTransformation(const StdString& id) { return SuperClass::get(id);} 63 64 virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} 65 virtual CGenericAlgorithmTransformation* createAlgorithm(bool isSource, 66 CGrid* gridDst, CGrid* gridSrc, 67 int elementPositionInGrid, 68 std::map<int, int>& elementPositionInGridSrc2ScalarPosition, 69 std::map<int, int>& elementPositionInGridSrc2AxisPosition, 70 std::map<int, int>& elementPositionInGridSrc2DomainPosition, 71 std::map<int, int>& elementPositionInGridDst2ScalarPosition, 72 std::map<int, int>& elementPositionInGridDst2AxisPosition, 73 std::map<int, int>& elementPositionInGridDst2DomainPosition) ; 64 74 private: 65 75 static bool registerTrans(); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/field.cpp
r2002 r2011 383 383 CATCH_DUMP_ATTR 384 384 385 //---------------------------------------------------------------- 386 387 std::shared_ptr<COutputPin> CField::getInstantDataFilter() 388 TRY 389 { 390 return instantDataFilter; 391 } 392 CATCH_DUMP_ATTR 393 385 394 386 //---------------------------------------------------------------- 395 387 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/field.hpp
r2002 r2011 107 107 template <int N> void getData(CArray<double, N>& _data) const; 108 108 109 std::shared_ptr<COutputPin> getInstantDataFilter();110 111 109 std::map<int, StdSize> getGridAttributesBufferSize(CContextClient* client, bool bufferForWriting = false); 112 110 // Grid data buffer size for each connection of contextclient … … 352 350 //! The output pin of the filter providing the instant data for the field 353 351 std::shared_ptr<COutputPin> instantDataFilter; 354 352 public: 353 std::shared_ptr<COutputPin> getInstantDataFilter(void) { return instantDataFilter;} 354 355 private: 356 355 357 //! The output pin of the filters providing the result of the field's temporal operation 356 358 std::map<CDuration, std::shared_ptr<COutputPin>, DurationFakeLessComparator> temporalDataFilters; -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/generate_rectilinear_domain.cpp
r1984 r2011 1 1 #include "generate_rectilinear_domain.hpp" 2 #include "domain_algorithm_generate_rectilinear.hpp" 2 3 #include "type.hpp" 3 4 … … 138 139 } 139 140 141 CGenericAlgorithmTransformation* CGenerateRectilinearDomain::createAlgorithm(bool isSource, 142 CGrid* gridDst, CGrid* gridSrc, 143 int elementPositionInGrid, 144 std::map<int, int>& elementPositionInGridSrc2ScalarPosition, 145 std::map<int, int>& elementPositionInGridSrc2AxisPosition, 146 std::map<int, int>& elementPositionInGridSrc2DomainPosition, 147 std::map<int, int>& elementPositionInGridDst2ScalarPosition, 148 std::map<int, int>& elementPositionInGridDst2AxisPosition, 149 std::map<int, int>& elementPositionInGridDst2DomainPosition) 150 { 151 return CDomainAlgorithmGenerateRectilinear::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, 152 elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, 153 elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition); 154 } 140 155 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/generate_rectilinear_domain.hpp
r1984 r2011 20 20 class CGenerateRectilinearDomain; 21 21 class CDomain; 22 22 class CGenericAlgorithmTransformation ; 23 class CGrid; 23 24 ///-------------------------------------------------------------- 24 25 … … 62 63 static CTransformation<CDomain>* getTransformation(const StdString& id) { return SuperClass::get(id);} 63 64 virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} 65 virtual CGenericAlgorithmTransformation* createAlgorithm(bool isSource, 66 CGrid* gridDst, CGrid* gridSrc, 67 int elementPositionInGrid, 68 std::map<int, int>& elementPositionInGridSrc2ScalarPosition, 69 std::map<int, int>& elementPositionInGridSrc2AxisPosition, 70 std::map<int, int>& elementPositionInGridSrc2DomainPosition, 71 std::map<int, int>& elementPositionInGridDst2ScalarPosition, 72 std::map<int, int>& elementPositionInGridDst2AxisPosition, 73 std::map<int, int>& elementPositionInGridDst2DomainPosition) ; 64 74 private: 65 75 static bool registerTrans(); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/grid.cpp
r2007 r2011 16 16 #include "client_server_mapping_distributed.hpp" 17 17 #include "distribution_client.hpp" 18 #include "grid_transformation.hpp"19 18 #include "server.hpp" 20 19 #include "distribution_type.hpp" … … 46 45 , connectedDataSize_(), connectedServerRank_(), connectedServerRankRead_(), connectedDataSizeRead_() 47 46 , isCompressible_(false) 48 , transformations_(0), isTransformed_(false)49 47 , axisPositionInGrid_(), hasDomainAxisBaseRef_(false) 50 , gridSrc_(), hasTransform_(false),order_()48 , gridSrc_(), order_() 51 49 , clients() 52 50 { … … 65 63 , connectedDataSize_(), connectedServerRank_(), connectedServerRankRead_(), connectedDataSizeRead_() 66 64 , isCompressible_(false) 67 , transformations_(0), isTransformed_(false)68 65 , axisPositionInGrid_(), hasDomainAxisBaseRef_(false) 69 , gridSrc_(), hasTransform_(false),order_()66 , gridSrc_(), order_() 70 67 , clients() 71 68 { … … 78 75 { 79 76 if (0 != clientDistribution_) delete clientDistribution_; 80 if (0 != transformations_) delete transformations_;81 77 } 82 78 … … 1363 1359 1364 1360 CArray<bool,1> maskOut ; 1365 gridGathererConnector.transfer (event,maskOut,false) ;1361 gridGathererConnector.transfer_or(event,maskOut) ; 1366 1362 gridMaskConnector.computeConnector(maskOut) ; 1367 1363 … … 1688 1684 CATCH_DUMP_ATTR 1689 1685 1690 1691 1692 vector<std::string> CGrid::getAuxInputTransformGrid(void)1693 TRY1694 {1695 if (transformations_ != nullptr) return transformations_->getAuxInputs() ;1696 }1697 CATCH_DUMP_ATTR1698 1699 1686 1700 1687 … … 1710 1697 // big mystery why it doesn't work witout that... 1711 1698 // problem with the linker ?? 1712 1699 1713 1700 std::shared_ptr<CFilter> inputFilter = std::shared_ptr<CPassThroughFilter>(new CPassThroughFilter(gc)); 1714 1701 std::shared_ptr<CFilter> outputFilter = inputFilter ; … … 1792 1779 tmpGridDst->addDomain(dstDomain->getId()) ; 1793 1780 1781 algo = transformation -> createAlgorithm(false, tmpGridDst, tmpGridSrc, 0, 1782 posInGrid,posInGrid,posInGrid, 1783 posInGrid,posInGrid,posInGrid ); 1794 1784 //reuse existing algorithm interface for, now 1795 algo = CGridTransformationFactory<CDomain>::createTransformation(transType, false, tmpGridDst, tmpGridSrc,1785 /* algo = CGridTransformationFactory<CDomain>::createTransformation(transType, false, tmpGridDst, tmpGridSrc, 1796 1786 transformation, 0, 1797 1787 posInGrid,posInGrid,posInGrid, 1798 1788 posInGrid,posInGrid,posInGrid ); 1789 */ 1799 1790 dstDomain->setTransformationAlgorithm(algo) ; 1800 1791 transformationPath.removeNextTransform() ; … … 1819 1810 tmpGridDst->addAxis(dstAxis->getId()) ; 1820 1811 1812 algo = transformation -> createAlgorithm(false, tmpGridDst, tmpGridSrc, 0, 1813 posInGrid,posInGrid,posInGrid, 1814 posInGrid,posInGrid,posInGrid ); 1815 1821 1816 //reuse existing algorithm interface for, now 1822 algo = CGridTransformationFactory<CAxis>::createTransformation(transType, false, tmpGridDst, tmpGridSrc,1817 /* algo = CGridTransformationFactory<CAxis>::createTransformation(transType, false, tmpGridDst, tmpGridSrc, 1823 1818 transformation, 0, 1824 1819 posInGrid,posInGrid,posInGrid, 1825 posInGrid,posInGrid,posInGrid ); 1820 posInGrid,posInGrid,posInGrid );*/ 1826 1821 dstAxis->setTransformationAlgorithm(algo) ; 1827 1822 transformationPath.removeNextTransform() ; … … 1846 1841 tmpGridDst->addScalar(dstScalar->getId()) ; 1847 1842 1843 algo = transformation -> createAlgorithm(false, tmpGridDst, tmpGridSrc, 0, 1844 posInGrid,posInGrid,posInGrid, 1845 posInGrid,posInGrid,posInGrid ); 1848 1846 //reuse existing algorithm interface for, now 1849 algo = CGridTransformationFactory<CScalar>::createTransformation(transType, false, tmpGridDst, tmpGridSrc,1847 /* algo = CGridTransformationFactory<CScalar>::createTransformation(transType, false, tmpGridDst, tmpGridSrc, 1850 1848 transformation, 0, 1851 1849 posInGrid,posInGrid,posInGrid, 1852 posInGrid,posInGrid,posInGrid ); 1850 posInGrid,posInGrid,posInGrid );*/ 1853 1851 dstScalar->setTransformationAlgorithm(algo) ; 1854 1852 transformationPath.removeNextTransform() ; … … 1917 1915 if (hadTransform) 1918 1916 { 1917 1919 1918 if (!isSource) 1920 1919 { … … 1929 1928 shared_ptr<CTransformFilter> transformFilter = shared_ptr<CTransformFilter>(gridAlgorithm->createTransformFilter(gc, detectMissingValues, defaultValue)) ; 1930 1929 outputFilter->connectOutput(transformFilter,0) ; 1930 vector<string> auxFieldId = algo->getAuxFieldId() ; // better to do that at transformation not algo ?? 1931 int i=1; 1932 for (auto& it : auxFieldId) 1933 { 1934 CField* auxField = CField::get(it) ; 1935 auxField->buildWorkflowGraph(gc) ; 1936 auxField->getInstantDataFilter()->connectOutput(transformFilter,i) ; 1937 i++ ; 1938 } 1931 1939 outputFilter = transformFilter ; 1932 1940 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/grid.hpp
r2002 r2011 39 39 class CServerDistributionDescription; 40 40 class CClientServerMapping; 41 class CGridTransformation; 42 41 43 42 ///-------------------------------------------------------------- 44 43 … … 215 214 /////////////////////////////////////////// 216 215 public: 217 CGridTransformation* getTransformations();218 219 std::vector<std::string> getAuxInputTransformGrid(void) ;220 void setTransformationAlgorithms();221 216 pair<shared_ptr<CFilter>, shared_ptr<CFilter> > buildTransformationGraph(CGarbageCollector& gc, bool isSource, CGrid* gridSrc, double detectMissingValues, 222 217 double defaultValue, CGrid*& newGrid) ; … … 226 221 void setGridAlgorithm(CGridAlgorithm* gridAlgorithm) {gridAlgorithm_ = gridAlgorithm;} 227 222 CGridAlgorithm* getGridAlgorithm(void) { return gridAlgorithm_ ;} 228 private:229 bool isTransformed_;230 CGridTransformation* transformations_;231 bool hasTransform_;232 223 233 224 /////////////////////////////////////////// -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/interpolate_axis.cpp
r1984 r2011 1 1 #include "interpolate_axis.hpp" 2 #include "axis_algorithm_interpolate_coordinate.hpp" 3 #include "axis_algorithm_interpolate.hpp" 2 4 #include "type.hpp" 3 5 #include "field.hpp" … … 84 86 return auxInputs; 85 87 } 88 89 CGenericAlgorithmTransformation* CInterpolateAxis::createAlgorithm(bool isSource, 90 CGrid* gridDst, CGrid* gridSrc, 91 int elementPositionInGrid, 92 std::map<int, int>& elementPositionInGridSrc2ScalarPosition, 93 std::map<int, int>& elementPositionInGridSrc2AxisPosition, 94 std::map<int, int>& elementPositionInGridSrc2DomainPosition, 95 std::map<int, int>& elementPositionInGridDst2ScalarPosition, 96 std::map<int, int>& elementPositionInGridDst2AxisPosition, 97 std::map<int, int>& elementPositionInGridDst2DomainPosition) 98 { 99 if (!coordinate.isEmpty()) return CAxisAlgorithmInterpolateCoordinate::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, 100 elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, 101 elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition); 102 else return CAxisAlgorithmInterpolate::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, 103 elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, 104 elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition); 105 } 86 106 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/interpolate_axis.hpp
r1984 r2011 20 20 class CInterpolateAxis; 21 21 class CAxis; 22 22 class CGenericAlgorithmTransformation ; 23 class CGrid; 23 24 ///-------------------------------------------------------------- 24 25 … … 64 65 static CTransformation<CAxis>* getTransformation(const StdString& id) { return SuperClass::get(id);} 65 66 virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} 67 virtual CGenericAlgorithmTransformation* createAlgorithm(bool isSource, 68 CGrid* gridDst, CGrid* gridSrc, 69 int elementPositionInGrid, 70 std::map<int, int>& elementPositionInGridSrc2ScalarPosition, 71 std::map<int, int>& elementPositionInGridSrc2AxisPosition, 72 std::map<int, int>& elementPositionInGridSrc2DomainPosition, 73 std::map<int, int>& elementPositionInGridDst2ScalarPosition, 74 std::map<int, int>& elementPositionInGridDst2AxisPosition, 75 std::map<int, int>& elementPositionInGridDst2DomainPosition) ; 66 76 private: 67 77 static bool registerTrans(); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/interpolate_domain.cpp
r1984 r2011 1 1 #include "interpolate_domain.hpp" 2 #include "domain_algorithm_interpolate.hpp" 2 3 #include "type.hpp" 3 4 … … 68 69 } 69 70 71 CGenericAlgorithmTransformation* CInterpolateDomain::createAlgorithm(bool isSource, 72 CGrid* gridDst, CGrid* gridSrc, 73 int elementPositionInGrid, 74 std::map<int, int>& elementPositionInGridSrc2ScalarPosition, 75 std::map<int, int>& elementPositionInGridSrc2AxisPosition, 76 std::map<int, int>& elementPositionInGridSrc2DomainPosition, 77 std::map<int, int>& elementPositionInGridDst2ScalarPosition, 78 std::map<int, int>& elementPositionInGridDst2AxisPosition, 79 std::map<int, int>& elementPositionInGridDst2DomainPosition) 80 { 81 return CDomainAlgorithmInterpolate::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, 82 elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, 83 elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition); 84 } 70 85 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/interpolate_domain.hpp
r1984 r2011 20 20 class CInterpolateDomain; 21 21 class CDomain; 22 22 class CGenericAlgorithmTransformation ; 23 class CGrid; 23 24 ///-------------------------------------------------------------- 24 25 … … 62 63 static CTransformation<CDomain>* getTransformation(const StdString& id) { return SuperClass::get(id);} 63 64 virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} 65 virtual CGenericAlgorithmTransformation* createAlgorithm(bool isSource, 66 CGrid* gridDst, CGrid* gridSrc, 67 int elementPositionInGrid, 68 std::map<int, int>& elementPositionInGridSrc2ScalarPosition, 69 std::map<int, int>& elementPositionInGridSrc2AxisPosition, 70 std::map<int, int>& elementPositionInGridSrc2DomainPosition, 71 std::map<int, int>& elementPositionInGridDst2ScalarPosition, 72 std::map<int, int>& elementPositionInGridDst2AxisPosition, 73 std::map<int, int>& elementPositionInGridDst2DomainPosition) ; 64 74 private: 65 75 static bool registerTrans(); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/inverse_axis.cpp
r1984 r2011 1 1 #include "inverse_axis.hpp" 2 #include "axis_algorithm_inverse.hpp" 2 3 #include "type.hpp" 3 4 … … 39 40 {} 40 41 42 CGenericAlgorithmTransformation* CInverseAxis::createAlgorithm(bool isSource, 43 CGrid* gridDst, CGrid* gridSrc, 44 int elementPositionInGrid, 45 std::map<int, int>& elementPositionInGridSrc2ScalarPosition, 46 std::map<int, int>& elementPositionInGridSrc2AxisPosition, 47 std::map<int, int>& elementPositionInGridSrc2DomainPosition, 48 std::map<int, int>& elementPositionInGridDst2ScalarPosition, 49 std::map<int, int>& elementPositionInGridDst2AxisPosition, 50 std::map<int, int>& elementPositionInGridDst2DomainPosition) 51 { 52 return CAxisAlgorithmInverse::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, 53 elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, 54 elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition) ; 55 } 41 56 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/inverse_axis.hpp
r1984 r2011 19 19 class CInverseAxis; 20 20 class CAxis; 21 class CGenericAlgorithmTransformation ; 22 class CGrid; 21 23 ///-------------------------------------------------------------- 22 24 … … 60 62 static CTransformation<CAxis>* getTransformation(const StdString& id) { return SuperClass::get(id);} 61 63 virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} 64 virtual CGenericAlgorithmTransformation* createAlgorithm(bool isSource, 65 CGrid* gridDst, CGrid* gridSrc, 66 int elementPositionInGrid, 67 std::map<int, int>& elementPositionInGridSrc2ScalarPosition, 68 std::map<int, int>& elementPositionInGridSrc2AxisPosition, 69 std::map<int, int>& elementPositionInGridSrc2DomainPosition, 70 std::map<int, int>& elementPositionInGridDst2ScalarPosition, 71 std::map<int, int>& elementPositionInGridDst2AxisPosition, 72 std::map<int, int>& elementPositionInGridDst2DomainPosition) ; 62 73 private: 63 74 static bool registerTrans(); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_axis_to_axis.cpp
r1984 r2011 1 1 #include "reduce_axis_to_axis.hpp" 2 #include "axis_algorithm_reduce_axis.hpp" 2 3 #include "type.hpp" 3 4 #include "axis.hpp" … … 56 57 } 57 58 59 CGenericAlgorithmTransformation* CReduceAxisToAxis::createAlgorithm(bool isSource, 60 CGrid* gridDst, CGrid* gridSrc, 61 int elementPositionInGrid, 62 std::map<int, int>& elementPositionInGridSrc2ScalarPosition, 63 std::map<int, int>& elementPositionInGridSrc2AxisPosition, 64 std::map<int, int>& elementPositionInGridSrc2DomainPosition, 65 std::map<int, int>& elementPositionInGridDst2ScalarPosition, 66 std::map<int, int>& elementPositionInGridDst2AxisPosition, 67 std::map<int, int>& elementPositionInGridDst2DomainPosition) 68 { 69 return CAxisAlgorithmReduceAxis::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, 70 elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, 71 elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition); 72 } 58 73 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_axis_to_axis.hpp
r1984 r2011 19 19 class CReduceAxisToAxis; 20 20 class CAxis; 21 21 class CGenericAlgorithmTransformation ; 22 class CGrid; 22 23 ///-------------------------------------------------------------- 23 24 … … 61 62 static CTransformation<CAxis>* getTransformation(const StdString& id) { return SuperClass::get(id);} 62 63 virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} 63 private: 64 virtual CGenericAlgorithmTransformation* createAlgorithm(bool isSource, 65 CGrid* gridDst, CGrid* gridSrc, 66 int elementPositionInGrid, 67 std::map<int, int>& elementPositionInGridSrc2ScalarPosition, 68 std::map<int, int>& elementPositionInGridSrc2AxisPosition, 69 std::map<int, int>& elementPositionInGridSrc2DomainPosition, 70 std::map<int, int>& elementPositionInGridDst2ScalarPosition, 71 std::map<int, int>& elementPositionInGridDst2AxisPosition, 72 std::map<int, int>& elementPositionInGridDst2DomainPosition) ; 73 private: 64 74 static bool registerTrans(); 65 75 static CTransformation<CAxis>* create(const StdString& id, xml::CXMLNode* node); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_axis_to_scalar.cpp
r1984 r2011 1 1 #include "reduce_axis_to_scalar.hpp" 2 #include "scalar_algorithm_reduce_axis.hpp" 2 3 #include "type.hpp" 3 4 … … 41 42 } 42 43 44 CGenericAlgorithmTransformation* CReduceAxisToScalar::createAlgorithm(bool isSource, 45 CGrid* gridDst, CGrid* gridSrc, 46 int elementPositionInGrid, 47 std::map<int, int>& elementPositionInGridSrc2ScalarPosition, 48 std::map<int, int>& elementPositionInGridSrc2AxisPosition, 49 std::map<int, int>& elementPositionInGridSrc2DomainPosition, 50 std::map<int, int>& elementPositionInGridDst2ScalarPosition, 51 std::map<int, int>& elementPositionInGridDst2AxisPosition, 52 std::map<int, int>& elementPositionInGridDst2DomainPosition) 53 { 54 return CScalarAlgorithmReduceAxis::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, 55 elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, 56 elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition); 57 } 43 58 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_axis_to_scalar.hpp
r1984 r2011 19 19 class CReduceAxisToScalar; 20 20 class CScalar; 21 21 class CGenericAlgorithmTransformation ; 22 class CGrid; 22 23 ///-------------------------------------------------------------- 23 24 … … 61 62 static CTransformation<CScalar>* getTransformation(const StdString& id) { return SuperClass::get(id);} 62 63 virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} 64 virtual CGenericAlgorithmTransformation* createAlgorithm(bool isSource, 65 CGrid* gridDst, CGrid* gridSrc, 66 int elementPositionInGrid, 67 std::map<int, int>& elementPositionInGridSrc2ScalarPosition, 68 std::map<int, int>& elementPositionInGridSrc2AxisPosition, 69 std::map<int, int>& elementPositionInGridSrc2DomainPosition, 70 std::map<int, int>& elementPositionInGridDst2ScalarPosition, 71 std::map<int, int>& elementPositionInGridDst2AxisPosition, 72 std::map<int, int>& elementPositionInGridDst2DomainPosition) ; 63 73 private: 64 74 static bool registerTrans(); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_domain_to_axis.cpp
r1984 r2011 1 1 #include "reduce_domain_to_axis.hpp" 2 #include "axis_algorithm_reduce_domain.hpp" 2 3 #include "type.hpp" 3 4 #include "axis.hpp" … … 87 88 } 88 89 90 CGenericAlgorithmTransformation* CReduceDomainToAxis::createAlgorithm(bool isSource, 91 CGrid* gridDst, CGrid* gridSrc, 92 int elementPositionInGrid, 93 std::map<int, int>& elementPositionInGridSrc2ScalarPosition, 94 std::map<int, int>& elementPositionInGridSrc2AxisPosition, 95 std::map<int, int>& elementPositionInGridSrc2DomainPosition, 96 std::map<int, int>& elementPositionInGridDst2ScalarPosition, 97 std::map<int, int>& elementPositionInGridDst2AxisPosition, 98 std::map<int, int>& elementPositionInGridDst2DomainPosition) 99 { 100 return CAxisAlgorithmReduceDomain::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, 101 elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, 102 elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition) ; 103 } 89 104 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_domain_to_axis.hpp
r1984 r2011 20 20 class CAxis; 21 21 class CDomain; 22 22 class CGenericAlgorithmTransformation ; 23 class CGrid; 23 24 ///-------------------------------------------------------------- 24 25 … … 62 63 static CTransformation<CAxis>* getTransformation(const StdString& id) { return SuperClass::get(id);} 63 64 virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} 65 virtual CGenericAlgorithmTransformation* createAlgorithm(bool isSource, 66 CGrid* gridDst, CGrid* gridSrc, 67 int elementPositionInGrid, 68 std::map<int, int>& elementPositionInGridSrc2ScalarPosition, 69 std::map<int, int>& elementPositionInGridSrc2AxisPosition, 70 std::map<int, int>& elementPositionInGridSrc2DomainPosition, 71 std::map<int, int>& elementPositionInGridDst2ScalarPosition, 72 std::map<int, int>& elementPositionInGridDst2AxisPosition, 73 std::map<int, int>& elementPositionInGridDst2DomainPosition) ; 64 74 private: 65 75 static bool registerTrans(); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_domain_to_scalar.cpp
r1984 r2011 1 1 #include "reduce_domain_to_scalar.hpp" 2 #include "scalar_algorithm_reduce_domain.hpp" 2 3 #include "type.hpp" 3 4 … … 42 43 } 43 44 45 CGenericAlgorithmTransformation* CReduceDomainToScalar::createAlgorithm(bool isSource, 46 CGrid* gridDst, CGrid* gridSrc, 47 int elementPositionInGrid, 48 std::map<int, int>& elementPositionInGridSrc2ScalarPosition, 49 std::map<int, int>& elementPositionInGridSrc2AxisPosition, 50 std::map<int, int>& elementPositionInGridSrc2DomainPosition, 51 std::map<int, int>& elementPositionInGridDst2ScalarPosition, 52 std::map<int, int>& elementPositionInGridDst2AxisPosition, 53 std::map<int, int>& elementPositionInGridDst2DomainPosition) 54 { 55 return CScalarAlgorithmReduceDomain::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, 56 elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, 57 elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition) ; 58 } 44 59 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_domain_to_scalar.hpp
r1984 r2011 20 20 class CDomain; 21 21 class CScalar; 22 22 class CGenericAlgorithmTransformation ; 23 class CGrid; 23 24 ///-------------------------------------------------------------- 24 25 … … 62 63 static CTransformation<CScalar>* getTransformation(const StdString& id) { return SuperClass::get(id);} 63 64 virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} 65 virtual CGenericAlgorithmTransformation* createAlgorithm(bool isSource, 66 CGrid* gridDst, CGrid* gridSrc, 67 int elementPositionInGrid, 68 std::map<int, int>& elementPositionInGridSrc2ScalarPosition, 69 std::map<int, int>& elementPositionInGridSrc2AxisPosition, 70 std::map<int, int>& elementPositionInGridSrc2DomainPosition, 71 std::map<int, int>& elementPositionInGridDst2ScalarPosition, 72 std::map<int, int>& elementPositionInGridDst2AxisPosition, 73 std::map<int, int>& elementPositionInGridDst2DomainPosition) ; 64 74 private: 65 75 static bool registerTrans(); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_scalar_to_scalar.cpp
r1984 r2011 1 1 #include "reduce_scalar_to_scalar.hpp" 2 #include "scalar_algorithm_reduce_scalar.hpp" 2 3 #include "type.hpp" 3 4 … … 41 42 } 42 43 44 CGenericAlgorithmTransformation* CReduceScalarToScalar::createAlgorithm(bool isSource, 45 CGrid* gridDst, CGrid* gridSrc, 46 int elementPositionInGrid, 47 std::map<int, int>& elementPositionInGridSrc2ScalarPosition, 48 std::map<int, int>& elementPositionInGridSrc2AxisPosition, 49 std::map<int, int>& elementPositionInGridSrc2DomainPosition, 50 std::map<int, int>& elementPositionInGridDst2ScalarPosition, 51 std::map<int, int>& elementPositionInGridDst2AxisPosition, 52 std::map<int, int>& elementPositionInGridDst2DomainPosition) 53 { 54 return CScalarAlgorithmReduceScalar::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, 55 elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, 56 elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition); 57 } 43 58 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_scalar_to_scalar.hpp
r1984 r2011 19 19 class CReduceScalarToScalar; 20 20 class CScalar; 21 21 class CGenericAlgorithmTransformation ; 22 class CGrid; 22 23 ///-------------------------------------------------------------- 23 24 … … 61 62 static CTransformation<CScalar>* getTransformation(const StdString& id) { return SuperClass::get(id);} 62 63 virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} 64 virtual CGenericAlgorithmTransformation* createAlgorithm(bool isSource, 65 CGrid* gridDst, CGrid* gridSrc, 66 int elementPositionInGrid, 67 std::map<int, int>& elementPositionInGridSrc2ScalarPosition, 68 std::map<int, int>& elementPositionInGridSrc2AxisPosition, 69 std::map<int, int>& elementPositionInGridSrc2DomainPosition, 70 std::map<int, int>& elementPositionInGridDst2ScalarPosition, 71 std::map<int, int>& elementPositionInGridDst2AxisPosition, 72 std::map<int, int>& elementPositionInGridDst2DomainPosition) ; 63 73 private: 64 74 static bool registerTrans(); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reorder_domain.cpp
r1984 r2011 1 1 #include "reorder_domain.hpp" 2 #include "domain_algorithm_reorder.hpp" 2 3 #include "type.hpp" 3 4 … … 41 42 } 42 43 44 CGenericAlgorithmTransformation* CReorderDomain::createAlgorithm(bool isSource, 45 CGrid* gridDst, CGrid* gridSrc, 46 int elementPositionInGrid, 47 std::map<int, int>& elementPositionInGridSrc2ScalarPosition, 48 std::map<int, int>& elementPositionInGridSrc2AxisPosition, 49 std::map<int, int>& elementPositionInGridSrc2DomainPosition, 50 std::map<int, int>& elementPositionInGridDst2ScalarPosition, 51 std::map<int, int>& elementPositionInGridDst2AxisPosition, 52 std::map<int, int>& elementPositionInGridDst2DomainPosition) 53 { 54 return CDomainAlgorithmReorder::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, 55 elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, 56 elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition); 57 } 43 58 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reorder_domain.hpp
r1984 r2011 20 20 class CReorderDomain; 21 21 class CDomain; 22 22 class CGenericAlgorithmTransformation ; 23 class CGrid; 23 24 ///-------------------------------------------------------------- 24 25 … … 62 63 static CTransformation<CDomain>* getTransformation(const StdString& id) { return SuperClass::get(id);} 63 64 virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} 65 virtual CGenericAlgorithmTransformation* createAlgorithm(bool isSource, 66 CGrid* gridDst, CGrid* gridSrc, 67 int elementPositionInGrid, 68 std::map<int, int>& elementPositionInGridSrc2ScalarPosition, 69 std::map<int, int>& elementPositionInGridSrc2AxisPosition, 70 std::map<int, int>& elementPositionInGridSrc2DomainPosition, 71 std::map<int, int>& elementPositionInGridDst2ScalarPosition, 72 std::map<int, int>& elementPositionInGridDst2AxisPosition, 73 std::map<int, int>& elementPositionInGridDst2DomainPosition) ; 64 74 private: 65 75 static bool registerTrans(); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/temporal_splitting.cpp
r1984 r2011 1 1 #include "temporal_splitting.hpp" 2 #include "axis_algorithm_temporal_splitting.hpp" 2 3 #include "type.hpp" 3 4 #include "axis.hpp" … … 45 46 } 46 47 48 CGenericAlgorithmTransformation* CTemporalSplitting::createAlgorithm(bool isSource, 49 CGrid* gridDst, CGrid* gridSrc, 50 int elementPositionInGrid, 51 std::map<int, int>& elementPositionInGridSrc2ScalarPosition, 52 std::map<int, int>& elementPositionInGridSrc2AxisPosition, 53 std::map<int, int>& elementPositionInGridSrc2DomainPosition, 54 std::map<int, int>& elementPositionInGridDst2ScalarPosition, 55 std::map<int, int>& elementPositionInGridDst2AxisPosition, 56 std::map<int, int>& elementPositionInGridDst2DomainPosition) 57 { 58 return CAxisAlgorithmTemporalSplitting::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, 59 elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, 60 elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition); 61 } 47 62 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/temporal_splitting.hpp
r1984 r2011 20 20 class CAxis; 21 21 class CScalar; 22 class CGenericAlgorithmTransformation ; 23 class CGrid; 22 24 ///-------------------------------------------------------------- 23 25 … … 61 63 static CTransformation<CAxis>* getTransformation(const StdString& id) { return SuperClass::get(id);} 62 64 virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} 65 virtual CGenericAlgorithmTransformation* createAlgorithm(bool isSource, 66 CGrid* gridDst, CGrid* gridSrc, 67 int elementPositionInGrid, 68 std::map<int, int>& elementPositionInGridSrc2ScalarPosition, 69 std::map<int, int>& elementPositionInGridSrc2AxisPosition, 70 std::map<int, int>& elementPositionInGridSrc2DomainPosition, 71 std::map<int, int>& elementPositionInGridDst2ScalarPosition, 72 std::map<int, int>& elementPositionInGridDst2AxisPosition, 73 std::map<int, int>& elementPositionInGridDst2DomainPosition) ; 63 74 private: 64 75 static bool registerTrans(); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/zoom_axis.cpp
r1984 r2011 1 1 #include "zoom_axis.hpp" 2 #include "axis_algorithm_zoom.hpp" 2 3 #include "type.hpp" 3 4 … … 77 78 } 78 79 80 CGenericAlgorithmTransformation* CZoomAxis::createAlgorithm(bool isSource, 81 CGrid* gridDst, CGrid* gridSrc, 82 int elementPositionInGrid, 83 std::map<int, int>& elementPositionInGridSrc2ScalarPosition, 84 std::map<int, int>& elementPositionInGridSrc2AxisPosition, 85 std::map<int, int>& elementPositionInGridSrc2DomainPosition, 86 std::map<int, int>& elementPositionInGridDst2ScalarPosition, 87 std::map<int, int>& elementPositionInGridDst2AxisPosition, 88 std::map<int, int>& elementPositionInGridDst2DomainPosition) 89 { 90 return CAxisAlgorithmZoom::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, 91 elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, 92 elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition); 93 } 79 94 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/zoom_axis.hpp
r1984 r2011 20 20 class CZoomAxis; 21 21 class CAxis; 22 22 class CGenericAlgorithmTransformation ; 23 class CGrid; 23 24 ///-------------------------------------------------------------- 24 25 … … 62 63 static CTransformation<CAxis>* getTransformation(const StdString& id) { return SuperClass::get(id);} 63 64 virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} 65 virtual CGenericAlgorithmTransformation* createAlgorithm(bool isSource, 66 CGrid* gridDst, CGrid* gridSrc, 67 int elementPositionInGrid, 68 std::map<int, int>& elementPositionInGridSrc2ScalarPosition, 69 std::map<int, int>& elementPositionInGridSrc2AxisPosition, 70 std::map<int, int>& elementPositionInGridSrc2DomainPosition, 71 std::map<int, int>& elementPositionInGridDst2ScalarPosition, 72 std::map<int, int>& elementPositionInGridDst2AxisPosition, 73 std::map<int, int>& elementPositionInGridDst2DomainPosition) ; 64 74 private: 65 75 static bool registerTrans(); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/zoom_domain.cpp
r1984 r2011 1 1 #include "zoom_domain.hpp" 2 #include "domain_algorithm_zoom.hpp" 2 3 #include "type.hpp" 3 4 … … 72 73 } 73 74 75 CGenericAlgorithmTransformation* CZoomDomain::createAlgorithm(bool isSource, 76 CGrid* gridDst, CGrid* gridSrc, 77 int elementPositionInGrid, 78 std::map<int, int>& elementPositionInGridSrc2ScalarPosition, 79 std::map<int, int>& elementPositionInGridSrc2AxisPosition, 80 std::map<int, int>& elementPositionInGridSrc2DomainPosition, 81 std::map<int, int>& elementPositionInGridDst2ScalarPosition, 82 std::map<int, int>& elementPositionInGridDst2AxisPosition, 83 std::map<int, int>& elementPositionInGridDst2DomainPosition) 84 { 85 return CDomainAlgorithmZoom::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, 86 elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, 87 elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition); 88 } 74 89 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/zoom_domain.hpp
r1984 r2011 20 20 class CZoomDomain; 21 21 class CDomain; 22 22 class CGenericAlgorithmTransformation ; 23 class CGrid; 23 24 ///-------------------------------------------------------------- 24 25 … … 62 63 virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} 63 64 static CTransformation<CDomain>* getTransformation(const StdString& id) { return SuperClass::get(id);} 65 virtual CGenericAlgorithmTransformation* createAlgorithm(bool isSource, 66 CGrid* gridDst, CGrid* gridSrc, 67 int elementPositionInGrid, 68 std::map<int, int>& elementPositionInGridSrc2ScalarPosition, 69 std::map<int, int>& elementPositionInGridSrc2AxisPosition, 70 std::map<int, int>& elementPositionInGridSrc2DomainPosition, 71 std::map<int, int>& elementPositionInGridDst2ScalarPosition, 72 std::map<int, int>& elementPositionInGridDst2AxisPosition, 73 std::map<int, int>& elementPositionInGridDst2DomainPosition) ; 64 74 private: 65 75 static bool registerTrans(); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/algo_types.cpp
r2008 r2011 20 20 ret=CAxisAlgorithmExtractDomain::registerTrans(); 21 21 ret=CAxisAlgorithmInterpolate::registerTrans(); 22 ret=CAxisAlgorithmInterpolateCoordinate::registerTrans(); 22 23 ret=CAxisAlgorithmExtract::registerTrans(); 23 24 ret=CAxisAlgorithmInverse::registerTrans(); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/algo_types.hpp
r2007 r2011 13 13 #include "scalar_algorithm_extract_axis.hpp" 14 14 #include "scalar_algorithm_reduce_domain.hpp" 15 #include "scalar_algorithm_reduce_scalar.hpp" 15 16 16 17 #include "axis_algorithm_inverse.hpp" 17 18 #include "axis_algorithm_zoom.hpp" 18 19 #include "axis_algorithm_interpolate.hpp" 20 #include "axis_algorithm_interpolate_coordinate.hpp" 19 21 #include "axis_algorithm_extract.hpp" 20 22 #include "axis_algorithm_reduce_domain.hpp" … … 23 25 #include "axis_algorithm_extract_domain.hpp" 24 26 #include "axis_algorithm_temporal_splitting.hpp" 27 #include "axis_algorithm_duplicate_scalar.hpp" 28 25 29 26 30 #include "domain_algorithm_zoom.hpp" … … 29 33 #include "domain_algorithm_compute_connectivity.hpp" 30 34 #include "domain_algorithm_expand.hpp" 31 #include "axis_algorithm_duplicate_scalar.hpp"32 #include "scalar_algorithm_reduce_scalar.hpp"33 35 #include "domain_algorithm_reorder.hpp" 34 36 #include "domain_algorithm_extract.hpp" -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm/axis_algorithm_duplicate_scalar.hpp
r1999 r2011 33 33 static bool registerTrans(); 34 34 35 36 private:37 38 35 static CGenericAlgorithmTransformation* create(bool isSource, CGrid* gridDst, CGrid* gridSrc, 39 36 CTransformation<CAxis>* transformation, -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm/axis_algorithm_extract.hpp
r1998 r2011 45 45 CAxis* axisSrc_; 46 46 CAxis* axisDest_; 47 48 public: 47 49 static CGenericAlgorithmTransformation* create(bool isSource, CGrid* gridDst, CGrid* gridSrc, 48 50 CTransformation<CAxis>* transformation, -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm/axis_algorithm_extract_domain.hpp
r1999 r2011 46 46 CDomain* domainSrc_; 47 47 CAxis* axisDest_ ; 48 49 public: 48 50 static CGenericAlgorithmTransformation* create(bool isSource, CGrid* gridDst, CGrid* gridSrc, 49 51 CTransformation<CAxis>* transformation, -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm/axis_algorithm_interpolate.cpp
r2009 r2011 46 46 TRY 47 47 { 48 return CGridTransformationFactory<CAxis>::registerTransformation(TRANS_INTERPOLATE_AXIS, create); 48 /// descativate for now 49 // return CGridTransformationFactory<CAxis>::registerTransformation(TRANS_INTERPOLATE_AXIS, create); 49 50 } 50 51 CATCH -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm/axis_algorithm_interpolate.hpp
r2009 r2011 49 49 CAxis* axisSrc_=nullptr ; 50 50 CAxis* axisDest_=nullptr; 51 private:52 51 52 public: 53 53 static CGenericAlgorithmTransformation* create(bool isSource, CGrid* gridDst, CGrid* gridSrc, 54 54 CTransformation<CAxis>* transformation, -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm/axis_algorithm_inverse.hpp
r1999 r2011 37 37 void updateAxisValue(); 38 38 39 p rivate:40 39 public: 40 static CGenericAlgorithmTransformation* create(bool isSource, CGrid* gridDst, CGrid* gridSrc, 41 41 CTransformation<CAxis>* transformation, 42 42 int elementPositionInGrid, -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm/axis_algorithm_reduce_axis.hpp
r1999 r2011 32 32 33 33 static bool registerTrans(); 34 35 p rivate:34 35 public: 36 36 static CGenericAlgorithmTransformation* create(bool isSource, CGrid* gridDst, CGrid* gridSrc, 37 37 CTransformation<CAxis>* transformation, -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm/axis_algorithm_reduce_domain.hpp
r1999 r2011 45 45 CAxis* axisDest_ ; 46 46 47 p rivate:47 public: 48 48 static CGenericAlgorithmTransformation* create(bool isSource, CGrid* gridDst, CGrid* gridSrc, 49 49 CTransformation<CAxis>* transformation, -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm/axis_algorithm_temporal_splitting.cpp
r2007 r2011 51 51 CTransformFilter* CAxisAlgorithmTemporalSplitting::createTransformFilter(CGarbageCollector& gc, CGridAlgorithm* algo, bool detectMissingValues, double defaultValue) 52 52 { 53 return new CTemporalTransformFilter(gc, algo, nrecords_, detectMissingValues, defaultValue) ;53 return new CTemporalTransformFilter(gc, 1, algo, nrecords_, detectMissingValues, defaultValue) ; 54 54 } 55 55 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm/axis_algorithm_temporal_splitting.hpp
r2007 r2011 30 30 static bool registerTrans(); 31 31 virtual CTransformFilter* createTransformFilter(CGarbageCollector& gc, CGridAlgorithm* algo, bool detectMissingValues, double defaultValue) ; 32 33 private: 32 34 33 static CGenericAlgorithmTransformation* create(bool isSource, CGrid* gridDst, CGrid* gridSrc, 35 34 CTransformation<CAxis>* transformation, … … 41 40 std::map<int, int>& elementPositionInGridDst2AxisPosition, 42 41 std::map<int, int>& elementPositionInGridDst2DomainPosition); 42 private: 43 43 int nrecords_; 44 44 static bool dummyRegistered_; -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm/axis_algorithm_zoom.hpp
r1998 r2011 47 47 CAxis* axisDest_; 48 48 49 public: 49 50 static CGenericAlgorithmTransformation* create(bool isSource, CGrid* gridDst, CGrid* gridSrc, 50 51 CTransformation<CAxis>* transformation, -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm/domain_algorithm_compute_connectivity.cpp
r2007 r2011 51 51 TRY 52 52 { 53 this->type_ = (ELEMENT_NO_MODIFICATION_WITHOUT_DATA);54 53 compute_connectivityDomain->checkValid(domainDestination); 55 54 int& nbNeighborMax = compute_connectivityDomain->n_neighbor_max; -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm/domain_algorithm_compute_connectivity.hpp
r1998 r2011 36 36 CArray<int,2>& localConnectivity); 37 37 38 p rivate:38 public: 39 39 static CGenericAlgorithmTransformation* create(bool isSource, CGrid* gridDst, CGrid* gridSrc, 40 40 CTransformation<CDomain>* transformation, … … 50 50 51 51 } 52 52 53 #endif // __XIOS_DOMAIN_ALGORITHM_COMPUTE_CONNECTIVITY_HPP__ -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm/domain_algorithm_expand.hpp
r1998 r2011 44 44 CArray<int,2>& neighborsDomainSrc); 45 45 46 p rivate:46 public: 47 47 static CGenericAlgorithmTransformation* create(bool isSource, CGrid* gridDst, CGrid* gridSrc, 48 48 CTransformation<CDomain>* transformation, -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm/domain_algorithm_extract.hpp
r1998 r2011 40 40 CDomain* domainDest_ ; 41 41 42 private:43 42 43 public: 44 44 static CGenericAlgorithmTransformation* create(bool isSource, CGrid* gridDst, CGrid* gridSrc, 45 45 CTransformation<CDomain>* transformation, -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm/domain_algorithm_generate_rectilinear.hpp
r1998 r2011 42 42 void computeDistributionGridDestination(CGrid* gridDest); 43 43 void fillInAttributesDomainDestination(); 44 45 public: 44 46 static CGenericAlgorithmTransformation* create(bool isSource, CGrid* gridDst, CGrid* gridSrc, 45 47 CTransformation<CDomain>* transformation, -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm/domain_algorithm_interpolate.hpp
r2007 r2011 95 95 std::map<int, int>& elementPositionInGridDst2AxisPosition, 96 96 std::map<int, int>& elementPositionInGridDst2DomainPosition); 97 97 private: 98 98 CDomain* domainSrc_ ; 99 99 CDomain* domainDest_ ; -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm/domain_algorithm_reorder.cpp
r2007 r2011 61 61 << "Domain destination " <<domainDestination->getId() << std::endl); 62 62 } 63 this->type_ = (ELEMENT_MODIFICATION_WITHOUT_DATA); 64 63 65 64 if (!reorderDomain->invert_lat.isEmpty()) 66 65 { -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm/domain_algorithm_reorder.hpp
r1998 r2011 27 27 static bool registerTrans(); 28 28 29 private:30 29 30 public: 31 31 static CGenericAlgorithmTransformation* create(bool isSource, CGrid* gridDst, CGrid* gridSrc, 32 32 CTransformation<CDomain>* transformation, -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm/domain_algorithm_zoom.hpp
r1998 r2011 44 44 CDomain* domainDest_ ; 45 45 46 private:47 46 47 public: 48 48 static CGenericAlgorithmTransformation* create(bool isSource, CGrid* gridDst, CGrid* gridSrc, 49 49 CTransformation<CDomain>* transformation, -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/generic_algorithm_transformation.cpp
r2007 r2011 23 23 24 24 CGenericAlgorithmTransformation::CGenericAlgorithmTransformation(bool isSource) 25 : isSource_(isSource), transformationMapping_(), transformationWeight_(), transformationPosition_(), 26 idAuxInputs_(), type_(ELEMENT_NO_MODIFICATION_WITH_DATA), indexElementSrc_(), 27 computedProcSrcNonTransformedElement_(false), eliminateRedondantSrc_(true), isDistributedComputed_(false) 25 : isSource_(isSource) 28 26 { 29 27 } 30 28 31 void CGenericAlgorithmTransformation::updateData(CArray<double,1>& dataOut)32 {33 34 }35 36 void CGenericAlgorithmTransformation::apply(const std::vector<std::pair<int,double> >& localIndex,37 const double* dataInput,38 CArray<double,1>& dataOut,39 std::vector<bool>& flagInitial,40 bool ignoreMissingValue, bool firstPass )41 TRY42 {43 int nbLocalIndex = localIndex.size();44 double defaultValue = std::numeric_limits<double>::quiet_NaN();45 46 if (ignoreMissingValue)47 {48 if (firstPass) dataOut=defaultValue ;49 50 for (int idx = 0; idx < nbLocalIndex; ++idx)51 {52 if (! NumTraits<double>::isNan(*(dataInput + idx)))53 {54 if (flagInitial[localIndex[idx].first]) dataOut(localIndex[idx].first) = *(dataInput + idx) * localIndex[idx].second;55 else dataOut(localIndex[idx].first) += *(dataInput + idx) * localIndex[idx].second;56 flagInitial[localIndex[idx].first] = false; // Reset flag to indicate not all data source are nan57 }58 }59 60 }61 else62 {63 for (int idx = 0; idx < nbLocalIndex; ++idx)64 {65 dataOut(localIndex[idx].first) += *(dataInput + idx) * localIndex[idx].second;66 }67 }68 }69 CATCH70 71 void CGenericAlgorithmTransformation::computePositionElements(CGrid* dst, CGrid* src)72 TRY73 {74 int idxScalar = 0, idxAxis = 0, idxDomain = 0;75 CArray<int,1> axisDomainOrderDst = dst->axis_domain_order;76 for (int i = 0; i < axisDomainOrderDst.numElements(); ++i)77 {78 int dimElement = axisDomainOrderDst(i);79 if (2 == dimElement)80 {81 elementPositionInGridDst2DomainPosition_[i] = idxDomain;82 ++idxDomain;83 }84 else if (1 == dimElement)85 {86 elementPositionInGridDst2AxisPosition_[i] = idxAxis;87 ++idxAxis;88 }89 else90 {91 elementPositionInGridDst2ScalarPosition_[i] = idxScalar;92 ++idxScalar;93 }94 }95 96 idxScalar = idxAxis = idxDomain = 0;97 CArray<int,1> axisDomainOrderSrc = src->axis_domain_order;98 for (int i = 0; i < axisDomainOrderSrc.numElements(); ++i)99 {100 int dimElement = axisDomainOrderSrc(i);101 if (2 == dimElement)102 {103 elementPositionInGridSrc2DomainPosition_[i] = idxDomain;104 ++idxDomain;105 }106 else if (1 == dimElement)107 {108 elementPositionInGridSrc2AxisPosition_[i] = idxAxis;109 ++idxAxis;110 }111 else112 {113 elementPositionInGridSrc2ScalarPosition_[i] = idxScalar;114 ++idxScalar;115 }116 }117 }118 CATCH119 120 bool CGenericAlgorithmTransformation::isDistributedTransformation(int elementPositionInGrid, CGrid* gridSrc, CGrid* gridDst)121 TRY122 {123 124 if (!isDistributedComputed_)125 {126 isDistributedComputed_=true ;127 if (!eliminateRedondantSrc_) isDistributed_=true ;128 else129 {130 CContext* context = CContext::getCurrent();131 132 computePositionElements(gridSrc, gridDst);133 std::vector<CScalar*> scalarListSrcP = gridSrc->getScalars();134 std::vector<CAxis*> axisListSrcP = gridSrc->getAxis();135 std::vector<CDomain*> domainListSrcP = gridSrc->getDomains();136 int distributed, distributed_glo ;137 138 CArray<int,1> axisDomainSrcOrder = gridSrc->axis_domain_order;139 if (2 == axisDomainSrcOrder(elementPositionInGrid)) // It's domain140 {141 distributed=domainListSrcP[elementPositionInGridSrc2DomainPosition_[elementPositionInGrid]]->isDistributed() ;142 MPI_Allreduce(&distributed,&distributed_glo, 1, MPI_INT, MPI_LOR, context->intraComm_) ;143 144 }145 else if (1 == axisDomainSrcOrder(elementPositionInGrid))//it's an axis146 {147 distributed=axisListSrcP[elementPositionInGridSrc2AxisPosition_[elementPositionInGrid]]->isDistributed() ;148 MPI_Allreduce(&distributed,&distributed_glo, 1, MPI_INT, MPI_LOR, context->intraComm_) ;149 }150 else //it's a scalar151 {152 distributed_glo=false ;153 }154 isDistributed_=distributed_glo ;155 }156 }157 return isDistributed_ ;158 }159 CATCH160 161 /*!162 This function computes the global indexes of grid source, which the grid destination is in demand.163 \param[in] elementPositionInGrid position of an element in a grid .E.g: if grid is composed of domain and axis (in order),164 then position of axis in grid is 1 and domain is positioned at 0.165 \param[in] gridSrc Grid source166 \param[in] gridDst Grid destination167 \param[in\out] globaIndexWeightFromSrcToDst mapping of each global index source and weight to index destination168 */169 void CGenericAlgorithmTransformation::computeGlobalSourceIndex(int elementPositionInGrid,170 CGrid* gridSrc,171 CGrid* gridDst,172 SourceDestinationIndexMap& globaIndexWeightFromSrcToDst)173 TRY174 {175 CContext* context = CContext::getCurrent();176 int nbClient = context->intraCommSize_;177 178 typedef std::unordered_map<int, std::vector<std::pair<int,double> > > SrcToDstMap;179 int idx;180 181 // compute position of elements on grids182 computePositionElements(gridDst, gridSrc);183 std::vector<CScalar*> scalarListDestP = gridDst->getScalars();184 std::vector<CAxis*> axisListDestP = gridDst->getAxis();185 std::vector<CDomain*> domainListDestP = gridDst->getDomains();186 CArray<int,1> axisDomainDstOrder = gridDst->axis_domain_order;187 std::vector<CScalar*> scalarListSrcP = gridSrc->getScalars();188 std::vector<CAxis*> axisListSrcP = gridSrc->getAxis();189 std::vector<CDomain*> domainListSrcP = gridSrc->getDomains();190 CArray<int,1> axisDomainSrcOrder = gridSrc->axis_domain_order;191 192 bool isTransPosEmpty = transformationPosition_.empty();193 CArray<size_t,1> transPos;194 if (!isTransPosEmpty) transPos.resize(transformationMapping_.size());195 std::set<size_t> allIndexSrc; // All index of source, which can be scattered among processes, need for doing transformation196 197 for (size_t idxTrans = 0; idxTrans < transformationMapping_.size(); ++idxTrans)198 {199 TransformationIndexMap::const_iterator itbTransMap = transformationMapping_[idxTrans].begin(), itTransMap,200 iteTransMap = transformationMapping_[idxTrans].end();201 TransformationWeightMap::const_iterator itbTransWeight = transformationWeight_[idxTrans].begin(), itTransWeight;202 203 // Build mapping between global source element index and global destination element index.204 itTransWeight = itbTransWeight;205 for (itTransMap = itbTransMap; itTransMap != iteTransMap; ++itTransMap, ++itTransWeight)206 {207 const std::vector<int>& srcIndex = itTransMap->second;208 for (idx = 0; idx < srcIndex.size(); ++idx)209 allIndexSrc.insert(srcIndex[idx]);210 }211 212 if (!isTransPosEmpty)213 {214 TransformationPositionMap::const_iterator itPosMap = transformationPosition_[idxTrans].begin();215 transPos(idxTrans) = itPosMap->second[0];216 }217 }218 219 size_t indexSrcSize = 0;220 CArray<size_t,1> indexSrc(allIndexSrc.size());221 for (std::set<size_t>::iterator it = allIndexSrc.begin(); it != allIndexSrc.end(); ++it, ++indexSrcSize)222 indexSrc(indexSrcSize) = *it;223 224 // Flag to indicate whether we will recompute distribution of source global index on processes225 bool computeGlobalIndexOnProc = false;226 if (indexElementSrc_.size() != allIndexSrc.size())227 computeGlobalIndexOnProc = true;228 else229 {230 for (std::set<size_t>::iterator it = allIndexSrc.begin(); it != allIndexSrc.end(); ++it)231 if (0 == indexElementSrc_.count(*it))232 {233 computeGlobalIndexOnProc = true;234 break;235 }236 }237 238 if (computeGlobalIndexOnProc)239 indexElementSrc_.swap(allIndexSrc);240 241 int sendValue = (computeGlobalIndexOnProc) ? 1 : 0;242 int recvValue = 0;243 MPI_Allreduce(&sendValue, &recvValue, 1, MPI_INT, MPI_SUM, context->intraComm_);244 computeGlobalIndexOnProc = (0 < recvValue);245 246 // CClientClientDHTInt::Index2VectorInfoTypeMap globalIndexOfTransformedElementOnProc;247 248 if (computeGlobalIndexOnProc || !computedProcSrcNonTransformedElement_)249 {250 {251 CClientClientDHTInt::Index2VectorInfoTypeMap tmp ;252 globalIndexOfTransformedElementOnProc_.swap(tmp) ;253 }254 // Find out global index source of transformed element on corresponding process.255 if (globalElementIndexOnProc_.empty())256 globalElementIndexOnProc_.resize(axisDomainDstOrder.numElements());257 258 for (idx = 0; idx < axisDomainDstOrder.numElements(); ++idx)259 {260 261 if (idx == elementPositionInGrid)262 computeExchangeGlobalIndex(indexSrc, axisDomainSrcOrder(idx), globalIndexOfTransformedElementOnProc_); //globalElementIndexOnProc[idx]);263 if (!computedProcSrcNonTransformedElement_)264 {265 if (2 == axisDomainDstOrder(idx)) // It's domain266 {267 if (idx != elementPositionInGrid)268 computeExchangeDomainIndex(domainListDestP[elementPositionInGridDst2DomainPosition_[idx]],269 domainListSrcP[elementPositionInGridSrc2DomainPosition_[idx]],270 transPos,271 globalElementIndexOnProc_[idx]);272 273 }274 else if (1 == axisDomainDstOrder(idx))//it's an axis275 {276 if (idx != elementPositionInGrid)277 computeExchangeAxisIndex(axisListDestP[elementPositionInGridDst2AxisPosition_[idx]],278 axisListSrcP[elementPositionInGridSrc2AxisPosition_[idx]],279 transPos,280 globalElementIndexOnProc_[idx]);281 }282 else //it's a scalar283 {284 if (idx != elementPositionInGrid)285 computeExchangeScalarIndex(scalarListDestP[elementPositionInGridDst2ScalarPosition_[idx]],286 scalarListSrcP[elementPositionInGridSrc2ScalarPosition_[idx]],287 transPos,288 globalElementIndexOnProc_[idx]);289 290 }291 }292 }293 294 if (!isTransPosEmpty && !computedProcSrcNonTransformedElement_)295 {296 for (idx = 0; idx < globalElementIndexOnProc_.size(); ++idx)297 {298 if (idx != elementPositionInGrid)299 {300 std::unordered_map<int,std::vector<size_t> >::iterator itb = globalElementIndexOnProc_[idx].begin(), it,301 ite = globalElementIndexOnProc_[idx].end();302 for (it = itb; it != ite; ++it) it->second.resize(1);303 }304 }305 }306 307 /*308 if (!computedProcSrcNonTransformedElement_)309 {310 for (idx = 0; idx < globalElementIndexOnProc_.size(); ++idx)311 {312 if (idx != elementPositionInGrid)313 {314 std::unordered_map<int,std::vector<size_t> >::iterator itb = globalElementIndexOnProc_[idx].begin(), it,315 ite = globalElementIndexOnProc_[idx].end();316 for (it = itb; it != ite; ++it) procOfNonTransformedElements_.insert(it->first);317 if (procOfNonTransformedElements_.size() == nbClient)318 break;319 }320 }321 }322 323 // Processes contain the source index of transformed element324 std::set<int> procOfTransformedElement;325 CClientClientDHTInt::Index2VectorInfoTypeMap::iterator itIdxb = globalIndexOfTransformedElementOnProc.begin(),326 itIdxe = globalIndexOfTransformedElementOnProc.end(), itIdx;327 for (itIdx = itIdxb; itIdx != itIdxe; ++itIdx)328 {329 std::vector<int>& tmp = itIdx->second;330 for (int i = 0; i < tmp.size(); ++i)331 procOfTransformedElement.insert(tmp[i]);332 if (tmp.size() == nbClient)333 break;334 }335 336 std::set<int>& commonProc = (procOfTransformedElement.size() < procOfNonTransformedElements_.size()) ? procOfTransformedElement337 : (!procOfNonTransformedElements_.empty() ? procOfNonTransformedElements_ : procOfTransformedElement);338 339 std::vector<int> procContainSrcElementIdx(commonProc.size());340 int count = 0;341 for (std::set<int>::iterator it = commonProc.begin(); it != commonProc.end(); ++it)342 procContainSrcElementIdx[count++] = *it;343 344 procContainSrcElementIdx_.swap(procContainSrcElementIdx);345 */346 347 if (procElementList_.empty()) procElementList_.resize(axisDomainDstOrder.numElements()) ;348 for (idx = 0; idx < axisDomainDstOrder.numElements(); ++idx)349 {350 std::set<int>& procList=procElementList_[idx] ;351 std::set<int> commonTmp ;352 if (idx == elementPositionInGrid)353 {354 set<int> tmpSet ;355 procList.swap(tmpSet) ;356 CClientClientDHTInt::Index2VectorInfoTypeMap::iterator itIdxb = globalIndexOfTransformedElementOnProc_.begin(),357 itIdxe = globalIndexOfTransformedElementOnProc_.end(), itIdx;358 for (itIdx = itIdxb; itIdx != itIdxe; ++itIdx)359 {360 std::vector<int>& tmp = itIdx->second;361 for (int i = 0; i < tmp.size(); ++i) procList.insert(tmp[i]);362 if (tmp.size() == nbClient)363 break;364 }365 }366 else367 {368 if (!computedProcSrcNonTransformedElement_)369 {370 set<int> tmpSet ;371 procList.swap(tmpSet) ;372 std::unordered_map<int,std::vector<size_t> >::iterator itb = globalElementIndexOnProc_[idx].begin(), it,373 ite = globalElementIndexOnProc_[idx].end();374 for (it = itb; it != ite; ++it)375 {376 procList.insert(it->first);377 if (procList.size() == nbClient) break;378 }379 }380 }381 382 if (idx==0) commonProc_= procList ;383 else384 {385 for (std::set<int>::iterator it = commonProc_.begin(); it != commonProc_.end(); ++it)386 if (procList.count(*it)==1) commonTmp.insert(*it) ;387 commonProc_.swap(commonTmp) ;388 }389 }390 std::vector<int> procContainSrcElementIdx(commonProc_.size());391 int count = 0;392 for (std::set<int>::iterator it = commonProc_.begin(); it != commonProc_.end(); ++it) procContainSrcElementIdx[count++] = *it;393 procContainSrcElementIdx_.swap(procContainSrcElementIdx);394 395 // For the first time, surely we calculate proc containing non transformed elements396 if (!computedProcSrcNonTransformedElement_) computedProcSrcNonTransformedElement_ = true;397 }398 399 for (size_t idxTrans = 0; idxTrans < transformationMapping_.size(); ++idxTrans)400 {401 TransformationIndexMap::const_iterator itbTransMap = transformationMapping_[idxTrans].begin(), itTransMap,402 iteTransMap = transformationMapping_[idxTrans].end();403 TransformationWeightMap::const_iterator itbTransWeight = transformationWeight_[idxTrans].begin(), itTransWeight;404 SrcToDstMap src2DstMap;405 src2DstMap.rehash(std::ceil(transformationMapping_[idxTrans].size()/src2DstMap.max_load_factor()));406 407 // Build mapping between global source element index and global destination element index.408 std::unordered_map<int,std::vector<size_t> >().swap(globalElementIndexOnProc_[elementPositionInGrid]);409 std::set<int> tmpCounter;410 itTransWeight = itbTransWeight;411 for (itTransMap = itbTransMap; itTransMap != iteTransMap; ++itTransMap, ++itTransWeight)412 {413 const std::vector<int>& srcIndex = itTransMap->second;414 const std::vector<double>& weight = itTransWeight->second;415 for (idx = 0; idx < srcIndex.size(); ++idx)416 {417 src2DstMap[srcIndex[idx]].push_back(make_pair(itTransMap->first, weight[idx]));418 if (0 == tmpCounter.count(srcIndex[idx]))419 {420 tmpCounter.insert(srcIndex[idx]);421 422 vector<int>& rankSrc = globalIndexOfTransformedElementOnProc_[srcIndex[idx]] ;423 for (int n=0;n<rankSrc.size();++n)424 {425 if (commonProc_.count(rankSrc[n])==1) globalElementIndexOnProc_[elementPositionInGrid][rankSrc[n]].push_back(srcIndex[idx]);426 }427 // for (int j = 0; j < procContainSrcElementIdx_.size(); ++j)428 // globalElementIndexOnProc_[elementPositionInGrid][procContainSrcElementIdx_[j]].push_back(srcIndex[idx]);429 }430 }431 }432 433 if (!isTransPosEmpty)434 {435 for (idx = 0; idx < globalElementIndexOnProc_.size(); ++idx)436 {437 if (idx != elementPositionInGrid)438 {439 std::unordered_map<int,std::vector<size_t> >::iterator itb = globalElementIndexOnProc_[idx].begin(), it,440 ite = globalElementIndexOnProc_[idx].end();441 for (it = itb; it != ite; ++it) it->second[0] = transPos(idxTrans);442 }443 }444 }445 446 // Ok, now compute global index of grid source and ones of grid destination447 computeGlobalGridIndexMapping(elementPositionInGrid,448 procContainSrcElementIdx_, //srcRank,449 src2DstMap,450 gridSrc,451 gridDst,452 globalElementIndexOnProc_,453 globaIndexWeightFromSrcToDst);454 }455 }456 CATCH457 458 /*!459 Compute mapping of global index of grid source and grid destination460 \param [in] elementPositionInGrid position of element in grid. E.x: grid composed of domain and axis, domain has position 0 and axis 1.461 \param [in] srcRank rank of client from which we demand global index of element source462 \param [in] src2DstMap mapping of global index of element source and global index of element destination463 \param [in] gridSrc Grid source464 \param [in] gridDst Grid destination465 \param [in] globalElementIndexOnProc Global index of element source on different client rank466 \param [out] globaIndexWeightFromSrcToDst Mapping of global index of grid source and grid destination467 */468 void CGenericAlgorithmTransformation::computeGlobalGridIndexMapping(int elementPositionInGrid,469 const std::vector<int>& srcRank,470 std::unordered_map<int, std::vector<std::pair<int,double> > >& src2DstMap,471 CGrid* gridSrc,472 CGrid* gridDst,473 std::vector<std::unordered_map<int,std::vector<size_t> > >& globalElementIndexOnProc,474 SourceDestinationIndexMap& globaIndexWeightFromSrcToDst)475 TRY476 {477 SourceDestinationIndexMap globaIndexWeightFromSrcToDst_tmp ;478 479 CContext* context = CContext::getCurrent();480 int clientRank = context->intraCommRank_;481 482 std::vector<CDomain*> domainListSrcP = gridSrc->getDomains();483 std::vector<CAxis*> axisListSrcP = gridSrc->getAxis();484 std::vector<CScalar*> scalarListSrcP = gridSrc->getScalars();485 CArray<int,1> axisDomainSrcOrder = gridSrc->axis_domain_order;486 487 size_t nbElement = axisDomainSrcOrder.numElements();488 std::vector<size_t> nGlobSrc(nbElement);489 size_t globalSrcSize = 1;490 int domainIndex = 0, axisIndex = 0, scalarIndex = 0;491 for (int idx = 0; idx < nbElement; ++idx)492 {493 nGlobSrc[idx] = globalSrcSize;494 int elementDimension = axisDomainSrcOrder(idx);495 496 // If this is a domain497 if (2 == elementDimension)498 {499 globalSrcSize *= domainListSrcP[domainIndex]->nj_glo.getValue() * domainListSrcP[domainIndex]->ni_glo.getValue();500 ++domainIndex;501 }502 else if (1 == elementDimension) // So it's an axis503 {504 globalSrcSize *= axisListSrcP[axisIndex]->n_glo.getValue();505 ++axisIndex;506 }507 else508 {509 globalSrcSize *= 1;510 ++scalarIndex;511 }512 }513 514 std::vector<CDomain*> domainListDestP = gridDst->getDomains();515 std::vector<CAxis*> axisListDestP = gridDst->getAxis();516 std::vector<CScalar*> scalarListDestP = gridDst->getScalars();517 CArray<int,1> axisDomainDstOrder = gridDst->axis_domain_order;518 519 std::vector<size_t> nGlobDst(nbElement);520 size_t globalDstSize = 1;521 domainIndex = axisIndex = scalarIndex = 0;522 set<size_t> globalSrcStoreIndex ;523 524 for (int idx = 0; idx < nbElement; ++idx)525 {526 nGlobDst[idx] = globalDstSize;527 int elementDimension = axisDomainDstOrder(idx);528 529 // If this is a domain530 if (2 == elementDimension)531 {532 globalDstSize *= domainListDestP[domainIndex]->nj_glo.getValue() * domainListDestP[domainIndex]->ni_glo.getValue();533 ++domainIndex;534 }535 else if (1 == elementDimension) // So it's an axis536 {537 globalDstSize *= axisListDestP[axisIndex]->n_glo.getValue();538 ++axisIndex;539 }540 else541 {542 globalDstSize *= 1;543 ++scalarIndex;544 }545 }546 547 std::map< std::pair<size_t,size_t>, int > rankMap ;548 std::map< std::pair<size_t,size_t>, int >:: iterator rankMapIt ;549 550 for (int i = 0; i < srcRank.size(); ++i)551 {552 size_t ssize = 1;553 int rankSrc = srcRank[i];554 for (int idx = 0; idx < nbElement; ++idx)555 {556 ssize *= (globalElementIndexOnProc[idx][rankSrc]).size();557 }558 559 std::vector<int> idxLoop(nbElement,0);560 std::vector<int> currentIndexSrc(nbElement, 0);561 std::vector<int> currentIndexDst(nbElement, 0);562 int innnerLoopSize = (globalElementIndexOnProc[0])[rankSrc].size();563 size_t idx = 0;564 while (idx < ssize)565 {566 for (int ind = 0; ind < nbElement; ++ind)567 {568 if (idxLoop[ind] == (globalElementIndexOnProc[ind])[rankSrc].size())569 {570 idxLoop[ind] = 0;571 ++idxLoop[ind+1];572 }573 574 currentIndexDst[ind] = currentIndexSrc[ind] = (globalElementIndexOnProc[ind])[rankSrc][idxLoop[ind]];575 }576 577 for (int ind = 0; ind < innnerLoopSize; ++ind)578 {579 currentIndexDst[0] = currentIndexSrc[0] = (globalElementIndexOnProc[0])[rankSrc][ind];580 int globalElementDstIndexSize = 0;581 if (1 == src2DstMap.count(currentIndexSrc[elementPositionInGrid]))582 {583 globalElementDstIndexSize = src2DstMap[currentIndexSrc[elementPositionInGrid]].size();584 }585 586 std::vector<size_t> globalDstVecIndex(globalElementDstIndexSize,0);587 size_t globalSrcIndex = 0;588 for (int idxElement = 0; idxElement < nbElement; ++idxElement)589 {590 if (idxElement == elementPositionInGrid)591 {592 for (int k = 0; k < globalElementDstIndexSize; ++k)593 {594 globalDstVecIndex[k] += src2DstMap[currentIndexSrc[elementPositionInGrid]][k].first * nGlobDst[idxElement];595 }596 }597 else598 {599 for (int k = 0; k < globalElementDstIndexSize; ++k)600 {601 globalDstVecIndex[k] += currentIndexDst[idxElement] * nGlobDst[idxElement];602 }603 }604 globalSrcIndex += currentIndexSrc[idxElement] * nGlobSrc[idxElement];605 }606 607 for (int k = 0; k < globalElementDstIndexSize; ++k)608 {609 610 globaIndexWeightFromSrcToDst_tmp[rankSrc][globalSrcIndex].push_back(make_pair(globalDstVecIndex[k],src2DstMap[currentIndexSrc[elementPositionInGrid]][k].second ));611 rankMapIt=rankMap.find(make_pair(globalSrcIndex,globalDstVecIndex[k])) ;612 if (rankMapIt==rankMap.end()) rankMap[make_pair(globalSrcIndex,globalDstVecIndex[k])] = rankSrc ;613 else if (rankSrc==clientRank) rankMapIt->second = rankSrc ;614 }615 ++idxLoop[0];616 }617 idx += innnerLoopSize;618 }619 }620 621 // eliminate redondant global src point owned by differrent processes.622 // Avoid as possible to tranfer data from an other process if the src point is also owned by current process623 int rankSrc ;624 size_t globalSrcIndex ;625 size_t globalDstIndex ;626 double weight ;627 628 SourceDestinationIndexMap::iterator rankIt,rankIte ;629 std::unordered_map<size_t, std::vector<std::pair<size_t,double> > >::iterator globalSrcIndexIt, globalSrcIndexIte ;630 std::vector<std::pair<size_t,double> >::iterator vectIt,vectIte ;631 632 rankIt=globaIndexWeightFromSrcToDst_tmp.begin() ; rankIte=globaIndexWeightFromSrcToDst_tmp.end() ;633 for(;rankIt!=rankIte;++rankIt)634 {635 rankSrc = rankIt->first ;636 globalSrcIndexIt = rankIt->second.begin() ; globalSrcIndexIte = rankIt->second.end() ;637 for(;globalSrcIndexIt!=globalSrcIndexIte;++globalSrcIndexIt)638 {639 globalSrcIndex = globalSrcIndexIt->first ;640 vectIt = globalSrcIndexIt->second.begin() ; vectIte = globalSrcIndexIt->second.end() ;641 for(vectIt; vectIt!=vectIte; vectIt++)642 {643 globalDstIndex = vectIt->first ;644 weight = vectIt->second ;645 if (eliminateRedondantSrc_)646 {647 if (rankMap[make_pair(globalSrcIndex,globalDstIndex)] == rankSrc)648 globaIndexWeightFromSrcToDst[rankSrc][globalSrcIndex].push_back(make_pair(globalDstIndex,weight)) ;649 }650 else globaIndexWeightFromSrcToDst[rankSrc][globalSrcIndex].push_back(make_pair(globalDstIndex,weight)) ;651 }652 }653 }654 }655 CATCH656 657 /*!658 Find out proc and global index of axis source which axis destination is on demande659 \param[in] scalar Scalar destination660 \param[in] scalar Scalar source661 \param[in] destGlobalIndexPositionInGrid Relative position of axis corresponds to other element of grid.662 \param[out] globalScalarIndexOnProc Global index of axis source on different procs663 */664 void CGenericAlgorithmTransformation::computeExchangeScalarIndex(CScalar* scalarDst,665 CScalar* scalarSrc,666 CArray<size_t,1>& destGlobalIndexPositionInGrid,667 std::unordered_map<int,std::vector<size_t> >& globalScalarIndexOnProc)668 TRY669 {670 CContext* context = CContext::getCurrent();671 int clientRank = context->intraCommRank_;672 int clientSize = context->intraCommSize_;673 674 globalScalarIndexOnProc.rehash(std::ceil(clientSize/globalScalarIndexOnProc.max_load_factor()));675 for (int idx = 0; idx < clientSize; ++idx)676 {677 globalScalarIndexOnProc[idx].push_back(0);678 }679 }680 CATCH681 682 /*!683 Find out proc and global index of axis source which axis destination is on demande684 \param[in] axisDst Axis destination685 \param[in] axisSrc Axis source686 \param[in] destGlobalIndexPositionInGrid Relative position of axis corresponds to other element of grid.687 \param[out] globalAxisIndexOnProc Global index of axis source on different procs688 */689 void CGenericAlgorithmTransformation::computeExchangeAxisIndex(CAxis* axisDst,690 CAxis* axisSrc,691 CArray<size_t,1>& destGlobalIndexPositionInGrid,692 std::unordered_map<int,std::vector<size_t> >& globalAxisIndexOnProc)693 TRY694 {695 CContext* context = CContext::getCurrent();696 int clientRank = context->intraCommRank_;697 int clientSize = context->intraCommSize_;698 699 size_t globalIndex;700 int nIndexSize = axisSrc->index.numElements();701 CClientClientDHTInt::Index2VectorInfoTypeMap globalIndex2ProcRank;702 globalIndex2ProcRank.rehash(std::ceil(nIndexSize/globalIndex2ProcRank.max_load_factor()));703 for (int idx = 0; idx < nIndexSize; ++idx)704 {705 if (axisSrc->mask(idx))706 {707 globalIndex = axisSrc->index(idx);708 globalIndex2ProcRank[globalIndex].push_back(clientRank);709 }710 }711 712 CClientClientDHTInt dhtIndexProcRank(globalIndex2ProcRank, context->intraComm_);713 CArray<size_t,1> globalAxisIndex(axisDst->index.numElements());714 for (int idx = 0; idx < globalAxisIndex.numElements(); ++idx)715 {716 globalAxisIndex(idx) = axisDst->index(idx);717 }718 dhtIndexProcRank.computeIndexInfoMapping(globalAxisIndex);719 720 std::vector<int> countIndex(clientSize,0);721 const CClientClientDHTInt::Index2VectorInfoTypeMap& computedGlobalIndexOnProc = dhtIndexProcRank.getInfoIndexMap();722 CClientClientDHTInt::Index2VectorInfoTypeMap::const_iterator itb = computedGlobalIndexOnProc.begin(), it,723 ite = computedGlobalIndexOnProc.end();724 for (it = itb; it != ite; ++it)725 {726 const std::vector<int>& procList = it->second;727 for (int idx = 0; idx < procList.size(); ++idx) ++countIndex[procList[idx]];728 }729 730 globalAxisIndexOnProc.rehash(std::ceil(clientSize/globalAxisIndexOnProc.max_load_factor()));731 for (int idx = 0; idx < clientSize; ++idx)732 {733 if (0 != countIndex[idx])734 {735 globalAxisIndexOnProc[idx].resize(countIndex[idx]);736 countIndex[idx] = 0;737 }738 }739 740 for (it = itb; it != ite; ++it)741 {742 const std::vector<int>& procList = it->second;743 for (int idx = 0; idx < procList.size(); ++idx)744 {745 globalAxisIndexOnProc[procList[idx]][countIndex[procList[idx]]] = it->first;746 ++countIndex[procList[idx]];747 }748 }749 }750 CATCH751 752 /*!753 Find out proc and global index of domain source which domain destination is on demande754 \param[in] domainDst Domain destination755 \param[in] domainSrc Domain source756 \param[in] destGlobalIndexPositionInGrid Relative position of domain corresponds to other element of grid.757 \param[out] globalDomainIndexOnProc Global index of domain source on different procs758 */759 void CGenericAlgorithmTransformation::computeExchangeDomainIndex(CDomain* domainDst,760 CDomain* domainSrc,761 CArray<size_t,1>& destGlobalIndexPositionInGrid,762 std::unordered_map<int,std::vector<size_t> >& globalDomainIndexOnProc)763 TRY764 {765 CContext* context = CContext::getCurrent();766 int clientRank = context->intraCommRank_;767 int clientSize = context->intraCommSize_;768 769 int niGlobSrc = domainSrc->ni_glo.getValue();770 size_t globalIndex;771 int i_ind, j_ind;772 int nIndexSize = (destGlobalIndexPositionInGrid.isEmpty()) ? domainSrc->i_index.numElements()773 : destGlobalIndexPositionInGrid.numElements();774 CClientClientDHTInt::Index2VectorInfoTypeMap globalIndex2ProcRank;775 globalIndex2ProcRank.rehash(std::ceil(nIndexSize/globalIndex2ProcRank.max_load_factor()));776 777 if (destGlobalIndexPositionInGrid.isEmpty())778 {779 for (int idx = 0; idx < nIndexSize; ++idx)780 {781 i_ind=domainSrc->i_index(idx) ;782 j_ind=domainSrc->j_index(idx) ;783 784 if (domainSrc->localMask(idx))785 {786 globalIndex = i_ind + j_ind * niGlobSrc;787 globalIndex2ProcRank[globalIndex].resize(1);788 globalIndex2ProcRank[globalIndex][0] = clientRank;789 }790 }791 }792 else793 {794 for (int idx = 0; idx < nIndexSize; ++idx)795 {796 // if (domainSrc->localMask(idx)) -> not necessairy, mask seem to be included in destGlobalIndexPositionInGrid(idx) (ym)797 globalIndex2ProcRank[destGlobalIndexPositionInGrid(idx)].push_back(clientRank);798 }799 }800 801 CArray<size_t,1> globalDomainIndex;802 if (destGlobalIndexPositionInGrid.isEmpty())803 {804 int niGlobDst = domainDst->ni_glo.getValue();805 globalDomainIndex.resize(domainDst->i_index.numElements());806 nIndexSize = domainDst->i_index.numElements();807 808 for (int idx = 0; idx < nIndexSize; ++idx)809 {810 i_ind=domainDst->i_index(idx) ;811 j_ind=domainDst->j_index(idx) ;812 813 globalDomainIndex(idx) = i_ind + j_ind * niGlobDst;814 }815 }816 else817 {818 globalDomainIndex.reference(destGlobalIndexPositionInGrid);819 }820 821 CClientClientDHTInt dhtIndexProcRank(globalIndex2ProcRank, context->intraComm_);822 dhtIndexProcRank.computeIndexInfoMapping(globalDomainIndex);823 824 std::vector<int> countIndex(clientSize,0);825 const CClientClientDHTInt::Index2VectorInfoTypeMap& computedGlobalIndexOnProc = dhtIndexProcRank.getInfoIndexMap();826 CClientClientDHTInt::Index2VectorInfoTypeMap::const_iterator itb = computedGlobalIndexOnProc.begin(), it,827 ite = computedGlobalIndexOnProc.end();828 for (it = itb; it != ite; ++it)829 {830 const std::vector<int>& procList = it->second;831 for (int idx = 0; idx < procList.size(); ++idx) ++countIndex[procList[idx]];832 }833 834 globalDomainIndexOnProc.rehash(std::ceil(clientSize/globalDomainIndexOnProc.max_load_factor()));835 for (int idx = 0; idx < clientSize; ++idx)836 {837 if (0 != countIndex[idx])838 {839 globalDomainIndexOnProc[idx].resize(countIndex[idx]);840 countIndex[idx] = 0;841 }842 }843 844 for (it = itb; it != ite; ++it)845 {846 const std::vector<int>& procList = it->second;847 for (int idx = 0; idx < procList.size(); ++idx)848 {849 globalDomainIndexOnProc[procList[idx]][countIndex[procList[idx]]] = it->first;850 ++countIndex[procList[idx]];851 }852 }853 }854 CATCH855 856 void CGenericAlgorithmTransformation::computeTransformationMappingNonDistributed(int elementPositionInGrid, CGrid* gridSrc, CGrid* gridDst,857 vector<int>& localSrc, vector<int>& localDst, vector<double>& weight,858 int& nlocalIndexDest)859 TRY860 {861 862 CContext* context = CContext::getCurrent();863 int nbClient = context->intraCommSize_;864 865 computePositionElements(gridDst, gridSrc);866 std::vector<CScalar*> scalarListDstP = gridDst->getScalars();867 std::vector<CAxis*> axisListDstP = gridDst->getAxis();868 std::vector<CDomain*> domainListDstP = gridDst->getDomains();869 CArray<int,1> axisDomainDstOrder = gridDst->axis_domain_order;870 std::vector<CScalar*> scalarListSrcP = gridSrc->getScalars();871 std::vector<CAxis*> axisListSrcP = gridSrc->getAxis();872 std::vector<CDomain*> domainListSrcP = gridSrc->getDomains();873 CArray<int,1> axisDomainSrcOrder = gridSrc->axis_domain_order;874 875 int nElement=axisDomainSrcOrder.numElements() ;876 int indSrc=1 ;877 int indDst=1 ;878 vector<int> nIndexSrc(nElement) ;879 vector<int> nIndexDst(nElement) ;880 vector< CArray<bool,1>* > maskSrc(nElement) ;881 vector< CArray<bool,1>* > maskDst(nElement) ;882 883 int nlocalIndexSrc=1 ;884 // int nlocalIndexDest=1 ;885 nlocalIndexDest=1 ;886 CArray<bool,1> maskScalar(1) ;887 maskScalar = true ;888 889 890 for(int i=0 ; i<nElement; i++)891 {892 int dimElement = axisDomainSrcOrder(i);893 if (2 == dimElement) //domain894 {895 CDomain* domain=domainListSrcP[elementPositionInGridSrc2DomainPosition_[i]] ;896 nIndexSrc[i] = domain->i_index.numElements() ;897 maskSrc[i]=&domain->localMask ;898 }899 else if (1 == dimElement) //axis900 {901 CAxis* axis=axisListSrcP[elementPositionInGridSrc2AxisPosition_[i]] ;902 nIndexSrc[i] = axis->index.numElements() ;903 maskSrc[i]=&axis->mask ;904 }905 else //scalar906 {907 nIndexSrc[i]=1 ;908 maskSrc[i]=&maskScalar ;909 }910 nlocalIndexSrc=nlocalIndexSrc*nIndexSrc[i] ;911 }912 913 914 915 int offset=1 ;916 for(int i=0 ; i<nElement; i++)917 {918 int dimElement = axisDomainDstOrder(i);919 if (2 == dimElement) //domain920 {921 CDomain* domain=domainListDstP[elementPositionInGridDst2DomainPosition_[i]] ;922 int nIndex=domain->i_index.numElements() ;923 CArray<bool,1>& localMask=domain->localMask ;924 int nbInd=0 ;925 for(int j=0;j<nIndex;j++) if (localMask(j)) nbInd++ ;926 nIndexDst[i] = nbInd ;927 maskDst[i]=&domain->localMask ;928 }929 else if (1 == dimElement) //axis930 {931 CAxis* axis = axisListDstP[elementPositionInGridDst2AxisPosition_[i]] ;932 int nIndex=axis->index.numElements() ;933 CArray<bool,1>& localMask=axis->mask ;934 int nbInd=0 ;935 for(int j=0;j<nIndex;j++) if (localMask(j)) nbInd++ ;936 nIndexDst[i] = nbInd ;937 maskDst[i]=&axis->mask ;938 }939 else //scalar940 {941 nIndexDst[i]=1 ;942 maskDst[i]=&maskScalar ;943 }944 if (i<elementPositionInGrid) offset=offset*nIndexDst[i] ;945 nlocalIndexDest=nlocalIndexDest*nIndexDst[i] ;946 }947 948 vector<int> dstLocalInd ;949 int dimElement = axisDomainDstOrder(elementPositionInGrid);950 if (2 == dimElement) //domain951 {952 CDomain* domain = domainListDstP[elementPositionInGridDst2DomainPosition_[elementPositionInGrid]] ;953 int ni_glo=domain->ni_glo ;954 int nj_glo=domain->nj_glo ;955 int nindex_glo=ni_glo*nj_glo ;956 dstLocalInd.resize(nindex_glo,-1) ;957 int nIndex=domain->i_index.numElements() ;958 CArray<bool,1>& localMask=domain->localMask ;959 int unmaskedInd=0 ;960 int globIndex ;961 for(int i=0;i<nIndex;i++)962 {963 if (localMask(i))964 {965 globIndex=domain->j_index(i)*ni_glo+domain->i_index(i) ;966 dstLocalInd[globIndex]=unmaskedInd ;967 unmaskedInd++ ;968 }969 }970 }971 else if (1 == dimElement) //axis972 {973 CAxis* axis = axisListDstP[elementPositionInGridDst2AxisPosition_[elementPositionInGrid]] ;974 int nindex_glo=axis->n_glo ;975 dstLocalInd.resize(nindex_glo,-1) ;976 int nIndex=axis->index.numElements() ;977 CArray<bool,1>& localMask=axis->mask ; // axis mask must include later data_index978 int unmaskedInd=0 ;979 for(int i=0;i<nIndex;i++)980 {981 if (localMask(i))982 {983 dstLocalInd[axis->index(i)]=unmaskedInd ;984 unmaskedInd++ ;985 }986 }987 }988 else //scalar989 {990 dstLocalInd.resize(1) ;991 dstLocalInd[0]=0 ;992 }993 994 vector<vector<vector<pair<int,double> > > > dstIndWeight(transformationMapping_.size()) ;995 996 for(int t=0;t<transformationMapping_.size();++t)997 {998 TransformationIndexMap::const_iterator itTransMap = transformationMapping_[t].begin(),999 iteTransMap = transformationMapping_[t].end();1000 TransformationWeightMap::const_iterator itTransWeight = transformationWeight_[t].begin();1001 dstIndWeight[t].resize(nIndexSrc[elementPositionInGrid]) ;1002 1003 for(;itTransMap!=iteTransMap;++itTransMap,++itTransWeight)1004 {1005 int dst=dstLocalInd[itTransMap->first] ;1006 if (dst!=-1)1007 {1008 const vector<int>& srcs=itTransMap->second;1009 const vector<double>& weights=itTransWeight->second;1010 for(int i=0;i<srcs.size() ;i++) dstIndWeight[t][srcs[i]].push_back(pair<int,double>(dst*offset+t,weights[i])) ;1011 }1012 }1013 }1014 int srcInd=0 ;1015 int currentInd ;1016 int t=0 ;1017 int srcIndCompressed=0 ;1018 1019 nonDistributedrecursiveFunct(nElement-1,true,elementPositionInGrid,maskSrc,maskDst, srcInd, srcIndCompressed, nIndexSrc, t, dstIndWeight,1020 currentInd,localSrc,localDst,weight);1021 1022 }1023 CATCH1024 1025 1026 void CGenericAlgorithmTransformation::nonDistributedrecursiveFunct(int currentPos, bool masked, int elementPositionInGrid,1027 vector< CArray<bool,1>* >& maskSrc, vector< CArray<bool,1>* >& maskDst,1028 int& srcInd, int& srcIndCompressed, vector<int>& nIndexSrc,1029 int& t, vector<vector<vector<pair<int,double> > > >& dstIndWeight, int currentInd,1030 vector<int>& localSrc, vector<int>& localDst, vector<double>& weight)1031 TRY1032 {1033 int masked_ ;1034 if (currentPos!=elementPositionInGrid)1035 {1036 if (currentPos!=0)1037 {1038 CArray<bool,1>& mask = *maskSrc[currentPos] ;1039 1040 for(int i=0;i<nIndexSrc[currentPos];i++)1041 {1042 masked_=masked ;1043 if (!mask(i)) masked_=false ;1044 nonDistributedrecursiveFunct(currentPos-1, masked_, elementPositionInGrid, maskSrc, maskDst, srcInd, srcIndCompressed, nIndexSrc, t,1045 dstIndWeight, currentInd, localSrc, localDst, weight);1046 }1047 }1048 else1049 {1050 CArray<bool,1>& mask = *maskSrc[currentPos] ;1051 for(int i=0;i<nIndexSrc[currentPos];i++)1052 {1053 if (masked && mask(i))1054 {1055 if (dstIndWeight[t][currentInd].size()>0)1056 {1057 for(vector<pair<int,double> >::iterator it = dstIndWeight[t][currentInd].begin(); it!=dstIndWeight[t][currentInd].end(); ++it)1058 {1059 localSrc.push_back(srcIndCompressed) ;1060 localDst.push_back(it->first) ;1061 weight.push_back(it->second) ;1062 (it->first)++ ;1063 }1064 }1065 if (t < dstIndWeight.size()-1) t++ ;1066 srcIndCompressed ++ ;1067 }1068 srcInd++ ;1069 }1070 }1071 }1072 else1073 {1074 1075 if (currentPos!=0)1076 {1077 1078 CArray<bool,1>& mask = *maskSrc[currentPos] ;1079 for(int i=0;i<nIndexSrc[currentPos];i++)1080 {1081 t=0 ;1082 masked_=masked ;1083 if (!mask(i)) masked_=false ;1084 nonDistributedrecursiveFunct(currentPos-1, masked_, elementPositionInGrid, maskSrc, maskDst, srcInd,1085 srcIndCompressed, nIndexSrc, t, dstIndWeight , i, localSrc, localDst, weight);1086 }1087 }1088 else1089 {1090 for(int i=0;i<nIndexSrc[currentPos];i++)1091 {1092 if (masked)1093 {1094 t=0 ;1095 if (dstIndWeight[t][i].size()>0)1096 {1097 for(vector<pair<int,double> >::iterator it = dstIndWeight[t][i].begin(); it!=dstIndWeight[t][i].end(); ++it)1098 {1099 localSrc.push_back(srcIndCompressed) ;1100 localDst.push_back(it->first) ;1101 weight.push_back(it->second) ;1102 (it->first)++ ;1103 }1104 }1105 if (t < dstIndWeight.size()-1) t++ ;1106 srcIndCompressed ++ ;1107 }1108 srcInd++ ;1109 }1110 }1111 }1112 1113 }1114 CATCH1115 1116 /*!1117 Compute index mapping between element source and element destination with an auxiliary inputs which determine1118 position of each mapped index in global index of grid destination.1119 \param [in] dataAuxInputs auxiliary inputs1120 */1121 void CGenericAlgorithmTransformation::computeIndexSourceMapping(const std::vector<CArray<double,1>* >& dataAuxInputs)1122 TRY1123 {1124 computeIndexSourceMapping_(dataAuxInputs);1125 }1126 CATCH1127 1128 std::vector<StdString> CGenericAlgorithmTransformation::getIdAuxInputs()1129 TRY1130 {1131 return idAuxInputs_;1132 }1133 CATCH1134 1135 CGenericAlgorithmTransformation::AlgoTransType CGenericAlgorithmTransformation::type()1136 TRY1137 {1138 return type_;1139 }1140 CATCH1141 29 1142 30 … … 1154 42 CTransformFilter* CGenericAlgorithmTransformation::createTransformFilter(CGarbageCollector& gc, CGridAlgorithm* algo, bool detectMissingValues, double defaultValue) 1155 43 { 1156 return new CTransformFilter(gc, algo, detectMissingValues, defaultValue) ;44 return new CTransformFilter(gc, 1, algo, detectMissingValues, defaultValue) ; 1157 45 } 1158 46 1159 v oid CGenericAlgorithmTransformation::apply(int dimBefore, int dimAfter, const CArray<double,1>& dataIn, CArray<double,1>& dataOut)47 vector<string> CGenericAlgorithmTransformation::getAuxFieldId(void) 1160 48 { 1161 // tranform into pure virtual funtion later 1162 abort() ; 49 return vector<string>() ; 1163 50 } 51 1164 52 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/generic_algorithm_transformation.hpp
r2007 r2011 34 34 class CGenericAlgorithmTransformation 35 35 { 36 public:37 enum AlgoTransType {38 ELEMENT_GENERATION = 0,39 ELEMENT_MODIFICATION_WITHOUT_DATA = 1,40 ELEMENT_MODIFICATION_WITH_DATA = 2,41 ELEMENT_NO_MODIFICATION_WITH_DATA = 3,42 ELEMENT_NO_MODIFICATION_WITHOUT_DATA = 443 } ;44 45 public:46 // Mapping between global index map of DESTINATION and its local index with pair of global index of SOURCE and weights47 typedef std::unordered_map<int, std::unordered_map<size_t, std::vector<std::pair<size_t,double> > > > SourceDestinationIndexMap;48 49 protected:50 typedef std::unordered_map<size_t,int> GlobalLocalMap;51 protected:52 typedef std::unordered_map<int, std::vector<int> > TransformationIndexMap;53 typedef std::unordered_map<int, std::vector<double> > TransformationWeightMap;54 typedef std::unordered_map<int, std::vector<int> > TransformationPositionMap;55 56 public:57 //CGenericAlgorithmTransformation();58 CGenericAlgorithmTransformation(bool isSource);59 60 virtual ~CGenericAlgorithmTransformation() {}61 62 bool isDistributedTransformation(int elementPositionInGrid, CGrid* gridSrc, CGrid* gridDst) ;63 64 void computeGlobalSourceIndex(int elementPositionInGrid,65 CGrid* gridSrc,66 CGrid* gridDst,67 SourceDestinationIndexMap& globaIndexWeightFromSrcToDst);68 69 /*!70 Apply a operation on local data.71 \param [in] localIndex vector contains local index of local data output and the corresponding weight72 \param [in] dataInput Pointer to the first element of data input array (in form of buffer)73 \param [in/out] dataOut Array contains local data74 \param [in/out] flagInitial vector of boolean to mark the local index already initialized. True means there is a need for initalization75 \param [in] ignoreMissingValue don't count missing value in operation if this flag is true76 \param [in] firstPass indicate if it is the first time the apply funtion is called for a same transformation, in order to make a clean initialization77 */78 virtual void apply(const std::vector<std::pair<int,double> >& localIndex,79 const double* dataInput,80 CArray<double,1>& dataOut,81 std::vector<bool>& flagInitial,82 bool ignoreMissingValue, bool firstPass);83 84 /*!85 * Update whole dataOut (on necessary).86 * (Example: Impose a weight, whose value is only known after being applied an operation, on dataOut)87 * \param [in/out] dataOut dataOut88 */89 virtual void updateData(CArray<double,1>& dataOut);90 91 std::vector<StdString> getIdAuxInputs();92 AlgoTransType type();93 /*!94 Compute global index mapping from one element of destination grid to the corresponding element of source grid95 */96 void computeIndexSourceMapping(const std::vector<CArray<double,1>* >& dataAuxInputs = std::vector<CArray<double,1>* >());97 void computeTransformationMappingNonDistributed(int elementPositionInGrid, CGrid* gridSrc, CGrid* gridDst,98 vector<int>& localSrc, vector<int>& localDst, vector<double>& weight, int& nbLocalIndexOnGridDest);99 void nonDistributedrecursiveFunct(int currentPos, bool masked, int elementPositionInGrid, vector< CArray<bool,1>* >& maskSrc, vector< CArray<bool,1>* >& maskDst,100 int& srcInd, int& srcIndCompressed, vector<int>& nIndexSrc,101 int& t, vector<vector<vector<pair<int,double> > > >& dstIndWeight, int currentInd,102 vector<int>& localSrc, vector<int>& localDst, vector<double>& weight) ;103 104 protected:105 virtual void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >&) {};106 107 /*!108 Compute proc which contains global index of an element109 \param[in] globalElementIndex demanding global index of an element of source grid110 \param[in] elementType type of source element, 2: domain, 1: axis and 0: scalar111 \param[out] globalElementIndexOnProc Proc contains the demanding global index112 */113 virtual void computeExchangeGlobalIndex(const CArray<size_t,1>& globalElementIndex,114 int elementType,115 CClientClientDHTInt::Index2VectorInfoTypeMap& globalElementIndexOnProc){};116 117 protected:118 void computeGlobalGridIndexMapping(int elementPositionInGrid,119 const std::vector<int>& srcRank,120 std::unordered_map<int, std::vector<std::pair<int,double> > >& src2DstMap,121 CGrid* gridDst,122 CGrid* gridSrc,123 std::vector<std::unordered_map<int,std::vector<size_t> > >& globalElementIndexOnProc,124 SourceDestinationIndexMap& globaIndexWeightFromSrcToDst);125 126 void computeExchangeDomainIndex(CDomain* domainDst,127 CDomain* domainSrc,128 CArray<size_t,1>& destGlobalIndexPositionInGrid,129 std::unordered_map<int,std::vector<size_t> >& globalDomainIndexOnProc);130 131 void computeExchangeAxisIndex(CAxis* axisDst,132 CAxis* axisSrc,133 CArray<size_t,1>& destGlobalIndexPositionInGrid,134 std::unordered_map<int,std::vector<size_t> >& globalAxisIndexOnProc);135 136 void computeExchangeScalarIndex(CScalar* scalarDst,137 CScalar* scalarSrc,138 CArray<size_t,1>& destGlobalIndexPositionInGrid,139 std::unordered_map<int,std::vector<size_t> >& globalScalarIndexOnProc);140 141 void computePositionElements(CGrid* dst, CGrid* src);142 143 protected:144 //! indicate if the transformation is performed on a distributed element145 bool isDistributed_ ;146 //! indicate if the method isDistributedTransformation has been called before147 bool isDistributedComputed_ ;148 149 //! Map between global index of destination element and source element150 std::vector<TransformationIndexMap> transformationMapping_;151 //! Weight corresponding of source to destination152 std::vector<TransformationWeightMap> transformationWeight_;153 //! Map of global index of destination element and corresponding global index of other elements in the same grid154 //! By default, one index of an element corresponds to all index of remaining element in the grid. So it's empty155 std::vector<TransformationPositionMap> transformationPosition_;156 157 //! Id of auxillary inputs which helps doing transformation dynamically158 std::vector<StdString> idAuxInputs_;159 AlgoTransType type_;160 161 std::set<StdSize> indexElementSrc_;162 163 std::vector<std::unordered_map<int,std::vector<size_t> > > globalElementIndexOnProc_;164 165 std::vector<int> procContainSrcElementIdx_; // List of processes containing source index of transformed elements166 // std::set<int> procOfNonTransformedElements_; // Processes contain the source index of non-transformed elements167 std::set<int> commonProc_;168 std::vector< set<int> > procElementList_ ; // List of processes containing source index of elements169 170 CClientClientDHTInt::Index2VectorInfoTypeMap globalIndexOfTransformedElementOnProc_;171 172 bool computedProcSrcNonTransformedElement_; // Flag to indicate whether we computed proc containing non transformed elements173 174 std::map<int, int> elementPositionInGridSrc2AxisPosition_, elementPositionInGridSrc2DomainPosition_, elementPositionInGridSrc2ScalarPosition_;175 std::map<int, int> elementPositionInGridDst2AxisPosition_, elementPositionInGridDst2DomainPosition_, elementPositionInGridDst2ScalarPosition_;176 177 bool eliminateRedondantSrc_ ; // flag to indicate if the transformation must select only one global source point for all proc.178 // In this case it will choose preferentially the current process179 bool isSource_ ; //flag to indicate that the algorithm is a source algorithm, that mean the grid is modified or generated but180 // no fluxes are tranformed181 182 // new methods for new algorithm183 184 36 public : 185 37 CGenericAlgorithmTransformation(bool isSource) ; 186 38 virtual CGridAlgorithm* createGridAlgorithm(CGrid* gridSrc, CGrid* newGrid, int pos) ; 187 39 virtual CTransformFilter* createTransformFilter(CGarbageCollector& gc, CGridAlgorithm* algo, bool detectMissingValues, double defaultValue) ; 188 virtual void apply(int dimBefore, int dimAfter, const CArray<double,1>& dataIn, CArray<double,1>& dataOut); // transform into pure virtual function later 40 virtual void apply(int dimBefore, int dimAfter, const CArray<double,1>& dataIn, CArray<double,1>& dataOut) { abort() ;} //=0 41 virtual void apply(int dimBefore, int dimAfter, const CArray<double,1>& dataIn, const vector<CArray<double,1>>& auxData, CArray<double,1>& dataOut) { abort() ;} //=0 42 43 virtual vector<string> getAuxFieldId(void) ; 189 44 protected : 45 typedef std::unordered_map<int, std::vector<int> > TransformationIndexMap; 46 typedef std::unordered_map<int, std::vector<double> > TransformationWeightMap; 47 48 CLocalElement* recvElement_=nullptr ; 49 bool isSource_ ; 190 50 191 CLocalElement* recvElement_=nullptr ;192 51 public: 193 52 CLocalElement* getRecvElement(void) { return recvElement_ ;} -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/grid_algorithm.hpp
r2007 r2011 24 24 CGridAlgorithm(CGenericAlgorithmTransformation* algorithm) : algorithm_(algorithm) {} ; 25 25 virtual ~CGridAlgorithm() {} ; 26 virtual void apply(const CArray<double,1>& dataIn, CArray<double,1>& dataOut)=0 ; 26 virtual void apply(const CArray<double,1>& dataIn, CArray<double,1>& dataOut) { abort(); } //=0 27 virtual void apply(const CArray<double,1>& dataIn, const vector<CArray<double,1>>& auxData, CArray<double,1>& dataOut) { abort(); } //=0 27 28 virtual CTransformFilter* createTransformFilter(CGarbageCollector& gc, bool detectMissingValues, double defaultValue) ; 28 29 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/grid_algorithm_generic.cpp
r2007 r2011 58 58 } 59 59 60 60 void CGridAlgorithmGeneric::apply(const CArray<double,1>& dataIn, const vector<CArray<double,1>>& auxData, CArray<double,1>& dataOut) 61 { 62 CArray<double,1> dataOutTmp ; 63 vector<CArray<double,1>> auxDataOutTmp(auxData.size()) ; 64 65 gridTransformConnector_->transfer(dataIn, dataOutTmp) ; 66 for (int i=0; i<auxData.size();i++) gridTransformConnector_->transfer(auxData[i], auxDataOutTmp[i]) ; 67 68 algorithm_->apply(dimBefore_, dimAfter_, dataOutTmp, auxDataOutTmp, dataOut) ; 69 } 70 61 71 62 72 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/grid_algorithm_generic.hpp
r2007 r2011 28 28 void computeAlgorithm(void) ; 29 29 virtual void apply(const CArray<double,1>& dataIn, CArray<double,1>& dataOut) ; 30 30 virtual void apply(const CArray<double,1>& dataIn, const vector<CArray<double,1>>& auxData, CArray<double,1>& dataOut) ; 31 31 32 protected: 32 33 CGridTransformConnector* gridTransformConnector_=nullptr ; -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/scalar_algorithm/scalar_algorithm_extract_axis.hpp
r1999 r2011 37 37 int pos_; 38 38 39 p rivate:39 public: 40 40 static CGenericAlgorithmTransformation* create(bool isSource, CGrid* gridDst, CGrid* gridSrc, 41 41 CTransformation<CScalar>* transformation, -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/scalar_algorithm/scalar_algorithm_reduce_axis.hpp
r1999 r2011 34 34 static bool registerTrans(); 35 35 36 private:37 36 37 public: 38 38 static CGenericAlgorithmTransformation* create(bool isSource, CGrid* gridDst, CGrid* gridSrc, 39 39 CTransformation<CScalar>* transformation, -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/scalar_algorithm/scalar_algorithm_reduce_domain.hpp
r1999 r2011 36 36 CDomain* domainSrc_ ; 37 37 38 private:39 38 39 public: 40 40 static CGenericAlgorithmTransformation* create(bool isSource, CGrid* gridDst, CGrid* gridSrc, 41 41 CTransformation<CScalar>* transformation, -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/scalar_algorithm/scalar_algorithm_reduce_scalar.cpp
r1988 r2011 44 44 45 45 CScalarAlgorithmReduceScalar::CScalarAlgorithmReduceScalar(bool isSource, CScalar* scalarDestination, CScalar* scalarSource, CReduceScalarToScalar* algo) 46 : C ScalarAlgorithmTransformation(isSource, scalarDestination, scalarSource), reduction_(0)46 : CAlgorithmTransformationReduce(isSource) 47 47 TRY 48 48 { … … 57 57 { 58 58 case CReduceScalarToScalar::operation_attr::sum: 59 op = "sum";59 operator_ = EReduction::sum; 60 60 break; 61 61 case CReduceScalarToScalar::operation_attr::min: 62 op = "min";62 operator_ = EReduction::min; 63 63 break; 64 64 case CReduceScalarToScalar::operation_attr::max: 65 op = "max";65 operator_ = EReduction::max; 66 66 break; 67 67 case CReduceScalarToScalar::operation_attr::average: 68 op = "average";68 operator_ = EReduction::average; 69 69 break; 70 70 default: … … 75 75 76 76 } 77 78 if (CReductionAlgorithm::ReductionOperations.end() == CReductionAlgorithm::ReductionOperations.find(op)) 79 ERROR("CScalarAlgorithmReduceScalar::CScalarAlgorithmReduceScalar(CScalar* scalarDestination, CScalar* scalarSource, CReduceScalarToScalar* algo)", 80 << "Operation '" << op << "' not found. Please make sure to use a supported one" 81 << "Scalar source " <<scalarSource->getId() << std::endl 82 << "Scalar destination " << scalarDestination->getId()); 77 transformationMapping_[0].push_back(0) ; 83 78 84 reduction_ = CReductionAlgorithm::createOperation(CReductionAlgorithm::ReductionOperations[op]); 85 } 86 CATCH 87 88 void CScalarAlgorithmReduceScalar::apply(const std::vector<std::pair<int,double> >& localIndex, const double* dataInput, CArray<double,1>& dataOut, 89 std::vector<bool>& flagInitial, bool ignoreMissingValue, bool firstPass) 90 TRY 91 { 92 reduction_->apply(localIndex, dataInput, dataOut, flagInitial, ignoreMissingValue, firstPass); 93 } 94 CATCH 95 96 void CScalarAlgorithmReduceScalar::updateData(CArray<double,1>& dataOut) 97 TRY 98 { 99 reduction_->updateData(dataOut); 79 scalarDestination->checkAttributes() ; 80 this->computeAlgorithm(scalarSource->getLocalView(CElementView::WORKFLOW), scalarDestination->getLocalView(CElementView::WORKFLOW)) ; 100 81 } 101 82 CATCH … … 104 85 TRY 105 86 { 106 if (0 != reduction_) delete reduction_;107 87 } 108 88 CATCH 109 89 110 void CScalarAlgorithmReduceScalar::computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs)111 TRY112 {113 this->transformationMapping_.resize(1);114 this->transformationWeight_.resize(1);115 116 TransformationIndexMap& transMap = this->transformationMapping_[0];117 TransformationWeightMap& transWeight = this->transformationWeight_[0];118 119 transMap[0].push_back(0);120 transWeight[0].push_back(1.0);121 90 122 91 } 123 CATCH124 125 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/scalar_algorithm/scalar_algorithm_reduce_scalar.hpp
r1988 r2011 6 6 #define __XIOS_SCALAR_ALGORITHM_REDUCE_SCALAR_HPP__ 7 7 8 #include " scalar_algorithm_transformation.hpp"8 #include "algorithm_transformation_reduce.hpp" 9 9 #include "transformation.hpp" 10 10 … … 19 19 Reducing an scalar to a scalar 20 20 */ 21 class CScalarAlgorithmReduceScalar : public C ScalarAlgorithmTransformation21 class CScalarAlgorithmReduceScalar : public CAlgorithmTransformationReduce 22 22 { 23 23 public: 24 24 CScalarAlgorithmReduceScalar(bool isSource, CScalar* scalarDestination, CScalar* scalarSource, CReduceScalarToScalar* algo); 25 25 26 virtual void apply(const std::vector<std::pair<int,double> >& localIndex,27 const double* dataInput,28 CArray<double,1>& dataOut,29 std::vector<bool>& flagInitial,30 bool ignoreMissingValue, bool firstPass);31 32 virtual void updateData(CArray<double,1>& dataOut);33 34 26 virtual ~CScalarAlgorithmReduceScalar(); 35 27 36 28 static bool registerTrans(); 37 29 protected: 38 void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs);30 39 31 40 protected: 41 CReductionAlgorithm* reduction_; 42 43 private: 44 32 public: 45 33 static CGenericAlgorithmTransformation* create(bool isSource, CGrid* gridDst, CGrid* gridSrc, 46 34 CTransformation<CScalar>* transformation, -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/transformation.hpp
r1984 r2011 13 13 This class describes inverse_axis in xml file. 14 14 */ 15 class CGenericAlgorithmTransformation; 16 class CGrid; 17 15 18 template<typename T> 16 19 class CTransformation … … 36 39 virtual const string& getName(void) { ERROR("string Transformation<T>::getId())",<< "unimplemented virtual function for child"); } ; 37 40 virtual const string& getDefName(void) { ERROR("string Transformation<T>::getId())",<< "unimplemented virtual function for child"); } ; 41 virtual CGenericAlgorithmTransformation* createAlgorithm(bool isSource, 42 CGrid* gridDst, CGrid* gridSrc, 43 int elementPositionInGrid, 44 std::map<int, int>& elementPositionInGridSrc2ScalarPosition, 45 std::map<int, int>& elementPositionInGridSrc2AxisPosition, 46 std::map<int, int>& elementPositionInGridSrc2DomainPosition, 47 std::map<int, int>& elementPositionInGridDst2ScalarPosition, 48 std::map<int, int>& elementPositionInGridDst2AxisPosition, 49 std::map<int, int>& elementPositionInGridDst2DomainPosition) =0 ; 50 38 51 /// Destructeur /// 39 52 public:
Note: See TracChangeset
for help on using the changeset viewer.