-
Notifications
You must be signed in to change notification settings - Fork 255
feat: first snapshot of (partly) BinUtility-freed SurfaceMaterial #5521
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
Open
asalzburger
wants to merge
17
commits into
acts-project:main
Choose a base branch
from
asalzburger:feat-change-material-to-proto-axis
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
4a7d7ff
first snapshot of (partly) BinUtility-freed SurfaceMaterial
asalzburger 616ad72
change construction to ProtoAxis type
asalzburger 651715d
Merge branch 'main' into feat-change-material-to-proto-axis
asalzburger bd9ac39
Merge branch 'main' into feat-change-material-to-proto-axis
asalzburger 71b46d6
Merge branch 'main' into feat-change-material-to-proto-axis
asalzburger fa5a453
ok fix it
asalzburger 3e58799
fix DD4hep autorange
asalzburger d4a816e
fix sonarcloud
asalzburger 468e224
Merge branch 'main' into feat-change-material-to-proto-axis
asalzburger 974cb00
Merge branch 'main' into feat-change-material-to-proto-axis
asalzburger 98eb5a9
Merge branch 'main' into feat-change-material-to-proto-axis
asalzburger 3658fb8
Update Core/src/Material/BinnedSurfaceMaterial.cpp
asalzburger f7050da
Update Core/src/Material/BinnedSurfaceMaterial.cpp
asalzburger 9d6ed7b
Update Core/src/Material/BinnedSurfaceMaterial.cpp
asalzburger 17dbfec
Update Core/src/Material/ProtoSurfaceMaterial.cpp
asalzburger e9040a3
Update Core/src/Material/ProtoSurfaceMaterial.cpp
asalzburger e84fefb
Update Core/src/Material/ProtoSurfaceMaterial.cpp
asalzburger 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 |
|---|---|---|
|
|
@@ -14,6 +14,7 @@ | |
| #include "Acts/Utilities/BinUtility.hpp" | ||
| #include "Acts/Utilities/ProtoAxis.hpp" | ||
|
|
||
| #include <array> | ||
| #include <iosfwd> | ||
| #include <vector> | ||
|
|
||
|
|
@@ -22,118 +23,110 @@ namespace Acts { | |
| /// @addtogroup material | ||
| /// @{ | ||
|
|
||
| /// Convert a BinUtility to a pair of two DirectedProtoAxis. | ||
| /// For a 1D BinUtility a single-bin dummy axis is appended as the second axis. | ||
| /// This helper is intended for migration code that still works with BinUtility. | ||
| std::array<DirectedProtoAxis, 2> protoAxesFromBinUtility(const BinUtility& bu); | ||
|
Comment on lines
+26
to
+29
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should we elevate this to an utility?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, actually something that can disappear with the |
||
|
|
||
| /// | ||
| /// @brief proxy to SurfaceMaterial hand over BinUtility or other suitable | ||
| /// binning description | ||
| /// @brief Prototype surface material described by two @ref DirectedProtoAxis | ||
| /// objects. | ||
| /// | ||
| /// The ProtoSurfaceMaterial class acts as a proxy to the SurfaceMaterial | ||
| /// to mark the layers and surfaces on which the material should be mapped on | ||
| /// at construction time of the geometry and to hand over the granularity of | ||
| /// of the material map with the bin Utility. | ||
| template <typename BinningType> | ||
| class ProtoSurfaceMaterialT : public ISurfaceMaterial { | ||
| /// to mark surfaces on which the material should be mapped at geometry | ||
| /// construction time. It carries the binning description with two directed | ||
| /// proto axes. A conceptually 1D surface uses a second axis with a single bin. | ||
| /// | ||
| class ProtoSurfaceMaterial : public ISurfaceMaterial { | ||
| public: | ||
| /// Constructor without binningType - homogeneous material | ||
| ProtoSurfaceMaterialT() = default; | ||
| /// Default constructor — creates a homogeneous (single-bin) placeholder. | ||
| ProtoSurfaceMaterial(); | ||
|
|
||
| /// Constructor with BinningType | ||
| /// @param binning a binning description for the material map binning | ||
| /// Constructor with two directed proto axes. | ||
| /// | ||
| /// @param axes the 2D binning description | ||
| /// @param mappingType is the type of surface mapping associated to the surface | ||
| explicit ProtoSurfaceMaterialT(const BinningType& binning, | ||
| MappingType mappingType = MappingType::Default) | ||
| : ISurfaceMaterial(1., mappingType), m_binning(binning) {} | ||
| explicit ProtoSurfaceMaterial(std::array<DirectedProtoAxis, 2> axes, | ||
| MappingType mappingType = MappingType::Default); | ||
|
|
||
| /// Copy constructor | ||
| /// @deprecated Use the std::array<DirectedProtoAxis, 2> constructor instead. | ||
| /// | ||
| /// @param smproxy The source proxy | ||
| ProtoSurfaceMaterialT(const ProtoSurfaceMaterialT<BinningType>& smproxy) = | ||
| default; | ||
|
|
||
| /// Copy move constructor | ||
| /// Constructor from a BinUtility. | ||
| /// | ||
| /// @param smproxy The source proxy | ||
| ProtoSurfaceMaterialT(ProtoSurfaceMaterialT<BinningType>&& smproxy) noexcept = | ||
| default; | ||
|
|
||
| /// Destructor | ||
| ~ProtoSurfaceMaterialT() override = default; | ||
| /// @param binUtil the binning utility (converted to two DirectedProtoAxis) | ||
| /// @param mappingType is the type of surface mapping associated to the surface | ||
| [[deprecated( | ||
| "Use ProtoSurfaceMaterial(std::array<DirectedProtoAxis, 2>) " | ||
| "instead")]] | ||
| explicit ProtoSurfaceMaterial(const BinUtility& binUtil, | ||
| MappingType mappingType = MappingType::Default); | ||
|
|
||
| /// Assignment operator | ||
| /// @deprecated Use the std::array<DirectedProtoAxis, 2> constructor instead. | ||
| /// | ||
| /// @param smproxy The source proxy | ||
| /// @return Reference to this object | ||
| ProtoSurfaceMaterialT<BinningType>& operator=( | ||
| const ProtoSurfaceMaterialT<BinningType>& smproxy) = default; | ||
|
|
||
| /// Assignment move operator | ||
| /// Constructor from a vector of DirectedProtoAxis objects (was the | ||
| /// ProtoGridSurfaceMaterial path). Only the first two axes are used; if only | ||
| /// one is provided a single-bin dummy axis is added. | ||
| /// | ||
| /// @param smproxy The source proxy | ||
| /// @return Reference to this object | ||
| ProtoSurfaceMaterialT<BinningType>& operator=( | ||
| ProtoSurfaceMaterialT<BinningType>&& smproxy) noexcept = default; | ||
|
|
||
| /// Scale operation - dummy implementation | ||
| /// @param axes vector of directed proto axes | ||
| /// @param mappingType is the type of surface mapping associated to the surface | ||
| [[deprecated( | ||
| "Use ProtoSurfaceMaterial(std::array<DirectedProtoAxis, 2>) " | ||
| "instead")]] | ||
| explicit ProtoSurfaceMaterial(const std::vector<DirectedProtoAxis>& axes, | ||
| MappingType mappingType = MappingType::Default); | ||
|
|
||
| /// Copy / move / destructor — all defaulted. | ||
| ProtoSurfaceMaterial(const ProtoSurfaceMaterial&) = default; | ||
| ProtoSurfaceMaterial(ProtoSurfaceMaterial&&) noexcept = default; | ||
| ~ProtoSurfaceMaterial() override = default; | ||
| ProtoSurfaceMaterial& operator=(const ProtoSurfaceMaterial&) = default; | ||
| ProtoSurfaceMaterial& operator=(ProtoSurfaceMaterial&&) noexcept = default; | ||
|
|
||
| /// Scale operation — no-op for proto material. | ||
| ProtoSurfaceMaterial& scale(double /*factor*/) final { return *this; } | ||
|
|
||
| /// Return the two directed proto axes. | ||
| /// @return const reference to the axes array | ||
| const std::array<DirectedProtoAxis, 2>& axes() const { return m_axes; } | ||
|
|
||
| /// @deprecated Use axes() instead. | ||
| /// | ||
| /// @return Reference to this object | ||
| ProtoSurfaceMaterialT<BinningType>& scale(double /*factor*/) final { | ||
| return (*this); | ||
| } | ||
|
|
||
| /// Return the BinUtility | ||
| /// @return Reference to the binning | ||
| const BinningType& binning() const { return (m_binning); } | ||
|
|
||
| /// Return method for full material description of the Surface - from local | ||
| /// coordinates | ||
| /// Reconstruct a BinUtility from the internal axes. | ||
| /// Single-bin dummy axes are omitted so the result matches what was | ||
| /// originally provided to the deprecated BinUtility constructor. | ||
| /// | ||
| /// @return will return dummy material | ||
| /// @return reconstructed BinUtility | ||
| [[deprecated("Use axes() instead")]] BinUtility binning() const; | ||
|
|
||
| /// Return method for full material description — returns dummy material. | ||
| const MaterialSlab& materialSlab(const Vector2& /*lp*/) const final { | ||
| return (m_materialSlab); | ||
| return m_materialSlab; | ||
| } | ||
|
|
||
| /// @copydoc ISurfaceMaterial::localAxisDirections() const | ||
| std::vector<AxisDirection> localAxisDirections() const final { return {}; } | ||
| std::vector<AxisDirection> localAxisDirections() const final; | ||
|
|
||
| /// Return method for full material description of the Surface - from the | ||
| /// global coordinates | ||
| /// | ||
| /// @return will return dummy material | ||
| /// @copydoc ISurfaceMaterial::materialSlab(const Vector3&) const | ||
| [[deprecated( | ||
| "Use materialSlab(const Vector2& lp) with a prior " | ||
| "Surface::globalToLocal() call instead")]] const MaterialSlab& | ||
| materialSlab(const Vector3& /*gp*/) const final { | ||
| return (m_materialSlab); | ||
| return m_materialSlab; | ||
| } | ||
|
|
||
| using ISurfaceMaterial::materialSlab; | ||
|
|
||
| /// Output Method for std::ostream, to be overloaded by child classes | ||
| /// | ||
| /// @param sl is the output stream | ||
| /// @return The output stream | ||
| std::ostream& toStream(std::ostream& sl) const final { | ||
| sl << "Acts::ProtoSurfaceMaterial : " << std::endl; | ||
| sl << m_binning << std::endl; | ||
| return sl; | ||
| } | ||
| /// Output Method for std::ostream. | ||
| std::ostream& toStream(std::ostream& sl) const final; | ||
|
|
||
| private: | ||
| /// A binning description | ||
| BinningType m_binning; | ||
|
|
||
| /// Dummy material properties | ||
| std::array<DirectedProtoAxis, 2> m_axes; | ||
| MaterialSlab m_materialSlab = MaterialSlab::Nothing(); | ||
| }; | ||
|
|
||
| /// @brief Type alias for a prototype surface material using BinUtility | ||
| /// A surface material implementation that uses BinUtility for binning | ||
| using ProtoSurfaceMaterial = ProtoSurfaceMaterialT<Acts::BinUtility>; | ||
|
|
||
| /// @brief Type alias for a prototype surface material using a grid of ProtoAxis | ||
| /// A surface material implementation that uses a vector of ProtoAxis for | ||
| /// grid-based binning | ||
| using ProtoGridSurfaceMaterial = | ||
| ProtoSurfaceMaterialT<std::vector<DirectedProtoAxis>>; | ||
| /// @deprecated Use ProtoSurfaceMaterial instead. Will be removed in a future release. | ||
| using ProtoGridSurfaceMaterial | ||
| [[deprecated("Use ProtoSurfaceMaterial instead")]] = ProtoSurfaceMaterial; | ||
|
|
||
| /// @} | ||
|
|
||
|
|
||
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
Oops, something went wrong.
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.
do we strictly need
DirectedProtoAxishere? the two things I know of it provides additionally to anIAxisis the direction, which I want to add with #5540, and the auto sizing fromProtoAxis. I imagine this cannot rely on auto sizing since the material matrix is already generated with some given binning.ultimately we could use
IMultiAxisND<N>from here #5531. what do you think?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.
Exactly, I think we should use
IMultiAxisND<2>here, shall we wait until we are through with theIAxisreordering?