1 | #include "interpolate_axis.hpp" |
---|
2 | #include "type.hpp" |
---|
3 | #include "field.hpp" |
---|
4 | |
---|
5 | namespace xios { |
---|
6 | |
---|
7 | /// ////////////////////// Définitions ////////////////////// /// |
---|
8 | |
---|
9 | CInterpolateAxis::CInterpolateAxis(void) |
---|
10 | : CObjectTemplate<CInterpolateAxis>(), CInterpolateAxisAttributes(), CTransformation<CAxis>() |
---|
11 | { /* Ne rien faire de plus */ } |
---|
12 | |
---|
13 | CInterpolateAxis::CInterpolateAxis(const StdString & id) |
---|
14 | : CObjectTemplate<CInterpolateAxis>(id), CInterpolateAxisAttributes(), CTransformation<CAxis>() |
---|
15 | { /* Ne rien faire de plus */ } |
---|
16 | |
---|
17 | CInterpolateAxis::~CInterpolateAxis(void) |
---|
18 | {} |
---|
19 | |
---|
20 | CTransformation<CAxis>* CInterpolateAxis::create(const StdString& id, xml::CXMLNode* node) |
---|
21 | { |
---|
22 | CInterpolateAxis* interpAxis = CInterpolateAxisGroup::get("interpolate_axis_definition")->createChild(id); |
---|
23 | if (node) interpAxis->parse(*node); |
---|
24 | return static_cast<CTransformation<CAxis>*>(interpAxis); |
---|
25 | } |
---|
26 | |
---|
27 | bool CInterpolateAxis::registerTrans() |
---|
28 | { |
---|
29 | return registerTransformation(TRANS_INTERPOLATE_AXIS, CInterpolateAxis::create); |
---|
30 | } |
---|
31 | |
---|
32 | bool CInterpolateAxis::_dummyRegistered = CInterpolateAxis::registerTrans(); |
---|
33 | |
---|
34 | //---------------------------------------------------------------- |
---|
35 | |
---|
36 | StdString CInterpolateAxis::GetName(void) { return StdString("interpolate_axis"); } |
---|
37 | StdString CInterpolateAxis::GetDefName(void) { return StdString("interpolate_axis"); } |
---|
38 | ENodeType CInterpolateAxis::GetType(void) { return eInterpolateAxis; } |
---|
39 | |
---|
40 | void CInterpolateAxis::checkValid(CAxis* axisSrc) |
---|
41 | { |
---|
42 | if (this->order.isEmpty()) this->order.setValue(1); |
---|
43 | int order = this->order.getValue(); |
---|
44 | if (order >= axisSrc->n_glo.getValue()) |
---|
45 | { |
---|
46 | ERROR("CInterpolateAxis::checkValid(CAxis* axisSrc)", |
---|
47 | << "Order of interpolation is greater than global size of axis source" |
---|
48 | << "Size of axis source " <<axisSrc->getId() << " is " << axisSrc->n_glo.getValue() << std::endl |
---|
49 | << "Order of interpolation is " << order ); |
---|
50 | } |
---|
51 | |
---|
52 | if (order < 1) |
---|
53 | { |
---|
54 | ERROR("CInterpolateAxis::checkValid(CAxis* axisSrc)", |
---|
55 | << "Order of interpolation is smaller than 1" |
---|
56 | << "Size of axis source " <<axisSrc->getId() << " is " << axisSrc->n_glo.getValue() << std::endl |
---|
57 | << "Order of interpolation is " << order ); |
---|
58 | } |
---|
59 | |
---|
60 | |
---|
61 | if (!this->coordinate.isEmpty()) |
---|
62 | { |
---|
63 | StdString coordinate = this->coordinate.getValue(); |
---|
64 | if (!CField::has(coordinate)) |
---|
65 | ERROR("CInterpolateAxis::checkValid(CAxis* axisSrc)", |
---|
66 | << "Coordinate field whose id " << coordinate << "does not exist " |
---|
67 | << "Please define one"); |
---|
68 | } |
---|
69 | } |
---|
70 | |
---|
71 | std::vector<StdString> CInterpolateAxis::checkAuxInputs_() |
---|
72 | { |
---|
73 | std::vector<StdString> auxInputs; |
---|
74 | if (!this->coordinate.isEmpty()) |
---|
75 | { |
---|
76 | StdString coordinate = this->coordinate.getValue(); |
---|
77 | if (!CField::has(coordinate)) |
---|
78 | ERROR("CInterpolateAxis::checkValid(CAxis* axisSrc)", |
---|
79 | << "Coordinate field whose id " << coordinate << "does not exist " |
---|
80 | << "Please define one"); |
---|
81 | auxInputs.push_back(coordinate); |
---|
82 | } |
---|
83 | |
---|
84 | return auxInputs; |
---|
85 | } |
---|
86 | } |
---|