gambit is hosted by Hepforge, IPPP Durham
GAMBIT  v1.5.0-2191-ga4742ac
a Global And Modular Bsm Inference Tool
Gambit::Printers::BaseBasePrinter Class Referenceabstract

#include <basebaseprinter.hpp>

Collaboration diagram for Gambit::Printers::BaseBasePrinter:

Public Member Functions

 BaseBasePrinter ()
 
virtual ~BaseBasePrinter ()
 
virtual void reset (bool force=false)=0
 Function to signal to the printer to write buffer contents to disk. More...
 
virtual void flush ()=0
 Signal printer to flush data in buffers to disk Printers should do this automatically as needed, but this is useful if a scanner is printing a bunch of data as a batch, to make sure it is all on disk after the batch is done. More...
 
int getRank ()
 Retrieve/Set MPI rank (setting is useful for e.g. the postprocessor to re-print points from other ranks) More...
 
void setRank (int r)
 
bool & get_printUnitcube ()
 
void set_printUnitcube (const bool &rflag)
 
std::set< std::string > getPrintList ()
 Retrieve/Set print list for this printer Required by e.g. More...
 
void setPrintList (const std::set< std::string > &in)
 
void addToPrintList (const std::string &in)
 
virtual Options resume_reader_options ()=0
 
bool get_resume ()
 
void set_resume (bool rflag)
 
virtual void finalise (bool abnormal=false)=0
 Signal printer that scan is finished, and final output needs to be performed. More...
 
void disable (int n=-1)
 "Turn off" printer; i.e. More...
 
void enable ()
 "Turn on" printer; print calls will work as normal. More...
 
template<typename T >
void print (T const &in, const std::string &label, const int vertexID, const uint rank, const ulong pointID)
 
template<typename T >
void print (T const &in, const std::string &label, const uint rank, const ulong pointID)
 

Protected Member Functions

template<typename T >
void _print (T const &, const std::string &label, const int vertexID, const uint, const ulong)
 Default _print function. More...
 
template<typename T >
void _print (T const &in, const std::string &label, const uint rank, const ulong pointID)
 Same for overloaded function. More...
 

Protected Attributes

bool printer_enabled
 Flag to check if print functions are enabled or disabled. More...
 
int printer_cooldown
 Counter for printer cooldown. If non-zero printer can be disabled for a fixed number of print calls. More...
 

Private Attributes

int rank
 
std::set< std::string > print_list
 
bool resume
 
bool printUnitcube
 

Detailed Description

Definition at line 75 of file basebaseprinter.hpp.

Constructor & Destructor Documentation

◆ BaseBasePrinter()

Gambit::Printers::BaseBasePrinter::BaseBasePrinter ( )
inline

Definition at line 84 of file basebaseprinter.hpp.

84 : rank(0), printUnitcube(false), printer_enabled(true), printer_cooldown(-1) {}
bool printer_enabled
Flag to check if print functions are enabled or disabled.
int printer_cooldown
Counter for printer cooldown. If non-zero printer can be disabled for a fixed number of print calls...

◆ ~BaseBasePrinter()

virtual Gambit::Printers::BaseBasePrinter::~BaseBasePrinter ( )
inlinevirtual

Definition at line 85 of file basebaseprinter.hpp.

References flush(), and reset().

85 {}
Here is the call graph for this function:

Member Function Documentation

◆ _print() [1/2]

template<typename T >
void Gambit::Printers::BaseBasePrinter::_print ( T const &  ,
const std::string &  label,
const int  vertexID,
const uint  ,
const ulong   
)
inlineprotected

Default _print function.

Throws an error if no matching virtual function for the type of the attempted print is found.

Definition at line 171 of file basebaseprinter.hpp.

References Gambit::LogTags::err, LOCAL_INFO, Gambit::Printers::printer_error(), and STRINGIFY.

Referenced by _print(), and print().

174  {
175  std::ostringstream err;
176 
177  err << "Attempted to print a functor whose return type "
178  << "is not registered as being printable. "
179  << "If you really want to print this functor, you must "
180  << "add its return type to the PRINTABLE_TYPES sequence "
181  << "in \"gambit/Elements/printable_types.hpp\". You will then have "
182  << "to define a print function for it in whatever printer "
183  << "you are using (see documentation for GAMBIT printers)."
184  << "\n Available info for this print attempt..."
185  << "\n Label : " << label
186  << "\n vertexID : " << vertexID
187  << "\n Type : " << STRINGIFY(T);
188  printer_error().raise(LOCAL_INFO,err.str());
189  }
#define STRINGIFY(X)
Definition: stringify.hpp:29
EXPORT_SYMBOLS error & printer_error()
Printer errors.
#define LOCAL_INFO
Definition: local_info.hpp:34
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _print() [2/2]

