MI - Fimex
CDMBorderSmoothing.h
Go to the documentation of this file.
1 /* -*- c++ -*-
2  * Fimex, CDMBorderSmoothing.h
3  *
4  * (C) Copyright 2013, met.no
5  *
6  * Project Info: https://wiki.met.no/fimex/start
7  *
8  * This library is free software; you can redistribute it and/or modify it
9  * under the terms of the GNU Lesser General Public License as published by
10  * the Free Software Foundation; either version 2.1 of the License, or
11  * (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
16  * License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
21  * USA.
22  *
23  * Created on: Nov 5, 2013
24  * Author: Alexander Bürger
25  */
26 
27 #ifndef fimex_CDMBorderSmoothing_H
28 #define fimex_CDMBorderSmoothing_H 1
29 
30 #include "fimex/CDMReader.h"
32 #include "fimex/Data.h"
33 
34 namespace MetNoFimex {
35 
36 struct CDMBorderSmoothingPrivate;
37 
50 class CDMBorderSmoothing : public CDMReader {
51 public:
56  class Smoothing {
57  public:
58  void setHorizontalSizes(size_t sizeX, size_t sizeY)
59  { sizeX_ = sizeX; sizeY_ = sizeY; }
60 
61  virtual double operator()(size_t curX, size_t curY, double valueI, double valueO) = 0;
62 
63  virtual ~Smoothing() {}
64 
65  protected:
66  size_t sizeX_, sizeY_;
67  };
68 
69  typedef boost::shared_ptr<Smoothing> SmoothingPtr;
70 
73  public:
74  virtual ~SmoothingFactory() {}
75  virtual SmoothingPtr operator()(const std::string& varName) = 0;
76  };
77 
78  typedef boost::shared_ptr<SmoothingFactory> SmoothingFactoryPtr;
79 
80 public:
82  CDMBorderSmoothing(boost::shared_ptr<CDMReader> inner, boost::shared_ptr<CDMReader> outer,
83  int gridInterpolationMethod = MIFI_INTERPOL_BILINEAR);
84 
86  void setSmoothing(SmoothingFactoryPtr smoothingFactory);
87 
89  void setUseOuterIfInnerUndefined(bool useOuter);
90 
92  virtual boost::shared_ptr<Data> getDataSlice(const std::string &varName, std::size_t unLimDimPos);
93 
94 private:
96 };
97 
98 typedef boost::shared_ptr<CDMBorderSmoothing> CDMBorderSmoothingPtr;
99 
100 } // namespace MetNoFimex
101 
102 #endif /* fimex_CDMBorderSmoothing_H */
CDMBorderSmoothing(boost::shared_ptr< CDMReader > inner, boost::shared_ptr< CDMReader > outer, int gridInterpolationMethod=MIFI_INTERPOL_BILINEAR)
Smooth transition to &#39;outer&#39; from inner&#39;s data. Returns data on inner grid.
basic_string< char > string
void setSmoothing(SmoothingFactoryPtr smoothingFactory)
Change the smooting function factory.
void setHorizontalSizes(size_t sizeX, size_t sizeY)
Definition: CDMBorderSmoothing.h:58
size_t sizeX_
Definition: CDMBorderSmoothing.h:66
virtual boost::shared_ptr< Data > getDataSlice(const std::string &varName, std::size_t unLimDimPos)
virtual DataPtr getDataSlice(const std::string &varName, size_t unLimDimPos)=0
data-reading function to be called from the CDMWriter
A factory for creating smoothing function objects.
Definition: CDMBorderSmoothing.h:72
boost::shared_ptr< Smoothing > SmoothingPtr
Definition: CDMBorderSmoothing.h:69
Definition: C_CDMReader.h:35
Basic interface for CDM reading and manipulation classes.
Definition: CDMReader.h:53
boost::shared_ptr< SmoothingFactory > SmoothingFactoryPtr
Definition: CDMBorderSmoothing.h:78
virtual ~SmoothingFactory()
Definition: CDMBorderSmoothing.h:74
boost::shared_ptr< CDMBorderSmoothing > CDMBorderSmoothingPtr
Definition: CDMBorderSmoothing.h:98
size_t sizeY_
Definition: CDMBorderSmoothing.h:66
Definition: CDMBorderSmoothing.h:50
void setUseOuterIfInnerUndefined(bool useOuter)
Decide if the outer value shall be used if the inner value is undefined. Default: true...
Definition: mifi_constants.h:68
virtual double operator()(size_t curX, size_t curY, double valueI, double valueO)=0
Definition: CDMBorderSmoothing.h:56
virtual ~Smoothing()
Definition: CDMBorderSmoothing.h:63