OpenPFC  0.1.4
Phase Field Crystal simulation framework
Loading...
Searching...
No Matches
field_modifier.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2025 VTT Technical Research Centre of Finland Ltd
2// SPDX-License-Identifier: AGPL-3.0-or-later
3
44#ifndef PFC_FIELD_MODIFIER_HPP
45#define PFC_FIELD_MODIFIER_HPP
46
47#include "constants.hpp"
48#include "model.hpp"
49
50namespace pfc {
51
241
242private:
243 std::string m_field_name = "default";
244 std::string m_default_name = "default";
245
246public:
261 // Future enhancement: Support modifying multiple fields in one modifier
262 // virtual void apply(Model &model, const std::string &field_name, double time) =
263 // 0;
264
303 void set_field_name(const std::string &field_name) {
304 if (field_name.empty()) {
305 throw std::invalid_argument("Field name cannot be empty");
306 }
307 m_field_name = field_name;
308 }
309
334 const std::string &get_field_name() const { return m_field_name; }
335
344 virtual const std::string &get_modifier_name() const { return m_default_name; }
345
401 virtual void apply(Model &model, double time) = 0;
402
409 virtual ~FieldModifier() = default;
410};
411
412} // namespace pfc
413
414#endif // PFC_FIELD_MODIFIER_HPP
Definition field_modifier.hpp:240
virtual const std::string & get_modifier_name() const
Get the name of the field modifier.
Definition field_modifier.hpp:344
virtual ~FieldModifier()=default
Destructor for the FieldModifier class.
virtual void apply(Model &model, double time)=0
Apply the field modification to the model (pure virtual)
The Model class represents the physics model for simulations in OpenPFC.
Definition model.hpp:95
Mathematical and physical constants.
Physics model abstraction for phase-field simulations.
Represents the global simulation domain (the "world").
Definition world.hpp:91