template<typename T >
void Gambit::Printers::BaseBasePrinter::_print ( T const &  in,
const std::string &  label,
const uint  rank,
const ulong  pointID 
)
inlineprotected

Same for overloaded function.

Definition at line 193 of file basebaseprinter.hpp.

References _print().

196  {
197  _print(in,label,rank,pointID);
198  }
void _print(T const &, const std::string &label, const int vertexID, const uint, const ulong)
Default _print function.
Here is the call graph for this function:

◆ addToPrintList()

void Gambit::Printers::BaseBasePrinter::addToPrintList ( const std::string &  in)
inline

Definition at line 109 of file basebaseprinter.hpp.

References resume_reader_options().

109 {print_list.insert(in);}
std::set< std::string > print_list
Here is the call graph for this function:

◆ disable()

void Gambit::Printers::BaseBasePrinter::disable ( int  n = -1)
inline

"Turn off" printer; i.e.

calls to print functions will do nothing while this is active Optionally, disable printer just for the next n print calls unless it was already disabled

Definition at line 123 of file basebaseprinter.hpp.

References generate_raster_scan_settings::n, printer_cooldown, and printer_enabled.

Referenced by Gambit::Likelihood_Container::main().

124  {
125  if(printer_enabled)
126  printer_cooldown = n;
127  printer_enabled = false;
128  }
bool printer_enabled
Flag to check if print functions are enabled or disabled.
int printer_cooldown
Counter for printer cooldown. If non-zero printer can be disabled for a fixed number of print calls...
Here is the caller graph for this function:

◆ enable()

void Gambit::Printers::BaseBasePrinter::enable ( )
inline

"Turn on" printer; print calls will work as normal.

Reset cooldown

Definition at line 132 of file basebaseprinter.hpp.

References printer_cooldown, and printer_enabled.

132 { printer_enabled = true; printer_cooldown = 0;}
bool printer_enabled
Flag to check if print functions are enabled or disabled.
int printer_cooldown
Counter for printer cooldown. If non-zero printer can be disabled for a fixed number of print calls...

◆ finalise()

virtual void Gambit::Printers::BaseBasePrinter::finalise ( bool  abnormal = false)
pure virtual

Signal printer that scan is finished, and final output needs to be performed.

Referenced by Gambit::Scanner::Plugins::pluginInfo::dump(), and set_resume().

Here is the caller graph for this function:

◆ flush()

virtual void Gambit::Printers::BaseBasePrinter::flush ( )
pure virtual

Signal printer to flush data in buffers to disk Printers should do this automatically as needed, but this is useful if a scanner is printing a bunch of data as a batch, to make sure it is all on disk after the batch is done.

Referenced by Gambit::Scanner::TWalk(), and ~BaseBasePrinter().

Here is the caller graph for this function:

◆ get_printUnitcube()

bool& Gambit::Printers::BaseBasePrinter::get_printUnitcube ( )
inline

Definition at line 102 of file basebaseprinter.hpp.

References printUnitcube.

◆ get_resume()

bool Gambit::Printers::BaseBasePrinter::get_resume ( )
inline

Definition at line 115 of file basebaseprinter.hpp.

References resume.

◆ getPrintList()

std::set<std::string> Gambit::Printers::BaseBasePrinter::getPrintList ( )
inline

Retrieve/Set print list for this printer Required by e.g.

postprocessor.

Definition at line 107 of file basebaseprinter.hpp.

References print_list.

107 {return print_list;}
std::set< std::string > print_list

◆ getRank()

int Gambit::Printers::BaseBasePrinter::getRank ( )
inline

Retrieve/Set MPI rank (setting is useful for e.g. the postprocessor to re-print points from other ranks)

Definition at line 98 of file basebaseprinter.hpp.

References rank.

Referenced by Gambit::Likelihood_Container::main().

Here is the caller graph for this function:

◆ print() [1/2]

template<typename T >
void Gambit::Printers::BaseBasePrinter::print ( T const &  in,
const std::string &  label,
const int  vertexID,
const uint  rank,
const ulong  pointID 
)
inline

Definition at line 139 of file basebaseprinter.hpp.

References _print(), printer_cooldown, and printer_enabled.

