TECA
teca_cartesian_mesh_regrid.h
1 #ifndef teca_cartesian_mesh_regrid_h
2 #define teca_cartesian_mesh_regrid_h
3 
4 #include "teca_shared_object.h"
5 #include "teca_algorithm.h"
6 #include "teca_metadata.h"
7 #include "teca_variant_array_fwd.h"
8 
9 #include <string>
10 #include <vector>
11 
12 TECA_SHARED_OBJECT_FORWARD_DECL(teca_cartesian_mesh_regrid)
13 
14 
28 {
29 public:
30  TECA_ALGORITHM_STATIC_NEW(teca_cartesian_mesh_regrid)
31  TECA_ALGORITHM_DELETE_COPY_ASSIGN(teca_cartesian_mesh_regrid)
32  TECA_ALGORITHM_CLASS_NAME(teca_cartesian_mesh_regrid)
34 
35  // report/initialize to/from Boost program options
36  // objects.
37  TECA_GET_ALGORITHM_PROPERTIES_DESCRIPTION()
38  TECA_SET_ALGORITHM_PROPERTIES()
39 
40  // set the list of arrays to move from the source
41  // to the target
42  TECA_ALGORITHM_VECTOR_PROPERTY(std::string, array)
43 
44  // set the input connection from which metadata such as arrays
45  // and time steps are taken from.
46  TECA_ALGORITHM_PROPERTY(int, target_input)
47 
48  // set the interpolation mode used in transfering
49  // data between meshes of differing resolution.
50  // in nearest mode value at the nearest grid point
51  // is used, in linear mode bi/tri linear interpolation
52  // is used.
53  enum {nearest=0, linear=1};
54  TECA_ALGORITHM_PROPERTY(int, interpolation_mode)
55  void set_interpolation_mode_nearest(){ interpolation_mode = nearest; }
56  void set_interpolation_mode_linear(){ interpolation_mode = linear; }
57 
58 protected:
60 
61 private:
62  teca_metadata get_output_metadata(unsigned int port,
63  const std::vector<teca_metadata> &input_md) override;
64 
65  std::vector<teca_metadata> get_upstream_request(
66  unsigned int port, const std::vector<teca_metadata> &input_md,
67  const teca_metadata &request) override;
68 
69  const_p_teca_dataset execute(unsigned int port,
70  const std::vector<const_p_teca_dataset> &input_data,
71  const teca_metadata &request) override;
72 
73 private:
74  std::vector<std::string> arrays;
75  int target_input;
76  int interpolation_mode;
77 };
78 
79 #endif
teca_metadata
Definition: teca_metadata.h:17
teca_cartesian_mesh_regrid
transfer data between overlapping meshes of potentially different resolution
Definition: teca_cartesian_mesh_regrid.h:28
teca_algorithm
Definition: teca_algorithm.h:25