[888] | 1 | #include "reduce_axis_to_scalar.hpp" |
---|
| 2 | #include "type.hpp" |
---|
| 3 | |
---|
| 4 | namespace xios { |
---|
| 5 | |
---|
| 6 | /// ////////////////////// Définitions ////////////////////// /// |
---|
| 7 | |
---|
| 8 | CReduceAxisToScalar::CReduceAxisToScalar(void) |
---|
| 9 | : CObjectTemplate<CReduceAxisToScalar>(), CReduceAxisToScalarAttributes(), CTransformation<CScalar>() |
---|
| 10 | { /* Ne rien faire de plus */ } |
---|
| 11 | |
---|
| 12 | CReduceAxisToScalar::CReduceAxisToScalar(const StdString & id) |
---|
| 13 | : CObjectTemplate<CReduceAxisToScalar>(id), CReduceAxisToScalarAttributes(), CTransformation<CScalar>() |
---|
| 14 | { /* Ne rien faire de plus */ } |
---|
| 15 | |
---|
| 16 | CReduceAxisToScalar::~CReduceAxisToScalar(void) |
---|
| 17 | {} |
---|
| 18 | |
---|
| 19 | CTransformation<CScalar>* CReduceAxisToScalar::create(const StdString& id, xml::CXMLNode* node) |
---|
| 20 | { |
---|
[891] | 21 | CReduceAxisToScalar* reduceAxis = CReduceAxisToScalarGroup::get("reduce_axis_to_scalar_definition")->createChild(id); |
---|
[888] | 22 | if (node) reduceAxis->parse(*node); |
---|
| 23 | return static_cast<CTransformation<CScalar>*>(reduceAxis); |
---|
| 24 | } |
---|
| 25 | |
---|
| 26 | bool CReduceAxisToScalar::registerTrans() |
---|
| 27 | { |
---|
| 28 | return registerTransformation(TRANS_REDUCE_AXIS_TO_SCALAR, CReduceAxisToScalar::create); |
---|
| 29 | } |
---|
| 30 | |
---|
| 31 | bool CReduceAxisToScalar::_dummyRegistered = CReduceAxisToScalar::registerTrans(); |
---|
| 32 | |
---|
| 33 | //---------------------------------------------------------------- |
---|
| 34 | |
---|
[891] | 35 | StdString CReduceAxisToScalar::GetName(void) { return StdString("reduce_axis_to_scalar"); } |
---|
| 36 | StdString CReduceAxisToScalar::GetDefName(void) { return StdString("reduce_axis_to_scalar"); } |
---|
[888] | 37 | ENodeType CReduceAxisToScalar::GetType(void) { return eReduceAxisToScalar; } |
---|
| 38 | |
---|
| 39 | void CReduceAxisToScalar::checkValid(CScalar* scalarDst) |
---|
| 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("CReduceAxisToScalar::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 | } |
---|