source: XIOS/trunk/src/node/zoom_axis.cpp @ 676

Last change on this file since 676 was 666, checked in by mhnguyen, 9 years ago

Change name of several axis attributes and remove some redundant variable of domain

+) Change name of axis attributes to make them consistent with ones of domain
+) Remove zoom_client_* of domain

Test
+) On Curie
+) All tests pass and are correct

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  //----------------------------------------------------------------
20
21  StdString CZoomAxis::GetName(void)    { return StdString("zoom_axis"); }
22  StdString CZoomAxis::GetDefName(void) { return StdString("zoom_axis"); }
23  ENodeType CZoomAxis::GetType(void)    { return eZoomAxis; }
24
25  void CZoomAxis::checkValid(CAxis* axisDest)
26  {
27    int axisIBegin, axisNi, axisGlobalSize;
28    int zoom_begin, zoom_end, zoom_size;
29
30    axisIBegin = axisDest->begin.getValue();
31    axisNi     = axisDest->n.getValue();
32    axisGlobalSize   = axisDest->n_glo.getValue();
33
34    zoom_begin = (this->zoom_begin.isEmpty()) ?  0 : this->zoom_begin.getValue() ;
35    zoom_size  = (this->zoom_size.isEmpty()) ?  axisGlobalSize : this->zoom_size.getValue() ;
36    zoom_end   = (this->zoom_end.isEmpty()) ?  (axisGlobalSize - 1) : this->zoom_end.getValue() ;
37
38    if (this->zoom_begin.isEmpty()) zoom_begin=zoom_end-zoom_size+1;
39    if (this->zoom_size.isEmpty()) zoom_size=zoom_end-zoom_begin+1;
40    if (this->zoom_end.isEmpty()) zoom_end=zoom_begin+zoom_size-1;
41
42    if ((zoom_begin < 0) || (zoom_begin > axisGlobalSize-1) || (zoom_end<0) || (zoom_end>axisGlobalSize-1) || (zoom_size<1) || (zoom_size>axisGlobalSize) || (zoom_begin>zoom_end))
43      ERROR("CZoomAxis::checkAttributes(void)",
44            << "One or more attributes among <zoom_begin>, <zoom_end>, <zoom_size> of axis transformation [ id = '" << axisDest->getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] are not well specified");
45
46    this->zoom_begin.setValue(zoom_begin) ;
47    this->zoom_end.setValue(zoom_end) ;
48    this->zoom_size.setValue(zoom_size) ;
49
50  }
51
52}
Note: See TracBrowser for help on using the repository browser.