TRIQS/TRIQS 4.0.0
Researching Interacting Quantum Systems
Loading...
Searching...
No Matches
concepts.hpp
Go to the documentation of this file.
1// Copyright (c) 2013-2018 Commissariat à l'énergie atomique et aux énergies alternatives (CEA)
2// Copyright (c) 2013-2018 Centre national de la recherche scientifique (CNRS)
3// Copyright (c) 2018-2022 Simons Foundation
4//
5// This program is free software: you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You may obtain a copy of the License at
16// https://www.gnu.org/licenses/gpl-3.0.txt
17//
18// Authors: Michel Ferrero, Olivier Parcollet, Nils Wentzell
19
24
25#pragma once
26
27#include <mpi/communicator.hpp>
28
29#include <complex>
30#include <concepts>
31#include <utility>
32
33namespace triqs::mc_tools {
34
39
44 template <typename T>
45 concept DoubleOrComplex = std::same_as<T, double> || std::same_as<T, std::complex<double>>;
46
58 template <typename T, typename MCSignType>
59 concept MCMove = requires(T x) {
60 { x.attempt() } -> std::convertible_to<MCSignType>;
61 { x.accept() } -> std::convertible_to<MCSignType>;
62 };
63
76 template <typename T, typename MCSignType>
77 concept MCMeasure = requires(T x, mpi::communicator comm) {
78 { x.accumulate(std::declval<MCSignType>()) };
79 { x.collect_results(comm) };
80 };
81
83
84} // namespace triqs::mc_tools
Check if a type is either a double or a std::complex<double>.
Definition concepts.hpp:45
Check if a type can be used as a MC measure.
Definition concepts.hpp:77
Check if a type can be used as a MC move.
Definition concepts.hpp:59