TECA
The Toolkit for Extreme Climate Analysis
teca_cartesian_mesh_writer.h
1 #ifndef teca_cartesian_mesh_writer_h
2 #define teca_cartesian_mesh_writer_h
3 
4 #include "teca_config.h"
5 #include "teca_shared_object.h"
6 #include "teca_algorithm.h"
7 #include "teca_metadata.h"
8 
9 #include <vector>
10 #include <string>
11 
12 TECA_SHARED_OBJECT_FORWARD_DECL(teca_cartesian_mesh_writer)
13 
14 /// An algorithm that writes Cartesian meshes in VTK format.
15 /**
16  * When VTK is found then the files are written using the
17  * XML formats. Otherwise legacy format is used. Can be
18  * written as raw binary (default) or as ASCII.
19  */
21 {
22 public:
23  TECA_ALGORITHM_STATIC_NEW(teca_cartesian_mesh_writer)
24  TECA_ALGORITHM_DELETE_COPY_ASSIGN(teca_cartesian_mesh_writer)
25  TECA_ALGORITHM_CLASS_NAME(teca_cartesian_mesh_writer)
27 
28  // report/initialize to/from Boost program options
29  // objects.
30  TECA_GET_ALGORITHM_PROPERTIES_DESCRIPTION()
31  TECA_SET_ALGORITHM_PROPERTIES()
32 
33  // set the output filename. for time series the substring
34  // %t% is replaced with the current time step.
35  TECA_ALGORITHM_PROPERTY(std::string, file_name)
36 
37  // set the output type. can be binary or ASCII.
38  TECA_ALGORITHM_PROPERTY(int, binary)
39 
40  // Select the output file format. 0:bin, 1:vtr, 2:vtk, 3:auto
41  // the default is bin.
42  enum {format_bin, format_vtk, format_vtr, format_auto};
43  TECA_ALGORITHM_PROPERTY(int, output_format)
44  void set_output_format_bin(){ this->set_output_format(format_bin); }
45  void set_output_format_vtk(){ this->set_output_format(format_vtk); }
46  void set_output_format_vtr(){ this->set_output_format(format_vtr); }
47  void set_output_format_auto(){ this->set_output_format(format_auto); }
48 
49 protected:
51 
52 private:
53  const_p_teca_dataset execute(unsigned int port,
54  const std::vector<const_p_teca_dataset> &input_data,
55  const teca_metadata &request) override;
56 
57 private:
58  std::string file_name;
59  int binary;
60  int output_format;
61 };
62 
63 #endif
teca_cartesian_mesh_writer
An algorithm that writes Cartesian meshes in VTK format.
Definition: teca_cartesian_mesh_writer.h:20
teca_metadata
A generic container for meta data in the form of name=value pairs.
Definition: teca_metadata.h:21
teca_shared_object.h
teca_error::TECA_EXPORT
p_teca_error_handler error_handler TECA_EXPORT
The global error handler instance.
teca_algorithm
The interface to TECA pipeline architecture.
Definition: teca_algorithm.h:237