Hex  2.2
Hydrogen-electron collision solver
Public Member Functions | Static Public Attributes
SolutionIO Class Reference

Solution input/output class. More...

#include <io.h>

Public Member Functions

 SolutionIO ()
 
 SolutionIO (int L, int S, int Pi, int ni, int li, int mi, Real E, std::vector< std::pair< int, int >> const &ang, std::vector< std::pair< int, int >> const &chann=std::vector< std::pair< int, int >>(), std::string prefix="psi")
 
std::string name (int ill=SolutionIO::All) const
 Get name of the solution file. More...
 
bool check (int ill, std::size_t &total_size) const
 Check that the file exists. More...
 
bool check (int ill=SolutionIO::All) const
 
bool load (BlockArray< Complex > &solution, int ill=SolutionIO::All)
 Load the solution from disk. More...
 
bool save (BlockArray< Complex > const &solution, int ill=SolutionIO::All) const
 Write solution to disk. More...
 
bool save_segment (const cArrayView solution, int ill) const
 
std::vector< std::pair< int, int > > const & channels () const
 

Static Public Attributes

static const int All = -1
 All blocks flag. More...
 

Detailed Description

On several places in code it is necessary to load some solutions. In order not to bother with the file names and still to keep them consistent, this class will carry the file name and do all operations on it.

Constructor & Destructor Documentation

◆ SolutionIO() [1/2]

SolutionIO::SolutionIO ( )
inline

◆ SolutionIO() [2/2]

SolutionIO::SolutionIO ( int  L,
int  S,
int  Pi,
int  ni,
int  li,
int  mi,
Real  E,
std::vector< std::pair< int, int >> const &  ang,
std::vector< std::pair< int, int >> const &  chann = std::vector<std::pair<int,int>>(),
std::string  prefix = "psi" 
)
inline

Member Function Documentation

◆ channels()

std::vector<std::pair<int,int> > const& SolutionIO::channels ( ) const
inline

◆ check() [1/2]

bool SolutionIO::check ( int  ill,
std::size_t &  total_size 
) const
inline

◆ check() [2/2]

bool SolutionIO::check ( int  ill = SolutionIO::All) const
inline

◆ load()

bool SolutionIO::load ( BlockArray< Complex > &  solution,
int  ill = SolutionIO::All 
)
inline

This function will try to load the solution HDF file (of name 'name_') into a complex array passed as argument. If the file is not found, array is not written and 'false' is returned. Otherwise the function returns 'true' and fills the contents of the array with the read data.

◆ name()

std::string SolutionIO::name ( int  ill = SolutionIO::All) const
inline

◆ save()

bool SolutionIO::save ( BlockArray< Complex > const &  solution,
int  ill = SolutionIO::All 
) const
inline

Save solution to disk as a HDF file. Zero blocks of the solution are automatically detected and compressed (substituted by position & length information). The function return 'true' when write was successful, 'false' otherwise.

◆ save_segment()

bool SolutionIO::save_segment ( const cArrayView  solution,
int  ill 
) const
inline

Field Documentation

◆ All

const int SolutionIO::All = -1
static

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