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_config.h"
5 #include "teca_mesh.h"
6 #include "teca_shared_object.h"
7 
8 TECA_SHARED_OBJECT_FORWARD_DECL(teca_curvilinear_mesh)
9 
10 /// Data on a physically uniform curvilinear mesh.
12 {
13 public:
14  TECA_DATASET_STATIC_NEW(teca_curvilinear_mesh)
15  TECA_DATASET_NEW_INSTANCE()
16  TECA_DATASET_NEW_COPY()
17 
18  virtual ~teca_curvilinear_mesh() = default;
19 
20  // return a unique string identifier
21  std::string get_class_name() const override
22  { return "teca_curvilinear_mesh"; }
23 
24  // return the type code
25  int get_type_code() const override;
26 
27  // set/get metadata
28  TECA_DATASET_METADATA(whole_extent, unsigned long, 6)
29  TECA_DATASET_METADATA(extent, unsigned long, 6)
30  TECA_DATASET_METADATA(bounds, double, 6)
31  TECA_DATASET_METADATA(periodic_in_x, int, 1)
32  TECA_DATASET_METADATA(periodic_in_y, int, 1)
33  TECA_DATASET_METADATA(periodic_in_z, int, 1)
34  TECA_DATASET_METADATA(x_coordinate_variable, std::string, 1)
35  TECA_DATASET_METADATA(y_coordinate_variable, std::string, 1)
36  TECA_DATASET_METADATA(z_coordinate_variable, std::string, 1)
37  TECA_DATASET_METADATA(t_coordinate_variable, std::string, 1)
38 
39  /// get the number of points in the mesh
40  unsigned long get_number_of_points() const override;
41 
42  /// get the number of cells in the mesh
43  unsigned long get_number_of_cells() const override;
44 
45  // get x coordinate array
46  p_teca_variant_array get_x_coordinates()
47  { return m_coordinate_arrays->get("x"); }
48 
49  const_p_teca_variant_array get_x_coordinates() const
50  { return m_coordinate_arrays->get("x"); }
51 
52  // get y coordinate array
53  p_teca_variant_array get_y_coordinates()
54  { return m_coordinate_arrays->get("y"); }
55 
56  const_p_teca_variant_array get_y_coordinates() const
57  { return m_coordinate_arrays->get("y"); }
58 
59  // get z coordinate array
60  p_teca_variant_array get_z_coordinates()
61  { return m_coordinate_arrays->get("z"); }
62 
63  const_p_teca_variant_array get_z_coordinates() const
64  { return m_coordinate_arrays->get("z"); }
65 
66  // set coordinate arrays
67  void set_x_coordinates(const std::string &name,
68  const p_teca_variant_array &array);
69 
70  void set_y_coordinates(const std::string &name,
71  const p_teca_variant_array &array);
72 
73  void set_z_coordinates(const std::string &name,
74  const p_teca_variant_array &array);
75 
76  /// @copydoc teca_dataset::copy(const const_p_teca_dataset &,allocator)
77  void copy(const const_p_teca_dataset &other,
78  allocator alloc = allocator::malloc) override;
79 
80  /// @copydoc teca_dataset::shallow_copy(const p_teca_dataset &)
81  void shallow_copy(const p_teca_dataset &other) override;
82 
83  // copy metadata. always a deep copy.
84  void copy_metadata(const const_p_teca_dataset &other) override;
85 
86  // swap internals of the two objects
87  void swap(const p_teca_dataset &) override;
88 
89  // serialize the dataset to/from the given stream
90  // for I/O or communication
91  int to_stream(teca_binary_stream &) const override;
93 
94  // stream to/from human readable representation
95  int to_stream(std::ostream &) const override;
97 
98 #if defined(SWIG)
99 protected:
100 #else
101 public:
102 #endif
103  // NOTE: constructors are public to enable std::make_shared. do not use.
105 
106 private:
107  p_teca_array_collection m_coordinate_arrays;
108 };
109 
110 #endif
Serialize objects into a binary stream.
Definition: teca_binary_stream.h:17
Data on a physically uniform curvilinear mesh.
Definition: teca_curvilinear_mesh.h:12
void copy(const const_p_teca_dataset &other, allocator alloc=allocator::malloc) override
void copy_metadata(const const_p_teca_dataset &other) override
copy metadata. always a deep copy.
int to_stream(teca_binary_stream &) const override
serialize the dataset to the given stream for I/O or communication
int to_stream(std::ostream &) const override
send to stream in a human readable representation
int from_stream(teca_binary_stream &) override
deserialize the dataset from the given stream for I/O or communication
void shallow_copy(const p_teca_dataset &other) override
void swap(const p_teca_dataset &) override
swap internals of the two objects
virtual int from_stream(teca_binary_stream &)
deserialize the dataset from the given stream for I/O or communication
A base class for geometric data.
Definition: teca_mesh.h:20
p_teca_error_handler error_handler TECA_EXPORT
The global error handler instance.
std::shared_ptr< teca_variant_array > p_teca_variant_array
Definition: teca_variant_array.h:27
std::shared_ptr< const teca_variant_array > const_p_teca_variant_array
Definition: teca_variant_array.h:27