libMesh
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
libMesh::EnsightIO Class Reference

This class implements writing meshes and solutions in Ensight's Gold format. More...

#include <ensight_io.h>

Inheritance diagram for libMesh::EnsightIO:
[legend]

Classes

struct  Scalars
 
struct  SystemVars
 
struct  Vectors
 

Public Member Functions

 EnsightIO (const std::string &filename, const EquationSystems &eq)
 Constructor. More...
 
 ~EnsightIO ()
 Empty destructor. More...
 
void add_scalar (const std::string &system, const std::string &scalar_description, const std::string &s)
 Tell the EnsightIO interface to output the finite element (not SCALAR) variable named "s". More...
 
void add_vector (const std::string &system, const std::string &vec_description, const std::string &u, const std::string &v)
 Tell the EnsightIO interface that the variables (u,v) constitute a vector. More...
 
void add_vector (const std::string &system, const std::string &vec_description, const std::string &u, const std::string &v, const std::string &w)
 Tell the EnsightIO interface that the variables (u, v, w) constitute a vector. More...
 
void write (Real time=0)
 Calls write_ascii() and write_case(). More...
 
virtual void write (const std::string &name) override
 Calls this->write(0);. More...
 
virtual void write_equation_systems (const std::string &, const EquationSystems &, const std::set< std::string > *system_names=nullptr)
 This method implements writing a mesh with data to a specified file where the data is taken from the EquationSystems object. More...
 
virtual void write_discontinuous_equation_systems (const std::string &, const EquationSystems &, const std::set< std::string > *system_names=nullptr)
 This method implements writing a mesh with discontinuous data to a specified file where the data is taken from the EquationSystems object. More...
 
virtual void write_nodal_data (const std::string &, const std::vector< Number > &, const std::vector< std::string > &)
 This method implements writing a mesh with nodal data to a specified file where the nodal data and variable names are provided. More...
 
virtual void write_nodal_data (const std::string &, const NumericVector< Number > &, const std::vector< std::string > &)
 This method should be overridden by "parallel" output formats for writing nodal data. More...
 
virtual void write_nodal_data_discontinuous (const std::string &, const std::vector< Number > &, const std::vector< std::string > &)
 This method implements writing a mesh with discontinuous data to a specified file where the nodal data and variables names are provided. More...
 
unsigned int & ascii_precision ()
 Return/set the precision to use when writing ASCII files. More...
 

Protected Member Functions

const MeshBasemesh () const
 

Protected Attributes

const bool _is_parallel_format
 Flag specifying whether this format is parallel-capable. More...
 
const bool _serial_only_needed_on_proc_0
 Flag specifying whether this format can be written by only serializing the mesh to processor zero. More...
 

Private Member Functions

void write_ascii (Real time=0)
 
void write_scalar_ascii (const std::string &sys, const std::string &var)
 
void write_vector_ascii (const std::string &sys, const std::vector< std::string > &vec, const std::string &var_name)
 
void write_solution_ascii ()
 
void write_geometry_ascii ()
 
void write_case ()
 

Static Private Member Functions

static std::map< ElemType, std::string > build_element_map ()
 

Private Attributes

std::string _ensight_file_name
 
std::vector< Real_time_steps
 
std::map< std::string, SystemVars_system_vars_map
 
const EquationSystems_equation_systems
 

Static Private Attributes

static std::map< ElemType, std::string > _element_map
 

Detailed Description

This class implements writing meshes and solutions in Ensight's Gold format.

Author
Camata
Date
2009
Author
J. W. Peterson (refactoring and iostreams implementation)
Date
2016

Definition at line 55 of file ensight_io.h.

Constructor & Destructor Documentation

◆ EnsightIO()

libMesh::EnsightIO::EnsightIO ( const std::string &  filename,
const EquationSystems eq 
)

Constructor.

◆ ~EnsightIO()

libMesh::EnsightIO::~EnsightIO ( )

Empty destructor.

Definition at line 68 of file ensight_io.h.

68 {}

Member Function Documentation

◆ add_scalar()

void libMesh::EnsightIO::add_scalar ( const std::string &  system,
const std::string &  scalar_description,
const std::string &  s 
)

Tell the EnsightIO interface to output the finite element (not SCALAR) variable named "s".

Note
You must call add_scalar() or add_vector() (see below) at least once, otherwise only the Mesh will be written out.

◆ add_vector() [1/2]

void libMesh::EnsightIO::add_vector ( const std::string &  system,
const std::string &  vec_description,
const std::string &  u,
const std::string &  v 
)

Tell the EnsightIO interface that the variables (u,v) constitute a vector.

Note
u and v must have the same FEType, and be defined in the same system.

◆ add_vector() [2/2]

void libMesh::EnsightIO::add_vector ( const std::string &  system,
const std::string &  vec_description,
const std::string &  u,
const std::string &  v,
const std::string &  w 
)

Tell the EnsightIO interface that the variables (u, v, w) constitute a vector.

Note
Requires a 3D mesh, u, v, and w must have the same FEType, and must be defined in the same system.

◆ ascii_precision()

unsigned int & libMesh::MeshOutput< MeshBase >::ascii_precision ( )
inherited

Return/set the precision to use when writing ASCII files.

By default we use numeric_limits<Real>::digits10 + 2, which should be enough to write out to ASCII and get the exact same Real back when reading in.

Definition at line 244 of file mesh_output.h.

245 {
246  return _ascii_precision;
247 }
unsigned int _ascii_precision
Precision to use when writing ASCII files.
Definition: mesh_output.h:182

◆ build_element_map()

static std::map<ElemType, std::string> libMesh::EnsightIO::build_element_map ( )
staticprivate

◆ mesh()

