hexed 0.3.0
 
Loading...
Searching...
No Matches
hexed::Xdmf_wrapper Class Reference

lightweight wrapper for XDMF API for block-structured data More...

#include <Xdmf_wrapper.hpp>

Inheritance diagram for hexed::Xdmf_wrapper:
hexed::Visualizer

Public Member Functions

 Xdmf_wrapper (int n_dim_geom, int n_dim_topo, std::string file_name, std::vector< std::string > var_names, double time, elem_type element_type=block)
 
void write_block (Array< double > pos, Array< double > vars) override
 writes a structured block of data
 
void write_unstruct (Array< int > elements, Array< double > pos, Array< double > vars) override
 writes unstructured data
 
 ~Xdmf_wrapper ()
 writes the data to the file(s)
 

Additional Inherited Members

- Public Types inherited from hexed::Visualizer
enum  elem_type { block , simplex }
 enum used to indicate the type of elements to visualize More...
 
- Static Public Member Functions inherited from hexed::Visualizer
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 inherited from hexed::Visualizer
static const std::string default_format
 Default file format to visualize in, depending on what libraries you have enabled.
 

Detailed Description

lightweight wrapper for XDMF API for block-structured data

Constructor & Destructor Documentation

◆ Xdmf_wrapper()

hexed::Xdmf_wrapper::Xdmf_wrapper ( int n_dim_geom,
int n_dim_topo,
std::string file_name,
std::vector< std::string > var_names,
double time,
elem_type element_type = block )
Parameters
n_dim_geomNumber of geometric dimensions. Distinct from the number of topological dimensions. For example, a 3D surface will have 3 geometric dimensions and 2 topological dimensions.
n_dim_topodefines the topology type/dimensionality
file_namename of output file(s) without extension
var_namesdefines the number and names of variables to be visualized
timeflow time
element_typewhether to visualize line/quad/hex (default) or line/tri/tet

Member Function Documentation

◆ write_block()

void hexed::Xdmf_wrapper::write_block ( Array< double > pos,
Array< double > vars )
overridevirtual

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]))

Implements hexed::Visualizer.

◆ write_unstruct()

void hexed::Xdmf_wrapper::write_unstruct ( Array< int > elements,
Array< double > pos,
Array< double > vars )
overridevirtual

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.

Implements hexed::Visualizer.


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