MADNESS 0.10.1
Public Member Functions | Static Public Member Functions | Public Attributes | Private Attributes | List of all members
madness::test_output Struct Reference

small class for pretty printing of test output More...

#include <test_utilities.h>

Public Member Functions

 test_output (std::string line, bool print=true)
 
 ~test_output ()
 
void checkpoint (bool success, std::string message, double time=-1.0)
 
void checkpoint (double error, double tol, std::string message, double time=-1.0)
 
void checkpoint (double value, double reference, double tol, std::string message, double time=-1.0)
 
int end (bool success=true)
 
bool get_final_success () const
 
void print_and_clear_log ()
 
void print_success_fail (std::ostream &os, bool success, double time, double error)
 
void set_cout_to_logger ()
 
void set_cout_to_terminal (bool newline=true)
 newline for use by user, not for internal use (e.g. checkpoint())
 

Static Public Member Functions

static std::string ltrim_to_length (std::string line, long length=70)
 

Public Attributes

std::stringstream logger
 

Private Attributes

bool cout_set_to_logger =false
 
bool final_success =true
 
bool have_checkpoints =false
 
std::streambuf * stream_buffer_cout
 
double time_begin =0.0
 
double time_last_checkpoint =0.0
 

Detailed Description

small class for pretty printing of test output

Constructor & Destructor Documentation

◆ test_output()

madness::test_output::test_output ( std::string  line,
bool  print = true 
)
inline
Parameters
[in]useas if (world.rank()==0) to avoid printing on all ranks

References madness::cpu_time(), logger, ltrim_to_length(), madness::print(), set_cout_to_logger(), time_begin, and time_last_checkpoint.

◆ ~test_output()

madness::test_output::~test_output ( )
inline

Member Function Documentation

◆ checkpoint() [1/3]

void madness::test_output::checkpoint ( bool  success,
std::string  message,
double  time = -1.0 
)
inline

◆ checkpoint() [2/3]

void madness::test_output::checkpoint ( double  error,
double  tol,
std::string  message,
double  time = -1.0 
)
inline

◆ checkpoint() [3/3]

void madness::test_output::checkpoint ( double  value,
double  reference,
double  tol,
std::string  message,
double  time = -1.0 
)
inline

◆ end()

int madness::test_output::end ( bool  success = true)
inline

References madness::cpu_time(), final_success, have_checkpoints, ltrim_to_length(), print_and_clear_log(), print_success_fail(), set_cout_to_terminal(), and time_begin.

Referenced by chunk_example(), main(), madness::OEP::selftest(), test_apply(), test_arithmetic(), test_combined_operators(), test_consolidate(), test_construction(), test_construction_optimization(), test_constructor(), test_conversion(), test_copy_function_from_other_world(), test_copy_function_from_other_world_through_cloud(), test_custom_serialization(), test_custom_worldobject(), test_deferred(), test_ethylene(), madness::Diamagnetic_potential_factor::test_factor(), test_full_rank_functor(), madness::Diamagnetic_potential_factor::test_harmonic_potential(), test_hartree_product(), test_immediate(), test_inner(), test_inner(), test_integration(), test_Kcommutator(), test_load_store(), test_lowrank_function(), madness::Diamagnetic_potential_factor::test_lz_commutator(), test_molecular_grid(), test_multiply(), test_multiply(), test_multiply_with_f12(), test_ne_boys(), test_norm(), test_operator_apply(), test_partial_inner_3d(), test_partial_inner_6d(), test_projector(), test_projector(), test_projector_outer(), test_Q12_projector(), test_scalar_multiplication(), madness::Diamagnetic_potential_factor::test_scalar_potentials(), test_simple(), test_swap_particles(), test_transform(), test_transformations(), madness::Znemo::test_U_potentials(), test_vector_composite(), madness::Diamagnetic_potential_factor::test_vector_potentials(), test_with_function(), and test_with_function_vector().

◆ get_final_success()

bool madness::test_output::get_final_success ( ) const
inline

References final_success.

◆ ltrim_to_length()

static std::string madness::test_output::ltrim_to_length ( std::string  line,
long  length = 70 
)
inlinestatic

References length.

Referenced by test_output(), checkpoint(), checkpoint(), checkpoint(), and end().

◆ print_and_clear_log()

void madness::test_output::print_and_clear_log ( )
inline

References logger, and set_cout_to_terminal().

Referenced by checkpoint(), checkpoint(), checkpoint(), and end().

◆ print_success_fail()

void madness::test_output::print_success_fail ( std::ostream &  os,
bool  success,
double  time,
double  error 
)
inline

References madness::error().

Referenced by checkpoint(), checkpoint(), checkpoint(), and end().

◆ set_cout_to_logger()

void madness::test_output::set_cout_to_logger ( )
inline

◆ set_cout_to_terminal()

void madness::test_output::set_cout_to_terminal ( bool  newline = true)
inline

Member Data Documentation

◆ cout_set_to_logger

bool madness::test_output::cout_set_to_logger =false
private

◆ final_success

bool madness::test_output::final_success =true
private

◆ have_checkpoints

bool madness::test_output::have_checkpoints =false
private

◆ logger

std::stringstream madness::test_output::logger

◆ stream_buffer_cout

std::streambuf* madness::test_output::stream_buffer_cout
private

◆ time_begin

double madness::test_output::time_begin =0.0
private

Referenced by test_output(), and end().

◆ time_last_checkpoint

double madness::test_output::time_last_checkpoint =0.0
private

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