GQCP
Loading...
Searching...
No Matches
FunctionalStep.hpp
Go to the documentation of this file.
1// This file is part of GQCG-GQCP.
2//
3// Copyright (C) 2017-2020 the GQCG developers
4//
5// GQCG-GQCP is free software: you can redistribute it and/or modify
6// it under the terms of the GNU Lesser 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// GQCG-GQCP 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 Lesser General Public License for more details.
14//
15// You should have received a copy of the GNU Lesser General Public License
16// along with GQCG-GQCP. If not, see <http://www.gnu.org/licenses/>.
17
18#pragma once
19
20
22
23#include <functional>
24
25
26namespace GQCP {
27
28
34template <typename _Environment>
36 public Step<_Environment> {
37
38public:
39 using Environment = _Environment;
40 using Function = std::function<void(Environment&)>;
41
42
43private:
44 std::string m_description; // a textual description of this functional step
45
46 Function function; // the function that this Step wraps
47
48
49public:
50 /*
51 * CONSTRUCTORS
52 */
53
59 FunctionalStep(const Function& function, const std::string& description = "A custom functional step.") :
60 function {function},
61 m_description {description} {}
62
63
64 /*
65 * PUBLIC OVERRIDDEN FUNCTIONS
66 */
67
71 std::string description() const override { return m_description; }
72
78 void execute(Environment& environment) override {
79 this->function(environment);
80 }
81};
82
83
84} // namespace GQCP
Definition: FunctionalStep.hpp:36
void execute(Environment &environment) override
Definition: FunctionalStep.hpp:78
std::function< void(Environment &)> Function
Definition: FunctionalStep.hpp:40
FunctionalStep(const Function &function, const std::string &description="A custom functional step.")
Definition: FunctionalStep.hpp:59
std::string description() const override
Definition: FunctionalStep.hpp:71
_Environment Environment
Definition: FunctionalStep.hpp:39
Definition: Step.hpp:37
Definition: BaseOneElectronIntegralBuffer.hpp:25