FEOutput< dim, VectorType > Class Template Reference#

DiFfRG: DiFfRG::FEOutput< dim, VectorType > Class Template Reference
DiFfRG
Discretization Framework for functional Renormalization Group flows

A class to output finite element data to disk as .vtu files and .pvd time series. More...

#include <fe_output.hh>

Classes

struct  SerialMirrorDoFs
 Serial mirror of the solution DoFHandler, plus the map from its dof numbering to ours. More...
 

Public Member Functions

 FEOutput (std::string top_folder, std::string output_name, std::string output_folder, const Config::OutputSettings &settings, bool active=true)
 Construct a new FEOutput object.
 
 FEOutput (std::string top_folder, std::string output_name, std::string output_folder, const ConfigTree &config, bool active=true)
 
 FEOutput ()
 
 ~FEOutput () noexcept
 
void drain ()
 
void finish ()
 
void set_hdf5_output (HDF5Output *output, bool session_closes_file=false, std::string group_name="FE")
 Route the finite-element frame data into an HDF5 file owned by someone else.
 
bool will_discard () const
 
std::size_t pending_workers () const
 
void attach (const DoFHandler< dim > &dof_handler, const VectorType &solution, const std::string &name)
 Attach a solution to the output.
 
void attach (const DoFHandler< dim > &dof_handler, const VectorType &solution, const std::vector< std::string > &names)
 Attach a solution to the output.
 
void flush (double time)
 Flush all attached solutions to disk.
 
FrameTimings take_frame_timings ()
 

Private Types

using OutputVectorType
 What the DataOut actually gets handed.
 

Private Member Functions

const DoFHandler< safe_dim > & prepare_output_vector (const DoFHandler< dim > &dof_handler, const VectorType &solution, OutputVectorType &target)
 
void update_buffers ()
 
void retire_oldest ()
 
void reserve_bytes (std::size_t bytes)
 

Private Attributes

const std::string top_folder
 
const std::string output_name
 
const std::string output_folder
 
const std::string filename_pvd
 
const uint buffer_size
 
const std::size_t max_pending_bytes
 
uint series_number
 
uint subdivisions
 
std::vector< std::pair< double, std::string > > time_series
 
std::vector< DataOut< safe_dim > > data_outs
 
std::list< std::thread > output_threads
 
std::list< uint > output_thread_series
 
std::list< std::list< std::unique_ptr< OutputVectorType > > > attached_solutions
 
std::list< std::size_t > attached_bytes
 
std::size_t pending_bytes = 0
 
std::mutex output_mutex
 
std::condition_variable output_condition
 
uint next_published_series = 0
 
bool publication_failed = false
 
std::mutex exception_mutex
 
std::exception_ptr stored_exception
 
bool finished = false
 
SerialMirrorDoFs mirror_dofs
 
HDF5Output * hdf5_output = nullptr
 
bool hdf5_closed_by_session = false
 
std::string hdf5_group_name = "FE"
 
bool save_vtk
 
FrameTimings frame_timings
 

Static Private Attributes

static constexpr uint safe_dim = dim == 0 ? 1 : dim
 

Detailed Description

template<uint dim, typename VectorType>
class DiFfRG::FEOutput< dim, VectorType >

A class to output finite element data to disk as .vtu files and .pvd time series.

Template Parameters
dimDimension of the problem
VectorTypeType of the vector

Member Typedef Documentation

◆ OutputVectorType

template<uint dim, typename VectorType >
using DiFfRG::FEOutput< dim, VectorType >::OutputVectorType
private
Initial value:
std::conditional_t<is_distributed_la<VectorType>, dealii::Vector<get_type::NumberType<VectorType>>, VectorType>

What the DataOut actually gets handed.

Never a distributed vector. DataOut::add_data_vector() routes every vector type through internal::DataOutImplementation::CreateVectors::create_dof_vector(), which builds a ghosted LinearAlgebra::distributed::BlockVector on dof_handler.get_mpi_communicator() and calls update_ghost_values() – two collectives, in a code path OutputSession runs on rank 0 alone. Under the replicated-mesh policy rank 0 already holds every dof, so it copies the replica into a plain serial vector and attaches that to a serial mirror DoFHandler instead. Nothing communicates and the whole domain still gets written.

Constructor & Destructor Documentation

◆ FEOutput() [1/3]

template<uint dim, typename VectorType >
DiFfRG::FEOutput< dim, VectorType >::FEOutput ( std::string top_folder,
std::string output_name,
std::string output_folder,
const Config::OutputSettings & settings,
bool active = true )

Construct a new FEOutput object.

