Loading...
Searching...
No Matches
q3::internal::wannier90_format Namespace Reference

Functions

void require_plausible_element_count (const std::string &file_path, long long elements, std::uintmax_t minimum_bytes_per_element)
 

Function Documentation

◆ require_plausible_element_count()

void q3::internal::wannier90_format::require_plausible_element_count ( const std::string &  file_path,
long long  elements,
std::uintmax_t  minimum_bytes_per_element 
)
inline

A header's declared element count must be reachable from the file's size: every element is one text line of at least minimum_bytes_per_element bytes, so a header claiming more than the file could hold is corrupt, and would otherwise become a huge allocation before the first element is read.

Definition at line 61 of file reader.hpp.

Referenced by q3::Wannier90FormatReader::read_overlaps(), and q3::Wannier90FormatReader::read_projections().