-
Notifications
You must be signed in to change notification settings - Fork 213
Add control system measurement initialization #3590
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
kidder
merged 4 commits into
sxs-collaboration:develop
from
wthrowe:control_measurement
Oct 20, 2021
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
ae54b8d
Expose tag collection functions in SetupDataBox
wthrowe 7e600c2
Add control system element-initialization action
wthrowe df59ffb
Add control sys interpolation_target_tag collector
wthrowe b97a52b
Move test into directory matching source file
wthrowe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| // Distributed under the MIT License. | ||
| // See LICENSE.txt for details. | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <memory> | ||
| #include <tuple> | ||
| #include <utility> | ||
|
|
||
| #include "ControlSystem/Event.hpp" | ||
| #include "ControlSystem/Metafunctions.hpp" | ||
| #include "ControlSystem/Tags.hpp" | ||
| #include "ControlSystem/Trigger.hpp" | ||
| #include "DataStructures/DataBox/DataBox.hpp" | ||
| #include "Evolution/EventsAndDenseTriggers/DenseTrigger.hpp" | ||
| #include "Evolution/EventsAndDenseTriggers/EventsAndDenseTriggers.hpp" | ||
| #include "Parallel/GlobalCache.hpp" | ||
| #include "ParallelAlgorithms/EventsAndTriggers/Event.hpp" | ||
| #include "Utilities/Gsl.hpp" | ||
| #include "Utilities/MakeVector.hpp" | ||
| #include "Utilities/TMPL.hpp" | ||
|
|
||
| /// \cond | ||
| namespace evolution::Tags { | ||
| struct EventsAndDenseTriggers; | ||
| } // namespace evolution::Tags | ||
| namespace tuples { | ||
| template <typename... Tags> | ||
| class TaggedTuple; | ||
| } // namespace tuples | ||
| /// \endcond | ||
|
|
||
| namespace control_system::Actions { | ||
| /// \ingroup ControlSystemsGroup | ||
| /// \brief Set up the element component for control-system measurements. | ||
| /// | ||
| /// DataBox changes: | ||
| /// - Adds: | ||
| /// * `Parallel::Tags::FromGlobalCache< | ||
| /// ::control_system::Tags::MeasurementTimescales>` | ||
| /// | ||
| /// - Removes: nothing | ||
| /// - Modifies: nothing | ||
| /// | ||
| /// \note This action relies on the `SetupDataBox` aggregated initialization | ||
| /// mechanism, so `Actions::SetupDataBox` must be present in the | ||
| /// `Initialization` phase action list prior to this action. | ||
| template <typename ControlSystems> | ||
| struct InitializeMeasurements { | ||
| using simple_tags = db::AddSimpleTags<>; | ||
| using compute_tags = tmpl::list<Parallel::Tags::FromGlobalCache< | ||
| ::control_system::Tags::MeasurementTimescales>>; | ||
| using mutable_global_cache_tags = | ||
| tmpl::list<control_system::Tags::MeasurementTimescales>; | ||
|
|
||
| template <typename DbTagsList, typename... InboxTags, typename Metavariables, | ||
| typename ArrayIndex, typename ActionList, | ||
| typename ParallelComponent> | ||
| static auto apply(db::DataBox<DbTagsList>& box, | ||
| const tuples::TaggedTuple<InboxTags...>& /*inboxes*/, | ||
| const Parallel::GlobalCache<Metavariables>& /*cache*/, | ||
| const ArrayIndex& /*array_index*/, ActionList /*meta*/, | ||
| const ParallelComponent* const /*meta*/) { | ||
| db::mutate<evolution::Tags::EventsAndDenseTriggers>( | ||
| make_not_null(&box), | ||
| [](const gsl::not_null<evolution::EventsAndDenseTriggers*> | ||
| events_and_dense_triggers) { | ||
| tmpl::for_each<metafunctions::measurements_t<ControlSystems>>( | ||
| [&events_and_dense_triggers](auto measurement_v) { | ||
| using control_system_group = | ||
| metafunctions::control_systems_with_measurement_t< | ||
| ControlSystems, | ||
| typename tmpl::type_from<decltype(measurement_v)>>; | ||
| events_and_dense_triggers->add_trigger_and_events( | ||
| std::make_unique< | ||
| control_system::Trigger<control_system_group>>(), | ||
| make_vector<std::unique_ptr<::Event>>( | ||
| std::make_unique< | ||
| control_system::Event<control_system_group>>())); | ||
| }); | ||
| }); | ||
| return std::make_tuple(std::move(box)); | ||
| } | ||
| }; | ||
| } // namespace control_system::Actions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # Distributed under the MIT License. | ||
| # See LICENSE.txt for details. | ||
|
|
||
| set(LIBRARY_SOURCES | ||
| ${LIBRARY_SOURCES} | ||
| Actions/Test_Initialization.cpp | ||
| Actions/Test_InitializeMeasurements.cpp | ||
| PARENT_SCOPE) |
File renamed without changes.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a question. Why does the conforming type have to specify void if it's just going to end up as an empty list anyways? Why can't it just originally be an empty list?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The alias isn't a list, just a type.