SimpleFastOpenAtomicVisualiser
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Structure Class Referenceabstract

Specification for the structure file interface. More...

#include <structure.h>

Inheritance diagram for Structure:
Inheritance graph
[legend]

Public Member Functions

 Structure (std::filesystem::path path, bool blocking=false)
 
virtual uint64_t atomCount () const
 Get the number of atoms in the file.
 
virtual void readFrame (uint64_t frame)
 Read a single frame at position frame, and increment the current frame.
 
virtual ~Structure ()=default
 
uint64_t frameCount () const
 Get the number of frames.
 
uint64_t framePosition () const
 Get the current frame index.
 
bool framePositionsLoaded () const
 Check if frames start positions have been loaded.
 
uint64_t frameReadProgress () const
 Progress of the current frame read.
 
bool frameReadComplete () const
 If the frame has been fully read into atoms.
 
glm::vec3 getCellA () const
 Get the a cell vector.
 
glm::vec3 getCellB () const
 Get the b cell vector.
 
glm::vec3 getCellC () const
 Get the c cell vector.
 

Public Attributes

std::vector< Atomatoms
 The Atoms read in the current frame.
 
std::map< Element, glm::vec4 > colourMap = CPK_COLOURS
 Colour map from Element to colour.
 

Protected Member Functions

virtual void beginning ()
 
virtual void getFrame ()=0
 
virtual void getCell ()=0
 
void skipFrame ()
 
virtual void skipFrames (uint64_t count)
 
void skipLine (std::ifstream &in)
 
virtual void initialise ()=0
 
void scanPositions ()
 
void cachePositions ()
 
void countContentLinesInFile ()
 
void checkRead (std::stringstream &ss, std::string lastInput, std::string context)
 

Protected Attributes

std::filesystem::path path
 
bool blockingReads
 
std::ifstream filestream
 
uint64_t natoms
 
uint64_t frames
 
uint64_t linesPerFrame
 
uint64_t timeStep
 
uint64_t currentFrame
 
uint64_t linesInFile
 
uint64_t atomsRead
 
glm::vec3 cellA
 
glm::vec3 cellB
 
glm::vec3 cellC
 
bool cacheComplete = false
 
std::map< uint64_t, uint64_tframePositions
 

Detailed Description

Specification for the structure file interface.

Remarks
See also
XYZ for an XYZ/EXTXYZ implementation.
Remarks
See also
CONFIG for a CONFIG implementation.
Remarks
Implementors must set:
  • atoms: the atom count.
  • frames: the frame count.
  • linesPerFrame: the (constant) lines in each frame.

Constructor & Destructor Documentation

◆ Structure()

Structure::Structure ( std::filesystem::path  path,
bool  blocking = false 
)
inline

◆ ~Structure()

virtual Structure::~Structure ( )
virtualdefault

Member Function Documentation

◆ atomCount()

virtual uint64_t Structure::atomCount ( ) const
inlinevirtual

Get the number of atoms in the file.

Returns
uint64_t the number of atoms.

◆ beginning()

virtual void Structure::beginning ( )
inlineprotectedvirtual

◆ cachePositions()

void Structure::cachePositions ( )
inlineprotected

◆ checkRead()

void Structure::checkRead ( std::stringstream &  ss,
std::string  lastInput,
std::string  context 
)
inlineprotected

◆ countContentLinesInFile()

void Structure::countContentLinesInFile ( )
inlineprotected

◆ frameCount()

uint64_t Structure::frameCount ( ) const
inline

Get the number of frames.

Returns
uint64_t the frame count.

◆ framePosition()

uint64_t Structure::framePosition ( ) const
inline

Get the current frame index.

Returns
uint64_t the current frame index.

◆ framePositionsLoaded()

bool Structure::framePositionsLoaded ( ) const
inline

Check if frames start positions have been loaded.

Remarks
Frame start position offsets are loaded in a detached I/O thread. The result of this method indicates whether the I/O read has completed.
Structure::frameCount will be update while the detached read is progressing.
Structure::readFrame will only allow reads up to Structure::framePosition.
Returns
true if all frame start offsets have been loaded.
false frame start positions are still being read.

◆ frameReadComplete()

bool Structure::frameReadComplete ( ) const
inline

If the frame has been fully read into atoms.

Returns
true if all Atoms in the frame have been read.
false if reading is in progress.

◆ frameReadProgress()

uint64_t Structure::frameReadProgress ( ) const
inline

Progress of the current frame read.

Returns
uint64_t count of Atom read into atoms.

◆ getCell()

virtual void Structure::getCell ( )
protectedpure virtual

◆ getCellA()

glm::vec3 Structure::getCellA ( ) const
inline

Get the a cell vector.

Returns
glm::vec3 cell vector a.

◆ getCellB()

glm::vec3 Structure::getCellB ( ) const
inline

Get the b cell vector.

Returns
glm::vec3 cell vector b.

◆ getCellC()

glm::vec3 Structure::getCellC ( ) const
inline

Get the c cell vector.

Returns
glm::vec3 cell vector c.

◆ getFrame()

virtual void Structure::getFrame ( )
protectedpure virtual

◆ initialise()

virtual void Structure::initialise ( )
protectedpure virtual

◆ readFrame()

virtual void Structure::readFrame ( uint64_t  frame)
inlinevirtual

Read a single frame at position frame, and increment the current frame.

Remarks
Structure::frameCount is the maximum readable frame. If frame is larger it will be 'd.
See also
framePosition for the status of detached frame caching.
getAtoms for accessing the read data.
Parameters
framethe frame position.

◆ scanPositions()

void Structure::scanPositions ( )
inlineprotected

◆ skipFrame()

void Structure::skipFrame ( )
inlineprotected

◆ skipFrames()

virtual void Structure::skipFrames ( uint64_t  count)
inlineprotectedvirtual

◆ skipLine()

void Structure::skipLine ( std::ifstream &  in)
inlineprotected

Member Data Documentation

◆ atoms

std::vector<Atom> Structure::atoms

The Atoms read in the current frame.

◆ atomsRead

uint64_t Structure::atomsRead
protected

◆ blockingReads

bool Structure::blockingReads
protected

◆ cacheComplete

bool Structure::cacheComplete = false
protected

◆ cellA

glm::vec3 Structure::cellA
protected

◆ cellB

glm::vec3 Structure::cellB
protected

◆ cellC

glm::vec3 Structure::cellC
protected

◆ colourMap

std::map<Element, glm::vec4> Structure::colourMap = CPK_COLOURS

Colour map from Element to colour.

◆ currentFrame

uint64_t Structure::currentFrame
protected

◆ filestream

std::ifstream Structure::filestream
protected

◆ framePositions

std::map<uint64_t, uint64_t> Structure::framePositions
protected

◆ frames

uint64_t Structure::frames
protected

◆ linesInFile

uint64_t Structure::linesInFile
protected

◆ linesPerFrame

uint64_t Structure::linesPerFrame
protected

◆ natoms

uint64_t Structure::natoms
protected

◆ path

std::filesystem::path Structure::path
protected

◆ timeStep

uint64_t Structure::timeStep
protected

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