source: XIOS/trunk/src/filter/axis_inverse.cpp @ 620

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

Implementing generic transformation algorithm (local commit)

+) Implement 3 important classes:

-gridTransformation to read transformation info from grid and interface with the rest of XIOS
-transformationMapping to be in charge of sending/receiving transformation info among clients
-transformationAlgorithm to represent various algorithms

+) Make some change on field to use the new classes

Test
+) Only test_new_features with inversed axis

File size: 1.1 KB
Line 
1#include "axis_inverse.hpp"
2
3namespace xios {
4
5CAxisInverse::CAxisInverse(CAxis* axisDestination, CAxis* axisSource)
6 : CAxisAlgorithmTransformation(axisDestination)
7{
8  if (axisDestination->size.getValue() != axisSource->size.getValue())
9  {
10    ERROR("CAxisInverse::CAxisInverse(CAxis* axisDestination, CAxis* axisSource)",
11           << "Two axis have different size"
12           << "Size of axis source " <<axisSource->getId() << " is " << axisSource->size.getValue()  << std::endl
13           << "Size of axis destionation " <<axisDestination->getId() << " is " << axisDestination->size.getValue());
14  }
15
16  axisDestGlobalSize_ = axisDestination->size.getValue();
17
18  this->computeIndexSourceMapping();
19}
20
21void CAxisInverse::computeIndexSourceMapping()
22{
23  std::map<int, std::vector<int> >& transMap = this->transformationMapping_;
24  if (!transMap.empty()) transMap.clear();
25
26  int globalIndexSize = axisDestGlobalIndex_.size();
27  for (int idx = 0; idx < globalIndexSize; ++idx)
28    transMap[axisDestGlobalIndex_[idx]].push_back(axisDestGlobalSize_-axisDestGlobalIndex_[idx]-1);
29}
30
31
32}
Note: See TracBrowser for help on using the repository browser.