Referenced by Gambit::Likelihood_Container::main(), Gambit::PostProcessor::PPDriver::run_main_loop(), scanner_plugin(), and Gambit::Scanner::TWalk().

142  {
143  if(printer_enabled) _print(in, label, vertexID, rank, pointID);
144  if(printer_cooldown > 0) printer_cooldown--; // if there's a cooldown, reduce it afer printing
145  if(!printer_cooldown) printer_enabled = true; // if cooldown has ended, re-enable printer
146  }
bool printer_enabled
Flag to check if print functions are enabled or disabled.
void _print(T const &, const std::string &label, const int vertexID, const uint, const ulong)
Default _print function.
int printer_cooldown
Counter for printer cooldown. If non-zero printer can be disabled for a fixed number of print calls...
Here is the call graph for this function:
Here is the caller graph for this function:

◆ print() [2/2]

template<typename T >
void Gambit::Printers::BaseBasePrinter::print ( T const &  in,
const std::string &  label,
const uint  rank,
const ulong  pointID 
)
inline

Definition at line 151 of file basebaseprinter.hpp.

References _print(), printer_cooldown, and printer_enabled.

154  {
155  if(printer_enabled) _print(in, label, rank, pointID);
156  if(printer_cooldown > 0) printer_cooldown--; // if there's a cooldown, reduce it afer printing
157  if(!printer_cooldown) printer_enabled = true; // if cooldown has ended, re-enable printer
158  }
bool printer_enabled
Flag to check if print functions are enabled or disabled.
void _print(T const &, const std::string &label, const int vertexID, const uint, const ulong)
Default _print function.
int printer_cooldown
Counter for printer cooldown. If non-zero printer can be disabled for a fixed number of print calls...
Here is the call graph for this function:

◆ reset()

virtual void Gambit::Printers::BaseBasePrinter::reset ( bool  force = false)
pure virtual

Function to signal to the printer to write buffer contents to disk.

Signal printer to reset contents, i.e. delete old data in preperation for replacement

Referenced by Gambit::MultiNest::LogLikeWrapper::dumper(), Gambit::PolyChord::LogLikeWrapper::dumper(), scanner_plugin(), ~BaseBasePrinter(), and Gambit::Printers::BaseBaseReader::~BaseBaseReader().

Here is the caller graph for this function:

◆ resume_reader_options()

virtual Options Gambit::Printers::BaseBasePrinter::resume_reader_options ( )
pure virtual

Referenced by addToPrintList().

Here is the caller graph for this function:

◆ set_printUnitcube()

void Gambit::Printers::BaseBasePrinter::set_printUnitcube ( const bool &  rflag)
inline

Definition at line 103 of file basebaseprinter.hpp.

◆ set_resume()

void Gambit::Printers::BaseBasePrinter::set_resume ( bool  rflag)
inline

Definition at line 116 of file basebaseprinter.hpp.

References finalise().

Here is the call graph for this function:

◆ setPrintList()

void Gambit::Printers::BaseBasePrinter::setPrintList ( const std::set< std::string > &  in)
inline

Definition at line 108 of file basebaseprinter.hpp.

108 {print_list = in;}
std::set< std::string > print_list

◆ setRank()

void Gambit::Printers::BaseBasePrinter::setRank ( int  r)
inline

Definition at line 99 of file basebaseprinter.hpp.

References r.

99 {rank = r;}
START_MODEL dNur_CMB r

Member Data Documentation

◆ print_list

std::set<std::string> Gambit::Printers::BaseBasePrinter::print_list
private

Definition at line 79 of file basebaseprinter.hpp.

Referenced by getPrintList().

◆ printer_cooldown

int Gambit::Printers::BaseBasePrinter::printer_cooldown
protected

Counter for printer cooldown. If non-zero printer can be disabled for a fixed number of print calls.

Definition at line 165 of file basebaseprinter.hpp.

Referenced by disable(), enable(), and print().

◆ printer_enabled

bool Gambit::Printers::BaseBasePrinter::printer_enabled
protected

Flag to check if print functions are enabled or disabled.

Definition at line 162 of file basebaseprinter.hpp.

Referenced by disable(), enable(), and print().

◆ printUnitcube

bool Gambit::Printers::BaseBasePrinter::printUnitcube
private

Definition at line 81 of file basebaseprinter.hpp.

Referenced by get_printUnitcube().

◆ rank

int Gambit::Printers::BaseBasePrinter::rank
private

◆ resume

bool Gambit::Printers::BaseBasePrinter::resume
private

Definition at line 80 of file basebaseprinter.hpp.

Referenced by get_resume().


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