Loading...
Searching...
No Matches
eonc::ForceCallTimer Class Reference

RAII wrapper for tracking force calls over a scope. More...

#include <ForceCallTimer.h>

Public Member Functions

 ForceCallTimer (size_t &target, const Potential &pot)
 ~ForceCallTimer ()
 ForceCallTimer (const ForceCallTimer &)=delete
ForceCallTimer & operator= (const ForceCallTimer &)=delete

Private Attributes

size_t & target_
const Potential & pot_
size_t initial_

Detailed Description

RAII wrapper for tracking force calls over a scope.

Usage: { ForceCallTimer timer(targetCounter, <em>pot); / work *‍/ } On destruction, adds the force calls pot evaluated in the scope to targetCounter. The potential's own counter is read, so the count holds whichever registry the potential charges.

Definition at line 22 of file ForceCallTimer.h.

Constructor & Destructor Documentation

◆ ForceCallTimer() [1/2]

eonc::ForceCallTimer::ForceCallTimer ( size_t & target,
const Potential & pot )
inline

Definition at line 28 of file ForceCallTimer.h.

29 : target_(target), pot_(pot), initial_(pot.forceCallCounter.load()) {}
const Potential & pot_

◆ ~ForceCallTimer()

eonc::ForceCallTimer::~ForceCallTimer ( )
inline

Definition at line 30 of file ForceCallTimer.h.

30{ target_ += pot_.forceCallCounter.load() - initial_; }

◆ ForceCallTimer() [2/2]

eonc::ForceCallTimer::ForceCallTimer ( const ForceCallTimer & )
delete

Member Function Documentation

◆ operator=()

ForceCallTimer & eonc::ForceCallTimer::operator= ( const ForceCallTimer & )
delete

Member Data Documentation

◆ initial_

size_t eonc::ForceCallTimer::initial_
private

Definition at line 25 of file ForceCallTimer.h.

◆ pot_

const Potential& eonc::ForceCallTimer::pot_
private

Definition at line 24 of file ForceCallTimer.h.

◆ target_

size_t& eonc::ForceCallTimer::target_
private

Definition at line 23 of file ForceCallTimer.h.


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