hexed 0.3.0
 
Loading...
Searching...
No Matches
hexed::Visualizer Class Referenceabstract

General interface for writing visualization data in different file formats. More...

#include <Visualizer.hpp>

Inheritance diagram for hexed::Visualizer:
hexed::Csv hexed::Tecplot_file hexed::Xdmf_wrapper

Public Types

enum  elem_type { block , simplex }
 enum used to indicate the type of elements to visualize More...
 

Public Member Functions

virtual void write_block (Array< double > pos, Array< double > vars)=0
 writes a structured block of data
 
virtual void write_unstruct (Array< int > elements, Array< double > pos, Array< double > vars)=0
 writes unstructured data
 

Static Public Member Functions

static std::unique_ptr< Visualizercreate (std::string format, int n_dim_geom, int n_dim_topo, std::string file_name, std::vector< std::string > variable_names, double time, elem_type element_type)
 Creates a Visualizer object, selecting the appropriate backend based on the requested file format.
 
static std::unique_ptr< Visualizercreate (std::string format, int n_dim_geom, int n_dim_topo, std::string file_name, const Output_data &, double time, elem_type)
 overload of create(std::string, int, int, std::string, std::vector<std::string>, double, elem_type)
 

Static Public Attributes

static const std::string default_format
 Default file format to visualize in, depending on what libraries you have enabled.
 

Detailed Description

General interface for writing visualization data in different file formats.

Member Enumeration Documentation

◆ elem_type

enum used to indicate the type of elements to visualize

Enumerator
block 

line segment, quad, or hex depending on the number of topological dimensions

simplex 

line segment, triangle, or tet depending on the number of topological dimensions

Member Function Documentation

◆ create() [1/2]

std::unique_ptr< Visualizer > hexed::Visualizer::create ( std::string format,
int n_dim_geom,
int n_dim_topo,
std::string file_name,
const Output_data & dat,
double time,
elem_type elem_t )
static

overload of create(std::string, int, int, std::string, std::vector<std::string>, double, elem_type)

The number and names of variables are determined from the Output_data supplied.

◆ create() [2/2]

std::unique_ptr< Visualizer > hexed::Visualizer::create ( std::string format,
int n_dim_geom,
int n_dim_topo,
std::string file_name,
std::vector< std::string > variable_names,
double time,
elem_type element_type )
static

Creates a Visualizer object, selecting the appropriate backend based on the requested file format.

Parameters
formatFile format to visualize in. Supported formats are:
n_dim_geomNumber of geometric dimensions. I.e., does your data exist in 1D, 2D, or 3D space?
n_dim_topoNumber of topological dimensions. I.e. 1 => curve, 2 => surface, 3 => solid
file_nameName of file to write, not including extension.
variable_namesList of names of output variables to be written, not including position variables, which are named automatically. This can be empty if you're only writing position. It also determines number of output variables.
timeFlow time to include in the output file, if applicable.
element_typeAlong with n_dim_topo, specifies the type of elements to visualize.

◆ write_block()

virtual void hexed::Visualizer::write_block ( Array< double > pos,
Array< double > vars )
pure virtual

writes a structured block of data

Parameters
posArray of position data. Layout: [i_dim][i_row]([j_row]([k_row])) (j_row and k_row optional depending on the topological dimension)
varsArray of field variable data. Layout: [i_var][i_row]([j_row]([k_row]))

Implemented in hexed::Csv, hexed::Tecplot_file, and hexed::Xdmf_wrapper.

◆ write_unstruct()

virtual void hexed::Visualizer::write_unstruct ( Array< int > elements,
Array< double > pos,
Array< double > vars )
pure virtual

writes unstructured data

Unstructured data is specified by a list of vertices, each of which has values of position and field variables associated with it, and a list of elements, each of which is specified by the indices of its vertices. All elements must be the same type (e.g. line segment, triangle, quad, etc.) and the element type is inferred from the number of vertices for each element. If you call write_unstruct() multiple times on the same Visualizer, the vertex indices you supply should restart from 0.

Parameters
elementsIndices of the vertices for each element. Layout: [i_element][i_vertex] E.g. for a mesh containing 2 quadrilateral elements, elements will have shape {2, 4}.
posPosition data for all vertices. Layout: [i_dim][i_vertex] E.g. if the above mesh was specifying a surface in 3D space and the two quadrilateral elements shared exactly one edge, pos would have shape {3, 6} (there would be 6 total vertices, 4 for each element minus 2 shared)
varsValues of field variables for all vertices. Layout [i_var][i_vertex]. The number of columns must be the same as pos.

Implemented in hexed::Csv, hexed::Tecplot_file, and hexed::Xdmf_wrapper.

Member Data Documentation

◆ default_format

const std::string hexed::Visualizer::default_format
static
Initial value:
=
"xdmf"

Default file format to visualize in, depending on what libraries you have enabled.

Determined based on build options as follows:

  1. if --use_xdmf is true, then "xdmf"
  2. otherwise, if --use_tecio is true, then "tecplot"
  3. otherwise, "csv"

The documentation for this class was generated from the following files: