TECA
The Toolkit for Extreme Climate Analysis
teca_curvilinear_mesh.h
1 #ifndef teca_curvilinear_mesh_h
2 #define teca_curvilinear_mesh_h
3 
4 #include "teca_mesh.h"
5 #include "teca_shared_object.h"
6 TECA_SHARED_OBJECT_FORWARD_DECL(teca_curvilinear_mesh)
7 
8 /// Data on a physically uniform curvilinear mesh.
10 {
11 public:
12  TECA_DATASET_STATIC_NEW(teca_curvilinear_mesh)
13  TECA_DATASET_NEW_INSTANCE()
14  TECA_DATASET_NEW_COPY()
15 
16  virtual ~teca_curvilinear_mesh() = default;
17 
18  // return a unique string identifier
19  std::string get_class_name() const override
20  { return "teca_curvilinear_mesh"; }
21 
22  // return the type code
23  int get_type_code() const override;
24 
25  // set/get metadata
26  TECA_DATASET_METADATA(whole_extent, unsigned long, 6)
27  TECA_DATASET_METADATA(extent, unsigned long, 6)
28  TECA_DATASET_METADATA(bounds, double, 6)
29  TECA_DATASET_METADATA(periodic_in_x, int, 1)
30  TECA_DATASET_METADATA(periodic_in_y, int, 1)
31  TECA_DATASET_METADATA(periodic_in_z, int, 1)
32  TECA_DATASET_METADATA(x_coordinate_variable, std::string, 1)
33  TECA_DATASET_METADATA(y_coordinate_variable, std::string, 1)
34  TECA_DATASET_METADATA(z_coordinate_variable, std::string, 1)
35  TECA_DATASET_METADATA(t_coordinate_variable, std::string, 1)
36 
37  /// get the number of points in the mesh
38  unsigned long get_number_of_points() const override;
39 
40  /// get the number of cells in the mesh
41  unsigned long get_number_of_cells() const override;
42 
43  // get x coordinate array
44  p_teca_variant_array get_x_coordinates()
45  { return m_coordinate_arrays->get("x"); }
46 
47  const_p_teca_variant_array get_x_coordinates() const
48  { return m_coordinate_arrays->get("x"); }
49 
50  // get y coordinate array
51  p_teca_variant_array get_y_coordinates()
52  { return m_coordinate_arrays->get("y"); }
53 
54  const_p_teca_variant_array get_y_coordinates() const
55  { return m_coordinate_arrays->get("y"); }
56 
57  // get z coordinate array
58  p_teca_variant_array get_z_coordinates()
59  { return m_coordinate_arrays->get("z"); }
60 
61  const_p_teca_variant_array get_z_coordinates() const
62  { return m_coordinate_arrays->get("z"); }
63 
64  // set coordinate arrays
65  void set_x_coordinates(const std::string &name,
66  const p_teca_variant_array &array);
67 
68  void set_y_coordinates(const std::string &name,
69  const p_teca_variant_array &array);
70 
71  void set_z_coordinates(const std::string &name,
72  const p_teca_variant_array &array);
73 
74  // copy data and metadata. shallow copy uses reference
75  // counting, while copy duplicates the data.
76  void copy(const const_p_teca_dataset &) override;
77  void shallow_copy(const p_teca_dataset &) override;
78 
79  // copy metadata. always a deep copy.
80  void copy_metadata(const const_p_teca_dataset &other) override;
81 
82  // swap internals of the two objects
83  void swap(const p_teca_dataset &) override;
84 
85  // serialize the dataset to/from the given stream
86  // for I/O or communication
87  int to_stream(teca_binary_stream &) const override;
88  int from_stream(teca_binary_stream &) override;
89 
90  // stream to/from human readable representation
91  int to_stream(std::ostream &) const override;
92 
93 protected:
95 
96 private:
97  p_teca_array_collection m_coordinate_arrays;
98 };
99 
100 #endif
teca_binary_stream
Serialize objects into a binary stream.
Definition: teca_binary_stream.h:15
teca_mesh
A base class for geometric data.
Definition: teca_mesh.h:18
teca_curvilinear_mesh
Data on a physically uniform curvilinear mesh.
Definition: teca_curvilinear_mesh.h:9
const_p_teca_variant_array
std::shared_ptr< const teca_variant_array > const_p_teca_variant_array
Definition: teca_variant_array.h:22
teca_shared_object.h
p_teca_variant_array
std::shared_ptr< teca_variant_array > p_teca_variant_array
Definition: teca_variant_array.h:22
teca_py_array::copy
bool copy(teca_variant_array *varr, PyObject *obj)
Copy values from the object into variant array.
Definition: teca_py_array.h:270