Loading...
Searching...
No Matches
Actions.hpp
/*
Copyright 2018 Equinor ASA.
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ActionCOnfig_HPP
#define ActionCOnfig_HPP
#include <opm/input/eclipse/Schedule/Action/ActionX.hpp>
#include <opm/input/eclipse/Schedule/Action/PyAction.hpp>
#include <cstddef>
#include <ctime>
#include <string>
#include <vector>
namespace Opm::Action {
class State;
} // namespace Opm::Action
namespace Opm::Action {
class Actions
{
public:
Actions() = default;
Actions(const std::vector<ActionX>& action,
const std::vector<PyAction>& pyactions);
static Actions serializationTestObject();
void add(const ActionX& action);
void add(const PyAction& pyaction);
std::size_t ecl_size() const;
std::size_t py_size() const;
int max_input_lines() const;
bool empty() const;
bool ready(const State& state, std::time_t sim_time) const;
const ActionX& operator[](const std::string& name) const;
const ActionX& operator[](std::size_t index) const;
std::vector<const ActionX*>
pending(const State& state, std::time_t sim_time) const;
std::vector<const PyAction*> pending_python(const State& state) const;
bool has(const std::string& name) const;
auto begin() const { return this->actions_.begin(); }
auto end() const { return this->actions_.end(); }
bool operator==(const Actions& data) const;
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(this->actions_);
serializer(this->pyactions_);
}
private:
std::vector<ActionX> actions_{};
std::vector<PyAction> pyactions_{};
};
} // namespace Opm::Action
#endif // ActionCOnfig_HPP
Opm::Action::ActionX
Definition ActionX.hpp:72
Opm::Action::Actions
Container of action keywords.
Definition Actions.hpp:44
Opm::Action::Actions::has
bool has(const std::string &name) const
ActionX object existence predicate.
Definition Actions.cpp:170
Opm::Action::Actions::py_size
std::size_t py_size() const
Number of PyAction objects in this collection.
Definition Actions.cpp:94
Opm::Action::Actions::pending_python
std::vector< const PyAction * > pending_python(const State &state) const
Retrieve PyAction objects that are ready to run.
Definition Actions.cpp:157
Opm::Action::Actions::ecl_size
std::size_t ecl_size() const
Number of ActionX objects in this collection.
Definition Actions.cpp:89
Opm::Action::Actions::serializeOp
void serializeOp(Serializer &serializer)
Convert between byte array and object representation.
Definition Actions.hpp:180
Opm::Action::Actions::begin
auto begin() const
Beginning of this collection's ActionX objects.
Definition Actions.hpp:161
Opm::Action::Actions::operator==
bool operator==(const Actions &data) const
Equality predicate.
Definition Actions.cpp:176
Opm::Action::Actions::add
void add(const ActionX &action)
Include ActionX object in current collection.
Definition Actions.cpp:64
Opm::Action::Actions::pending
std::vector< const ActionX * > pending(const State &state, std::time_t sim_time) const
Retrieve ActionX objects that are ready to run.
Definition Actions.cpp:143
Opm::Action::Actions::end
auto end() const
End of this collection's ActionX objects.
Definition Actions.hpp:164
Opm::Action::Actions::ready
bool ready(const State &state, std::time_t sim_time) const
Runnability predicate.
Definition Actions.cpp:117
Opm::Action::Actions::serializationTestObject
static Actions serializationTestObject()
Create a serialisation test object.
Definition Actions.cpp:55
Opm::Action::Actions::operator[]
const ActionX & operator[](const std::string &name) const
Look up ActionX object by name.
Definition Actions.cpp:124
Opm::Action::Actions::max_input_lines
int max_input_lines() const
Maximum number of records in any one ACTIONX block.
Definition Actions.cpp:99
Opm::Action::Actions::Actions
Actions()=default
Default constructor.
Opm::Action::Actions::empty
bool empty() const
Whether or not this collection is empty.
Definition Actions.cpp:112
Opm::Action::PyAction
Definition PyAction.hpp:40
Opm::Action::State
Management information about the current run's ACTION system, especially concerning the number of tim...
Definition State.hpp:51
Opm::Serializer
Class for (de-)serializing.
Definition Serializer.hpp:94