Parameters
dof_handlerDoFHandler associated with the solution
top_folderFolder where the output will be written, i.e. the folder containing the .pvd file.
output_nameName of the output, i.e. the name of the .pvd file.
output_folderFolder where the .vtu files will be saved. Should be relative to top_folder.
subdivisionsNumber of subdivisions of the cells in the .vtu files.

◆ FEOutput() [2/3]

template<uint dim, typename VectorType >
DiFfRG::FEOutput< dim, VectorType >::FEOutput ( std::string top_folder,
std::string output_name,
std::string output_folder,
const ConfigTree & config,
bool active = true )
inline

◆ FEOutput() [3/3]

template<uint dim, typename VectorType >
DiFfRG::FEOutput< dim, VectorType >::FEOutput ( )

◆ ~FEOutput()

template<uint dim, typename VectorType >
DiFfRG::FEOutput< dim, VectorType >::~FEOutput ( )
noexcept

Member Function Documentation

◆ attach() [1/2]

template<uint dim, typename VectorType >
void DiFfRG::FEOutput< dim, VectorType >::attach ( const DoFHandler< dim > & dof_handler,
const VectorType & solution,
const std::string & name )

Attach a solution to the output.

Parameters
dof_handlerThe DoFHandler associated with the solution.
solutionThe solution to attach.
nameThe name of the solution.

◆ attach() [2/2]

template<uint dim, typename VectorType >
void DiFfRG::FEOutput< dim, VectorType >::attach ( const DoFHandler< dim > & dof_handler,
const VectorType & solution,
const std::vector< std::string > & names )

Attach a solution to the output.

Parameters
dof_handlerThe DoFHandler associated with the solution.
solutionThe solution to attach.
namesThe names of each component of the solution.

◆ drain()

template<uint dim, typename VectorType >
void DiFfRG::FEOutput< dim, VectorType >::drain ( )

Join pending writers and surface the first worker error without closing the output.

◆ finish()

template<uint dim, typename VectorType >
void DiFfRG::FEOutput< dim, VectorType >::finish ( )

Drain pending writers, release terminal resources, and close the output.

◆ flush()

template<uint dim, typename VectorType >
void DiFfRG::FEOutput< dim, VectorType >::flush ( double time)

Flush all attached solutions to disk.

Parameters
timeThe time tag to attach to the solution.

◆ pending_workers()

template<uint dim, typename VectorType >
std::size_t DiFfRG::FEOutput< dim, VectorType >::pending_workers ( ) const
inline

Number of writer threads that have not been joined yet.

◆ prepare_output_vector()

template<uint dim, typename VectorType >
const DoFHandler< safe_dim > & DiFfRG::FEOutput< dim, VectorType >::prepare_output_vector ( const DoFHandler< dim > & dof_handler,
const VectorType & solution,
OutputVectorType & target )
private

The DoFHandler to hand DataOut, and the values permuted into its numbering.

◆ reserve_bytes()

template<uint dim, typename VectorType >
void DiFfRG::FEOutput< dim, VectorType >::reserve_bytes ( std::size_t bytes)
private

◆ retire_oldest()

template<uint dim, typename VectorType >
void DiFfRG::FEOutput< dim, VectorType >::retire_oldest ( )
private

◆ set_hdf5_output()

template<uint dim, typename VectorType >
void DiFfRG::FEOutput< dim, VectorType >::set_hdf5_output ( HDF5Output * output,
bool session_closes_file = false,
std::string group_name = "FE" )

Route the finite-element frame data into an HDF5 file owned by someone else.

Parameters
session_closes_fileWhen true, flush() leaves the file open and relies on the owner to close it once per frame – which is what OutputSession does, since it flushes its HDF5Output sinks after this one. Standalone users, who may never call HDF5Output::flush() at all, keep the default and get a close per frame.
group_nameTop-level HDF5 group that owns this field series.

◆ take_frame_timings()

template<uint dim, typename VectorType >
FrameTimings DiFfRG::FEOutput< dim, VectorType >::take_frame_timings ( )
inline

Timing buckets accumulated since the last call, and reset by it.

◆ update_buffers()

template<uint dim, typename VectorType >
void DiFfRG::FEOutput< dim, VectorType >::update_buffers ( )
private

◆ will_discard()

template<uint dim, typename VectorType >
bool DiFfRG::FEOutput< dim, VectorType >::will_discard ( ) const
inline

True when flush() would throw everything attached to it away.

Member Data Documentation

◆ attached_bytes

template<uint dim, typename VectorType >
std::list<std::size_t> DiFfRG::FEOutput< dim, VectorType >::attached_bytes
private

