tk::ExodusIIMeshWriter class

ExodusII mesh-based data writer

Mesh writer class facilitating writing a mesh and associated mesh-based field data to a file in ExodusII format.

Constructors, destructors, conversion operators

ExodusIIMeshWriter(const std::string& filename, ExoWriter mode, int cpuwordsize = sizeof(double), int iowordsize = sizeof(double)) explicit
Constructor: create/open ExodusII file.
~ExodusIIMeshWriter() noexcept
Destructor.

Public functions

void writeMesh(const UnsMesh& mesh) const
Write ExodusII mesh file taking a tk::UnsMesh object.
void writeMesh(const std::vector<std::size_t>& tetinp, const UnsMesh::Coords& coord, const std::map<int, std::vector<std::size_t>>& bface, const std::vector<std::size_t>& triinp) const
Write ExodusII mesh file taking inputs to a tk::UnsMesh object.
void writeMesh(const std::vector<std::size_t>& tetinp, const UnsMesh::Coords& coord, const std::map<int, std::vector<std::size_t>>& bnode) const
Write ExodusII mesh file taking inputs to a tk::UnsMesh object.
template<std::size_t nnode>
void writeMesh(const std::vector<std::size_t>& inpoel, const UnsMesh::Coords& coord) const
void writeTimeStamp(uint64_t it, tk::real time) const
Write time stamp to ExodusII file.
void writeTimeValues(const std::vector<tk::real>& tv) const
Write time values to ExodusII file.
void writeNodeVarNames(const std::vector<std::string>& nv) const
Write the names of nodal output variables to ExodusII file.
void writeElemVarNames(const std::vector<std::string>& ev) const
Write the names of element output variables to ExodusII file.
void writeNodeScalars(const std::vector<std::vector<std::vector<tk::real>>>& var) const
Write multiple node scalar fields to ExodusII file at multiple time steps.
void writeNodeScalar(uint64_t it, int varid, const std::vector<tk::real>& var) const
Write node scalar field to ExodusII file.
void writeElemScalar(uint64_t it, int varid, const std::vector<tk::real>& var) const
Write elem scalar field to ExodusII file.
void writeHeader(const char* title, int64_t ndim, int64_t nnodes, int64_t nelem, int64_t nblk, int64_t node_set, int64_t side_set) const
Write header without mesh, function overloading.
void writeNodes(const std::vector<tk::real>& x, const std::vector<tk::real>& y, const std::vector<tk::real>& z) const
Write nodes without mesh, function overloading.
void writeElemBlock(int& elclass, int64_t nnpe, const std::string& eltype, const std::vector<std::size_t>& inpoel) const
Write element block to ExodusII file.

Function documentation

tk::ExodusIIMeshWriter::ExodusIIMeshWriter(const std::string& filename, ExoWriter mode, int cpuwordsize = sizeof(double), int iowordsize = sizeof(double)) explicit

Constructor: create/open ExodusII file.

Parameters
filename in File to open as ExodusII file
mode in ExodusII writer constructor mode: ExoWriter::CREATE for creating a new file, ExoWriter::OPEN for opening an existing file for appending
cpuwordsize in Set CPU word size, see ExodusII documentation
iowordsize in Set I/O word size, see ExodusII documentation

void tk::ExodusIIMeshWriter::writeMesh(const UnsMesh& mesh) const

Write ExodusII mesh file taking a tk::UnsMesh object.

Parameters
mesh in Unstructured mesh object

void tk::ExodusIIMeshWriter::writeMesh(const std::vector<std::size_t>& tetinp, const UnsMesh::Coords& coord, const std::map<int, std::vector<std::size_t>>& bface, const std::vector<std::size_t>& triinp) const

Write ExodusII mesh file taking inputs to a tk::UnsMesh object.

Parameters
tetinp in Tetrahedron element connectivity
coord in Node coordinates
bface in Boundary face ids for each side set
triinp in Triangle face connectivity (for all faces in bface)

void tk::ExodusIIMeshWriter::writeMesh(const std::vector<std::size_t>& tetinp, const UnsMesh::Coords& coord, const std::map<int, std::vector<std::size_t>>& bnode) const

Write ExodusII mesh file taking inputs to a tk::UnsMesh object.

Parameters
tetinp in Tetrahedron element connectivity
coord in Node coordinates
bnode in Boundary node ids for each side set

template<std::size_t nnode>
void tk::ExodusIIMeshWriter::writeMesh(const std::vector<std::size_t>& inpoel, const UnsMesh::Coords& coord) const

Template parameters
nnode 3 or 4, indicating a triangle or tetrahedron mesh
Parameters
inpoel in Element connectivity
coord in Node coordinates

Write ExodusII mesh file taking inputs to a tk::UnsMesh object

void tk::ExodusIIMeshWriter::writeTimeStamp(uint64_t it, tk::real time) const

Write time stamp to ExodusII file.

Parameters
it in Iteration number
time in Time

void tk::ExodusIIMeshWriter::writeTimeValues(const std::vector<tk::real>& tv) const

Write time values to ExodusII file.

Parameters
tv in Time values for all time steps

void tk::ExodusIIMeshWriter::writeNodeVarNames(const std::vector<std::string>& nv) const

Write the names of nodal output variables to ExodusII file.

Parameters
nv in Nodal variable names

void tk::ExodusIIMeshWriter::writeElemVarNames(const std::vector<std::string>& ev) const

Write the names of element output variables to ExodusII file.

Parameters
ev in Elem variable names

void tk::ExodusIIMeshWriter::writeNodeScalars(const std::vector<std::vector<std::vector<tk::real>>>& var) const

Write multiple node scalar fields to ExodusII file at multiple time steps.

Parameters
var in Vector of nodal variables to read to: inner vector: nodes, middle vector: (physics) variable, outer vector: time step

void tk::ExodusIIMeshWriter::writeNodeScalar(uint64_t it, int varid, const std::vector<tk::real>& var) const

Write node scalar field to ExodusII file.

Parameters
it in Iteration number
varid in Variable id
var in Vector of variable to output

void tk::ExodusIIMeshWriter::writeElemScalar(uint64_t it, int varid, const std::vector<tk::real>& var) const

Write elem scalar field to ExodusII file.

Parameters
it in Iteration number
varid in Variable id
var in Vector of variable to output

void tk::ExodusIIMeshWriter::writeHeader(const char* title, int64_t ndim, int64_t nnodes, int64_t nelem, int64_t nblk, int64_t node_set, int64_t side_set) const

Write header without mesh, function overloading.

Parameters
title in ExodusII file header 'title'
ndim in Number of spatial dimensions in ExodusII file
nnodes in Number of mesh nodes in ExodusII file
nelem in Number of mesh elements in ExodusII file
nblk in Number of mesh element blocks in ExodusII file
node_set in Number of node sets in ExodusII file
side_set in Number of side sets in ExodusII file

void tk::ExodusIIMeshWriter::writeNodes(const std::vector<tk::real>& x, const std::vector<tk::real>& y, const std::vector<tk::real>& z) const

Write nodes without mesh, function overloading.

Parameters
in coordinates of mesh nodes
in coordinates of mesh nodes
in coordinates of mesh nodes

void tk::ExodusIIMeshWriter::writeElemBlock(int& elclass, int64_t nnpe, const std::string& eltype, const std::vector<std::size_t>& inpoel) const

Write element block to ExodusII file.

Parameters
elclass in/out Count element class ids in file
nnpe in Number of nodes per element for block
eltype in String describing element type
inpoel in Element connectivity