Correlation 4.10.0
An Analysis Tool for Liquids and for Amorphous Solids
Loading...
Searching...
No Matches
ArcReader.hpp
Go to the documentation of this file.
1
8#pragma once
9
10#include "BaseReader.hpp"
11#include "core/Cell.hpp"
12#include "core/Trajectory.hpp"
13
14#include <functional>
15#include <string>
16#include <vector>
17
18namespace correlation::readers {
19
24class ArcReader : public BaseReader {
25public:
26 std::string getName() const override { return "Accelrys ARC"; }
27 std::vector<std::string> getExtensions() const override { return {"arc"}; }
28 bool isTrajectory() const override { return true; }
29
31 const std::string &filename,
32 std::function<void(float, const std::string &)> progress_callback = nullptr) override;
33
35 const std::string &filename,
36 std::function<void(float, const std::string &)> progress_callback = nullptr) override;
37
44 static std::vector<correlation::core::Cell>
45 read(const std::string &file_name,
46 const std::function<void(float, const std::string &)> &progress_callback = nullptr);
47
48private:
49 static void
50 updateProgress(std::streampos current_pos, std::streampos file_size,
51 std::streampos &last_progress_pos, std::streamoff update_interval,
52 const std::function<void(float, const std::string &)> &progress_callback);
53
54 static void parseLine(const std::string &line, correlation::core::Cell &temp_cell,
55 std::vector<correlation::core::Cell> &frames);
56};
57
58} // namespace correlation::readers
Abstract base class for all file format readers.
Simulation cell structure with periodic boundary conditions.
Trajectory data structure for time-series atomistic simulations.
Represents the simulation cell (periodic box).
Definition Cell.hpp:30
This class stores a series of snapshots of a system.
Definition Trajectory.hpp:32
Reads an ARC file and returns a vector of correlation::core::Cell objects.
Definition ArcReader.hpp:24
static std::vector< correlation::core::Cell > read(const std::string &file_name, const std::function< void(float, const std::string &)> &progress_callback=nullptr)
Low-level parser for the specific file format.
Definition ArcReader.cpp:40
std::vector< std::string > getExtensions() const override
Returns a list of supported file extensions.
Definition ArcReader.hpp:27
correlation::core::Cell readStructure(const std::string &filename, std::function< void(float, const std::string &)> progress_callback=nullptr) override
Reads an atomic structure from a file.
Definition ArcReader.cpp:28
std::string getName() const override
Returns the display name of the format.
Definition ArcReader.hpp:26
correlation::core::Trajectory readTrajectory(const std::string &filename, std::function< void(float, const std::string &)> progress_callback=nullptr) override
Reads a trajectory from a file.
Definition ArcReader.cpp:34
bool isTrajectory() const override
Returns true if this reader supports trajectory files.
Definition ArcReader.hpp:28
static void parseLine(const std::string &line, correlation::core::Cell &temp_cell, std::vector< correlation::core::Cell > &frames)
Definition ArcReader.cpp:80
static void updateProgress(std::streampos current_pos, std::streampos file_size, std::streampos &last_progress_pos, std::streamoff update_interval, const std::function< void(float, const std::string &)> &progress_callback)
Definition ArcReader.cpp:69
Definition TrajectoryLoader.hpp:24