[687] | 1 | /*! |
---|
| 2 | \file grid_generate.hpp |
---|
| 3 | \author Ha NGUYEN |
---|
| 4 | \since 28 Aug 2015 |
---|
| 5 | \date 28 Aug 2015 |
---|
| 6 | |
---|
| 7 | \brief A special transformation to generate a grid. |
---|
| 8 | */ |
---|
| 9 | #ifndef __XIOS_GRID_GENERATE_HPP__ |
---|
| 10 | #define __XIOS_GRID_GENERATE_HPP__ |
---|
| 11 | |
---|
| 12 | #include "xios_spl.hpp" |
---|
| 13 | #include "transformation_enum.hpp" |
---|
| 14 | #include "generic_algorithm_transformation.hpp" |
---|
| 15 | |
---|
| 16 | namespace xios { |
---|
| 17 | |
---|
| 18 | class CGrid; |
---|
| 19 | |
---|
| 20 | /*! |
---|
| 21 | \class CGridGenerate |
---|
| 22 | This class creates a grid from scratch, e.g: only global dimension of grid and its type are provided, |
---|
| 23 | then the generated grid plays the destination in a transformation. Not only some attributes of grid and its subcomponents are filled in |
---|
| 24 | automatically but it also have a distribution which might be different from one of grid source. |
---|
| 25 | This class only plays a role of interface between XIOS and specific algorithm of auto filling-in and auto distributing on sub-component |
---|
| 26 | */ |
---|
| 27 | class CGridGenerate |
---|
| 28 | { |
---|
| 29 | public: |
---|
| 30 | typedef std::list<std::pair<int,std::pair<ETranformationType,int> > > ListAlgoType; |
---|
| 31 | |
---|
| 32 | public: |
---|
| 33 | /** Default constructor */ |
---|
| 34 | CGridGenerate(CGrid* destination, CGrid* source); |
---|
| 35 | ~CGridGenerate(); |
---|
| 36 | |
---|
| 37 | void completeGrid(); |
---|
| 38 | ListAlgoType getAlgoList() const {return listAlgos_; } |
---|
| 39 | |
---|
| 40 | protected: |
---|
| 41 | void initializeAlgorithms(); |
---|
| 42 | void initializeAxisAlgorithms(int axisPositionInGrid); |
---|
| 43 | void initializeDomainAlgorithms(int domPositionInGrid); |
---|
| 44 | |
---|
| 45 | void selectAxisAlgo(int elementPositionInGrid, ETranformationType transType, int transformationOrder); |
---|
| 46 | void selectDomainAlgo(int elementPositionInGrid, ETranformationType transType, int transformationOrder); |
---|
| 47 | void selectAlgo(int elementPositionInGrid, ETranformationType transType, int transformationOrder, bool isDomainAlgo); |
---|
| 48 | |
---|
| 49 | protected: |
---|
| 50 | //! Grid source on transformation |
---|
| 51 | CGrid* gridSource_; |
---|
| 52 | |
---|
| 53 | //! Grid destination on transformation |
---|
| 54 | CGrid* gridDestination_; |
---|
| 55 | |
---|
| 56 | protected: |
---|
| 57 | //! List of algorithm types and their order |
---|
| 58 | ListAlgoType listAlgos_; |
---|
| 59 | // true if domain algorithm and false if axis algorithm (can be replaced by tuple with listAlgos_ |
---|
| 60 | std::vector<bool> algoTypes_; |
---|
| 61 | |
---|
| 62 | // Mapping between position of an element in grid and its transformation (if any) |
---|
| 63 | std::list<CGenericAlgorithmTransformation*> algoTransformation_; |
---|
| 64 | |
---|
| 65 | //! Position of axis and domain in grid |
---|
| 66 | std::map<int, int> elementPosition2AxisPositionInGrid_, elementPosition2DomainPositionInGrid_; |
---|
| 67 | }; |
---|
| 68 | |
---|
| 69 | } |
---|
| 70 | #endif // __XIOS_GRID_GENERATE_HPP__ |
---|