source: XIOS/trunk/src/filter/axis_algorithm_inverse.cpp @ 623

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

Implementing transformation algorithm: zoom axis (local commit)

+) Implement zoom axis: zoomed points are points not masked
+) Correct some minor bugs

Test
+) Ok with normal cases: zoom in the last of transformation list
+) There is still a bug in case of zoom then inverse

File size: 1.3 KB
Line 
1#include "axis_algorithm_inverse.hpp"
2
3namespace xios {
4
5CAxisAlgorithmInverse::CAxisAlgorithmInverse(CAxis* axisDestination, CAxis* axisSource)
6 : CAxisAlgorithmTransformation(axisDestination, axisSource)
7{
8  if (axisDestination->size.getValue() != axisSource->size.getValue())
9  {
10    ERROR("CAxisAlgorithmInverse::CAxisAlgorithmInverse(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
17  axisDestGlobalSize_ = axisDestination->size.getValue();
18  int niDest = axisDestination->ni.getValue();
19  int ibeginDest = axisDestination->ibegin.getValue();
20
21  for (int idx = 0; idx < niDest; ++idx)
22    if ((axisDestination->mask)(idx)) axisDestGlobalIndex_.push_back(ibeginDest+idx);
23  this->computeIndexSourceMapping();
24}
25
26void CAxisAlgorithmInverse::computeIndexSourceMapping()
27{
28  std::map<int, std::vector<int> >& transMap = this->transformationMapping_;
29
30  int globalIndexSize = axisDestGlobalIndex_.size();
31  for (int idx = 0; idx < globalIndexSize; ++idx)
32    transMap[axisDestGlobalIndex_[idx]].push_back(axisDestGlobalSize_-axisDestGlobalIndex_[idx]-1);
33}
34
35}
Note: See TracBrowser for help on using the repository browser.