2014-09-09 14:42:13 -04:00
|
|
|
#ifndef WRITER_INC
|
|
|
|
|
#define WRITER_INC
|
|
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
#include "IO/Mesh.h"
|
|
|
|
|
#include "IO/MeshDatabase.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace IO {
|
|
|
|
|
|
|
|
|
|
|
2017-01-23 10:42:21 -05:00
|
|
|
/*!
|
|
|
|
|
* @brief Initialize the writer
|
|
|
|
|
* @details This function initializes the writer to the given path. All subsequent
|
|
|
|
|
* writes will occur in this directory. If this is not called, then it will default
|
|
|
|
|
* to the current path.
|
|
|
|
|
* @param[in] path The path to use for writes
|
|
|
|
|
* @param[in] format The data format to use:
|
|
|
|
|
* old - Old mesh format (provided for backward compatibility, cannot write variables)
|
|
|
|
|
* new - New format, 1 file/process
|
|
|
|
|
* silo - Silo
|
|
|
|
|
* @param[in] append Append any existing data (default is false)
|
|
|
|
|
*/
|
2018-11-14 13:43:59 -05:00
|
|
|
void initialize( const std::string& path="", const std::string& format="silo", bool append=false );
|
2017-01-23 10:42:21 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* @brief Write the data for the timestep
|
|
|
|
|
* @details This function writes the mesh and variable data provided for the current timestep
|
|
|
|
|
* @param[in] subdir The subdirectory to use for the timestep
|
|
|
|
|
* @param[in] meshData The data to write
|
|
|
|
|
* @param[in] comm The comm to use for writing (usually MPI_COMM_WORLD or a dup thereof)
|
|
|
|
|
*/
|
2021-01-04 21:40:41 -05:00
|
|
|
void writeData( const std::string& subdir, const std::vector<IO::MeshDataStruct>& meshData, const Utilities::MPI& comm );
|
2017-01-23 10:42:21 -05:00
|
|
|
|
|
|
|
|
|
2014-11-04 21:58:20 -05:00
|
|
|
/*!
|
|
|
|
|
* @brief Write the data for the timestep
|
|
|
|
|
* @details This function writes the mesh and variable data provided for the current timestep
|
|
|
|
|
* @param[in] timestep The timestep iteration
|
|
|
|
|
* @param[in] meshData The data to write
|
2015-09-04 13:06:36 -04:00
|
|
|
* @param[in] comm The comm to use for writing (usually MPI_COMM_WORLD or a dup thereof)
|
2014-11-04 21:58:20 -05:00
|
|
|
*/
|
2021-01-04 21:40:41 -05:00
|
|
|
inline void writeData( int timestep, const std::vector<IO::MeshDataStruct>& meshData, const Utilities::MPI& comm )
|
2017-01-23 10:42:21 -05:00
|
|
|
{
|
|
|
|
|
char subdir[100];
|
|
|
|
|
sprintf(subdir,"vis%03i",timestep);
|
|
|
|
|
writeData( subdir, meshData, comm );
|
|
|
|
|
}
|
2014-09-09 14:42:13 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
} // IO namespace
|
|
|
|
|
|
|
|
|
|
#endif
|