1 | #include "interpolate_domain.hpp" |
---|
2 | #include "domain_algorithm_interpolate.hpp" |
---|
3 | #include "type.hpp" |
---|
4 | |
---|
5 | namespace xios { |
---|
6 | |
---|
7 | /// ////////////////////// Définitions ////////////////////// /// |
---|
8 | |
---|
9 | CInterpolateDomain::CInterpolateDomain(void) |
---|
10 | : CObjectTemplate<CInterpolateDomain>(), CInterpolateDomainAttributes(), CTransformation<CDomain>() |
---|
11 | { /* Ne rien faire de plus */ } |
---|
12 | |
---|
13 | CInterpolateDomain::CInterpolateDomain(const StdString & id) |
---|
14 | : CObjectTemplate<CInterpolateDomain>(id), CInterpolateDomainAttributes(), CTransformation<CDomain>() |
---|
15 | { /* Ne rien faire de plus */ } |
---|
16 | |
---|
17 | CInterpolateDomain::~CInterpolateDomain(void) |
---|
18 | {} |
---|
19 | |
---|
20 | CTransformation<CDomain>* CInterpolateDomain::create(const StdString& id, xml::CXMLNode* node) |
---|
21 | { |
---|
22 | CInterpolateDomain* interpDomain = CInterpolateDomainGroup::get("interpolate_domain_definition")->createChild(id); |
---|
23 | if (node) interpDomain->parse(*node); |
---|
24 | return static_cast<CTransformation<CDomain>*>(interpDomain); |
---|
25 | } |
---|
26 | |
---|
27 | bool CInterpolateDomain::_dummyRegistered = CInterpolateDomain::registerTrans(); |
---|
28 | bool CInterpolateDomain::registerTrans() |
---|
29 | { |
---|
30 | return registerTransformation(TRANS_INTERPOLATE_DOMAIN, {create, getTransformation}); |
---|
31 | } |
---|
32 | |
---|
33 | //---------------------------------------------------------------- |
---|
34 | |
---|
35 | StdString CInterpolateDomain::GetName(void) { return StdString("interpolate_domain"); } |
---|
36 | StdString CInterpolateDomain::GetDefName(void) { return StdString("interpolate_domain"); } |
---|
37 | ENodeType CInterpolateDomain::GetType(void) { return eInterpolateDomain; } |
---|
38 | |
---|
39 | void CInterpolateDomain::checkValid(CDomain* domainSrc) |
---|
40 | { |
---|
41 | int order = 2; |
---|
42 | if (!this->order.isEmpty()) order = this->order.getValue(); |
---|
43 | else this->order.setValue(order); |
---|
44 | if (order < 1) |
---|
45 | { |
---|
46 | ERROR("void CInterpolateDomain::checkValid(CDomain* domainSrc)", |
---|
47 | << "Interpolation order is less than 1, it should be greater than 0." |
---|
48 | << "Please define a correct one") ; |
---|
49 | } |
---|
50 | |
---|
51 | bool detect_missing_value=false ; |
---|
52 | if (!this->detect_missing_value.isEmpty()) detect_missing_value = this->detect_missing_value.getValue(); |
---|
53 | else this->detect_missing_value.setValue(detect_missing_value); |
---|
54 | |
---|
55 | bool renormalize=false ; |
---|
56 | if (!this->renormalize.isEmpty()) renormalize = this->renormalize.getValue(); |
---|
57 | else this->renormalize.setValue(renormalize); |
---|
58 | |
---|
59 | bool quantity=false ; |
---|
60 | if (!this->quantity.isEmpty()) quantity = this->quantity.getValue(); |
---|
61 | else this->quantity.setValue(quantity); |
---|
62 | |
---|
63 | if (this->mode.isEmpty()) this->mode.setValue(mode_attr::compute); |
---|
64 | if (this->write_weight.isEmpty()) this->write_weight.setValue(false); |
---|
65 | |
---|
66 | if (this->read_write_convention.isEmpty()) this->read_write_convention.setValue(read_write_convention_attr::fortran); |
---|
67 | |
---|
68 | |
---|
69 | } |
---|
70 | |
---|
71 | shared_ptr<CGenericAlgorithmTransformation> CInterpolateDomain::createAlgorithm(bool isSource, |
---|
72 | CGrid* gridDst, CGrid* gridSrc, |
---|
73 | int elementPositionInGrid, |
---|
74 | std::map<int, int>& elementPositionInGridSrc2ScalarPosition, |
---|
75 | std::map<int, int>& elementPositionInGridSrc2AxisPosition, |
---|
76 | std::map<int, int>& elementPositionInGridSrc2DomainPosition, |
---|
77 | std::map<int, int>& elementPositionInGridDst2ScalarPosition, |
---|
78 | std::map<int, int>& elementPositionInGridDst2AxisPosition, |
---|
79 | std::map<int, int>& elementPositionInGridDst2DomainPosition) |
---|
80 | { |
---|
81 | return CDomainAlgorithmInterpolate::create(isSource, gridDst, gridSrc, this, elementPositionInGrid, |
---|
82 | elementPositionInGridSrc2ScalarPosition, elementPositionInGridSrc2AxisPosition, elementPositionInGridSrc2DomainPosition, |
---|
83 | elementPositionInGridDst2ScalarPosition, elementPositionInGridDst2AxisPosition, elementPositionInGridDst2DomainPosition); |
---|
84 | } |
---|
85 | } |
---|