source: XIOS/trunk/src/node/interpolate_axis.cpp @ 836

Last change on this file since 836 was 836, checked in by mhnguyen, 8 years ago

Exposing transformation to Fortran interface

+) Export zoom and axis transformation to Fortran interface

Test
+) On Curie
+) All work

File size: 2.7 KB
Line 
1#include "interpolate_axis.hpp"
2#include "type.hpp"
3#include "field.hpp"
4
5namespace 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(2);
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
53    if (!this->coordinate.isEmpty())
54    {
55      StdString coordinate = this->coordinate.getValue();
56      if (!CField::has(coordinate))
57        ERROR("CInterpolateAxis::checkValid(CAxis* axisSrc)",
58               << "Coordinate field whose id " << coordinate << "does not exist "
59               << "Please define one");
60    }
61  }
62
63  std::vector<StdString> CInterpolateAxis::checkAuxInputs_()
64  {
65    std::vector<StdString> auxInputs;
66    if (!this->coordinate.isEmpty())
67    {
68      StdString coordinate = this->coordinate.getValue();
69      if (!CField::has(coordinate))
70        ERROR("CInterpolateAxis::checkValid(CAxis* axisSrc)",
71               << "Coordinate field whose id " << coordinate << "does not exist "
72               << "Please define one");
73      auxInputs.push_back(coordinate);
74    }
75
76    return auxInputs;
77  }
78}
Note: See TracBrowser for help on using the repository browser.