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

Last change on this file since 827 was 827, checked in by mhnguyen, 5 years ago

Implementing dynamic interpolation on axis

+) Change grid transformation to make it more flexible
+) Make some small improvements

Test
+) On Curie
+) All test pass

File size: 2.2 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  //----------------------------------------------------------------
21
22  StdString CInterpolateAxis::GetName(void)    { return StdString("interpolate_axis"); }
23  StdString CInterpolateAxis::GetDefName(void) { return StdString("interpolate_axis"); }
24  ENodeType CInterpolateAxis::GetType(void)    { return eInterpolateAxis; }
25
26  void CInterpolateAxis::checkValid(CAxis* axisSrc)
27  {
28    if (this->order.isEmpty()) this->order.setValue(2);
29    int order = this->order.getValue();
30    if (order >= axisSrc->n_glo.getValue())
31    {
32      ERROR("CInterpolateAxis::checkValid(CAxis* axisSrc)",
33             << "Order of interpolation is greater than global size of axis source"
34             << "Size of axis source " <<axisSrc->getId() << " is " << axisSrc->n_glo.getValue()  << std::endl
35             << "Order of interpolation is " << order );
36    }
37
38
39    if (!this->coordinate.isEmpty())
40    {
41      StdString coordinate = this->coordinate.getValue();
42      if (!CField::has(coordinate))
43        ERROR("CInterpolateAxis::checkValid(CAxis* axisSrc)",
44               << "Coordinate field whose id " << coordinate << "does not exist "
45               << "Please define one");
46    }
47  }
48
49  std::vector<StdString> CInterpolateAxis::checkAuxInputs_()
50  {
51    std::vector<StdString> auxInputs;
52    if (!this->coordinate.isEmpty())
53    {
54      StdString coordinate = this->coordinate.getValue();
55      if (!CField::has(coordinate))
56        ERROR("CInterpolateAxis::checkValid(CAxis* axisSrc)",
57               << "Coordinate field whose id " << coordinate << "does not exist "
58               << "Please define one");
59      auxInputs.push_back(coordinate);
60    }
61
62    return auxInputs;
63  }
64}
Note: See TracBrowser for help on using the repository browser.