const MeshBase & libMesh::MeshOutput< MeshBase >::mesh ( ) const
protectedinherited
Returns
The object as a read-only reference.

Definition at line 234 of file mesh_output.h.

235 {
236  libmesh_assert(_obj);
237  return *_obj;
238 }
const MeshBase *const _obj
A pointer to a constant object.
Definition: mesh_output.h:177

◆ write() [1/2]

void libMesh::EnsightIO::write ( Real  time = 0)

Calls write_ascii() and write_case().

Writes case, mesh, and solution files named: name.case (contains a description of other files) name.geo000 (mesh) name_{varname}.scl000 (one file per scalar variable) name_{vecname}.vec000 (one file per vector variable)

◆ write() [2/2]

virtual void libMesh::EnsightIO::write ( const std::string &  name)
overridevirtual

Calls this->write(0);.

Implements libMesh::MeshOutput< MeshBase >.

◆ write_ascii()

void libMesh::EnsightIO::write_ascii ( Real  time = 0)
private

◆ write_case()

void libMesh::EnsightIO::write_case ( )
private

◆ write_discontinuous_equation_systems()

virtual void libMesh::MeshOutput< MeshBase >::write_discontinuous_equation_systems ( const std::string &  ,
const EquationSystems ,
const std::set< std::string > *  system_names = nullptr 
)
virtualinherited

This method implements writing a mesh with discontinuous data to a specified file where the data is taken from the EquationSystems object.

◆ write_equation_systems()

virtual void libMesh::MeshOutput< MeshBase >::write_equation_systems ( const std::string &  ,
const EquationSystems ,
const std::set< std::string > *  system_names = nullptr 
)
virtualinherited

This method implements writing a mesh with data to a specified file where the data is taken from the EquationSystems object.

Reimplemented in libMesh::NameBasedIO.

◆ write_geometry_ascii()

void libMesh::EnsightIO::write_geometry_ascii ( )
private

◆ write_nodal_data() [1/2]

virtual void libMesh::MeshOutput< MeshBase >::write_nodal_data ( const std::string &  ,
const std::vector< Number > &  ,
const std::vector< std::string > &   
)
virtualinherited

This method implements writing a mesh with nodal data to a specified file where the nodal data and variable names are provided.

Reimplemented in libMesh::ExodusII_IO, libMesh::Nemesis_IO, libMesh::UCDIO, libMesh::NameBasedIO, libMesh::GmshIO, libMesh::GMVIO, libMesh::VTKIO, libMesh::MEDITIO, libMesh::GnuPlotIO, and libMesh::TecplotIO.

Definition at line 105 of file mesh_output.h.

108  { libmesh_not_implemented(); }

◆ write_nodal_data() [2/2]

virtual void libMesh::MeshOutput< MeshBase >::write_nodal_data ( const std::string &  ,
const NumericVector< Number > &  ,
const std::vector< std::string > &   
)
virtualinherited

This method should be overridden by "parallel" output formats for writing nodal data.

Instead of getting a localized copy of the nodal solution vector, it is passed a NumericVector of type=PARALLEL which is in node-major order i.e. (u0,v0,w0, u1,v1,w1, u2,v2,w2, u3,v3,w3, ...) and contains n_nodes*n_vars total entries. Then, it is up to the individual I/O class to extract the required solution values from this vector and write them in parallel.

If not implemented, localizes the parallel vector into a std::vector and calls the other version of this function.

Reimplemented in libMesh::Nemesis_IO.

◆ write_nodal_data_discontinuous()

virtual void libMesh::MeshOutput< MeshBase >::write_nodal_data_discontinuous ( const std::string &  ,
const std::vector< Number > &  ,
const std::vector< std::string > &   
)
virtualinherited

This method implements writing a mesh with discontinuous data to a specified file where the nodal data and variables names are provided.

Reimplemented in libMesh::ExodusII_IO.

Definition at line 114 of file mesh_output.h.

117  { libmesh_not_implemented(); }

◆ write_scalar_ascii()

void libMesh::EnsightIO::write_scalar_ascii ( const std::string &  sys,
const std::string &  var 
)
private

◆ write_solution_ascii()

void libMesh::EnsightIO::write_solution_ascii ( )
private

◆ write_vector_ascii()

void libMesh::EnsightIO::write_vector_ascii ( const std::string &  sys,
const std::vector< std::string > &  vec,
const std::string &  var_name 
)
private

Member Data Documentation

◆ _element_map

std::map<ElemType, std::string> libMesh::EnsightIO::_element_map
staticprivate

Definition at line 162 of file ensight_io.h.

◆ _ensight_file_name

std::string libMesh::EnsightIO::_ensight_file_name
private

Definition at line 152 of file ensight_io.h.

◆ _equation_systems

const EquationSystems& libMesh::EnsightIO::_equation_systems
private

Definition at line 159 of file ensight_io.h.

◆ _is_parallel_format

const bool libMesh::MeshOutput< MeshBase >::_is_parallel_format
protectedinherited

Flag specifying whether this format is parallel-capable.

If this is false (default) I/O is only permitted when the mesh has been serialized.

Definition at line 159 of file mesh_output.h.

◆ _serial_only_needed_on_proc_0

const bool libMesh::MeshOutput< MeshBase >::_serial_only_needed_on_proc_0
protectedinherited

Flag specifying whether this format can be written by only serializing the mesh to processor zero.

If this is false (default) the mesh will be serialized to all processors

Definition at line 168 of file mesh_output.h.

◆ _system_vars_map

std::map<std::string, SystemVars> libMesh::EnsightIO::_system_vars_map
private

Definition at line 156 of file ensight_io.h.

◆ _time_steps

std::vector<Real> libMesh::EnsightIO::_time_steps
private

Definition at line 153 of file ensight_io.h.


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