source: XIOS/dev/dev_olga/src/node/zoom_axis.cpp @ 1158

Last change on this file since 1158 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.1 KB
Line 
1#include "zoom_axis.hpp"
2#include "type.hpp"
3
4namespace xios {
5
6  /// ////////////////////// Définitions ////////////////////// ///
7
8  CZoomAxis::CZoomAxis(void)
9    : CObjectTemplate<CZoomAxis>(), CZoomAxisAttributes(), CTransformation<CAxis>()
10  { /* Ne rien faire de plus */ }
11
12  CZoomAxis::CZoomAxis(const StdString & id)
13    : CObjectTemplate<CZoomAxis>(id), CZoomAxisAttributes(), CTransformation<CAxis>()
14  { /* Ne rien faire de plus */ }
15
16  CZoomAxis::~CZoomAxis(void)
17  {}
18
19  CTransformation<CAxis>* CZoomAxis::create(const StdString& id, xml::CXMLNode* node)
20  {
21    CZoomAxis* zoomAxis = CZoomAxisGroup::get("zoom_axis_definition")->createChild(id);
22    if (node) zoomAxis->parse(*node);
23    return static_cast<CTransformation<CAxis>*>(zoomAxis);
24  }
25
26  bool CZoomAxis::registerTrans()
27  {
28    return registerTransformation(TRANS_ZOOM_AXIS, CZoomAxis::create);
29  }
30
31  bool CZoomAxis::_dummyRegistered = CZoomAxis::registerTrans();
32
33  //----------------------------------------------------------------
34
35  StdString CZoomAxis::GetName(void)    { return StdString("zoom_axis"); }
36  StdString CZoomAxis::GetDefName(void) { return StdString("zoom_axis"); }
37  ENodeType CZoomAxis::GetType(void)    { return eZoomAxis; }
38
39  void CZoomAxis::checkValid(CAxis* axisDest)
40  {
41    int axisIBegin, axisNi, axisGlobalSize;
42    int begin, end, n;
43
44    axisIBegin = axisDest->begin.getValue();
45    axisNi     = axisDest->n.getValue();
46    axisGlobalSize   = axisDest->n_glo.getValue();
47
48    begin = (this->begin.isEmpty()) ?  0 : this->begin.getValue();
49    n     = (this->n.isEmpty()) ?  axisGlobalSize : this->n.getValue();
50    end   = begin+n-1;
51
52    if (begin < 0 || begin > axisGlobalSize - 1 || end < 0 || end > axisGlobalSize - 1
53        || n < 1 || n > axisGlobalSize || begin > end)
54      ERROR("CZoomAxis::checkValid(CAxis* axisDest)",
55            << "One or more attributes among 'begin' (" << begin << "), 'end' (" << end << "), 'n' (" << n << ") "
56            << "of axis transformation [ id = '" << axisDest->getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] are not well specified");
57
58    this->begin.setValue(begin);
59    this->n.setValue(n);
60
61  }
62
63}
Note: See TracBrowser for help on using the repository browser.