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

Manages loading of structure/trajectory files and provides atomic/cell metadata. More...

#include <TrajectoryLoader.hpp>

Collaboration diagram for correlation::app::TrajectoryLoader:

Public Types

using ProgressCallback = std::function<void(float, const std::string &)>

Public Member Functions

 TrajectoryLoader ()
 Constructs a TrajectoryLoader using the global default ReaderFactory singleton.
 TrajectoryLoader (const correlation::readers::IReaderRegistry &registry)
 Constructs a TrajectoryLoader with an injected IReaderRegistry dependency.
 ~TrajectoryLoader ()=default
 TrajectoryLoader (const TrajectoryLoader &)=delete
TrajectoryLoader & operator= (const TrajectoryLoader &)=delete
 TrajectoryLoader (TrajectoryLoader &&) noexcept=default
TrajectoryLoader & operator= (TrajectoryLoader &&) noexcept=default
std::expected< std::string, std::string > loadFile (const std::string &path, const ProgressCallback &progress=nullptr)
 Loads a structure or trajectory file from the given path.
std::expected< std::string, std::string > loadFiles (const std::vector< std::string > &paths, const ProgressCallback &progress=nullptr)
 Loads a multi-file trajectory from a collection of paths.
const correlation::core::Trajectory * trajectory () const noexcept
 Gets a pointer to the loaded trajectory.
correlation::core::Trajectory * trajectoryMut () noexcept
 Gets a mutable pointer to the loaded trajectory.
std::shared_ptr< const correlation::core::Trajectory > trajectoryShared () const noexcept
 Gets a shared pointer to the loaded trajectory.
const correlation::core::Cell * cell () const noexcept
 Gets a pointer to the first cell frame.
std::map< std::string, int > getAtomCounts () const
 Computes atomic species counts for the active cell.
std::vector< std::pair< std::string, int > > getOrderedAtomCounts () const
 Computes atomic species counts in cell element-registration order.
bool renameElement (std::string_view old_symbol, std::string_view new_symbol)
 Renames an element species across the loaded trajectory.
size_t getFrameCount () const noexcept
 Total number of frames in the loaded trajectory.
size_t getTotalAtomCount () const noexcept
 Total number of atoms in the primary frame.
size_t getRemovedFrameCount () const noexcept
 Number of skipped/removed frames during parsing.
real_t getTimeStep () const noexcept
 Simulation timestep of the trajectory in femtoseconds.
real_t getRecommendedTimeStep () const
 Recommended timestep derived from atomic masses in the active cell.
void setTrajectory (std::shared_ptr< correlation::core::Trajectory > traj) noexcept
 Injects an existing trajectory instance.
void clear () noexcept
 Clears currently loaded trajectory and resets state.

Private Attributes

std::shared_ptr< correlation::core::Trajectory > trajectory_
const correlation::readers::IReaderRegistry * registry_ {nullptr}

Detailed Description

Manages loading of structure/trajectory files and provides atomic/cell metadata.

Member Typedef Documentation

◆ ProgressCallback

using correlation::app::TrajectoryLoader::ProgressCallback = std::function<void(float, const std::string &)>

Constructor & Destructor Documentation

◆ TrajectoryLoader() [1/4]

correlation::app::TrajectoryLoader::TrajectoryLoader ( )

Constructs a TrajectoryLoader using the global default ReaderFactory singleton.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TrajectoryLoader() [2/4]

correlation::app::TrajectoryLoader::TrajectoryLoader ( const correlation::readers::IReaderRegistry & registry)
explicit

Constructs a TrajectoryLoader with an injected IReaderRegistry dependency.

Parameters
[in]registryInjected reader registry for format querying.

◆ ~TrajectoryLoader()

correlation::app::TrajectoryLoader::~TrajectoryLoader ( )
default

◆ TrajectoryLoader() [3/4]

correlation::app::TrajectoryLoader::TrajectoryLoader ( const TrajectoryLoader & )
delete
Here is the call graph for this function:

◆ TrajectoryLoader() [4/4]

correlation::app::TrajectoryLoader::TrajectoryLoader ( TrajectoryLoader && )
defaultnoexcept
Here is the call graph for this function:

Member Function Documentation

◆ cell()

const correlation::core::Cell * correlation::app::TrajectoryLoader::cell ( ) const
inlinenodiscardnoexcept

Gets a pointer to the first cell frame.

Returns
Const pointer to Cell, or nullptr if none loaded.
Here is the caller graph for this function:

◆ clear()

void correlation::app::TrajectoryLoader::clear ( )
inlinenoexcept

