QMCPACK
EstimatorManagerBaseTest Class Reference

Testing class breaking EstimatorManagerBase encapsultation. More...

+ Collaboration diagram for EstimatorManagerBaseTest:

Public Member Functions

 EstimatorManagerBaseTest (Communicate *comm, int ranks)
 
void fakeSomeScalarSamples ()
 Quickly add scalar samples using FakeEstimator mock estimator. More...
 
void collectScalarEstimators ()
 call private EMB method and colelct EMBTs estimators_ More...
 
bool testMakeBlockAverages ()
 for mpi test (it's trivial for 1 rank) More...
 
 EstimatorManagerBaseTest (Communicate *comm, int ranks)
 
void fakeSomeScalarSamples ()
 Quickly add scalar samples using FakeEstimator mock estimator. More...
 
void collectScalarEstimators ()
 call private EMB method and colelct EMBTs estimators_ More...
 
bool testMakeBlockAverages ()
 for mpi test (it's trivial for 1 rank) More...
 

Public Attributes

EstimatorManagerBase em
 

Private Attributes

Communicatecomm_
 
std::vector< FakeEstimatorestimators_
 

Detailed Description

Testing class breaking EstimatorManagerBase encapsultation.

Wraps EstimatorManagerBase

Definition at line 30 of file EstimatorManagerBaseTest.h.

Constructor & Destructor Documentation

◆ EstimatorManagerBaseTest() [1/2]

EstimatorManagerBaseTest ( Communicate comm,
int  ranks 
)

Definition at line 19 of file EstimatorManagerBaseTest.cpp.

References qmcplusplus::app_log(), EstimatorManagerBaseTest::comm_, qmcplusplus::num_ranks, and Communicate::size().

19  : em(comm), comm_(comm)
20 {
21  int num_ranks = comm_->size();
22  if (num_ranks != ranks)
23  throw std::runtime_error("Bad Rank Count, test expects different number of ranks.");
24 
25  app_log() << "running on " << num_ranks << '\n';
26 
27 }
std::ostream & app_log()
Definition: OutputManager.h:65
int size() const
return the number of tasks
Definition: Communicate.h:118

◆ EstimatorManagerBaseTest() [2/2]

EstimatorManagerBaseTest ( Communicate comm,
int  ranks 
)

Member Function Documentation

◆ collectScalarEstimators() [1/2]

void collectScalarEstimators ( )

call private EMB method and colelct EMBTs estimators_

◆ collectScalarEstimators() [2/2]

void collectScalarEstimators ( )

call private EMB method and colelct EMBTs estimators_

◆ fakeSomeScalarSamples() [1/2]

void fakeSomeScalarSamples ( )

Quickly add scalar samples using FakeEstimator mock estimator.

Definition at line 29 of file EstimatorManagerBaseTest.cpp.

References EstimatorManagerBaseTest::em, EstimatorManagerBaseTest::estimators_, EstimatorManagerBase::get_AverageCache(), EstimatorManagerBase::get_SquaredAverageCache(), ScalarEstimatorBase::scalars, and ScalarEstimatorBase::scalars_saved.

30 {
31  FakeEstimator fake_estimator;
32  fake_estimator.scalars.resize(4);
33  fake_estimator.scalars_saved.resize(4);
34  fake_estimator.scalars[0](1.0);
35  fake_estimator.scalars[1](2.0);
36  fake_estimator.scalars[2](3.0);
37  fake_estimator.scalars[3](4.0);
38 
39  //three estimators
40  estimators_.push_back(fake_estimator);
41  estimators_.push_back(fake_estimator);
42  estimators_.push_back(fake_estimator);
43 
44  estimators_[2].scalars[0](2.0);
45  estimators_[2].scalars[1](2.0);
46  estimators_[2].scalars[2](2.0);
47  estimators_[2].scalars[3](2.0);
48 
49  em.get_AverageCache().resize(4);
50  em.get_SquaredAverageCache().resize(4);
51 }

◆ fakeSomeScalarSamples() [2/2]

void fakeSomeScalarSamples ( )

Quickly add scalar samples using FakeEstimator mock estimator.

◆ testMakeBlockAverages() [1/2]

bool testMakeBlockAverages ( )

for mpi test (it's trivial for 1 rank)

only used by test_manager_mpi.cpp so implemented there.

◆ testMakeBlockAverages() [2/2]

bool testMakeBlockAverages ( )

for mpi test (it's trivial for 1 rank)

only used by test_manager_mpi.cpp so implemented there.

Member Data Documentation

◆ comm_

Communicate * comm_
private

◆ em

◆ estimators_

std::vector< FakeEstimator > estimators_
private

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