ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
core/accumulators/MeanVarianceCalculator.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2016-2022 The ESPResSo project
3 *
4 * This file is part of ESPResSo.
5 *
6 * ESPResSo is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * ESPResSo is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#pragma once
21
22#include "AccumulatorBase.hpp"
23#include "observables/Observable.hpp"
24
25#include <utils/Accumulator.hpp>
26
27#include <cstddef>
28#include <memory>
29#include <string>
30#include <vector>
31
32namespace Accumulators {
33
35public:
36 // The accumulator struct has to be initialized with the correct vector size,
37 // therefore the order of init is important.
39 std::shared_ptr<Observables::Observable> obs)
40 : AccumulatorBase(system, delta_N), m_obs(obs), m_acc(obs->n_values()) {}
41
42 void update(boost::mpi::communicator const &comm) override;
43 std::vector<double> mean();
44 std::vector<double> variance();
45 std::vector<double> std_error();
46 std::string get_internal_state() const final;
47 void set_internal_state(std::string const &) final;
48 std::vector<std::size_t> shape() const override { return m_obs->shape(); }
49
50private:
51 std::shared_ptr<Observables::Observable> m_obs;
53};
54
55} // namespace Accumulators
MeanVarianceCalculator(::System::System const *system, int delta_N, std::shared_ptr< Observables::Observable > obs)
void set_internal_state(std::string const &) final
std::vector< std::size_t > shape() const override
void update(boost::mpi::communicator const &comm) override
Main system class.