tColumnInterpolation.hh - pism - [fork] customized build of PISM, the parallel ice sheet model (tillflux branch)
HTML git clone git://src.adamsgaard.dk/pism
DIR Log
DIR Files
DIR Refs
DIR LICENSE
---
tColumnInterpolation.hh (2327B)
---
1 /* Copyright (C) 2014, 2015 PISM Authors
2 *
3 * This file is part of PISM.
4 *
5 * PISM is free software; you can redistribute it and/or modify it under the
6 * terms of the GNU General Public License as published by the Free Software
7 * Foundation; either version 3 of the License, or (at your option) any later
8 * version.
9 *
10 * PISM is distributed in the hope that it will be useful, but WITHOUT ANY
11 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with PISM; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20 #ifndef _COLUMNINTERPOLATION_H_
21 #define _COLUMNINTERPOLATION_H_
22
23 #include <vector>
24
25 namespace pism {
26
27 class ColumnInterpolation {
28 public:
29 ColumnInterpolation(const std::vector<double> &z_coarse,
30 const std::vector<double> &z_fine);
31
32 void coarse_to_fine(const double *input, unsigned int ks, double *result) const;
33 void fine_to_coarse(const double *input, double *result) const;
34
35 // These two methods allocate fresh storage for the output.
36 std::vector<double> coarse_to_fine(const std::vector<double> &input, unsigned int ks) const;
37 std::vector<double> fine_to_coarse(const std::vector<double> &input) const;
38
39 unsigned int Mz_coarse() const;
40 const std::vector<double>& z_coarse() const;
41
42 unsigned int Mz_fine() const;
43 double dz_fine() const;
44 const std::vector<double>& z_fine() const;
45 private:
46 std::vector<double> m_z_fine, m_z_coarse;
47 std::vector<double> m_constants;
48
49 // Array m_coarse2fine contains indices of the ice coarse vertical grid
50 // that are just below a level of the fine grid. I.e. m_coarse2fine[k] is
51 // the coarse grid level just below fine-grid level k (zlevels_fine[k]).
52 // Similarly for other arrays below.
53 std::vector<unsigned int> m_coarse2fine, m_fine2coarse;
54 bool m_use_linear_interpolation;
55
56 void init_interpolation();
57 void coarse_to_fine_linear(const double *input, unsigned int ks, double *result) const;
58 void coarse_to_fine_quadratic(const double *input, unsigned int ks, double *result) const;
59 };
60
61 } // end of namespace pism
62
63 #endif /* _COLUMNINTERPOLATION_H_ */