#include <postscript_io.h>
Public Member Functions | |
PostscriptIO (const MeshBase &mesh) | |
virtual | ~PostscriptIO () |
virtual void | write (const std::string &) override |
void | plot_quadratic_elem (const Elem *elem) |
void | plot_linear_elem (const Elem *elem) |
virtual void | write_equation_systems (const std::string &, const EquationSystems &, const std::set< std::string > *system_names=nullptr) |
virtual void | write_discontinuous_equation_systems (const std::string &, const EquationSystems &, const std::set< std::string > *system_names=nullptr) |
virtual void | write_nodal_data (const std::string &, const std::vector< Number > &, const std::vector< std::string > &) |
virtual void | write_nodal_data (const std::string &, const NumericVector< Number > &, const std::vector< std::string > &) |
virtual void | write_nodal_data_discontinuous (const std::string &, const std::vector< Number > &, const std::vector< std::string > &) |
unsigned int & | ascii_precision () |
Public Attributes | |
Real | shade_value |
Real | line_width |
Protected Member Functions | |
const MeshBase & | mesh () const |
Protected Attributes | |
const bool | _is_parallel_format |
const bool | _serial_only_needed_on_proc_0 |
Private Member Functions | |
void | _compute_edge_bezier_coeffs (const Elem *elem) |
Private Attributes | |
std::vector< Point > | _bezier_coeffs |
Point | _offset |
Real | _scale |
Point | _current_point |
std::ostringstream | _cell_string |
std::ofstream | _out |
Static Private Attributes | |
static const float | _bezier_transform [3][3] |
This class implements writing 2D meshes in Postscript. It borrows several ideas from, and is a more simple-minded version of, the DataOutBase::write_eps() function from Deal II. Only output is supported here, and only the Mesh (none of the data) is written. The main use I imagined for this class is creating nice Mesh images for publications, since I didn't find/don't know of a free visualization program which would do this.
Definition at line 53 of file postscript_io.h.
|
explicit |
Constructor.
Definition at line 42 of file postscript_io.C.
References _bezier_coeffs.
|
virtual |
|
private |
Given a quadratic edge Elem which lies in the x-y plane, computes the Bezier coefficients. These may be passed to the Postscript routine "curveto".
Definition at line 264 of file postscript_io.C.
References _bezier_coeffs, _bezier_transform, _offset, _scale, libMesh::EDGE3, libMesh::Elem::point(), and libMesh::Elem::type().
Referenced by plot_quadratic_elem().
|
inlineinherited |
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.
Referenced by libMesh::TecplotIO::write_ascii(), libMesh::GMVIO::write_ascii_new_impl(), and libMesh::GMVIO::write_ascii_old_impl().
|
inlineprotectedinherited |
Definition at line 234 of file mesh_output.h.
Referenced by libMesh::FroIO::write(), libMesh::TecplotIO::write(), libMesh::MEDITIO::write(), write(), libMesh::EnsightIO::write(), libMesh::TecplotIO::write_ascii(), libMesh::TecplotIO::write_binary(), libMesh::TecplotIO::write_nodal_data(), libMesh::MEDITIO::write_nodal_data(), and libMesh::GnuPlotIO::write_solution().
void libMesh::PostscriptIO::plot_linear_elem | ( | const Elem * | elem | ) |
Draws an element with straight lines
Definition at line 190 of file postscript_io.C.
References _cell_string, _current_point, _offset, _out, _scale, libMesh::Elem::n_vertices(), libMesh::Elem::point(), and shade_value.
Referenced by write().
void libMesh::PostscriptIO::plot_quadratic_elem | ( | const Elem * | elem | ) |
Draws an element with Bezier curves
Definition at line 232 of file postscript_io.C.
References _bezier_coeffs, _compute_edge_bezier_coeffs(), _current_point, _offset, _out, _scale, libMesh::Elem::build_side_ptr(), libMesh::EDGE3, side, and libMesh::Elem::side_index_range().
|
overridevirtual |
This method implements writing a mesh to a specified file.
Implements libMesh::MeshOutput< MeshBase >.
Definition at line 71 of file postscript_io.C.
References libMesh::MeshOutput< MeshBase >::_is_parallel_format, _offset, _out, _scale, libMesh::MeshBase::active_element_ptr_range(), libMesh::MeshTools::create_bounding_box(), line_width, libMesh::MeshOutput< MeshBase >::mesh(), libMesh::MeshOutput< MT >::mesh(), libMesh::MeshBase::mesh_dimension(), plot_linear_elem(), and libMesh::Real.
|
virtualinherited |
This method implements writing a mesh with discontinuous data to a specified file where the data is taken from the EquationSystems
object.
Definition at line 92 of file mesh_output.C.
References libMesh::EquationSystems::build_discontinuous_solution_vector(), libMesh::EquationSystems::build_variable_names(), libMesh::EquationSystems::get_mesh(), and libMesh::out.
Referenced by libMesh::ExodusII_IO::write_timestep_discontinuous().
|
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.
Definition at line 31 of file mesh_output.C.
References libMesh::EquationSystems::build_parallel_solution_vector(), libMesh::EquationSystems::build_solution_vector(), libMesh::EquationSystems::build_variable_names(), libMesh::EquationSystems::get_mesh(), and libMesh::out.
Referenced by libMesh::Nemesis_IO::write_timestep(), and libMesh::ExodusII_IO::write_timestep().
|
inlinevirtualinherited |
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.
|
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.
Definition at line 150 of file mesh_output.C.
References libMesh::NumericVector< T >::localize().
|
inlinevirtualinherited |
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.
|
private |
Vector containing 3 points corresponding to Bezier coefficients, as computed by _compute_edge_bezier_coeffs.
Definition at line 120 of file postscript_io.h.
Referenced by _compute_edge_bezier_coeffs(), plot_quadratic_elem(), and PostscriptIO().
|
staticprivate |
Coefficients of the transformation from physical-space edge coordinates to Bezier basis coefficients. Transforms x and y separately.
Definition at line 114 of file postscript_io.h.
Referenced by _compute_edge_bezier_coeffs().
|
private |
Drawing style-independent data for a single cell. This can be used as a temporary buffer for storing data which may be sent to the output stream multiple times.
Definition at line 142 of file postscript_io.h.
Referenced by plot_linear_elem().
|
private |
A point object used for temporary calculations
Definition at line 135 of file postscript_io.h.
Referenced by plot_linear_elem(), and plot_quadratic_elem().
|
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.
Referenced by libMesh::FroIO::write(), write(), and libMesh::EnsightIO::write().
|
private |
Amount to add to every (x,y) point to place it in Postscript coordinates.
Definition at line 125 of file postscript_io.h.
Referenced by _compute_edge_bezier_coeffs(), plot_linear_elem(), plot_quadratic_elem(), and write().
|
private |
Output file stream which will be opened when the file name is known
Definition at line 147 of file postscript_io.h.
Referenced by plot_linear_elem(), plot_quadratic_elem(), and write().
|
private |
Amount by which to stretch each point to place it in Postscript coordinates.
Definition at line 130 of file postscript_io.h.
Referenced by _compute_edge_bezier_coeffs(), plot_linear_elem(), plot_quadratic_elem(), and write().
|
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.
Real libMesh::PostscriptIO::line_width |
Control the thickness of the lines used. 0.5 is a reasonable default for printed images, but you may need to decrease this value (or choose it adaptively) when there are very slim cells present in the mesh.
Definition at line 88 of file postscript_io.h.
Referenced by write().
Real libMesh::PostscriptIO::shade_value |
Controls greyscale shading of cells. By default this value is 0.0 (which actually corresponds to black) and this indicates "no shading" i.e. only mesh lines will be drawn. Any other value in (0,1] will cause the cells to be grey-shaded to some degree, with higher values being lighter. A value of 0.75 gives decent results.
Definition at line 80 of file postscript_io.h.
Referenced by plot_linear_elem().