◆ attached_solutions

template<uint dim, typename VectorType >
std::list<std::list<std::unique_ptr<OutputVectorType> > > DiFfRG::FEOutput< dim, VectorType >::attached_solutions
private

◆ buffer_size

template<uint dim, typename VectorType >
const uint DiFfRG::FEOutput< dim, VectorType >::buffer_size
private

◆ data_outs

template<uint dim, typename VectorType >
std::vector<DataOut<safe_dim> > DiFfRG::FEOutput< dim, VectorType >::data_outs
private

◆ exception_mutex

template<uint dim, typename VectorType >
std::mutex DiFfRG::FEOutput< dim, VectorType >::exception_mutex
private

◆ filename_pvd

template<uint dim, typename VectorType >
const std::string DiFfRG::FEOutput< dim, VectorType >::filename_pvd
private

◆ finished

template<uint dim, typename VectorType >
bool DiFfRG::FEOutput< dim, VectorType >::finished = false
private

◆ frame_timings

template<uint dim, typename VectorType >
FrameTimings DiFfRG::FEOutput< dim, VectorType >::frame_timings
private

◆ hdf5_closed_by_session

template<uint dim, typename VectorType >
bool DiFfRG::FEOutput< dim, VectorType >::hdf5_closed_by_session = false
private

◆ hdf5_group_name

template<uint dim, typename VectorType >
std::string DiFfRG::FEOutput< dim, VectorType >::hdf5_group_name = "FE"
private

◆ hdf5_output

template<uint dim, typename VectorType >
HDF5Output* DiFfRG::FEOutput< dim, VectorType >::hdf5_output = nullptr
private

◆ max_pending_bytes

template<uint dim, typename VectorType >
const std::size_t DiFfRG::FEOutput< dim, VectorType >::max_pending_bytes
private

◆ mirror_dofs

template<uint dim, typename VectorType >
SerialMirrorDoFs DiFfRG::FEOutput< dim, VectorType >::mirror_dofs
private

◆ next_published_series

template<uint dim, typename VectorType >
uint DiFfRG::FEOutput< dim, VectorType >::next_published_series = 0
private

◆ output_condition

template<uint dim, typename VectorType >
std::condition_variable DiFfRG::FEOutput< dim, VectorType >::output_condition
private

◆ output_folder

template<uint dim, typename VectorType >
const std::string DiFfRG::FEOutput< dim, VectorType >::output_folder
private

◆ output_mutex

template<uint dim, typename VectorType >
std::mutex DiFfRG::FEOutput< dim, VectorType >::output_mutex
private

◆ output_name

template<uint dim, typename VectorType >
const std::string DiFfRG::FEOutput< dim, VectorType >::output_name
private

◆ output_thread_series

template<uint dim, typename VectorType >
std::list<uint> DiFfRG::FEOutput< dim, VectorType >::output_thread_series
private

◆ output_threads

template<uint dim, typename VectorType >
std::list<std::thread> DiFfRG::FEOutput< dim, VectorType >::output_threads
private

◆ pending_bytes

template<uint dim, typename VectorType >
std::size_t DiFfRG::FEOutput< dim, VectorType >::pending_bytes = 0
private

◆ publication_failed

template<uint dim, typename VectorType >
bool DiFfRG::FEOutput< dim, VectorType >::publication_failed = false
private

◆ safe_dim

template<uint dim, typename VectorType >
uint DiFfRG::FEOutput< dim, VectorType >::safe_dim = dim == 0 ? 1 : dim
staticconstexprprivate

◆ save_vtk

template<uint dim, typename VectorType >
bool DiFfRG::FEOutput< dim, VectorType >::save_vtk
private

◆ series_number

template<uint dim, typename VectorType >
uint DiFfRG::FEOutput< dim, VectorType >::series_number
private

◆ stored_exception

template<uint dim, typename VectorType >
std::exception_ptr DiFfRG::FEOutput< dim, VectorType >::stored_exception
private

◆ subdivisions

template<uint dim, typename VectorType >
uint DiFfRG::FEOutput< dim, VectorType >::subdivisions
private

◆ time_series

template<uint dim, typename VectorType >
std::vector<std::pair<double, std::string> > DiFfRG::FEOutput< dim, VectorType >::time_series
private

◆ top_folder

template<uint dim, typename VectorType >
const std::string DiFfRG::FEOutput< dim, VectorType >::top_folder
private

The documentation for this class was generated from the following file:
  • /home/runner/work/DiFfRG_current/DiFfRG_current/DiFfRG/include/DiFfRG/discretization/data/fe_output.hh