tLocalInterpCtx.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
---
tLocalInterpCtx.hh (2514B)
---
1 // Copyright (C) 2007--2011, 2013, 2014, 2015, 2017, 2018 Jed Brown, Ed Bueler and Constantine Khroulev
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 #ifndef __lic_hh
20 #define __lic_hh
21
22 #include <vector>
23 #include <memory>
24
25 #include "pism/util/interpolation.hh"
26 #include "pism/util/io/IO_Flags.hh"
27
28 namespace pism {
29
30 class IceGrid;
31 class grid_info;
32
33 //! The "local interpolation context" describes the processor's part of the source NetCDF file (for regridding).
34 /*!
35 The local interpolation context contains the details of how the processor's block
36 of the new computational domain fits into the domain of the netCDF file. Note that each vertical column
37 of the grid is owned by exactly one processor.
38
39 For any particular dimension, we have a new computational domain \f$[a,b]\f$ with
40 spacing \f$h\f$ so there are \f$n = (b - a) / h\f$ interior cells, indexed by \f$\{i_0, \dots, i_n\}\f$.
41 The local processor owns a range \f$\{i_m, \dots, i_{m'}\}\f$. Suppose the netCDF file has
42 domain \f$[A,B]\f$, spacing \f$H\f$, and \f$N = (B - A) / H\f$ cells. In order to interpolate
43 onto these points, we need the indices \f$\{I_m, \dots, I_{m'}\}\f$ of the netCDF file so that
44
45 \f[ [x(i_m), x(i_{m'})] \quad \text{is a subset of} \quad [x(I_m), x(I_{m'})] \f]
46
47 The arrays `start` and `count` have 4 integer entries, corresponding to the dimensions
48 \f$t, x, y, z(zb)\f$.
49 */
50 class LocalInterpCtx {
51 public:
52 LocalInterpCtx(const grid_info &input, const IceGrid &grid,
53 const std::vector<double> &z_output, InterpolationType type);
54 // Indices in netCDF file.
55 unsigned int start[4], count[4];
56 // indexes and coefficients for 1D linear interpolation
57 std::shared_ptr<Interpolation> x, y, z;
58 //! temporary storage
59 std::vector<double> buffer;
60 };
61
62 } // end of namespace pism
63
64 #endif // __lic_hh