libMesh
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
libMesh::GnuPlotIO Class Reference

This class implements writing meshes using GNUplot, designed for use only with 1D meshes. More...

#include <gnuplot_io.h>

Inheritance diagram for libMesh::GnuPlotIO:
[legend]

Public Types

enum  PlottingProperties { GRID_ON = 1, PNG_OUTPUT = 2 }
 Define enumerations to set plotting properties on construction. More...
 

Public Member Functions

 GnuPlotIO (const MeshBase &, const std::string &=std::string("FE 1D Solution"), int properties=0)
 Constructor. More...
 
virtual void write (const std::string &) override
 Write the mesh to the specified file. More...
 
virtual void write_nodal_data (const std::string &, const std::vector< Number > &, const std::vector< std::string > &) override
 This method implements writing a mesh with nodal data to a specified file where the nodal data and variable names are provided. More...
 
void set_title (const std::string &title)
 Set title of plot. More...
 
void use_grid (bool grid)
 Turn grid on or off. More...
 
void set_png_output (bool png_output)
 Write output to a .png file using gnuplot. 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 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...
 

Public Attributes

std::string axes_limits
 GNUplot automatically adjusts the x and y-axes of 2D plots to "zoom in" on the data. 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_solution (const std::string &, const std::vector< Number > *=nullptr, const std::vector< std::string > *=nullptr)
 This method implements writing a mesh with nodal data to a specified file where the nodal data and variable names are optionally provided. More...
 

Private Attributes

std::string _title
 
bool _grid
 
bool _png_output
 

Detailed Description

This class implements writing meshes using GNUplot, designed for use only with 1D meshes.

Author
David Knezevic
Date
2005

Definition at line 43 of file gnuplot_io.h.

Member Enumeration Documentation

◆ PlottingProperties

Define enumerations to set plotting properties on construction.

Enumerator
GRID_ON 
PNG_OUTPUT 

Definition at line 50 of file gnuplot_io.h.

Constructor & Destructor Documentation

◆ GnuPlotIO()

libMesh::GnuPlotIO::GnuPlotIO ( const MeshBase ,
const std::string &  = std::string("FE 1D Solution"),
int  properties = 0 
)
explicit

Constructor.

Takes a reference to a constant mesh object. To set the properties, we input a bitwise OR of the GnuPlotIO::PlottingProperties enumerations, e.g. GnuPlotIO::GRID_ON | GnuPlotIO::PNG_OUTPUT

Member Function Documentation

◆ 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

◆ 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

◆ set_png_output()

void libMesh::GnuPlotIO::set_png_output ( bool  png_output)

Write output to a .png file using gnuplot.

Definition at line 97 of file gnuplot_io.h.

References _png_output.

97 { _png_output = png_output; }

◆ set_title()

void libMesh::GnuPlotIO::set_title ( const std::string &  title)

Set title of plot.

Definition at line 86 of file gnuplot_io.h.

References _title.

86 { _title = title; }
std::string _title
Definition: gnuplot_io.h:119

◆ use_grid()

void libMesh::GnuPlotIO::use_grid ( bool  grid)

Turn grid on or off.

Definition at line 91 of file gnuplot_io.h.

References _grid.

91 { _grid = grid; }

◆ write()

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

Write the mesh to the specified file.

Implements libMesh::MeshOutput< MeshBase >.

◆ 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_nodal_data() [1/2]

virtual void libMesh::GnuPlotIO::write_nodal_data ( const std::string &  ,
const std::vector< Number > &  ,
const std::vector< std::string > &   
)
overridevirtual

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

Reimplemented from libMesh::MeshOutput< MeshBase >.

◆ 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_solution()

void libMesh::GnuPlotIO::write_solution ( const std::string &  ,
const std::vector< Number > *  = nullptr,
const std::vector< std::string > *  = nullptr 
)
private

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

This will write an ASCII file.

Member Data Documentation

◆ _grid

bool libMesh::GnuPlotIO::_grid
private

Definition at line 121 of file gnuplot_io.h.

Referenced by use_grid().

◆ _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.

◆ _png_output

bool libMesh::GnuPlotIO::_png_output
private

Definition at line 122 of file gnuplot_io.h.

Referenced by set_png_output().

◆ _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.

◆ _title

std::string libMesh::GnuPlotIO::_title
private

Definition at line 119 of file gnuplot_io.h.

Referenced by set_title().

◆ axes_limits

std::string libMesh::GnuPlotIO::axes_limits

GNUplot automatically adjusts the x and y-axes of 2D plots to "zoom in" on the data.

You can set this string to force GNUplot to maintain a fixed set of axes. Example: axes_limits = "[0:1] [0:1]" would force x and y to be plotted on the range 0<=x<=1 and 0<=y<=1 regardless of where the data lie.

Definition at line 107 of file gnuplot_io.h.


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