- Timestamp:
- 12/06/20 22:14:56 (4 years ago)
- Location:
- XIOS/dev/dev_ym/XIOS_COUPLING/src
- Files:
-
- 16 added
- 48 deleted
- 63 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_ym/XIOS_COUPLING/src/declare_ref_func.hpp
r1361 r1984 51 51 SuperClassAttribute::setAttributes(refer_ptr, apply); \ 52 52 } \ 53 if (this->hasAttribute("name") && this->name.isEmpty()) \54 this->name.setValue(this->get##type##OutputName()); \55 53 } \ 56 54 \ -
XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/gatherer_connector.hpp
r1930 r1984 29 29 30 30 template<typename T> 31 void transfer(int sizeT, map<int, CArray<T,1>>& dataIn, CArray<T,1>& dataOut)31 void transfer(int repeat, int sizeT, map<int, CArray<T,1>>& dataIn, CArray<T,1>& dataOut) 32 32 { 33 33 // for future, make a specific transfer function for sizeT=1 to avoid multiplication (increasing performance) 34 dataOut.resize(dstSize_*sizeT) ; 35 T* output = dataOut.dataFirst() ; 34 size_t dstSlice = dstSize_*sizeT ; 35 dataOut.resize(repeat* dstSlice) ; 36 36 37 for(auto& data : dataIn) 37 38 { 39 T* output = dataOut.dataFirst() ; 38 40 int rank=data.first ; 39 41 auto input = data.second.dataFirst() ; … … 41 43 auto& mask=mask_[rank] ; 42 44 int size=mask.size() ; 43 44 for(int i=0, j=0 ;i<size;i++)45 { 46 if (mask[i])45 size_t srcSlice = size * sizeT ; 46 for(int l=0; l<repeat; l++) 47 { 48 for(int i=0, j=0 ;i<size;i++) 47 49 { 48 int cj = connector[j]*sizeT ; 49 int ci = i*sizeT ; 50 for (int k=0;k<sizeT;k++) output[cj+k] = input[ci+k] ; 51 j++ ; 50 if (mask[i]) 51 { 52 int cj = connector[j]*sizeT ; 53 int ci = i*sizeT ; 54 for (int k=0;k<sizeT;k++) output[cj+k] = input[ci+k] ; 55 j++ ; 56 } 52 57 } 58 input+=srcSlice ; 59 output+=dstSlice ; 53 60 } 54 61 } 62 } 63 64 template<typename T> 65 void transfer(int sizeT, map<int, CArray<T,1>>& dataIn, CArray<T,1>& dataOut) 66 { 67 transfer(1, 1, dataIn, dataOut) ; 55 68 } 56 69 … … 101 114 void transfer(map<int, CArray<T,1>>& dataIn, CArray<T,1>& dataOut, T missingValue) 102 115 { 103 transfer(1, dataIn, dataout, missingValue)116 transfer(1, 1, dataIn, dataout, missingValue) 104 117 } 105 118 … … 107 120 void transfer(int sizeT, map<int, CArray<T,1>>& dataIn, CArray<T,1>& dataOut, T missingValue) 108 121 { 109 dataOut.resize(dstSize_*sizeT) ; 122 transfer(1, sizeT, dataIn, dataOut, missingValue) ; 123 } 124 125 template<typename T> 126 void transfer(int repeat , int sizeT, map<int, CArray<T,1>>& dataIn, CArray<T,1>& dataOut, T missingValue) 127 { 128 dataOut.resize(repeat*dstSize_*sizeT) ; 110 129 dataOut=missingValue ; 111 transfer( sizeT, dataIn, dataOut) ;130 transfer(1, sizeT, dataIn, dataOut) ; 112 131 } 113 132 … … 121 140 (*subEvent.buffer) >> data ; 122 141 } 123 transfer( sizeT, dataIn, dataOut) ;142 transfer(1, sizeT, dataIn, dataOut) ; 124 143 } 125 144 … … 139 158 (*subEvent.buffer) >> data ; 140 159 } 141 transfer( sizeT, dataIn, dataOut, missingValue) ;160 transfer(1, sizeT, dataIn, dataOut, missingValue) ; 142 161 } 143 162 … … 151 170 (*subEvent.buffer) >> data ; 152 171 } 153 transfer(1, dataIn, dataOut, missingValue) ;172 transfer(1, 1, dataIn, dataOut, missingValue) ; 154 173 } 155 174 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/grid_remote_connector.cpp
r1938 r1984 87 87 srcView_[nSrc-1]->getGlobalIndex(srcGlobalIndex, sliceIndex, srcSliceSize.data(), srcView_.data(), nSrc-1) ; 88 88 89 CArray<size_t,1> srcGlobalIndexArray(srcGlobalIndex.data(), shape(srcGlobalIndex.size()),neverDeleteData) ; 90 dataRanks.computeIndexInfoMapping(srcGlobalIndexArray) ; 89 if (srcGlobalIndex.size()>0) 90 { 91 CArray<size_t,1> srcGlobalIndexArray(srcGlobalIndex.data(), shape(srcGlobalIndex.size()),neverDeleteData) ; 92 dataRanks.computeIndexInfoMapping(srcGlobalIndexArray) ; 93 } 94 else 95 { 96 CArray<size_t,1> srcGlobalIndexArray ; 97 dataRanks.computeIndexInfoMapping(srcGlobalIndexArray) ; 98 } 91 99 const auto& returnInfo = dataRanks.getInfoIndexMap() ; 92 100 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/scatterer_connector.hpp
r1943 r1984 38 38 void transfer(const CArray<T,n>& dataIn, map<int, CArray<T,1>>& dataOut) 39 39 { 40 transfer(1, dataIn, dataOut) ;40 transfer(1,1, dataIn, dataOut) ; 41 41 } 42 42 … … 44 44 void transfer(const CArray<T,n>& dataIn, map<int, CArray<T,1>>& dataOut, T missingValue) 45 45 { 46 transfer(1, dataIn, dataOut, missingValue) ;46 transfer(1, 1, dataIn, dataOut, missingValue) ; 47 47 } 48 48 … … 50 50 void transfer(int sizeT, const CArray<T,n>& dataIn, map<int, CArray<T,1>>& dataOut) 51 51 { 52 transfer(1, sizeT, dataIn, dataOut) 53 } 54 55 template<typename T, int n> 56 void transfer(int repeat, int sizeT, const CArray<T,n>& dataIn, map<int, CArray<T,1>>& dataOut) 57 { 52 58 // for future, make a specific transfer function for sizeT=1 to avoid multiplication (increasing performance) 59 size_t srcSlice = sizeT*srcSize_ ; 53 60 for(auto& rankConnector : connector_) 54 61 { … … 58 65 int dstSize = mask.size() ; 59 66 auto& data = dataOut[rank] ; 60 data.resize(dstSize * sizeT) ; 67 size_t dstSlice = dstSize*sizeT ; 68 data.resize(repeat*dstSlice) ; 61 69 T* dstData = data.dataFirst() ; 62 70 const T* srcData = dataIn.dataFirst() ; 63 for(int i=0, j=0; i<dstSize; i++) 64 if (mask[i]) 65 { 66 for(int k=0;k<sizeT;k++) dstData[i*sizeT+k] = srcData[connector[j]*sizeT+k] ; 67 j++ ; 68 } 69 } 70 } 71 72 template<typename T, int n> 73 void transfer(int sizeT, const CArray<T,n>& dataIn, map<int, CArray<T,1>>& dataOut, T missingValue) 71 for(int l=0; l<repeat; l++) 72 { 73 for(int i=0, j=0; i<dstSize; i++) 74 if (mask[i]) 75 { 76 for(int k=0;k<sizeT;k++) dstData[i*sizeT+k] = srcData[connector[j]*sizeT+k] ; 77 j++ ; 78 } 79 dstData+=dstSlice ; 80 srcData+=srcSlice ; 81 } 82 } 83 } 84 85 template<typename T, int n> 86 void transfer(int repeat, int sizeT, const CArray<T,n>& dataIn, map<int, CArray<T,1>>& dataOut, T missingValue) 74 87 { 75 88 // for future, make a specific transfer function for sizeT=1 to avoid multiplication (increasing performance) 89 size_t srcSlice = sizeT*srcSize_ ; 76 90 for(auto& rankConnector : connector_) 77 91 { … … 81 95 int dstSize = mask.size() ; 82 96 auto& data = dataOut[rank] ; 83 data.resize(dstSize * sizeT) ; 97 size_t dstSlice = dstSize*sizeT ; 98 data.resize(repeat * dstSlice) ; 84 99 T* dstData = data.dataFirst() ; 85 100 const T* srcData = dataIn.dataFirst() ; 86 for(int i=0, j=0; i<dstSize; i++) 87 if (mask[i]) 88 { 89 for(int k=0;k<sizeT;k++) dstData[i*sizeT+k] = srcData[connector[j]*sizeT+k] ; 90 j++ ; 91 } 92 else 93 { 94 for(int k=0;k<sizeT;k++) dstData[i*sizeT+k] = missingValue ; 95 j++ ; 96 } 101 for(int l=0; l<repeat; l++) 102 { 103 for(int i=0, j=0; i<dstSize; i++) 104 if (mask[i]) 105 { 106 for(int k=0;k<sizeT;k++) dstData[i*sizeT+k] = srcData[connector[j]*sizeT+k] ; 107 j++ ; 108 } 109 else 110 { 111 for(int k=0;k<sizeT;k++) dstData[i*sizeT+k] = missingValue ; 112 j++ ; 113 } 114 dstData+=dstSlice ; 115 srcData+=srcSlice ; 116 } 97 117 } 98 118 } … … 101 121 void transfer(const CArray<T,n>& dataIn, CContextClient* client, CEventClient& event, const CMessage& messageHeader) 102 122 { 103 transfer( 1, dataIn, client, event, messageHeader) ;123 transfer( 1, dataIn, client, event, messageHeader) ; 104 124 } 105 125 … … 107 127 void transfer(const CArray<T,n>& dataIn, T missingValue, CContextClient* client, CEventClient& event, const CMessage& messageHeader) 108 128 { 109 transfer( 1, dataIn, missingValue, client, event, messageHeader) ;129 transfer( 1, dataIn, missingValue, client, event, messageHeader) ; 110 130 } 111 131 … … 114 134 { 115 135 map<int, CArray<T,1>> dataOut ; 116 transfer( sizeT, dataIn, dataOut) ;136 transfer(1, sizeT, dataIn, dataOut) ; 117 137 sendToServer(dataOut, client, event, messageHeader) ; 118 138 } … … 122 142 { 123 143 map<int, CArray<T,1>> dataOut ; 124 transfer( sizeT, dataIn, dataOut, missingValue) ;144 transfer(1, sizeT, dataIn, dataOut, missingValue) ; 125 145 sendToServer(dataOut, client, event, messageHeader) ; 126 146 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/filter/client_to_server_store_filter.cpp
r1935 r1984 25 25 CMessage message ; 26 26 message<<field_->getId() << data[0]->timestamp ; 27 field_->get Grid()->getClientToServerConnector(client_)->transfer(data[0]->data, client_, event, message) ;27 field_->getSentGrid()->getClientToServerConnector(client_)->transfer(data[0]->data, client_, event, message) ; 28 28 CTimer::get("Field : send data").suspend(); 29 29 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/mpi_tools.cpp
r1759 r1984 26 26 return ret ; 27 27 } 28 28 29 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/mpi_tools.hpp
r1759 r1984 1 1 #ifndef __XIOS_MPI_TOOLS_HPP__ 2 #define __XIOS_MPI_TOOLS_HPP__ 2 3 3 4 #include <string> … … 7 8 8 9 int MPI_Bcast_string(std::string& str, int root, MPI_Comm comm) ; 10 11 template<typename T> 12 MPI_Datatype MPI_GetType(void) ; 13 14 template<> 15 MPI_Datatype MPI_GetType<char>(void) { return MPI_CHAR ;} 16 17 template<> 18 MPI_Datatype MPI_GetType<short int>(void) { return MPI_SHORT ;} 19 20 template<> 21 MPI_Datatype MPI_GetType<int>(void) { return MPI_INT ;} 22 23 template<> 24 MPI_Datatype MPI_GetType<size_t>(void) { return MPI_SIZE_T ;} 25 26 template<> 27 MPI_Datatype MPI_GetType<float>(void) { return MPI_FLOAT ;} 28 29 template<> 30 MPI_Datatype MPI_GetType<double>(void) { return MPI_DOUBLE ;} 31 32 template<> 33 MPI_Datatype MPI_GetType<long double>(void) { return MPI_LONG_DOUBLE ;} 34 35 9 36 } 10 37 #endif -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/axis.cpp
r1975 r1984 555 555 * Go through the hierarchy to find the axis from which the transformations must be inherited 556 556 */ 557 void CAxis::solveInheritanceTransformation ()557 void CAxis::solveInheritanceTransformation_old() 558 558 TRY 559 559 { … … 572 572 for (size_t i = 0; i < refAxis.size(); ++i) 573 573 refAxis[i]->setTransformations(axis->getAllTransformations()); 574 } 575 CATCH_DUMP_ATTR 576 577 void CAxis::solveInheritanceTransformation() 578 TRY 579 { 580 if (solveInheritanceTransformation_done_) return; 581 else solveInheritanceTransformation_done_=true ; 582 583 CAxis* axis = this; 584 std::list<CAxis*> refAxis; 585 bool out=false ; 586 vector<StdString> excludedAttr; 587 excludedAttr.push_back("axis_ref"); 588 589 refAxis.push_front(axis) ; 590 while (axis->hasDirectAxisReference() && !out) 591 { 592 CAxis* lastAxis=axis ; 593 axis = axis->getDirectAxisReference(); 594 axis->solveRefInheritance() ; 595 if (!axis->SuperClass::isEqual(lastAxis,excludedAttr)) out=true ; 596 refAxis.push_front(axis) ; 597 } 598 599 CTransformationPaths::TPath path ; 600 auto& pathList = std::get<2>(path) ; 601 std::get<0>(path) = EElement::AXIS ; 602 std::get<1>(path) = refAxis.front()->getId() ; 603 for (auto& axis : refAxis) 604 { 605 CAxis::TransMapTypes transformations = axis->getAllTransformations(); 606 for(auto& transformation : transformations) pathList.push_back({transformation.second->getTransformationType(), 607 transformation.second->getId()}) ; 608 } 609 transformationPaths_.addPath(path) ; 610 574 611 } 575 612 CATCH_DUMP_ATTR -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/axis.hpp
r1975 r1984 16 16 #include "transformation.hpp" 17 17 #include "transformation_enum.hpp" 18 #include "transformation_path.hpp" 18 19 #include "element.hpp" 19 20 #include "local_connector.hpp" … … 21 22 #include "gatherer_connector.hpp" 22 23 #include "distribution_type.hpp" 23 24 25 namespace xios { 24 #include "generic_algorithm_transformation.hpp" 25 26 27 namespace xios 28 { 26 29 /// ////////////////////// Déclarations ////////////////////// /// 27 30 … … 57 60 typedef CAxisAttributes RelAttributes; 58 61 typedef CAxisGroup RelGroup; 59 typedef CTransformation<CAxis>::TransformationMapTypes TransMapTypes;60 62 61 63 public: … … 79 81 bool isDistributed(void) const; 80 82 81 83 public: 82 84 /*! 83 85 \brief return if the axis can be written or not in a compressed way. … … 86 88 */ 87 89 bool isCompressible(void) { if (!isCompressibleComputed_) computeIsCompressible() ; return isCompressible_ ;} 88 90 private: 89 91 bool isCompressible_ ; /** specify if the domain can be written in a compressed way */ 90 92 bool isCompressibleComputed_=false ; /** Indicate if compressability has been computed*/ 91 93 void computeIsCompressible() ; 92 94 93 95 public: 94 96 95 97 /// Mutateur /// … … 119 121 size_t getGlobalWrittenSize(void) ; 120 122 121 bool hasTransformation(); 122 void solveInheritanceTransformation(); 123 TransMapTypes getAllTransformations(); 124 void duplicateTransformation(CAxis*); 125 CTransformation<CAxis>* addTransformation(ETranformationType transType, const StdString& id=""); 123 ////////////////////////// 124 ///// transformations //// 125 ////////////////////////// 126 public: 127 typedef CTransformation<CAxis>::TransformationMapTypes TransMapTypes; 128 private: 129 static bool initializeTransformationMap(std::map<StdString, ETranformationType>& m); 130 static std::map<StdString, ETranformationType> transformationMapList_; 131 static bool dummyTransformationMapList_; 132 TransMapTypes transformationMap_; 133 134 public: 135 CTransformation<CAxis>* addTransformation(ETranformationType transType, const StdString& id=""); 136 CTransformation<CAxis>* addTransformation(ETranformationType transType, CTransformation<CAxis>* transformation) ; 137 void setTransformations(const TransMapTypes&); 138 void duplicateTransformation(CAxis*); 139 TransMapTypes getAllTransformations(); 140 bool hasTransformation(); 141 void solveInheritanceTransformation_old(); // to remove later 142 void solveInheritanceTransformation(); 143 private: 144 bool solveInheritanceTransformation_done_= false ; 145 private: 146 CGenericAlgorithmTransformation* transformationAlgorithm_ = nullptr ; 147 public: 148 void setTransformationAlgorithm(CGenericAlgorithmTransformation* transformationAlgorithm) { transformationAlgorithm=transformationAlgorithm ;} 149 CGenericAlgorithmTransformation* getTransformationAlgorithm(void) { return transformationAlgorithm_ ;} 150 private: 151 CTransformationPaths transformationPaths_ ; 152 public: 153 CTransformationPaths getTransformationPaths(void) {return transformationPaths_;} 154 void setTransformationPaths(const CTransformationPaths& transformationPaths) { transformationPaths_=transformationPaths ;} 155 156 //////////////////////////// 126 157 bool isEqual(CAxis* axis); 127 158 … … 131 162 bool hasLabel; 132 163 133 164 private: 134 165 void checkData(); 135 166 void checkMask(); … … 145 176 void makeAliasForCoupling(const string& fieldId, int posInGrid) ; 146 177 147 private:148 void setTransformations(const TransMapTypes&);149 178 150 179 private: … … 177 206 bool isChecked; 178 207 std::set<StdString> relFiles, relFilesCompressed; 179 TransMapTypes transformationMap_; 180 181 std::map<int, std::unordered_map<int, vector<size_t> > > indSrv_; // Global index of each client sent to server 208 std::map<int, std::unordered_map<int, vector<size_t> > > indSrv_; // Global index of each client sent to server 182 209 std::map<int, std::vector<int> > connectedServerRank_; 183 184 private:185 static bool initializeTransformationMap(std::map<StdString, ETranformationType>& m);186 static std::map<StdString, ETranformationType> transformationMapList_;187 static bool dummyTransformationMapList_;188 189 210 190 211 ////////////////////////////////////////////////////////////////////////////////////// -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/compute_connectivity_domain.cpp
r944 r1984 27 27 bool CComputeConnectivityDomain::registerTrans() 28 28 { 29 registerTransformation(TRANS_COMPUTE_CONNECTIVITY_DOMAIN, CComputeConnectivityDomain::create);29 registerTransformation(TRANS_COMPUTE_CONNECTIVITY_DOMAIN, {create, getTransformation}); 30 30 } 31 31 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/compute_connectivity_domain.hpp
r934 r1984 41 41 typedef CObjectTemplate<CComputeConnectivityDomain> SuperClass; 42 42 typedef CComputeConnectivityDomainAttributes SuperClassAttribute; 43 typedef CComputeConnectivityDomain MyClass ; 44 typedef CTransformation<CDomain> SuperTransform ; 43 45 44 46 public : … … 56 58 static StdString GetDefName(void); 57 59 static ENodeType GetType(void); 60 const string& getId(void) { return this->SuperClass::getId();} 61 ETranformationType getTransformationType(void) { return TRANS_COMPUTE_CONNECTIVITY_DOMAIN ;} 62 static CTransformation<CDomain>* getTransformation(const StdString& id) { return SuperClass::get(id);} 63 virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} 58 64 private: 59 65 static bool registerTrans(); 60 66 static CTransformation<CDomain>* create(const StdString& id, xml::CXMLNode* node); 61 67 static bool _dummyRegistered; 62 }; // class CComputeConnectivityDomain 68 public: 69 }; // class CComputeConnectivityDomain 63 70 64 71 DECLARE_GROUP(CComputeConnectivityDomain); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/context.cpp
r1974 r1984 1302 1302 CATCH_DUMP_ATTR 1303 1303 1304 void CContext::buildFilterGraphOfEnabledFields()1305 TRY1306 {1307 int size = this->enabledFiles.size();1308 for (int i = 0; i < size; ++i)1309 {1310 this->enabledFiles[i]->buildFilterGraphOfEnabledFields(garbageCollector);1311 }1312 1313 size = this->enabledCouplerOut.size();1314 for (int i = 0; i < size; ++i)1315 {1316 this->enabledCouplerOut[i]->buildFilterGraphOfEnabledFields(garbageCollector);1317 }1318 }1319 CATCH_DUMP_ATTR1320 1304 1321 1305 void CContext::postProcessFilterGraph() … … 1380 1364 CATCH_DUMP_ATTR 1381 1365 1382 void CContext::solveAllRefOfFieldsWithReadAccess() 1383 TRY 1384 { 1385 for (size_t i = 0; i < fieldsWithReadAccess_.size(); ++i) 1386 fieldsWithReadAccess_[i]->solveAllReferenceEnabledField(false); 1387 } 1388 CATCH_DUMP_ATTR 1389 1390 void CContext::buildFilterGraphOfFieldsWithReadAccess() 1391 TRY 1392 { 1393 for (size_t i = 0; i < fieldsWithReadAccess_.size(); ++i) 1394 fieldsWithReadAccess_[i]->buildFilterGraph(garbageCollector, true); 1395 } 1396 CATCH_DUMP_ATTR 1397 1366 1398 1367 void CContext::solveAllInheritance(bool apply) 1399 1368 TRY -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/context.hpp
r1974 r1984 139 139 void prepareTimeseries(void); 140 140 void solveOnlyRefOfEnabledFields(void); 141 void buildFilterGraphOfEnabledFields();142 141 void postProcessFilterGraph(); 143 142 void startPrefetchingOfEnabledReadModeFiles(); … … 145 144 void doPostTimestepOperationsForEnabledReadModeFiles(); 146 145 void findFieldsWithReadAccess(void); 147 void solveAllRefOfFieldsWithReadAccess();148 void buildFilterGraphOfFieldsWithReadAccess();149 146 void triggerLateFields(void) ; 150 147 void solveAllRefOfEnabledFieldsAndTransform(void); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/domain.cpp
r1974 r1984 1 1 #include "domain.hpp" 2 3 2 #include "attribute_template.hpp" 4 3 #include "object_template.hpp" … … 25 24 #include "grid_scatterer_connector.hpp" 26 25 #include "grid_gatherer_connector.hpp" 26 #include "transformation_path.hpp" 27 27 28 28 … … 77 77 CDomain* domain = CDomainGroup::get("domain_definition")->createChild(); 78 78 return domain; 79 }80 CATCH81 82 std::map<StdString, ETranformationType> CDomain::transformationMapList_ = std::map<StdString, ETranformationType>();83 bool CDomain::_dummyTransformationMapList = CDomain::initializeTransformationMap(CDomain::transformationMapList_);84 85 bool CDomain::initializeTransformationMap(std::map<StdString, ETranformationType>& m)86 TRY87 {88 m["zoom_domain"] = TRANS_ZOOM_DOMAIN;89 m["interpolate_domain"] = TRANS_INTERPOLATE_DOMAIN;90 m["generate_rectilinear_domain"] = TRANS_GENERATE_RECTILINEAR_DOMAIN;91 m["compute_connectivity_domain"] = TRANS_COMPUTE_CONNECTIVITY_DOMAIN;92 m["expand_domain"] = TRANS_EXPAND_DOMAIN;93 m["reorder_domain"] = TRANS_REORDER_DOMAIN;94 m["extract_domain"] = TRANS_EXTRACT_DOMAIN;95 79 } 96 80 CATCH … … 2179 2163 CATCH_DUMP_ATTR 2180 2164 2181 2165 ///////////////////////////////////////////////////////////////////////// 2166 /////////////// TRANSFORMATIONS ////////// 2167 ///////////////////////////////////////////////////////////////////////// 2168 2169 std::map<StdString, ETranformationType> CDomain::transformationMapList_ = std::map<StdString, ETranformationType>(); 2170 bool CDomain::dummyTransformationMapList_ = CDomain::initializeTransformationMap(CDomain::transformationMapList_); 2171 2172 bool CDomain::initializeTransformationMap(std::map<StdString, ETranformationType>& m) 2173 TRY 2174 { 2175 m["zoom_domain"] = TRANS_ZOOM_DOMAIN; 2176 m["interpolate_domain"] = TRANS_INTERPOLATE_DOMAIN; 2177 m["generate_rectilinear_domain"] = TRANS_GENERATE_RECTILINEAR_DOMAIN; 2178 m["compute_connectivity_domain"] = TRANS_COMPUTE_CONNECTIVITY_DOMAIN; 2179 m["expand_domain"] = TRANS_EXPAND_DOMAIN; 2180 m["reorder_domain"] = TRANS_REORDER_DOMAIN; 2181 m["extract_domain"] = TRANS_EXTRACT_DOMAIN; 2182 } 2183 CATCH 2184 2185 2182 2186 CTransformation<CDomain>* CDomain::addTransformation(ETranformationType transType, const StdString& id) 2183 2187 TRY … … 2188 2192 CATCH_DUMP_ATTR 2189 2193 2194 CTransformation<CDomain>* CDomain::addTransformation(ETranformationType transType, CTransformation<CDomain>* transformation) 2195 TRY 2196 { 2197 transformationMap_.push_back(std::make_pair(transType, transformation)); 2198 return transformationMap_.back().second; 2199 } 2200 CATCH_DUMP_ATTR 2190 2201 /*! 2191 2202 Check whether a domain has transformation … … 2234 2245 * Go through the hierarchy to find the domain from which the transformations must be inherited 2235 2246 */ 2236 void CDomain::solveInheritanceTransformation ()2247 void CDomain::solveInheritanceTransformation_old() 2237 2248 TRY 2238 2249 { … … 2253 2264 } 2254 2265 CATCH_DUMP_ATTR 2266 2267 2268 void CDomain::solveInheritanceTransformation() 2269 TRY 2270 { 2271 if (solveInheritanceTransformation_done_) return; 2272 else solveInheritanceTransformation_done_=true ; 2273 2274 CDomain* domain = this; 2275 CDomain* Lastdomain ; 2276 std::list<CDomain*> refDomains; 2277 bool out=false ; 2278 vector<StdString> excludedAttr; 2279 excludedAttr.push_back("domain_ref"); 2280 2281 refDomains.push_front(domain) ; 2282 while (domain->hasDirectDomainReference() && !out) 2283 { 2284 CDomain* lastDomain=domain ; 2285 domain = domain->getDirectDomainReference(); 2286 domain->solveRefInheritance() ; 2287 if (!domain->SuperClass::isEqual(lastDomain,excludedAttr)) out=true ; 2288 refDomains.push_front(domain) ; 2289 } 2290 2291 CTransformationPaths::TPath path ; 2292 auto& pathList = std::get<2>(path) ; 2293 std::get<0>(path) = EElement::DOMAIN ; 2294 std::get<1>(path) = refDomains.front()->getId() ; 2295 for (auto& domain : refDomains) 2296 { 2297 CDomain::TransMapTypes transformations = domain->getAllTransformations(); 2298 for(auto& transformation : transformations) pathList.push_back({transformation.second->getTransformationType(), 2299 transformation.second->getId()}) ; 2300 } 2301 transformationPaths_.addPath(path) ; 2302 2303 } 2304 CATCH_DUMP_ATTR 2305 2306 ///////////////////////////////////////////////////////////////////////////////////////////// 2307 ///////////////////////////////////////////////////////////////////////////////////////////// 2255 2308 2256 2309 void CDomain::setContextClient(CContextClient* contextClient) -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/domain.hpp
r1974 r1984 16 16 #include "transformation.hpp" 17 17 #include "transformation_enum.hpp" 18 #include "transformation_path.hpp" 18 19 #include "server_distribution_description.hpp" 19 20 #include "mesh.hpp" … … 23 24 #include "gatherer_connector.hpp" 24 25 #include "distribution_type.hpp" 25 26 27 namespace xios { 26 #include "generic_algorithm_transformation.hpp" 27 28 29 namespace xios 30 { 28 31 29 32 /// ////////////////////// Déclarations ////////////////////// /// … … 61 64 typedef CDomainAttributes RelAttributes; 62 65 typedef CDomainGroup RelGroup; 63 typedef CTransformation<CDomain>::TransformationMapTypes TransMapTypes; 64 66 65 67 /// Constructeurs /// 66 68 CDomain(void); … … 82 84 bool checkAttributes_done_ = false ; 83 85 84 bool hasTransformation(); 85 void solveInheritanceTransformation(); 86 TransMapTypes getAllTransformations(); 86 87 ////////////////////////// 88 ///// transformations //// 89 ////////////////////////// 90 public: 91 typedef CTransformation<CDomain>::TransformationMapTypes TransMapTypes; 92 private: 93 static bool initializeTransformationMap(std::map<StdString, ETranformationType>& m); 94 static std::map<StdString, ETranformationType> transformationMapList_; 95 static bool dummyTransformationMapList_; 96 TransMapTypes transformationMap_; 97 98 public: 99 CTransformation<CDomain>* addTransformation(ETranformationType transType, const StdString& id=""); 100 CTransformation<CDomain>* addTransformation(ETranformationType transType, CTransformation<CDomain>* transformation) ; 101 void setTransformations(const TransMapTypes&); 102 void duplicateTransformation(CDomain*); 103 TransMapTypes getAllTransformations(); 104 bool hasTransformation(); 105 void solveInheritanceTransformation_old(); // to remove later 106 void solveInheritanceTransformation(); 107 private: 108 bool solveInheritanceTransformation_done_= false ; 109 private: 110 CGenericAlgorithmTransformation* transformationAlgorithm_ = nullptr ; 111 public: 112 void setTransformationAlgorithm(CGenericAlgorithmTransformation* transformationAlgorithm) { transformationAlgorithm_=transformationAlgorithm ;} 113 CGenericAlgorithmTransformation* getTransformationAlgorithm(void) { return transformationAlgorithm_ ;} 114 private: 115 CTransformationPaths transformationPaths_ ; 116 public: 117 CTransformationPaths getTransformationPaths(void) {return transformationPaths_;} 118 void setTransformationPaths(const CTransformationPaths& transformationPaths) { transformationPaths_=transformationPaths ;} 119 120 //////////////////////////// 121 87 122 void redistribute(int nbLocalDomain); 88 void duplicateTransformation(CDomain*);89 CTransformation<CDomain>* addTransformation(ETranformationType transType, const StdString& id="");90 123 91 124 public: … … 195 228 void checkArea(void); 196 229 void checkLonLat(); 197 198 void setTransformations(const TransMapTypes&);199 void computeNGlobDomain();200 230 201 231 public: … … 239 269 240 270 bool isRedistributed_; 241 TransMapTypes transformationMap_;242 271 bool isUnstructed_; 243 272 244 273 245 private:246 static bool initializeTransformationMap(std::map<StdString, ETranformationType>& m);247 static std::map<StdString, ETranformationType> transformationMapList_;248 static bool _dummyTransformationMapList;249 250 274 ////////////////////////////////////////////////////////////////////////////////////// 251 275 // this part is related to distribution, element definition, views and connectors // -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/duplicate_scalar_to_axis.cpp
r1314 r1984 28 28 bool CDuplicateScalarToAxis::registerTrans() 29 29 { 30 return registerTransformation(TRANS_DUPLICATE_SCALAR_TO_AXIS, CDuplicateScalarToAxis::create);30 return registerTransformation(TRANS_DUPLICATE_SCALAR_TO_AXIS, {create, getTransformation}); 31 31 } 32 32 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/duplicate_scalar_to_axis.hpp
r1314 r1984 41 41 typedef CObjectTemplate<CDuplicateScalarToAxis> SuperClass; 42 42 typedef CDuplicateScalarToAxisAttributes SuperClassAttribute; 43 typedef CDuplicateScalarToAxis MyClass ; 44 typedef CTransformation<CAxis> SuperTransform ; 43 45 44 46 public : … … 56 58 static StdString GetDefName(void); 57 59 static ENodeType GetType(void); 60 const string& getId(void) { return this->SuperClass::getId();} 61 ETranformationType getTransformationType(void) { return TRANS_DUPLICATE_SCALAR_TO_AXIS ;} 62 static CTransformation<CAxis>* getTransformation(const StdString& id) { return SuperClass::get(id);} 63 virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} 58 64 private: 59 65 static bool registerTrans(); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/expand_domain.cpp
r1158 r1984 27 27 bool CExpandDomain::registerTrans() 28 28 { 29 registerTransformation(TRANS_EXPAND_DOMAIN, CExpandDomain::create);29 registerTransformation(TRANS_EXPAND_DOMAIN, {create, getTransformation}); 30 30 } 31 31 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/expand_domain.hpp
r935 r1984 41 41 typedef CObjectTemplate<CExpandDomain> SuperClass; 42 42 typedef CExpandDomainAttributes SuperClassAttribute; 43 typedef CExpandDomain MyClass ; 44 typedef CTransformation<CDomain> SuperTransform ; 43 45 44 46 public : … … 56 58 static StdString GetDefName(void); 57 59 static ENodeType GetType(void); 60 const string& getId(void) { return this->SuperClass::getId();} 61 ETranformationType getTransformationType(void) { return TRANS_EXPAND_DOMAIN ;} 62 static CTransformation<CDomain>* getTransformation(const StdString& id) { return SuperClass::get(id);} 63 virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} 58 64 private: 59 65 static bool registerTrans(); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/extract_axis.cpp
r1558 r1984 26 26 bool CExtractAxis::registerTrans() 27 27 { 28 return registerTransformation(TRANS_EXTRACT_AXIS, CExtractAxis::create);28 return registerTransformation(TRANS_EXTRACT_AXIS, {create, getTransformation}); 29 29 } 30 30 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/extract_axis.hpp
r1558 r1984 41 41 typedef CObjectTemplate<CExtractAxis> SuperClass; 42 42 typedef CExtractAxisAttributes SuperClassAttribute; 43 typedef CExtractAxis MyClass ; 44 typedef CTransformation<CAxis> SuperTransform ; 43 45 44 46 public : … … 56 58 static StdString GetDefName(void); 57 59 static ENodeType GetType(void); 60 const string& getId(void) { return this->SuperClass::getId();} 61 ETranformationType getTransformationType(void) { return TRANS_EXTRACT_AXIS ;} 62 static CTransformation<CAxis>* getTransformation(const StdString& id) { return SuperClass::get(id);} 63 virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} 58 64 private: 59 65 static bool registerTrans(); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/extract_axis_to_scalar.cpp
r960 r1984 28 28 bool CExtractAxisToScalar::registerTrans() 29 29 { 30 return registerTransformation(TRANS_EXTRACT_AXIS_TO_SCALAR, CExtractAxisToScalar::create);30 return registerTransformation(TRANS_EXTRACT_AXIS_TO_SCALAR, {create, getTransformation}); 31 31 } 32 32 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/extract_axis_to_scalar.hpp
r960 r1984 41 41 typedef CObjectTemplate<CExtractAxisToScalar> SuperClass; 42 42 typedef CExtractAxisToScalarAttributes SuperClassAttribute; 43 typedef CExtractAxisToScalar MyClass ; 44 typedef CTransformation<CScalar> SuperTransform ; 43 45 44 46 public : … … 56 58 static StdString GetDefName(void); 57 59 static ENodeType GetType(void); 60 const string& getId(void) { return this->SuperClass::getId();} 61 ETranformationType getTransformationType(void) { return TRANS_EXTRACT_AXIS_TO_SCALAR ;} 62 static CTransformation<CScalar>* getTransformation(const StdString& id) { return SuperClass::get(id);} 63 virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} 58 64 private: 59 65 static bool registerTrans(); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/extract_domain.cpp
r1549 r1984 27 27 bool CExtractDomain::registerTrans() 28 28 { 29 registerTransformation(TRANS_EXTRACT_DOMAIN, CExtractDomain::create);29 registerTransformation(TRANS_EXTRACT_DOMAIN, {create, getTransformation}); 30 30 } 31 31 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/extract_domain.hpp
r1549 r1984 41 41 typedef CObjectTemplate<CExtractDomain> SuperClass; 42 42 typedef CExtractDomainAttributes SuperClassAttribute; 43 typedef CExtractDomain MyClass ; 44 typedef CTransformation<CDomain> SuperTransform ; 43 45 44 46 public : … … 56 58 static StdString GetDefName(void); 57 59 static ENodeType GetType(void); 58 private: 60 const string& getId(void) { return this->SuperClass::getId();} 61 ETranformationType getTransformationType(void) { return TRANS_EXTRACT_DOMAIN ;} 62 static CTransformation<CDomain>* getTransformation(const StdString& id) { return SuperClass::get(id);} 63 virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} 64 private: 59 65 static bool registerTrans(); 60 66 static CTransformation<CDomain>* create(const StdString& id, xml::CXMLNode* node); 61 67 static bool _dummyRegistered; 62 68 }; // class CExtractDomain 63 69 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/extract_domain_to_axis.cpp
r980 r1984 28 28 bool CExtractDomainToAxis::registerTrans() 29 29 { 30 return registerTransformation(TRANS_EXTRACT_DOMAIN_TO_AXIS, CExtractDomainToAxis::create);30 return registerTransformation(TRANS_EXTRACT_DOMAIN_TO_AXIS, {create, getTransformation}); 31 31 } 32 32 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/extract_domain_to_axis.hpp
r895 r1984 41 41 typedef CObjectTemplate<CExtractDomainToAxis> SuperClass; 42 42 typedef CExtractDomainToAxisAttributes SuperClassAttribute; 43 43 typedef CExtractDomainToAxis MyClass ; 44 typedef CTransformation<CAxis> SuperTransform ; 45 44 46 public : 45 47 /// Constructeurs /// … … 56 58 static StdString GetDefName(void); 57 59 static ENodeType GetType(void); 60 const string& getId(void) { return this->SuperClass::getId();} 61 ETranformationType getTransformationType(void) { return TRANS_EXTRACT_DOMAIN_TO_AXIS ;} 62 static CTransformation<CAxis>* getTransformation(const StdString& id) { return SuperClass::get(id);} 63 virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} 58 64 private: 59 65 static bool registerTrans(); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/field.cpp
r1973 r1984 766 766 767 767 CGrid* gridSrc=getDirectFieldReference()->getGrid() ; 768 std::shared_ptr<COutputPin> lastFilter ; 769 if (filterExpr) lastFilter=filterExpr ; 770 else lastFilter = inputFilter ; 771 CGrid* newGrid ; 772 768 773 for(auto grid : gridPath) 769 774 { 770 775 grid->solveElementsRefInheritance() ; 776 777 // new 778 779 std::pair<std::shared_ptr<CFilter>, std::shared_ptr<CFilter> > filters = grid->buildTransformationGraph(gc, gridSrc, detectMissingValues, defaultValue, newGrid) ; 780 lastFilter->connectOutput(filters.first, 0); 781 lastFilter = filters.second; 782 gridSrc = newGrid ; 783 784 // end new 785 /* 771 786 grid->completeGrid(gridSrc); // grid generation, to be checked 772 787 grid->checkElementsAttributes() ; … … 775 790 if (!CField::get(fieldId)->buildWorkflowGraph(gc)) return false ; 776 791 gridSrc=grid ; 777 } 778 792 */ 793 } 794 795 /* 779 796 std::shared_ptr<COutputPin> lastFilter ; 780 797 if (filterExpr) lastFilter=filterExpr ; … … 793 810 } 794 811 } 812 */ 813 grid_=newGrid ; 814 grid_ref=grid_->getId() ; // for server 795 815 instantDataFilter = lastFilter ; 796 816 … … 824 844 825 845 grid_->solveElementsRefInheritance() ; 826 grid_->completeGrid(); // grid generation, to be checked 846 CGrid* newGrid ; 847 std::pair<std::shared_ptr<CFilter>, std::shared_ptr<CFilter> > filters = grid_->buildTransformationGraph(gc, nullptr, detectMissingValues, defaultValue, newGrid) ; 848 grid_ = newGrid ; 849 grid_ref=grid_->getId() ; // for server 850 // grid_->completeGrid(); // grid generation, to be checked => later 827 851 grid_->checkElementsAttributes() ; 828 852 instantDataFilter=inputFilter ; … … 1603 1627 CContext::getCurrent()->sendContextToFileServer(client); 1604 1628 getRelFile()->sendFileToFileServer(client); 1605 grid_->sendGridToFileServer(client); 1629 sentGrid_ = grid_-> duplicateSentGrid() ; 1630 sentGrid_->sendGridToFileServer(client); 1631 name = getFieldOutputName() ; 1606 1632 this->sendAllAttributesToServer(client); 1607 1633 this->sendAddAllVariables(client); … … 1697 1723 if (grid_ref.isEmpty()) 1698 1724 { 1699 grid_ref= grid_->getId() ;1725 grid_ref=sentGrid_->getId() ; 1700 1726 SuperClass::sendAllAttributesToServer(client) ; 1701 1727 domain_ref.reset() ; … … 1704 1730 grid_ref.reset(); 1705 1731 } 1706 else SuperClass::sendAllAttributesToServer(client) ; 1732 else 1733 { 1734 string tmp = grid_ref; 1735 grid_ref = sentGrid_->getId() ; 1736 SuperClass::sendAllAttributesToServer(client) ; 1737 grid_ref = tmp ; 1738 } 1707 1739 } 1708 1740 CATCH_DUMP_ATTR -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/field.hpp
r1973 r1984 227 227 228 228 bool hasGridMask(void) const; 229 CGrid* getGrid(void) { return grid_; } 230 229 231 230 void connectToFileServer(CGarbageCollector& gc) ; 232 231 void connectToCouplerOut(CGarbageCollector& gc) ; … … 268 267 269 268 CGrid* grid_=nullptr; 269 CGrid* getGrid(void) { return grid_; } 270 271 private: 272 CGrid* sentGrid_=nullptr ; 273 public: 274 CGrid* getSentGrid(void) { return sentGrid_; } 275 276 public: 270 277 // CFile* file; 271 278 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/generate_rectilinear_domain.cpp
r838 r1984 27 27 bool CGenerateRectilinearDomain::registerTrans() 28 28 { 29 registerTransformation(TRANS_GENERATE_RECTILINEAR_DOMAIN, create);29 registerTransformation(TRANS_GENERATE_RECTILINEAR_DOMAIN, {create, getTransformation}); 30 30 } 31 31 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/generate_rectilinear_domain.hpp
r836 r1984 41 41 typedef CObjectTemplate<CGenerateRectilinearDomain> SuperClass; 42 42 typedef CGenerateRectilinearDomainAttributes SuperClassAttribute; 43 typedef CGenerateRectilinearDomain MyClass ; 44 typedef CTransformation<CDomain> SuperTransform ; 43 45 44 46 public : … … 56 58 static StdString GetDefName(void); 57 59 static ENodeType GetType(void); 60 const string& getId(void) { return this->SuperClass::getId();} 61 ETranformationType getTransformationType(void) { return TRANS_GENERATE_RECTILINEAR_DOMAIN ;} 62 static CTransformation<CDomain>* getTransformation(const StdString& id) { return SuperClass::get(id);} 63 virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} 58 64 private: 59 65 static bool registerTrans(); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/grid.cpp
r1974 r1984 24 24 #include "grid_local_view.hpp" 25 25 #include "grid_mask_connector.hpp" 26 27 28 namespace xios { 26 #include "transformation_path.hpp" 27 #include "grid_transformation_factory_impl.hpp" 28 #include "transform_filter.hpp" 29 30 31 namespace xios 32 { 29 33 30 34 /// ////////////////////// Dfinitions ////////////////////// /// … … 236 240 axis_domain_order.resize(order_.size()); 237 241 for (int idx = 0; idx < order_.size(); ++idx) axis_domain_order(idx)=order_[idx]; 238 return vDomainGroup_->createChild(id); 242 CDomain* domain = vDomainGroup_->createChild(id); 243 computeElements(); 244 return domain ; 239 245 } 240 246 CATCH_DUMP_ATTR … … 246 252 axis_domain_order.resize(order_.size()); 247 253 for (int idx = 0; idx < order_.size(); ++idx) axis_domain_order(idx)=order_[idx]; 248 return vAxisGroup_->createChild(id); 254 CAxis* axis=vAxisGroup_->createChild(id); 255 computeElements(); 256 return axis ; 249 257 } 250 258 CATCH_DUMP_ATTR … … 256 264 axis_domain_order.resize(order_.size()); 257 265 for (int idx = 0; idx < order_.size(); ++idx) axis_domain_order(idx)=order_[idx]; 258 return vScalarGroup_->createChild(id); 266 CScalar* scalar = vScalarGroup_->createChild(id); 267 computeElements(); 268 return scalar; 259 269 } 260 270 CATCH_DUMP_ATTR … … 518 528 int idxDomain = 0, idxAxis=0 , idxScalar=0 ; 519 529 530 elements_.clear() ; 520 531 for(auto type : order_) 521 532 { … … 572 583 setAxisList(); 573 584 setScalarList(); 585 computeElements() ; 574 586 } 575 587 CATCH_DUMP_ATTR … … 960 972 961 973 962 //----------------------------------------------------------------963 964 974 965 975 … … 1871 1881 1872 1882 1873 1874 1875 1876 1877 1878 1883 bool CGrid::hasTransform() 1879 1884 TRY … … 1892 1897 } 1893 1898 CATCH_DUMP_ATTR 1899 1900 1901 1902 //********************************************************** 1903 //************** New transformation method ************** 1904 //********************************************************** 1905 1906 std::pair<std::shared_ptr<CFilter>, std::shared_ptr<CFilter> > 1907 CGrid::buildTransformationGraph(CGarbageCollector& gc, CGrid* gridSrc, double detectMissingValues, double defaultValue, CGrid*& newGrid) 1908 TRY 1909 { 1910 std::shared_ptr<CFilter> inputFilter = std::shared_ptr<CPassThroughFilter>(new CPassThroughFilter(gc)); 1911 std::shared_ptr<CFilter> outputFilter = inputFilter ; 1912 1913 newGrid = CGrid::create() ; // give it an id later ?? 1914 bool hadTransform=false ; 1915 bool hasTransform=false ; 1916 CGenericAlgorithmTransformation* algo ; 1917 int dimBefore=1 ; 1918 int dimAfter=1 ; 1919 1920 for(int i=0 ; i<elements_.size(); i++) 1921 { 1922 CTransformationPaths transformationPath ; 1923 auto dstElement = elements_[i] ; 1924 1925 if (dstElement.type==TYPE_DOMAIN) transformationPath = dstElement.domain->getTransformationPaths() ; 1926 else if (dstElement.type==TYPE_AXIS) transformationPath = dstElement.axis->getTransformationPaths() ; 1927 else if (dstElement.type==TYPE_SCALAR) transformationPath = dstElement.scalar->getTransformationPaths() ; 1928 1929 SElement srcElement ; 1930 if (gridSrc==nullptr) srcElement = this->elements_[i] ; 1931 else srcElement = gridSrc->elements_[i] ; 1932 1933 if (gridSrc==nullptr) transformationPath.mergePaths() ; 1934 else 1935 { 1936 if (srcElement.type==TYPE_DOMAIN) transformationPath.mergePaths(srcElement.domain->getTransformationPaths()) ; 1937 else if (srcElement.type==TYPE_AXIS) transformationPath.mergePaths(srcElement.axis->getTransformationPaths()) ; 1938 else if (srcElement.type==TYPE_SCALAR) transformationPath.mergePaths(srcElement.scalar->getTransformationPaths()) ; 1939 } 1940 1941 hasTransform=transformationPath.hasTransform() ; 1942 1943 1944 if (hasTransform && !hadTransform) 1945 { 1946 EElement dstElementType=transformationPath.getNextElementType() ; 1947 string dstElementId=transformationPath.getNextElementId() ; 1948 string srcElementId=transformationPath.getNextElementSrcId() ; 1949 auto transType = transformationPath.getNextTransformationType() ; 1950 auto transId = transformationPath.getNextTransformationId() ; 1951 1952 CGrid* tmpGridSrc=CGrid::create(); // source grid 1953 if (srcElement.type==TYPE_DOMAIN) tmpGridSrc->addDomain(srcElement.domain->getId()) ; 1954 else if (srcElement.type==TYPE_AXIS) tmpGridSrc->addAxis(srcElement.axis->getId()) ; 1955 else if (srcElement.type==TYPE_SCALAR) tmpGridSrc->addScalar(srcElement.scalar->getId()) ; 1956 tmpGridSrc->checkElementsAttributes() ; 1957 CGrid* tmpGridDst=CGrid::create(); // destination Grid 1958 map<int,int> posInGrid={{0,0}} ; 1959 1960 cout<<"--> New transform from "<<srcElementId<<" to "<<dstElementId<<endl ; 1961 if (dstElementType==EElement::DOMAIN) 1962 { 1963 CDomain* dstDomain ; 1964 if (CDomain::has(dstElementId)) dstDomain = CDomain::get(dstElementId) ; 1965 else 1966 { 1967 dstDomain = CDomain::create() ; 1968 dstDomain->createAlias(dstElementId) ; 1969 if (srcElementId=="" && srcElement.type==TYPE_DOMAIN) dstDomain->duplicateAttributes(srcElement.domain) ; // make a copy 1970 else dstDomain->duplicateAttributes(CDomain::get(srcElementId)) ; // make a copy 1971 CTransformation<CDomain>* transformation = CTransformation<CDomain>::createTransformation(transType,"") ; 1972 auto srcTransform = CTransformation<CDomain>::getTransformation(transType, transId) ; 1973 transformation->inheritFrom(srcTransform) ; 1974 tmpGridDst->addDomain(dstDomain->getId()) ; 1975 1976 //reuse existing algorithm interface for, now 1977 algo = CGridTransformationFactory<CDomain>::createTransformation(transType, tmpGridDst, tmpGridSrc, 1978 transformation, 0, 1979 posInGrid,posInGrid,posInGrid, 1980 posInGrid,posInGrid,posInGrid ); 1981 dstDomain->setTransformationAlgorithm(algo) ; 1982 transformationPath.removeNextTransform() ; 1983 dstDomain->setTransformationPaths(transformationPath) ; 1984 newGrid->addDomain(dstDomain->getId()) ; 1985 } 1986 algo = dstDomain->getTransformationAlgorithm() ; 1987 } 1988 else if (dstElementType==EElement::AXIS) 1989 { 1990 CAxis* dstAxis ; 1991 if (CAxis::has(dstElementId)) dstAxis = CAxis::get(dstElementId) ; 1992 else 1993 { 1994 dstAxis = CAxis::create() ; 1995 dstAxis->createAlias(dstElementId) ; 1996 if (srcElementId=="" && srcElement.type==TYPE_AXIS) dstAxis->duplicateAttributes(srcElement.axis) ; // make a copy 1997 else dstAxis->duplicateAttributes(CAxis::get(srcElementId)) ; // make a copy 1998 CTransformation<CAxis>* transformation = CTransformation<CAxis>::createTransformation(transType,"") ; 1999 auto srcTransform = CTransformation<CAxis>::getTransformation(transType, transId) ; 2000 transformation->inheritFrom(srcTransform) ; 2001 tmpGridDst->addAxis(dstAxis->getId()) ; 2002 2003 //reuse existing algorithm interface for, now 2004 algo = CGridTransformationFactory<CAxis>::createTransformation(transType, tmpGridDst, tmpGridSrc, 2005 transformation, 0, 2006 posInGrid,posInGrid,posInGrid, 2007 posInGrid,posInGrid,posInGrid ); 2008 dstAxis->setTransformationAlgorithm(algo) ; 2009 transformationPath.removeNextTransform() ; 2010 dstAxis->setTransformationPaths(transformationPath) ; 2011 newGrid->addAxis(dstAxis->getId()) ; 2012 } 2013 algo = dstAxis->getTransformationAlgorithm() ; 2014 } 2015 else if (dstElementType==EElement::SCALAR) 2016 { 2017 CScalar* dstScalar ; 2018 if (CScalar::has(dstElementId)) dstScalar = CScalar::get(dstElementId) ; 2019 else 2020 { 2021 dstScalar = CScalar::create() ; 2022 dstScalar->createAlias(dstElementId) ; 2023 if (srcElementId=="" && srcElement.type==TYPE_SCALAR) dstScalar->duplicateAttributes(srcElement.scalar) ; // make a copy 2024 else dstScalar->duplicateAttributes(CScalar::get(srcElementId)) ; // make a copy 2025 CTransformation<CScalar>* transformation = CTransformation<CScalar>::createTransformation(transType,"") ; 2026 auto srcTransform = CTransformation<CScalar>::getTransformation(transType, transId) ; 2027 transformation->inheritFrom(srcTransform) ; 2028 tmpGridDst->addScalar(dstScalar->getId()) ; 2029 2030 //reuse existing algorithm interface for, now 2031 algo = CGridTransformationFactory<CScalar>::createTransformation(transType, tmpGridDst, tmpGridSrc, 2032 transformation, 0, 2033 posInGrid,posInGrid,posInGrid, 2034 posInGrid,posInGrid,posInGrid ); 2035 dstScalar->setTransformationAlgorithm(algo) ; 2036 transformationPath.removeNextTransform() ; 2037 dstScalar->setTransformationPaths(transformationPath) ; 2038 newGrid->addScalar(dstScalar->getId()) ; 2039 } 2040 algo = dstScalar->getTransformationAlgorithm() ; 2041 } 2042 // here create a new spatial filter with algo 2043 2044 hadTransform=true ; 2045 hasTransform=false ; 2046 } 2047 else 2048 { 2049 string srcElementId=transformationPath.getNextElementSrcId() ; 2050 if (srcElement.type==TYPE_DOMAIN) 2051 { 2052 CDomain* domain ; 2053 if (!CDomain::has(srcElementId)) 2054 { 2055 domain=srcElement.domain ; 2056 domain->createAlias(srcElementId) ; 2057 } 2058 else domain = CDomain::get(srcElementId) ; 2059 domain->checkAttributes() ; 2060 2061 if (hadTransform) dimBefore*=domain->getLocalView(CElementView::WORKFLOW)->getLocalSize() ; 2062 else dimAfter*=domain->getLocalView(CElementView::WORKFLOW)->getLocalSize() ; 2063 newGrid->addDomain(srcElementId) ; 2064 } 2065 else if (srcElement.type==TYPE_AXIS) 2066 { 2067 CAxis* axis ; 2068 if (!CAxis::has(srcElementId)) 2069 { 2070 axis=srcElement.axis ; 2071 axis->createAlias(srcElementId) ; 2072 } 2073 else axis = CAxis::get(srcElementId) ; 2074 axis->checkAttributes() ; 2075 2076 if (hadTransform) dimBefore*=axis->getLocalView(CElementView::WORKFLOW)->getLocalSize() ; 2077 else dimAfter*=axis->getLocalView(CElementView::WORKFLOW)->getLocalSize() ; 2078 newGrid->addAxis(srcElementId) ; 2079 } 2080 else if (srcElement.type==TYPE_SCALAR) 2081 { 2082 CScalar* scalar ; 2083 if (!CScalar::has(srcElementId)) 2084 { 2085 scalar=srcElement.scalar ; 2086 scalar->createAlias(srcElementId) ; 2087 } 2088 else scalar = CScalar::get(srcElementId) ; 2089 scalar->checkAttributes() ; 2090 2091 if (hadTransform) dimBefore*=scalar->getLocalView(CElementView::WORKFLOW)->getLocalSize() ; 2092 else dimAfter*=scalar->getLocalView(CElementView::WORKFLOW)->getLocalSize() ; 2093 newGrid->addScalar(srcElementId) ; 2094 } 2095 } 2096 } 2097 2098 if (hadTransform) 2099 { 2100 shared_ptr<CTransformFilter> transformFilter = shared_ptr<CTransformFilter>(new CTransformFilter(gc, algo, dimBefore, dimAfter, detectMissingValues, defaultValue)) ; 2101 outputFilter->connectOutput(transformFilter,0) ; 2102 outputFilter = transformFilter ; 2103 2104 gridSrc=newGrid ; 2105 pair<shared_ptr<CFilter>, shared_ptr<CFilter> > filters = gridSrc->buildTransformationGraph(gc, gridSrc, detectMissingValues, defaultValue, newGrid) ; 2106 outputFilter->connectOutput(filters.first,0) ; 2107 outputFilter=filters.second ; 2108 } 2109 2110 return {inputFilter,outputFilter} ; 2111 } 2112 CATCH_DUMP_ATTR 2113 2114 2115 //**************************************************************** 2116 //**************************************************************** 2117 2118 //---------------------------------------------------------------- 2119 2120 CGrid* CGrid::duplicateSentGrid(void) 2121 { 2122 CGrid* newGrid ; 2123 string sentGridId="sent__"+getId() ; 2124 if (has(sentGridId)) newGrid = get(sentGridId) ; 2125 else 2126 { 2127 newGrid = CGrid::create(sentGridId) ; 2128 for(auto element : elements_) 2129 { 2130 if (element.type==TYPE_DOMAIN) 2131 { 2132 CDomain* domain = CDomain::create(); 2133 domain->duplicateAttributes(element.domain) ; 2134 domain->name = element.domain->getId() ; 2135 newGrid->addDomain(domain->getId()) ; 2136 } 2137 else if (element.type==TYPE_AXIS) 2138 { 2139 CAxis* axis = CAxis::create(); 2140 axis->duplicateAttributes(element.axis) ; 2141 axis->name = element.axis->getId() ; 2142 newGrid->addAxis(axis->getId()) ; 2143 } 2144 else if (element.type==TYPE_SCALAR) 2145 { 2146 CScalar* scalar = CScalar::create(); 2147 scalar->duplicateAttributes(element.scalar) ; 2148 scalar->name = element.scalar->getId() ; 2149 newGrid->addScalar(scalar->getId()) ; 2150 } 2151 } 2152 newGrid->checkElementsAttributes() ; 2153 } 2154 return newGrid ; 2155 } 2156 1894 2157 1895 2158 void CGrid::setContextClient(CContextClient* contextClient) -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/grid.hpp
r1974 r1984 20 20 #include "grid_scatterer_connector.hpp" 21 21 #include "grid_gatherer_connector.hpp" 22 #include "transformation_path.hpp" 23 #include "filter.hpp" 22 24 23 25 … … 210 212 bool doGridHaveDataDistributed(CContextClient* client = 0); 211 213 214 /////////////////////////////////////////// 215 //////// TRANSFORMATIONS ///// 216 /////////////////////////////////////////// 217 public: 212 218 CGridTransformation* getTransformations(); 213 219 … … 221 227 222 228 std::vector<std::string> getAuxInputTransformGrid(void) ; 223 229 std::map<CGrid*, std::pair<bool,StdString> >& getTransGridSource(); 230 bool hasTransform(); 231 void addTransGridSource(CGrid* gridSrc); 224 232 void completeGrid(CGrid* transformGridSrc = 0); 225 233 bool isTransformed(); … … 227 235 bool isGenerated(); 228 236 void setGenerated(); 229 void addTransGridSource(CGrid* gridSrc); 230 std::map<CGrid*, std::pair<bool,StdString> >& getTransGridSource(); 231 bool hasTransform(); 232 size_t getGlobalWrittenSize(void) ; 237 void setTransformationAlgorithms(); 238 pair<shared_ptr<CFilter>, shared_ptr<CFilter> > buildTransformationGraph(CGarbageCollector& gc, CGrid* gridSrc, double detectMissingValues, 239 double defaultValue, CGrid*& newGrid) ; 240 private: 241 bool isTransformed_, isGenerated_; 242 CGridTransformation* transformations_; 243 bool hasTransform_; 244 245 /////////////////////////////////////////// 246 public: 247 248 size_t getGlobalWrittenSize(void) ; 233 249 234 250 bool isCompleted(void) ; … … 265 281 CScalarGroup* getVirtualScalarGroup() const; 266 282 267 void setTransformationAlgorithms();268 283 int computeGridGlobalDimension(std::vector<int>& globalDim, 269 284 const std::vector<CDomain*> domains, … … 310 325 std::set<std::string> relFilesCompressed; 311 326 312 bool isTransformed_, isGenerated_;313 327 314 328 std::vector<int> axisPositionInGrid_; … … 317 331 std::vector<int>& getAxisPositionInGrid(void) { if (!computeAxisPositionInGrid_done_) computeAxisPositionInGrid() ; return axisPositionInGrid_ ;} 318 332 319 CGridTransformation* transformations_;320 333 bool hasDomainAxisBaseRef_; 321 334 std::map<CGrid*, std::pair<bool,StdString> > gridSrc_; 322 bool hasTransform_;323 335 324 336 ////////////////////////////////////////////////////////////////////////////////////// 325 337 // this part is related to distribution, element definition, views and connectors // 326 338 ////////////////////////////////////////////////////////////////////////////////////// 339 public: 340 CGrid* duplicateSentGrid(void) ; 327 341 private: 328 342 static void recvMask(CEventServer& event) ; … … 336 350 337 351 private: 338 CGridLocalConnector* modelToWorkflowConnector_ ;352 CGridLocalConnector* modelToWorkflowConnector_ = nullptr ; 339 353 public: 340 354 void computeModelToWorkflowConnector(void) ; -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/interpolate_axis.cpp
r937 r1984 27 27 bool CInterpolateAxis::registerTrans() 28 28 { 29 return registerTransformation(TRANS_INTERPOLATE_AXIS, CInterpolateAxis::create);29 return registerTransformation(TRANS_INTERPOLATE_AXIS, {create, getTransformation}); 30 30 } 31 31 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/interpolate_axis.hpp
r836 r1984 41 41 typedef CObjectTemplate<CInterpolateAxis> SuperClass; 42 42 typedef CInterpolateAxisAttributes SuperClassAttribute; 43 typedef CInterpolateAxis MyClass ; 44 typedef CTransformation<CAxis> SuperTransform ; 43 45 44 46 public : … … 58 60 static StdString GetDefName(void); 59 61 static ENodeType GetType(void); 62 const string& getId(void) { return this->SuperClass::getId();} 63 ETranformationType getTransformationType(void) { return TRANS_INTERPOLATE_AXIS ;} 64 static CTransformation<CAxis>* getTransformation(const StdString& id) { return SuperClass::get(id);} 65 virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} 60 66 private: 61 67 static bool registerTrans(); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/interpolate_domain.cpp
r1615 r1984 27 27 bool CInterpolateDomain::registerTrans() 28 28 { 29 registerTransformation(TRANS_INTERPOLATE_DOMAIN, create);29 registerTransformation(TRANS_INTERPOLATE_DOMAIN, {create, getTransformation}); 30 30 } 31 31 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/interpolate_domain.hpp
r1021 r1984 41 41 typedef CObjectTemplate<CInterpolateDomain> SuperClass; 42 42 typedef CInterpolateDomainAttributes SuperClassAttribute; 43 typedef CInterpolateDomain MyClass ; 44 typedef CTransformation<CDomain> SuperTransform ; 43 45 44 46 public : … … 56 58 static StdString GetDefName(void); 57 59 static ENodeType GetType(void); 60 const string& getId(void) { return this->SuperClass::getId();} 61 ETranformationType getTransformationType(void) { return TRANS_INTERPOLATE_DOMAIN ;} 62 static CTransformation<CDomain>* getTransformation(const StdString& id) { return SuperClass::get(id);} 63 virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} 58 64 private: 59 65 static bool registerTrans(); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/inverse_axis.cpp
r836 r1984 26 26 bool CInverseAxis::registerTrans() 27 27 { 28 return registerTransformation(TRANS_INVERSE_AXIS, CInverseAxis::create);28 return registerTransformation(TRANS_INVERSE_AXIS, {create, getTransformation}); 29 29 } 30 30 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/inverse_axis.hpp
r836 r1984 39 39 typedef CObjectTemplate<CInverseAxis> SuperClass; 40 40 typedef CInverseAxisAttributes SuperClassAttribute; 41 typedef CInverseAxis MyClass ; 42 typedef CTransformation<CAxis> SuperTransform ; 41 43 42 44 public : … … 54 56 static StdString GetDefName(void); 55 57 static ENodeType GetType(void); 56 58 const string& getId(void) { return this->SuperClass::getId();} 59 ETranformationType getTransformationType(void) { return TRANS_INVERSE_AXIS ;} 60 static CTransformation<CAxis>* getTransformation(const StdString& id) { return SuperClass::get(id);} 61 virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} 57 62 private: 58 63 static bool registerTrans(); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_axis_to_axis.cpp
r1314 r1984 27 27 bool CReduceAxisToAxis::registerTrans() 28 28 { 29 return registerTransformation(TRANS_REDUCE_AXIS_TO_AXIS, CReduceAxisToAxis::create);29 return registerTransformation(TRANS_REDUCE_AXIS_TO_AXIS, {create, getTransformation}); 30 30 } 31 31 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_axis_to_axis.hpp
r1301 r1984 40 40 typedef CObjectTemplate<CReduceAxisToAxis> SuperClass; 41 41 typedef CReduceAxisToAxisAttributes SuperClassAttribute; 42 typedef CReduceAxisToAxis MyClass ; 43 typedef CTransformation<CAxis> SuperTransform ; 42 44 43 45 public : … … 55 57 static StdString GetDefName(void); 56 58 static ENodeType GetType(void); 59 const string& getId(void) { return this->SuperClass::getId();} 60 ETranformationType getTransformationType(void) { return TRANS_REDUCE_AXIS_TO_AXIS ;} 61 static CTransformation<CAxis>* getTransformation(const StdString& id) { return SuperClass::get(id);} 62 virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} 57 63 private: 58 64 static bool registerTrans(); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_axis_to_scalar.cpp
r980 r1984 26 26 bool CReduceAxisToScalar::registerTrans() 27 27 { 28 return registerTransformation(TRANS_REDUCE_AXIS_TO_SCALAR, CReduceAxisToScalar::create);28 return registerTransformation(TRANS_REDUCE_AXIS_TO_SCALAR, {create, getTransformation}); 29 29 } 30 30 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_axis_to_scalar.hpp
r888 r1984 40 40 typedef CObjectTemplate<CReduceAxisToScalar> SuperClass; 41 41 typedef CReduceAxisToScalarAttributes SuperClassAttribute; 42 typedef CReduceAxisToScalar MyClass ; 43 typedef CTransformation<CScalar> SuperTransform ; 42 44 43 45 public : … … 55 57 static StdString GetDefName(void); 56 58 static ENodeType GetType(void); 59 const string& getId(void) { return this->SuperClass::getId();} 60 ETranformationType getTransformationType(void) { return TRANS_REDUCE_AXIS_TO_SCALAR ;} 61 static CTransformation<CScalar>* getTransformation(const StdString& id) { return SuperClass::get(id);} 62 virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} 57 63 private: 58 64 static bool registerTrans(); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_domain_to_axis.cpp
r1299 r1984 28 28 bool CReduceDomainToAxis::registerTrans() 29 29 { 30 return registerTransformation(TRANS_REDUCE_DOMAIN_TO_AXIS, CReduceDomainToAxis::create);30 return registerTransformation(TRANS_REDUCE_DOMAIN_TO_AXIS, {create, getTransformation}); 31 31 } 32 32 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_domain_to_axis.hpp
r895 r1984 41 41 typedef CObjectTemplate<CReduceDomainToAxis> SuperClass; 42 42 typedef CReduceDomainToAxisAttributes SuperClassAttribute; 43 typedef CReduceDomainToAxis MyClass ; 44 typedef CTransformation<CAxis> SuperTransform ; 43 45 44 46 public : … … 56 58 static StdString GetDefName(void); 57 59 static ENodeType GetType(void); 58 private: 60 const string& getId(void) { return this->SuperClass::getId();} 61 ETranformationType getTransformationType(void) { return TRANS_REDUCE_DOMAIN_TO_AXIS ;} 62 static CTransformation<CAxis>* getTransformation(const StdString& id) { return SuperClass::get(id);} 63 virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} 64 private: 59 65 static bool registerTrans(); 60 66 static CTransformation<CAxis>* create(const StdString& id, xml::CXMLNode* node); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_domain_to_scalar.cpp
r1313 r1984 26 26 bool CReduceDomainToScalar::registerTrans() 27 27 { 28 return registerTransformation(TRANS_REDUCE_DOMAIN_TO_SCALAR, CReduceDomainToScalar::create);28 return registerTransformation(TRANS_REDUCE_DOMAIN_TO_SCALAR, {create, getTransformation}); 29 29 } 30 30 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_domain_to_scalar.hpp
r976 r1984 41 41 typedef CObjectTemplate<CReduceDomainToScalar> SuperClass; 42 42 typedef CReduceDomainToScalarAttributes SuperClassAttribute; 43 typedef CReduceDomainToScalar MyClass ; 44 typedef CTransformation<CScalar> SuperTransform ; 43 45 44 46 public : … … 56 58 static StdString GetDefName(void); 57 59 static ENodeType GetType(void); 60 const string& getId(void) { return this->SuperClass::getId();} 61 ETranformationType getTransformationType(void) { return TRANS_REDUCE_DOMAIN_TO_SCALAR ;} 62 static CTransformation<CScalar>* getTransformation(const StdString& id) { return SuperClass::get(id);} 63 virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} 58 64 private: 59 65 static bool registerTrans(); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_scalar_to_scalar.cpp
r1314 r1984 26 26 bool CReduceScalarToScalar::registerTrans() 27 27 { 28 return registerTransformation(TRANS_REDUCE_SCALAR_TO_SCALAR, CReduceScalarToScalar::create);28 return registerTransformation(TRANS_REDUCE_SCALAR_TO_SCALAR, {create, getTransformation}); 29 29 } 30 30 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reduce_scalar_to_scalar.hpp
r1314 r1984 40 40 typedef CObjectTemplate<CReduceScalarToScalar> SuperClass; 41 41 typedef CReduceScalarToScalarAttributes SuperClassAttribute; 42 typedef CReduceScalarToScalar MyClass ; 43 typedef CTransformation<CScalar> SuperTransform ; 42 44 43 45 public : … … 55 57 static StdString GetDefName(void); 56 58 static ENodeType GetType(void); 59 const string& getId(void) { return this->SuperClass::getId();} 60 ETranformationType getTransformationType(void) { return TRANS_REDUCE_SCALAR_TO_SCALAR ;} 61 static CTransformation<CScalar>* getTransformation(const StdString& id) { return SuperClass::get(id);} 62 virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} 57 63 private: 58 64 static bool registerTrans(); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reorder_domain.cpp
r1457 r1984 27 27 bool CReorderDomain::registerTrans() 28 28 { 29 registerTransformation(TRANS_REORDER_DOMAIN, CReorderDomain::create);29 registerTransformation(TRANS_REORDER_DOMAIN, {create, getTransformation}); 30 30 } 31 31 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/reorder_domain.hpp
r1457 r1984 41 41 typedef CObjectTemplate<CReorderDomain> SuperClass; 42 42 typedef CReorderDomainAttributes SuperClassAttribute; 43 typedef CReorderDomain MyClass ; 44 typedef CTransformation<CDomain> SuperTransform ; 43 45 44 46 public : … … 56 58 static StdString GetDefName(void); 57 59 static ENodeType GetType(void); 58 private: 60 const string& getId(void) { return this->SuperClass::getId();} 61 ETranformationType getTransformationType(void) { return TRANS_REORDER_DOMAIN ;} 62 static CTransformation<CDomain>* getTransformation(const StdString& id) { return SuperClass::get(id);} 63 virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} 64 private: 59 65 static bool registerTrans(); 60 66 static CTransformation<CDomain>* create(const StdString& id, xml::CXMLNode* node); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/scalar.cpp
r1975 r1984 135 135 * Go through the hierarchy to find the scalar from which the transformations must be inherited 136 136 */ 137 void CScalar::solveInheritanceTransformation ()137 void CScalar::solveInheritanceTransformation_old() 138 138 { 139 139 if (hasTransformation() || !hasDirectScalarReference()) … … 153 153 } 154 154 155 void CScalar::solveInheritanceTransformation() 156 TRY 157 { 158 if (solveInheritanceTransformation_done_) return; 159 else solveInheritanceTransformation_done_=true ; 160 161 CScalar* scalar = this; 162 CScalar* Lastscalar ; 163 std::list<CScalar*> refScalars; 164 bool out=false ; 165 vector<StdString> excludedAttr; 166 excludedAttr.push_back("scalar_ref"); 167 168 refScalars.push_front(scalar) ; 169 while (scalar->hasDirectScalarReference() && !out) 170 { 171 CScalar* lastScalar=scalar ; 172 scalar = scalar->getDirectScalarReference(); 173 scalar->solveRefInheritance() ; 174 if (!scalar->SuperClass::isEqual(lastScalar,excludedAttr)) out=true ; 175 refScalars.push_front(scalar) ; 176 } 177 178 CTransformationPaths::TPath path ; 179 auto& pathList = std::get<2>(path) ; 180 std::get<0>(path) = EElement::SCALAR ; 181 std::get<1>(path) = refScalars.front()->getId() ; 182 for (auto& scalar : refScalars) 183 { 184 CScalar::TransMapTypes transformations = scalar->getAllTransformations(); 185 for(auto& transformation : transformations) pathList.push_back({transformation.second->getTransformationType(), 186 transformation.second->getId()}) ; 187 } 188 transformationPaths_.addPath(path) ; 189 190 } 191 CATCH_DUMP_ATTR 192 155 193 /* obsolete, to remove after reimplementing coupling */ 156 194 void CScalar::sendScalarToCouplerOut(CContextClient* client, const string& fieldId, int posInGrid) -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/scalar.hpp
r1975 r1984 13 13 #include "transformation.hpp" 14 14 #include "transformation_enum.hpp" 15 15 #include "transformation_path.hpp" 16 16 #include "element.hpp" 17 17 #include "local_connector.hpp" … … 19 19 #include "gatherer_connector.hpp" 20 20 #include "distribution_type.hpp" 21 #include "generic_algorithm_transformation.hpp" 21 22 22 23 23 24 namespace xios 24 25 { 25 26 27 28 29 30 31 32 33 26 /// ////////////////////// Déclarations ////////////////////// /// 27 28 class CScalarGroup; 29 class CScalarAttributes; 30 class CScalar; 31 ///-------------------------------------------------------------- 32 33 // Declare/Define CVarAttribute 34 BEGIN_DECLARE_ATTRIBUTE_MAP(CScalar) 34 35 #include "scalar_attribute.conf" 35 END_DECLARE_ATTRIBUTE_MAP(CScalar) 36 37 ///-------------------------------------------------------------- 38 39 class CScalar 40 : public CObjectTemplate<CScalar> 41 , public CScalarAttributes 36 END_DECLARE_ATTRIBUTE_MAP(CScalar) 37 38 ///-------------------------------------------------------------- 39 40 class CScalar: public CObjectTemplate<CScalar> 41 , public CScalarAttributes 42 { 43 friend class CScalarGroup; 44 45 /// typedef /// 46 typedef CObjectTemplate<CScalar> SuperClass; 47 typedef CScalarAttributes SuperClassAttribute; 48 49 public: 50 enum EEventId 42 51 { 43 friend class CScalarGroup; 44 45 /// typedef /// 46 typedef CObjectTemplate<CScalar> SuperClass; 47 typedef CScalarAttributes SuperClassAttribute; 48 49 public: 50 enum EEventId 51 { 52 EVENT_ID_SCALAR_DISTRIBUTION, 53 EVENT_ID_SEND_DISTRIBUTED_ATTRIBUTE, 54 } ; 55 static bool dispatchEvent(CEventServer& event); 52 EVENT_ID_SCALAR_DISTRIBUTION, 53 EVENT_ID_SEND_DISTRIBUTED_ATTRIBUTE, 54 } ; 55 static bool dispatchEvent(CEventServer& event); 56 56 57 57 58 public : 59 60 typedef CScalarAttributes RelAttributes; 61 typedef CScalarGroup RelGroup; 62 typedef CTransformation<CScalar>::TransformationMapTypes TransMapTypes; 63 64 /// Constructeurs /// 65 CScalar(void); 66 explicit CScalar(const StdString & id); 67 CScalar(const CScalar & var); // Not implemented yet. 68 CScalar(const CScalar * const var); // Not implemented yet. 69 70 /// Destructeur /// 71 virtual ~CScalar(void); 72 73 public : 74 /// Accesseurs statiques /// 75 static StdString GetName(void); 76 static StdString GetDefName(void); 77 static ENodeType GetType(void); 78 79 public: 80 static CScalar* createScalar(); 81 82 public: 83 void checkAttributes(void); 84 bool checkAttributes_done_ = false ; 58 public : 59 60 typedef CScalarAttributes RelAttributes; 61 typedef CScalarGroup RelGroup; 62 63 /// Constructeurs /// 64 CScalar(void); 65 explicit CScalar(const StdString & id); 66 CScalar(const CScalar & var); // Not implemented yet. 67 CScalar(const CScalar * const var); // Not implemented yet. 68 69 /// Destructeur /// 70 virtual ~CScalar(void); 71 72 public : 73 /// Accesseurs statiques /// 74 static StdString GetName(void); 75 static StdString GetDefName(void); 76 static ENodeType GetType(void); 77 78 public: 79 static CScalar* createScalar(); 80 81 public: 82 void checkAttributes(void); 83 bool checkAttributes_done_ = false ; 85 84 86 87 88 85 void addRelFile(const StdString& filename); 86 bool IsWritten(const StdString& filename) const; 87 virtual void parse(xml::CXMLNode & node); 89 88 90 91 92 93 89 public: 90 void sendScalarToCouplerOut(CContextClient* client, const string& fieldId, int posInGrid) ; 91 private: 92 std::set<CContextClient*> sendScalarToCouplerOut_done_ ; 94 93 95 public: 96 void makeAliasForCoupling(const string& fieldId, int posInGrid) ; 97 98 public: 99 bool hasTransformation(); 100 void solveInheritanceTransformation(); 101 TransMapTypes getAllTransformations(); 102 void duplicateTransformation(CScalar*); 103 CTransformation<CScalar>* addTransformation(ETranformationType transType, const StdString& id=""); 104 bool isEqual(CScalar* scalar); 105 private: 94 public: 95 void makeAliasForCoupling(const string& fieldId, int posInGrid) ; 96 97 //////////////////////////////// 98 //// TRANSFORMATIONS //// 99 //////////////////////////////// 100 public: 101 typedef CTransformation<CScalar>::TransformationMapTypes TransMapTypes; 102 private: 103 static bool initializeTransformationMap(std::map<StdString, ETranformationType>& m); 104 static std::map<StdString, ETranformationType> transformationMapList_; 105 static bool dummyTransformationMapList_; TransMapTypes transformationMap_; 106 void setTransformations(const TransMapTypes&); 107 108 public: 109 bool hasTransformation(); 110 TransMapTypes getAllTransformations(); 111 void duplicateTransformation(CScalar*); 112 CTransformation<CScalar>* addTransformation(ETranformationType transType, const StdString& id=""); 113 114 void solveInheritanceTransformation_old(); 115 void solveInheritanceTransformation(); 116 private: 117 bool solveInheritanceTransformation_done_= false ; 118 private: 119 CGenericAlgorithmTransformation* transformationAlgorithm_ = nullptr ; 120 public: 121 void setTransformationAlgorithm(CGenericAlgorithmTransformation* transformationAlgorithm) { transformationAlgorithm_=transformationAlgorithm ;} 122 CGenericAlgorithmTransformation* getTransformationAlgorithm(void) { return transformationAlgorithm_ ;} 123 private: 124 CTransformationPaths transformationPaths_ ; 125 public: 126 CTransformationPaths getTransformationPaths(void) {return transformationPaths_;} 127 void setTransformationPaths(const CTransformationPaths& transformationPaths) { transformationPaths_=transformationPaths ;} 128 //////////////////////////////// 129 //////////////////////////////// 130 131 bool isEqual(CScalar* scalar); 132 private: 106 133 /** Clients that have to send a scalar. There can be multiple clients in case of secondary server, otherwise only one client. */ 107 108 109 110 134 std::list<CContextClient*> clients; 135 std::set<CContextClient*> clientsSet; 136 public: 137 void setContextClient(CContextClient* contextClient) ; 111 138 112 private: 113 std::set<StdString> relFiles; 114 TransMapTypes transformationMap_; 115 116 void setTransformations(const TransMapTypes&); 117 118 private: 119 static bool initializeTransformationMap(std::map<StdString, ETranformationType>& m); 120 static std::map<StdString, ETranformationType> transformationMapList_; 121 static bool dummyTransformationMapList_; 122 123 /** define if the scalar is completed or not ie all attributes have been received before in case 124 of grid reading from file or coupling */ 125 private: 126 /** define if the scalar is completed or not ie all attributes have been received before in case 127 of grid reading from file or coupling */ 128 bool isCompleted_=true ; 129 public: 130 /*! 131 \brief Check if a scalar is completed 132 Before make any scalar processing, we must be sure that all scalar informations have 133 been sent, for exemple when reading a grid in a file or when grid elements are sent by an 134 other context (coupling). So all direct reference of the scalar (scalar_ref) must be also completed 135 \return true if scalar and scalar reference are completed 136 */ 137 bool isCompleted(void) 138 { 139 if (hasDirectScalarReference()) if (!getDirectScalarReference()->isCompleted()) return false; 140 else return isCompleted_ ; 141 } 142 void setCompleted(void) { isCompleted_=true ; } 143 void unsetCompleted(void) { isCompleted_=false ; } 144 145 146 147 ////////////////////////////////////////////////////////////////////////////////////// 148 // this part is related to distribution, element definition, views and connectors // 149 ////////////////////////////////////////////////////////////////////////////////////// 150 private: 151 CLocalElement* localElement_ = nullptr ; 152 void initializeLocalElement(void) ; 139 private: 140 std::set<StdString> relFiles; 141 142 private: 143 /** define if the scalar is completed or not ie all attributes have been received before in case 144 of grid reading from file or coupling */ 145 bool isCompleted_=true ; 146 public: 147 /*! 148 \brief Check if a scalar is completed 149 Before make any scalar processing, we must be sure that all scalar informations have 150 been sent, for exemple when reading a grid in a file or when grid elements are sent by an 151 other context (coupling). So all direct reference of the scalar (scalar_ref) must be also completed 152 \return true if scalar and scalar reference are completed 153 */ 154 bool isCompleted(void) 155 { 156 if (hasDirectScalarReference()) if (!getDirectScalarReference()->isCompleted()) return false; 157 else return isCompleted_ ; 158 } 159 void setCompleted(void) { isCompleted_=true ; } 160 void unsetCompleted(void) { isCompleted_=false ; } 161 162 163 164 ////////////////////////////////////////////////////////////////////////////////////// 165 // this part is related to distribution, element definition, views and connectors // 166 ////////////////////////////////////////////////////////////////////////////////////// 167 private: 168 CLocalElement* localElement_ = nullptr ; 169 void initializeLocalElement(void) ; 153 170 154 155 156 171 public: 172 CLocalElement* getLocalElement(void) { if (localElement_==nullptr) initializeLocalElement() ; return localElement_ ; } 173 CLocalView* getLocalView(CElementView::type type) { return getLocalElement()->getView(type) ;} 157 174 158 159 160 161 175 private: 176 void addFullView(void) ; 177 void addWorkflowView(void) ; 178 void addModelView(void) ; 162 179 163 164 165 166 167 168 169 170 171 180 private: 181 CLocalConnector* modelToWorkflowConnector_ ; 182 void computeModelToWorkflowConnector(void) ; 183 public: 184 CLocalConnector* getModelToWorkflowConnector(void) { if (modelToWorkflowConnector_==nullptr) computeModelToWorkflowConnector() ; return modelToWorkflowConnector_ ;} 185 186 public: 187 void computeRemoteElement(CContextClient* client, EDistributionType) ; 188 void distributeToServer(CContextClient* client, std::map<int, CArray<size_t,1>>& globalIndex, CScattererConnector* &scattererConnector, 172 189 const string& scalarId="") ; 173 190 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 191 static void recvScalarDistribution(CEventServer& event) ; 192 void receivedScalarDistribution(CEventServer& event, int phasis) ; 193 void setServerMask(CArray<bool,1>& serverMask, CContextClient* client) ; 194 void sendDistributedAttributes(CContextClient* client, CScattererConnector& scattererConnector, const string& scalarId) ; 195 static void recvDistributedAttributes(CEventServer& event) ; 196 void recvDistributedAttributes(CEventServer& event, const string& type) ; 197 198 private: 199 map<CContextClient*, CDistributedElement*> remoteElement_ ; 200 public: 201 CDistributedElement* getRemoteElement(CContextClient* client) {return remoteElement_[client] ;} 202 private: 203 map<CContextClient*, CScattererConnector*> clientToServerConnector_ ; 204 public: 205 CScattererConnector* getClientToServerConnector(CContextClient* client) { return clientToServerConnector_[client] ;} 206 207 private: 208 CGathererConnector* gathererConnector_ ; 209 public: 210 CGathererConnector* getGathererConnector(void) { return gathererConnector_ ;} 211 private: 212 CGathererConnector* serverFromClientConnector_ ; 213 CDistributedElement* elementFrom_ ; 214 public: 215 CGathererConnector* getServerFromClientConnector(void) { return serverFromClientConnector_ ;} 216 217 private: 218 CScattererConnector* serverToClientConnector_ = nullptr ; 219 public: 220 CScattererConnector* getServerToClientConnector(void) { return serverToClientConnector_ ;} 221 222 private: 223 map<CContextClient*,CGathererConnector*> clientFromServerConnector_ ; 224 public: 225 CGathererConnector* getClientFromServerConnector(CContextClient* client) { return clientFromServerConnector_[client] ;} 226 227 private: 228 DECLARE_REF_FUNC(Scalar,scalar) 229 230 }; // class CVar 231 ///-------------------------------------------------------------- 232 233 // Declare/Define CScalarGroup and CScalarDefinition 234 DECLARE_GROUP(CScalar); 218 235 } // namespace xios 219 236 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/temporal_splitting.cpp
r1275 r1984 29 29 bool CTemporalSplitting::registerTrans() 30 30 { 31 return registerTransformation(TRANS_TEMPORAL_SPLITTING, CTemporalSplitting::create);31 return registerTransformation(TRANS_TEMPORAL_SPLITTING, {create, getTransformation}); 32 32 } 33 33 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/temporal_splitting.hpp
r1275 r1984 40 40 typedef CObjectTemplate<CTemporalSplitting> SuperClass; 41 41 typedef CTemporalSplittingAttributes SuperClassAttribute; 42 typedef CTemporalSplitting MyClass ; 43 typedef CTransformation<CAxis> SuperTransform ; 42 44 43 45 public : … … 55 57 static StdString GetDefName(void); 56 58 static ENodeType GetType(void); 59 const string& getId(void) { return this->SuperClass::getId();} 60 ETranformationType getTransformationType(void) { return TRANS_TEMPORAL_SPLITTING ;} 61 static CTransformation<CAxis>* getTransformation(const StdString& id) { return SuperClass::get(id);} 62 virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} 57 63 private: 58 64 static bool registerTrans(); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/zoom_axis.cpp
r1201 r1984 26 26 bool CZoomAxis::registerTrans() 27 27 { 28 return registerTransformation(TRANS_ZOOM_AXIS, CZoomAxis::create);28 return registerTransformation(TRANS_ZOOM_AXIS, {create, getTransformation}); 29 29 } 30 30 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/zoom_axis.hpp
r836 r1984 41 41 typedef CObjectTemplate<CZoomAxis> SuperClass; 42 42 typedef CZoomAxisAttributes SuperClassAttribute; 43 typedef CZoomAxis MyClass ; 44 typedef CTransformation<CAxis> SuperTransform ; 43 45 44 46 public : … … 56 58 static StdString GetDefName(void); 57 59 static ENodeType GetType(void); 60 const string& getId(void) { return this->SuperClass::getId();} 61 ETranformationType getTransformationType(void) { return TRANS_ZOOM_AXIS ;} 62 static CTransformation<CAxis>* getTransformation(const StdString& id) { return SuperClass::get(id);} 63 virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} 58 64 private: 59 65 static bool registerTrans(); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/zoom_domain.cpp
r836 r1984 27 27 bool CZoomDomain::registerTrans() 28 28 { 29 registerTransformation(TRANS_ZOOM_DOMAIN, CZoomDomain::create);29 registerTransformation(TRANS_ZOOM_DOMAIN, {create, getTransformation}); 30 30 } 31 31 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/zoom_domain.hpp
r836 r1984 41 41 typedef CObjectTemplate<CZoomDomain> SuperClass; 42 42 typedef CZoomDomainAttributes SuperClassAttribute; 43 typedef CZoomDomain MyClass ; 44 typedef CTransformation<CDomain> SuperTransform ; 43 45 44 46 public : … … 56 58 static StdString GetDefName(void); 57 59 static ENodeType GetType(void); 60 const string& getId(void) { return this->SuperClass::getId();} 61 ETranformationType getTransformationType(void) { return TRANS_ZOOM_DOMAIN ;} 62 virtual void inheritFrom(SuperTransform* srcTransform) { solveDescInheritance(true, this->SuperClass::get((MyClass*)srcTransform)) ;} 63 static CTransformation<CDomain>* getTransformation(const StdString& id) { return SuperClass::get(id);} 58 64 private: 59 65 static bool registerTrans(); 60 66 static CTransformation<CDomain>* create(const StdString& id, xml::CXMLNode* node); 67 61 68 static bool _dummyRegistered; 62 69 }; // class CZoomDomain -
XIOS/dev/dev_ym/XIOS_COUPLING/src/object_template.hpp
r1875 r1984 52 52 /// Traitements /// 53 53 virtual void solveDescInheritance(bool apply, const CAttributeMap * const parent = 0); 54 54 55 55 /// Traitement statique /// 56 56 static void ClearAllAttributes(void); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/generic_algorithm_transformation.cpp
r1784 r1984 14 14 #include "timer.hpp" 15 15 #include "mpi.hpp" 16 17 namespace xios { 16 #include "transform_connector.hpp" 17 #include "weight_transform_connector.hpp" 18 19 namespace xios 20 { 18 21 19 22 CGenericAlgorithmTransformation::CGenericAlgorithmTransformation() … … 1135 1138 CATCH 1136 1139 1137 } 1140 1141 /////////////////////////////////////////////////////////////// 1142 ////////// new algorithm for new method ///////// 1143 /////////////////////////////////////////////////////////////// 1144 1145 1146 1147 void CGenericAlgorithmTransformation::computeAlgorithm(CLocalView* srcView, CLocalView* dstView) 1148 { 1149 auto& srcMap = transformationMapping_[0] ; 1150 set<size_t> srcIndex ; 1151 for(auto& it : srcMap) 1152 for(size_t index : it.second) srcIndex.insert(index) ; 1153 1154 CArray<size_t,1> srcArrayIndex(srcIndex.size()) ; 1155 int i=0 ; 1156 for(size_t index : srcIndex) { srcArrayIndex(i) = index ; i++ ;} 1157 CLocalElement recvElement(CContext::getCurrent()->getIntraCommRank(), srcView->getGlobalSize(), srcArrayIndex) ; 1158 recvElement.addFullView() ; 1159 1160 transformConnector_ = new CTransformConnector(srcView, recvElement.getView(CElementView::FULL), CContext::getCurrent()->getIntraComm()) ; 1161 transformConnector_->computeConnector() ; 1162 weightTransformConnector_ = new CWeightTransformConnector( recvElement.getView(CElementView::FULL), dstView, transformationMapping_[0], transformationWeight_[0]) ; 1163 } 1164 1165 1166 void CGenericAlgorithmTransformation::apply(int dimBefore, int dimAfter, const CArray<double,1>& dataIn, CArray<double,1>& dataOut) 1167 { 1168 CArray<double,1> dataOutTmp ; 1169 transformConnector_->transfer(dimBefore, dimAfter, dataIn, dataOutTmp) ; 1170 weightTransformConnector_ -> transfer(dimBefore, dimAfter, dataOutTmp, dataOut) ; 1171 } 1172 1173 1174 1175 1176 1177 1178 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/generic_algorithm_transformation.hpp
r1637 r1984 14 14 #include "array_new.hpp" 15 15 #include "client_client_dht_template.hpp" 16 #include "local_view.hpp" 17 #include "transform_connector.hpp" 18 #include "weight_transform_connector.hpp" 16 19 17 namespace xios { 20 namespace xios 21 { 18 22 class CGrid; 19 23 class CDomain; … … 169 173 bool eliminateRedondantSrc_ ; // flag to indicate if the transformation must select only one global source point for all proc. 170 174 // In this case it will choose preferentially the current process 175 176 177 // new methods for new algorithm 178 179 public : 180 181 void computeAlgorithm(CLocalView* srcView, CLocalView* dstView) ; 182 void apply(int dimBefore, int dimAfter, const CArray<double,1>& dataIn, CArray<double,1>& dataOut); 183 184 CTransformConnector* transformConnector_ ; 185 CWeightTransformConnector* weightTransformConnector_ ; 186 171 187 }; 172 188 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/xios_spl.hpp
r1875 r1984 8 8 #include <unordered_map> 9 9 #include <memory> 10 11 10 // standard C 12 11 #include <cstring> 13 12 #include <cstdlib> 13 14 14 #include <cmath> 15 // bug in cmath header => macro collision marco with DOMAIN 16 #ifdef DOMAIN 17 #undef DOMAIN 18 #endif 19 15 20 #include <ctime> 16 21 … … 24 29 #include <queue> 25 30 #include <valarray> 31 #include <tuple> 32 26 33 // Flux. 27 34 #include <iostream> … … 32 39 #include <boost/cast.hpp> 33 40 #include <boost/current_function.hpp> 41 34 42 /// Map /// 35 43 #define xios_map std::map … … 61 69 #include "log.hpp" 62 70 using namespace std; 63 using namespace boost ; 64 71 //using namespace boost ; 65 72 66 73 #endif //__XIOS_SPL__
Note: See TracChangeset
for help on using the changeset viewer.