1 #ifndef teca_cartesian_mesh_h
2 #define teca_cartesian_mesh_h
4 #include "teca_config.h"
15 TECA_DATASET_NEW_INSTANCE()
16 TECA_DATASET_NEW_COPY()
21 TECA_DATASET_METADATA(whole_extent,
unsigned long, 6)
22 TECA_DATASET_METADATA(extent,
unsigned long, 6)
23 TECA_DATASET_METADATA(bounds,
double, 6)
24 TECA_DATASET_METADATA(periodic_in_x,
int, 1)
25 TECA_DATASET_METADATA(periodic_in_y,
int, 1)
26 TECA_DATASET_METADATA(periodic_in_z,
int, 1)
27 TECA_DATASET_METADATA(x_coordinate_variable, std::
string, 1)
28 TECA_DATASET_METADATA(y_coordinate_variable, std::
string, 1)
29 TECA_DATASET_METADATA(z_coordinate_variable, std::
string, 1)
30 TECA_DATASET_METADATA(t_coordinate_variable, std::
string, 1)
39 unsigned long array_extent[8]) const;
47 int get_array_shape(const std::
string &array_name,
48 unsigned long array_shape[4]) const;
54 std::tuple<
unsigned long,
unsigned long,
unsigned long,
unsigned long>
55 get_array_shape(const std::
string &array_name)
const
57 unsigned long array_shape[4] = {0};
58 if (this->get_array_shape(array_name, array_shape) < 0)
60 TECA_ERROR(
"Failed to get shape for \"" << array_name <<
"\"")
62 return std::make_tuple(array_shape[0], array_shape[1],
63 array_shape[2], array_shape[3]);
74 {
return m_coordinate_arrays->get(
"x"); }
77 {
return m_coordinate_arrays->get(
"x"); }
81 {
return m_coordinate_arrays->get(
"y"); }
84 {
return m_coordinate_arrays->get(
"y"); }
88 {
return m_coordinate_arrays->get(
"z"); }
91 {
return m_coordinate_arrays->get(
"z"); }
116 {
return "teca_cartesian_mesh"; }
122 void copy(
const const_p_teca_dataset &other,
123 allocator alloc = allocator::malloc)
override;
132 void swap(
const p_teca_dataset &)
override;
153 p_teca_array_collection m_coordinate_arrays;
Serialize objects into a binary stream.
Definition: teca_binary_stream.h:17
An object representing data on a stretched Cartesian mesh.
Definition: teca_cartesian_mesh.h:12
void update_y_coordinates(const p_teca_variant_array &array)
Update the y coordinate array.
void update_x_coordinates(const p_teca_variant_array &array)
Update the x coordinate array.
int from_stream(teca_binary_stream &) override
deserialize the dataset from the given stream for I/O or communication
void copy(const const_p_teca_dataset &other, allocator alloc=allocator::malloc) override
void shallow_copy(const p_teca_dataset &other) override
unsigned long get_number_of_points() const override
get the number of points in the mesh
p_teca_variant_array get_z_coordinates()
Get the z coordinate array.
Definition: teca_cartesian_mesh.h:87
p_teca_variant_array get_y_coordinates()
Get the y coordinate array.
Definition: teca_cartesian_mesh.h:80
void swap(const p_teca_dataset &) override
Swap the internals of the two objects.
std::string get_class_name() const override
Return the name of the class.
Definition: teca_cartesian_mesh.h:115
p_teca_variant_array get_x_coordinates()
Get the x coordinate array.
Definition: teca_cartesian_mesh.h:73
void set_x_coordinates(const std::string &name, const p_teca_variant_array &array)
Set the x coordinate array and x_coordinate_variable name.
void update_z_coordinates(const p_teca_variant_array &array)
Update the z coordinate array.
int to_stream(std::ostream &) const override
send to stream in a human readable representation
void set_z_coordinates(const std::string &name, const p_teca_variant_array &array)
set the z coordinate array and z_coordinate_variable name
int get_type_code() const override
return an integer identifier uniquely naming the dataset type
int to_stream(teca_binary_stream &) const override
unsigned long get_number_of_cells() const override
get the number of cells in the mesh
void copy_metadata(const const_p_teca_dataset &other) override
Copy metadata. This is always a deep copy.
void set_y_coordinates(const std::string &name, const p_teca_variant_array &array)
Set the y coordinate array and y_coordinate_variable name.
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.
#define TECA_ERROR(_msg)
Constructs an error message and sends it to the stderr stream.
Definition: teca_common.h:161
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