-
Notifications
You must be signed in to change notification settings - Fork 16
Composite injector #365
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
JamesMcClung
merged 7 commits into
psc-code:main
from
JamesMcClung:pr/composite-injector
Nov 6, 2025
Merged
Composite injector #365
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
86e2f0a
+composite_injector
JamesMcClung b98144e
composite_injector: +make_composite
JamesMcClung 7ca11ea
test_boundary_injector: +IntegrationManySpecies
JamesMcClung 3301567
boundary_injector: don't override total boundary current
JamesMcClung 087842d
test_boundary_injector: don't template ParticleGenerator
JamesMcClung 55d3182
boundary_injector: more comments
JamesMcClung 2f7dcf8
composite_injector: update comments
JamesMcClung 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,48 @@ | ||
| #pragma once | ||
|
|
||
| /// @brief An injector comprising two other injectors. Enables multiple | ||
| /// injectors in a single psc case. Useful for injecting multiple species with | ||
| /// @ref BoundaryInjector. | ||
| /// @tparam INJECTOR_1 first type of injector | ||
| /// @tparam INJECTOR_2 second type of injector | ||
| template <typename INJECTOR_1, typename INJECTOR_2> | ||
| class CompositeInjector | ||
| { | ||
| public: | ||
| using Mparticles = typename INJECTOR_1::Mparticles; | ||
| using MfieldsState = typename INJECTOR_1::MfieldsState; | ||
|
|
||
| CompositeInjector(INJECTOR_1 injector_1, INJECTOR_2 injector_2) | ||
| : injector_1{injector_1}, injector_2{injector_2} | ||
| {} | ||
|
|
||
| /// @brief Calls both member injectors in order. | ||
| /// @param mprts particles | ||
| /// @param mflds fields | ||
| void operator()(Mparticles& mprts, MfieldsState& mflds) | ||
| { | ||
| injector_1(mprts, mflds); | ||
| injector_2(mprts, mflds); | ||
| } | ||
|
|
||
| private: | ||
| INJECTOR_1 injector_1; | ||
| INJECTOR_2 injector_2; | ||
| }; | ||
|
|
||
| /// @brief Helper method to deduce the type of a composite injector, enabling | ||
| /// e.g. `auto composite_injector = make_composite(injector_1, injector_2);` | ||
| /// | ||
| /// Wouldn't be necessary in C++17; see | ||
| /// https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rt-deduce. | ||
| /// @tparam INJECTOR_1 first type of injector | ||
| /// @tparam INJECTOR_2 second type of injector | ||
| /// @param injector_1 first injector | ||
| /// @param injector_2 second injector | ||
| /// @return | ||
| template <typename INJECTOR_1, typename INJECTOR_2> | ||
| CompositeInjector<INJECTOR_1, INJECTOR_2> make_composite(INJECTOR_1 injector_1, | ||
| INJECTOR_2 injector_2) | ||
| { | ||
| return CompositeInjector<INJECTOR_1, INJECTOR_2>(injector_1, injector_2); | ||
| } | ||
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
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.
Uh oh!
There was an error while loading. Please reload this page.