Correlation 4.10.0
An Analysis Tool for Liquids and for Amorphous Solids
Loading...
Searching...
No Matches
correlation::writers::CSVWriter Class Reference

Manages the writing of distribution function data to CSV files. More...

#include <CSVWriter.hpp>

Inheritance diagram for correlation::writers::CSVWriter:
Collaboration diagram for correlation::writers::CSVWriter:

Public Member Functions

 CSVWriter ()=default
std::string getName () const override
 Returns the display name of the format (e.g., "HDF5", "CSV").
std::vector< std::string > getExtensions () const override
 Returns a list of supported file extensions (e.g., {".h5"}, {".csv"}).
void write (const std::string &base_path, const correlation::analysis::DistributionFunctions &dists, bool smoothing) const override
 Writes the distribution function data to file(s).
Public Member Functions inherited from correlation::writers::BaseWriter
 BaseWriter ()=default
virtual ~BaseWriter ()=default
 BaseWriter (const BaseWriter &)=delete
BaseWriter & operator= (const BaseWriter &)=delete
 BaseWriter (BaseWriter &&)=delete
BaseWriter & operator= (BaseWriter &&)=delete

Static Public Member Functions

static void writeAllCSVs (const std::string &base_path, const correlation::analysis::DistributionFunctions &dists, bool write_smoothed=false)
 Writes all available histograms to appropriately named CSV files.
static void writeHistogramToStream (std::ostream &out_stream, const correlation::analysis::Histogram &hist, const correlation::analysis::Histogram *raw_companion=nullptr)
 Writes a single histogram and its smoothed companion to an output stream (CSV format).

Static Private Member Functions

static void writeHistogramToCSV (const std::string &filename, const correlation::analysis::Histogram &hist, const correlation::analysis::Histogram *raw_companion=nullptr)
 The core implementation for writing a single histogram and it's smoothed histograms to a single CSV file.

Detailed Description

Manages the writing of distribution function data to CSV files.

This class takes a DistributionFunctions object and provides methods to write the calculated histograms (both raw and smoothed) to disk in a well-formatted, data-driven way.

Constructor & Destructor Documentation

◆ CSVWriter()

correlation::writers::CSVWriter::CSVWriter ( )
default

Member Function Documentation

◆ getExtensions()

std::vector< std::string > correlation::writers::CSVWriter::getExtensions ( ) const
inlineoverridevirtual

Returns a list of supported file extensions (e.g., {".h5"}, {".csv"}).

Returns
A vector of extension strings including the dot.

Implements correlation::writers::BaseWriter.

◆ getName()

std::string correlation::writers::CSVWriter::getName ( ) const
inlineoverridevirtual

Returns the display name of the format (e.g., "HDF5", "CSV").

Returns
A human-readable name for the writer format.

Implements correlation::writers::BaseWriter.

◆ write()

void correlation::writers::CSVWriter::write ( const std::string & base_path,
const correlation::analysis::DistributionFunctions & dists,
bool smoothing ) const
inlineoverridevirtual

Writes the distribution function data to file(s).

Parameters
base_pathThe base name for the output files.
distsThe DistributionFunctions object containing the data.
smoothingWhether to include smoothed data.

Implements correlation::writers::BaseWriter.

Here is the call graph for this function:

◆ writeAllCSVs()

void correlation::writers::CSVWriter::writeAllCSVs ( const std::string & base_path,
const correlation::analysis::DistributionFunctions & dists,
bool write_smoothed = false )
static

Writes all available histograms to appropriately named CSV files.

For each histogram in the DistributionFunctions object (e.g., "g(r)"), this method will create a corresponding CSV file (e.g., "base_path_g.csv").

Parameters
base_pathThe base name for the output files (e.g., "output/my_sample").
distsThe DistributionFunctions object containing the data.
write_smoothedIf true, also writes smoothed data to separate files (e.g., "base_path_g_smoothed.csv").
Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeHistogramToCSV()

void correlation::writers::CSVWriter::writeHistogramToCSV ( const std::string & filename,
const correlation::analysis::Histogram & hist,
const correlation::analysis::Histogram * raw_companion = nullptr )
staticprivate

The core implementation for writing a single histogram and it's smoothed histograms to a single CSV file.

Parameters
filenameThe full path of the file to write.
histThe Histogram data structure to write.
raw_companionOptional pointer to a raw-count companion histogram (e.g. PAD_raw for PAD). When non-null, its partials are prepended as {key}_raw columns before the normalized data.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeHistogramToStream()

void correlation::writers::CSVWriter::writeHistogramToStream ( std::ostream & out_stream,
const correlation::analysis::Histogram & hist,
const correlation::analysis::Histogram * raw_companion = nullptr )
static

Writes a single histogram and its smoothed companion to an output stream (CSV format).

Parameters
out_streamOutput stream.
histThe Histogram data structure.
raw_companionOptional raw companion histogram.
Here is the caller graph for this function:

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