Changeset 1155 for XIOS/dev/branch_yushan_merged/src/transformation
- Timestamp:
- 06/06/17 15:12:34 (7 years ago)
- Location:
- XIOS/dev/branch_yushan_merged/src/transformation
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/branch_yushan_merged/src/transformation/Functions/reduction.cpp
r1153 r1155 11 11 //std::map<StdString,EReductionType> CReductionAlgorithm::ReductionOperations = std::map<StdString,EReductionType>(); 12 12 std::map<StdString,EReductionType> *CReductionAlgorithm::ReductionOperations_ptr = 0; 13 14 bool CReductionAlgorithm::initReductionOperation(std::map<StdString,EReductionType>& m) 15 { 16 // So so stupid way to intialize operation but it works ... 17 m["sum"] = TRANS_REDUCE_SUM; 18 CSumReductionAlgorithm::registerTrans(); 19 20 m["min"] = TRANS_REDUCE_MIN; 21 CMinReductionAlgorithm::registerTrans(); 22 23 m["max"] = TRANS_REDUCE_MAX; 24 CMaxReductionAlgorithm::registerTrans(); 25 26 m["extract"] = TRANS_REDUCE_EXTRACT; 27 CExtractReductionAlgorithm::registerTrans(); 28 29 m["average"] = TRANS_REDUCE_AVERAGE; 30 CAverageReductionAlgorithm::registerTrans(); 31 } 13 //#pragma omp threadprivate(CReductionAlgorithm::ReductionOperations_ptr) 32 14 33 15 34 16 bool CReductionAlgorithm::initReductionOperation() 35 17 { 36 if(CReductionAlgorithm::ReductionOperations_ptr == NULL)CReductionAlgorithm::ReductionOperations_ptr = new std::map<StdString,EReductionType>();18 CReductionAlgorithm::ReductionOperations_ptr = new std::map<StdString,EReductionType>(); 37 19 // So so stupid way to intialize operation but it works ... 38 20 (*CReductionAlgorithm::ReductionOperations_ptr)["sum"] = TRANS_REDUCE_SUM; … … 50 32 (*CReductionAlgorithm::ReductionOperations_ptr)["average"] = TRANS_REDUCE_AVERAGE; 51 33 CAverageReductionAlgorithm::registerTrans(); 52 53 printf("*CReductionAlgorithm::ReductionOperations_ptr = %p\t %p\n", *CReductionAlgorithm::ReductionOperations_ptr, &(*CReductionAlgorithm::ReductionOperations_ptr));54 34 } 55 35 56 36 //bool CReductionAlgorithm::_dummyInit = CReductionAlgorithm::initReductionOperation(CReductionAlgorithm::ReductionOperations); 57 bool CReductionAlgorithm::_dummyInit = CReductionAlgorithm::initReductionOperation();37 //bool CReductionAlgorithm::_dummyInit = CReductionAlgorithm::initReductionOperation(); 58 38 59 39 CReductionAlgorithm* CReductionAlgorithm::createOperation(EReductionType reduceType) 60 40 { 61 41 int reduceTypeInt = reduceType; 62 //if (0 == reductionCreationCallBacks_)63 // reductionCreationCallBacks_ = new CallBackMap();64 42 65 43 CallBackMap::const_iterator it = (*reductionCreationCallBacks_).find(reduceType); -
XIOS/dev/branch_yushan_merged/src/transformation/Functions/reduction.hpp
r1134 r1155 28 28 29 29 public: 30 CReductionAlgorithm() { }30 CReductionAlgorithm() { } 31 31 32 32 /*! -
XIOS/dev/branch_yushan_merged/src/transformation/axis_algorithm_extract_domain.cpp
r1134 r1155 13 13 #include "grid.hpp" 14 14 #include "grid_transformation_factory_impl.hpp" 15 #include "reduction.hpp"16 15 17 16 namespace xios { … … 62 61 63 62 pos_ = algo->position; 63 64 if(CReductionAlgorithm::ReductionOperations_ptr == 0) 65 CReductionAlgorithm::initReductionOperation(); 66 64 67 reduction_ = CReductionAlgorithm::createOperation((*CReductionAlgorithm::ReductionOperations_ptr)[op]); 65 68 } -
XIOS/dev/branch_yushan_merged/src/transformation/axis_algorithm_extract_domain.hpp
r1076 r1155 12 12 #include "axis_algorithm_transformation.hpp" 13 13 #include "transformation.hpp" 14 #include "reduction.hpp" 14 15 15 16 namespace xios { … … 25 26 Extract a domain to an axis 26 27 */ 27 class CAxisAlgorithmExtractDomain : public CAxisAlgorithmTransformation 28 class CAxisAlgorithmExtractDomain : public CAxisAlgorithmTransformation, public CReductionAlgorithm 28 29 { 29 30 public: -
XIOS/dev/branch_yushan_merged/src/transformation/axis_algorithm_reduce_domain.cpp
r1134 r1155 13 13 #include "grid.hpp" 14 14 #include "grid_transformation_factory_impl.hpp" 15 #include "reduction.hpp"16 15 17 16 namespace xios { … … 70 69 71 70 dir_ = (CReduceDomainToAxis::direction_attr::iDir == algo->direction) ? iDir : jDir; 71 72 if(CReductionAlgorithm::ReductionOperations_ptr == 0) 73 CReductionAlgorithm::initReductionOperation(); 74 72 75 reduction_ = CReductionAlgorithm::createOperation((*CReductionAlgorithm::ReductionOperations_ptr)[op]); 73 76 } -
XIOS/dev/branch_yushan_merged/src/transformation/axis_algorithm_reduce_domain.hpp
r1076 r1155 12 12 #include "axis_algorithm_transformation.hpp" 13 13 #include "transformation.hpp" 14 #include "reduction.hpp" 14 15 15 16 namespace xios { … … 24 25 Reduce a domain to an axis 25 26 */ 26 class CAxisAlgorithmReduceDomain : public CAxisAlgorithmTransformation 27 class CAxisAlgorithmReduceDomain : public CAxisAlgorithmTransformation, public CReductionAlgorithm 27 28 { 28 29 public: -
XIOS/dev/branch_yushan_merged/src/transformation/domain_algorithm_interpolate.cpp
r1149 r1155 111 111 const int constNVertex = 4; // Value by default number of vertex for rectangular domain 112 112 int nVertexSrc, nVertexDest; 113 nVertexSrc = nVertexDest = constNVertex; 113 nVertexSrc = constNVertex; 114 nVertexDest = constNVertex; 114 115 115 116 // First of all, try to retrieve the boundary values of domain source and domain destination -
XIOS/dev/branch_yushan_merged/src/transformation/scalar_algorithm_extract_axis.cpp
r1134 r1155 14 14 #include "grid_transformation_factory_impl.hpp" 15 15 16 #include "reduction.hpp" 16 17 17 18 18 namespace xios { … … 49 49 StdString op = "extract"; 50 50 pos_ = algo->position; 51 52 if(CReductionAlgorithm::ReductionOperations_ptr == 0) 53 CReductionAlgorithm::initReductionOperation(); 54 51 55 reduction_ = CReductionAlgorithm::createOperation((*CReductionAlgorithm::ReductionOperations_ptr)[op]); 52 56 } -
XIOS/dev/branch_yushan_merged/src/transformation/scalar_algorithm_extract_axis.hpp
r1076 r1155 12 12 #include "scalar_algorithm_transformation.hpp" 13 13 #include "transformation.hpp" 14 #include "reduction.hpp" 14 15 15 16 namespace xios { … … 24 25 Extract a scalar from an axis 25 26 */ 26 class CScalarAlgorithmExtractAxis : public CScalarAlgorithmTransformation 27 class CScalarAlgorithmExtractAxis : public CScalarAlgorithmTransformation, public CReductionAlgorithm 27 28 { 28 29 public: -
XIOS/dev/branch_yushan_merged/src/transformation/scalar_algorithm_reduce_axis.cpp
r1153 r1155 13 13 #include "grid.hpp" 14 14 #include "grid_transformation_factory_impl.hpp" 15 #include "reduction.hpp"16 17 #include "reduction.hpp"18 15 19 16 namespace xios { 17 18 //extern std::map<StdString,EReductionType> *CReductionAlgorithm::ReductionOperations_ptr; 19 //#pragma omp threadprivate(CReductionAlgorithm::ReductionOperations_ptr) 20 20 21 CGenericAlgorithmTransformation* CScalarAlgorithmReduceAxis::create(CGrid* gridDst, CGrid* gridSrc, 21 22 CTransformation<CScalar>* transformation, … … 75 76 } 76 77 77 //if ((*CReductionAlgorithm::ReductionOperations_ptr).end() == (*CReductionAlgorithm::ReductionOperations_ptr).find(op)) 78 // if ((CReductionAlgorithm::ReductionOperations_ptr)->end() == (CReductionAlgorithm::ReductionOperations_ptr)->find(op)) 79 // ERROR("CScalarAlgorithmReduceAxis::CScalarAlgorithmReduceAxis(CAxis* axisDestination, CAxis* axisSource, CReduceAxisToScalar* algo)", 80 // << "Operation '" << op << "' not found. Please make sure to use a supported one" 81 // << "Axis source " <<axisSource->getId() << std::endl 82 // << "Scalar destination " << scalarDestination->getId()); 78 if(CReductionAlgorithm::ReductionOperations_ptr == 0) 79 CReductionAlgorithm::initReductionOperation(); 80 81 if ((*CReductionAlgorithm::ReductionOperations_ptr).end() == (*CReductionAlgorithm::ReductionOperations_ptr).find(op)) 82 ERROR("CScalarAlgorithmReduceAxis::CScalarAlgorithmReduceAxis(CAxis* axisDestination, CAxis* axisSource, CReduceAxisToScalar* algo)", 83 << "Operation '" << op << "' not found. Please make sure to use a supported one" 84 << "Axis source " <<axisSource->getId() << std::endl 85 << "Scalar destination " << scalarDestination->getId()); 83 86 84 87 reduction_ = CReductionAlgorithm::createOperation((*CReductionAlgorithm::ReductionOperations_ptr)[op]); -
XIOS/dev/branch_yushan_merged/src/transformation/scalar_algorithm_reduce_axis.hpp
r1082 r1155 12 12 #include "scalar_algorithm_transformation.hpp" 13 13 #include "transformation.hpp" 14 #include "reduction.hpp" 14 15 15 16 namespace xios { … … 24 25 Reducing an axis to a scalar 25 26 */ 26 class CScalarAlgorithmReduceAxis : public CScalarAlgorithmTransformation 27 class CScalarAlgorithmReduceAxis : public CScalarAlgorithmTransformation, public CReductionAlgorithm 27 28 { 28 29 public: -
XIOS/dev/branch_yushan_merged/src/transformation/scalar_algorithm_reduce_domain.cpp
r1134 r1155 14 14 #include "grid_transformation_factory_impl.hpp" 15 15 16 #include "reduction.hpp" 16 17 17 18 18 namespace xios { … … 68 68 69 69 } 70 70 71 if(CReductionAlgorithm::ReductionOperations_ptr == 0) 72 CReductionAlgorithm::initReductionOperation(); 73 71 74 if ((*CReductionAlgorithm::ReductionOperations_ptr).end() == (*CReductionAlgorithm::ReductionOperations_ptr).find(op)) 72 75 ERROR("CScalarAlgorithmReduceDomain::CScalarAlgorithmReduceDomain(CDomain* domainDestination, CDomain* domainSource, CReduceDomainToScalar* algo)", -
XIOS/dev/branch_yushan_merged/src/transformation/scalar_algorithm_reduce_domain.hpp
r1076 r1155 12 12 #include "scalar_algorithm_transformation.hpp" 13 13 #include "transformation.hpp" 14 #include "reduction.hpp" 14 15 15 16 namespace xios { … … 24 25 Reducing an DOMAIN to a scalar 25 26 */ 26 class CScalarAlgorithmReduceDomain : public CScalarAlgorithmTransformation 27 class CScalarAlgorithmReduceDomain : public CScalarAlgorithmTransformation, public CReductionAlgorithm 27 28 { 28 29 public:
Note: See TracChangeset
for help on using the changeset viewer.