A class used to abstract away reading/writing files. More...
#include <Writer.h>

Classes | |
| struct | baseMeshData |
| struct | GlobalID |
| struct | MatrixData |
| struct | multiMeshData |
| struct | VectorData |
| struct | WriterProperties |
Public Types | |
| enum class | DecompositionType : uint8_t { SINGLE , MULTIPLE } |
| enum class | VectorType : uint8_t { DOUBLE , SINGLE , INT } |
Public Member Functions | |
| std::string | getExtension () const |
| Function to return the file extension. | |
| virtual WriterProperties | getProperties () const =0 |
| Function to get the writer properties. | |
| virtual void | readFile (const std::string &fname)=0 |
| Function to read a file. | |
| void | registerMatrix (std::shared_ptr< AMP::LinearAlgebra::Matrix > mat, const std::string &name="") |
| Function to register a matrix. | |
| void | registerMesh (std::shared_ptr< AMP::Mesh::Mesh > mesh, int level=1, const std::string &path=std::string()) |
| Function to register a mesh. | |
| void | registerVector (std::shared_ptr< AMP::LinearAlgebra::Vector > vec, const std::string &name="") |
| Function to register a vector. | |
| virtual void | registerVector (std::shared_ptr< AMP::LinearAlgebra::Vector > vec, std::shared_ptr< AMP::Mesh::Mesh > mesh, AMP::Mesh::GeomType type, const std::string &name="", VectorType precision=VectorType::DOUBLE, bool isStatic=false) |
| Function to register a vector. | |
| virtual void | setDecomposition (int decomposition) |
| Function to set the file decomposition. | |
| virtual void | writeFile (const std::string &fname, size_t iteration, double time=0)=0 |
| Function to write a file. | |
| Writer (const Writer &)=delete | |
| Delete copy constructor. | |
| virtual | ~Writer ()=default |
| Default destructor. | |
Static Public Member Functions | |
| static std::shared_ptr< AMP::IO::Writer > | buildWriter (std::shared_ptr< AMP::Database > db) |
| Function to build a writer. | |
| static std::shared_ptr< AMP::IO::Writer > | buildWriter (std::string type, AMP_MPI comm=AMP_COMM_WORLD) |
| Function to build a writer. | |
Protected Types | |
| using | GeomType = AMP::Mesh::GeomType |
Protected Member Functions | |
| void | createDirectories (const std::string &filename) |
| GlobalID | getID (const AMP_MPI &comm) const |
| void | registerMesh2 (std::shared_ptr< AMP::Mesh::Mesh > mesh, int level, const std::string &path, std::set< GlobalID > &base_ids) |
| template<class TYPE > | |
| void | syncData (std::vector< TYPE > &data, int root) const |
| std::tuple< std::vector< multiMeshData >, std::map< GlobalID, baseMeshData > > | syncMultiMeshData (int root=-1) const |
| void | syncVectors () |
| Writer ()=default | |
Static Protected Member Functions | |
| static std::vector< AMP::Mesh::MeshID > | getMeshIDs (std::shared_ptr< AMP::Mesh::Mesh > mesh) |
| static void | getNodeElemList (std::shared_ptr< const AMP::Mesh::Mesh > mesh, const AMP::Mesh::MeshIterator &elements, AMP::Array< double > *x, AMP::Array< int > &nodelist, std::vector< AMP::Mesh::MeshElementID > &nodelist_ids) |
Protected Attributes | |
| std::map< GlobalID, baseMeshData > | d_baseMeshes |
| AMP_MPI | d_comm = AMP_COMM_WORLD |
| DecompositionType | d_decomposition = DecompositionType::MULTIPLE |
| std::map< GlobalID, MatrixData > | d_matrices |
| std::map< GlobalID, multiMeshData > | d_multiMeshes |
| std::map< GlobalID, VectorData > | d_vectors |
| std::vector< std::shared_ptr< AMP::LinearAlgebra::Vector > > | d_vectorsMesh |
A class used to abstract away reading/writing files.
This class provides routines for reading, accessing and writing meshes and vectors. The writers can be used to generate files for visualization or interfacing with other codes.
|
protected |
|
strong |
|
strong |
|
virtualdefault |
Default destructor.
|
delete |
Delete copy constructor.
|
protecteddefault |
|
static |
Function to build a writer.
This function will build a default writer for use.
| [in] | db | Input database for the writer |
|
static |
Function to build a writer.
This function will build a default writer for use.
| [in] | type | Writer type: "None" - An empty writer will be created "Silo" - A silo writer will be created if silo is configured, otherwise an empty writer will be created. "Ascii" - A simple ascii writer "HDF5" - A simple HDF5 writer "auto" - Choose the writer based on the comm size and compiled packages |
| [in] | comm | Communicator to use |
|
protected |
| std::string AMP::IO::Writer::getExtension | ( | ) | const |
Function to return the file extension.
|
staticprotected |
|
staticprotected |
|
pure virtual |
Function to get the writer properties.
Implemented in AMP::IO::AsciiWriter, AMP::IO::HDF5writer, AMP::IO::NullWriter, and AMP::IO::SiloIO.
|
pure virtual |
Function to read a file.
Implemented in AMP::IO::NullWriter, AMP::IO::AsciiWriter, AMP::IO::HDF5writer, and AMP::IO::SiloIO.
| void AMP::IO::Writer::registerMatrix | ( | std::shared_ptr< AMP::LinearAlgebra::Matrix > | mat, |
| const std::string & | name = "" |
||
| ) |
Function to register a matrix.
This function will register a matrix with the writer. This version of registerMatrix only stores the raw data.. It is not associated with a mesh.
| [in] | mat | The matrix we want to write |
| [in] | name | Optional name for the vector. |
| void AMP::IO::Writer::registerMesh | ( | std::shared_ptr< AMP::Mesh::Mesh > | mesh, |
| int | level = 1, |
||
| const std::string & | path = std::string() |
||
| ) |
Function to register a mesh.
This function will register a mesh with the writer. Note: if mesh is a MultiMesh, it will register all sub meshes.
| [in] | mesh | The mesh to register |
| [in] | level | How many sub meshes do we want? 0: Only register the local base meshes (advanced users only) 1: Register current mesh only (default) 2: Register all meshes (do not separate for the ranks) 3: Register all mesh pieces including the individual ranks |
| [in] | path | The directory path for the mesh. Default is an empty string. |
|
protected |
| void AMP::IO::Writer::registerVector | ( | std::shared_ptr< AMP::LinearAlgebra::Vector > | vec, |
| const std::string & | name = "" |
||
| ) |
Function to register a vector.
This function will register a vector with the writer. This version of registerVector only stores the raw data. It is not associated with a mesh.
| [in] | vec | The vector we want to write |
| [in] | name | Optional name for the vector. |
|
virtual |
Function to register a vector.
This function will register a vector with the writer and register it with the given mesh. This version of registerVector allows the data to be "stored" on the mesh for visualization or mesh-based operations.
| [in] | vec | The vector we want to write |
| [in] | mesh | The mesh we want to write the vector over. Note: any writers require the vector to completely cover the mesh. Note: mesh does not have to be previously registered with registerMesh. |
| [in] | type | The entity type we want to save (vertex, face, cell, etc.) Note: some writers only supports writing one entity type. If the vector spans multiple entity type (eg cell+vertex) the user should register the vector multiple times (one for each entity type). |
| [in] | name | Optional name for the vector. |
| [in] | precision | Desired precision in output file. Note: not all types are supported by all writers. |
| [in] | isStatic | Is the vectors static (constant vs time) |
|
virtual |
Function to set the file decomposition.
This function will set the method used for file IO. When writing files, there are different decompositions that affect the performance and usability of the output files. By default, this writer will generate a single file.
| [in] | decomposition | Decomposition method to use: 1: This will write all of the data to a single file. Note that this requires a serial write and will have the worst performance 2: Each processor will write a separate file and a separate summary file will be written. Note that this will have better performance at large scale, but will write many files simultaneously. |
|
protected |
|
protected |
|
protected |
|
pure virtual |
Function to write a file.
Implemented in AMP::IO::NullWriter, AMP::IO::HDF5writer, AMP::IO::SiloIO, and AMP::IO::AsciiWriter.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
Advanced Multi-Physics (AMP) Oak Ridge National Laboratory Idaho National Laboratory Los Alamos National Laboratory |
This page automatically produced from the source code by Last updated: Tue Mar 10 2026 13:06:42. Comments on this page |