Loading...
Searching...
No Matches
ForceCallTimer.h
Go to the documentation of this file.
1/*
2** This file is part of eOn.
3**
4** SPDX-License-Identifier: BSD-3-Clause
5**
6** Copyright (c) 2010--present, eOn Development Team
7** All rights reserved.
8**
9** Repo:
10** https://github.com/TheochemUI/eOn
11*/
12#pragma once
13#include "Potential.h"
14
15namespace eonc {
16
23 size_t &target_;
25 size_t initial_;
26
27public:
28 ForceCallTimer(size_t &target, const Potential &pot)
29 : target_(target), pot_(pot), initial_(pot.forceCallCounter.load()) {}
30 ~ForceCallTimer() { target_ += pot_.forceCallCounter.load() - initial_; }
31
32 // Non-copyable, non-movable
33 ForceCallTimer(const ForceCallTimer &) = delete;
35};
36
37} // namespace eonc
const Potential & pot_
ForceCallTimer(const ForceCallTimer &)=delete
ForceCallTimer & operator=(const ForceCallTimer &)=delete
ForceCallTimer(size_t &target, const Potential &pot)
RAII resource manager for the ARTn C library with global synchronization.