Clears currently loaded trajectory and resets state.

◆ getAtomCounts()

std::map< std::string, int > correlation::app::TrajectoryLoader::getAtomCounts ( ) const
nodiscard

Computes atomic species counts for the active cell.

Returns
Map of element symbol to count.
Here is the call graph for this function:

◆ getFrameCount()

size_t correlation::app::TrajectoryLoader::getFrameCount ( ) const
inlinenodiscardnoexcept

Total number of frames in the loaded trajectory.

Here is the caller graph for this function:

◆ getOrderedAtomCounts()

std::vector< std::pair< std::string, int > > correlation::app::TrajectoryLoader::getOrderedAtomCounts ( ) const
nodiscard

Computes atomic species counts in cell element-registration order.

Returns
Ordered list of (element symbol, count) pairs.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getRecommendedTimeStep()

real_t correlation::app::TrajectoryLoader::getRecommendedTimeStep ( ) const
nodiscard

Recommended timestep derived from atomic masses in the active cell.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getRemovedFrameCount()

size_t correlation::app::TrajectoryLoader::getRemovedFrameCount ( ) const
inlinenodiscardnoexcept

Number of skipped/removed frames during parsing.

◆ getTimeStep()

real_t correlation::app::TrajectoryLoader::getTimeStep ( ) const
inlinenodiscardnoexcept

Simulation timestep of the trajectory in femtoseconds.

◆ getTotalAtomCount()

size_t correlation::app::TrajectoryLoader::getTotalAtomCount ( ) const
inlinenodiscardnoexcept

Total number of atoms in the primary frame.

Here is the caller graph for this function:

◆ loadFile()

std::expected< std::string, std::string > correlation::app::TrajectoryLoader::loadFile ( const std::string & path,
const ProgressCallback & progress = nullptr )

Loads a structure or trajectory file from the given path.

Parameters
[in]pathAbsolute or relative file path.
[in]progressOptional progress reporting callback.
Returns
Success message string or error description string.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadFiles()

std::expected< std::string, std::string > correlation::app::TrajectoryLoader::loadFiles ( const std::vector< std::string > & paths,
const ProgressCallback & progress = nullptr )

Loads a multi-file trajectory from a collection of paths.

Parameters
[in]pathsCollection of file paths making up the trajectory.
[in]progressOptional progress reporting callback.
Returns
Success message string or error description string.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=() [1/2]

TrajectoryLoader & correlation::app::TrajectoryLoader::operator= ( const TrajectoryLoader & )
delete
Here is the call graph for this function:

◆ operator=() [2/2]

TrajectoryLoader & correlation::app::TrajectoryLoader::operator= ( TrajectoryLoader && )
defaultnoexcept
Here is the call graph for this function:

◆ renameElement()

bool correlation::app::TrajectoryLoader::renameElement ( std::string_view old_symbol,
std::string_view new_symbol )

Renames an element species across the loaded trajectory.

Parameters
[in]old_symbolExisting element symbol (e.g., "1").
[in]new_symbolReplacement element symbol (e.g., "Cu").
Returns
True if renamed successfully, false otherwise.

◆ setTrajectory()

void correlation::app::TrajectoryLoader::setTrajectory ( std::shared_ptr< correlation::core::Trajectory > traj)
inlinenoexcept

Injects an existing trajectory instance.

Parameters
[in]trajTrajectory instance to own.

◆ trajectory()

const correlation::core::Trajectory * correlation::app::TrajectoryLoader::trajectory ( ) const
inlinenodiscardnoexcept

Gets a pointer to the loaded trajectory.

Returns
Const pointer to Trajectory, or nullptr if none loaded.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ trajectoryMut()

correlation::core::Trajectory * correlation::app::TrajectoryLoader::trajectoryMut ( )
inlinenodiscardnoexcept

Gets a mutable pointer to the loaded trajectory.

Returns
Pointer to Trajectory, or nullptr if none loaded.
Here is the caller graph for this function:

◆ trajectoryShared()

std::shared_ptr< const correlation::core::Trajectory > correlation::app::TrajectoryLoader::trajectoryShared ( ) const
inlinenodiscardnoexcept

Gets a shared pointer to the loaded trajectory.

Returns
Shared pointer to const Trajectory, or nullptr if none loaded.

Member Data Documentation

◆ registry_

const correlation::readers::IReaderRegistry* correlation::app::TrajectoryLoader::registry_ {nullptr}
private

◆ trajectory_

std::shared_ptr<correlation::core::Trajectory> correlation::app::TrajectoryLoader::trajectory_
private

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