WSL/SLF GitLab Repository

ResamplingAlgorithms.h 2.73 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/***********************************************************************************/
/*  Copyright 2009 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
/***********************************************************************************/
/* This file is part of MeteoIO.
    MeteoIO is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    MeteoIO is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with MeteoIO.  If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __RESAMPLINGALGORITHMS_H__
#define __RESAMPLINGALGORITHMS_H__

#include <meteoio/MeteoData.h>
#include <meteoio/StationData.h>
#include <meteoio/libinterpol1D.h>

#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <map>

namespace mio {

typedef void(*resamplingptr)(const unsigned int& position, const MeteoData::Parameters& paramindex,
					    const std::vector<std::string>& taskargs,
                             std::vector<MeteoData>& vecM, std::vector<StationData>& vecS);

/**
 * @class ResamplingAlgorithms
 * @brief 
 * @author Thomas Egger
 * @date   2010-06-25
 */
class ResamplingAlgorithms {
	public:

		static const resamplingptr& getAlgorithm(const std::string& algorithmname);

		//Available algorithms
		static void LinearResampling(const unsigned int& position, const MeteoData::Parameters& paramindex,
51
52
		                             const std::vector<std::string>& taskargs,
		                             std::vector<MeteoData>& vecM, std::vector<StationData>& vecS);
53
		static void NearestNeighbour(const unsigned int& position, const MeteoData::Parameters& paramindex, 
54
55
56
57
58
59
		                             const std::vector<std::string>& taskargs,
		                             std::vector<MeteoData>& vecM, std::vector<StationData>& vecS);

		static void Accumulate(const unsigned int& pos, const MeteoData::Parameters& paramindex,
		                       const std::vector<std::string>& taskargs,
		                       std::vector<MeteoData>& vecM, std::vector<StationData>& vecS);
60
61
62
63
64
65
66
67
68
		
 	private:
		static std::map<std::string, resamplingptr> algorithmMap;
		static const bool __init;    ///<helper variable to enable the init of static collection data
		static bool initStaticData();///<initialize the static map algorithmMap
};
} //end namespace

#endif