-
Notifications
You must be signed in to change notification settings - Fork 191
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
Allow Strahlkorper construction from different frame #5871
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
#include "NumericalAlgorithms/SphericalHarmonics/Spherepack.hpp" | ||
#include "Options/String.hpp" | ||
#include "Utilities/ForceInline.hpp" | ||
#include "Utilities/StdArrayHelpers.hpp" | ||
|
||
/// \cond | ||
namespace PUP { | ||
|
@@ -49,6 +50,10 @@ class Strahlkorper { | |
|
||
// Pup needs default constructor | ||
Strahlkorper() = default; | ||
Strahlkorper(const Strahlkorper&) = default; | ||
Strahlkorper(Strahlkorper&&) = default; | ||
Strahlkorper& operator=(const Strahlkorper&) = default; | ||
Strahlkorper& operator=(Strahlkorper&&) = default; | ||
|
||
/// Construct a sphere of radius `radius` with a given center. | ||
Strahlkorper(size_t l_max, size_t m_max, double radius, | ||
|
@@ -87,19 +92,51 @@ class Strahlkorper { | |
const ModalVector& spectral_coefficients, | ||
std::array<double, 3> center); | ||
|
||
/// Copies a Strahlkorper from another frame into this Strahlkorper. | ||
/// | ||
/// \note The `OtherFrame` is ignored. | ||
template <typename OtherFrame> | ||
explicit Strahlkorper(const Strahlkorper<OtherFrame>& another_strahlkorper) | ||
: l_max_(another_strahlkorper.l_max()), | ||
m_max_(another_strahlkorper.m_max()), | ||
ylm_(l_max_, m_max_), | ||
center_(another_strahlkorper.expansion_center()), | ||
strahlkorper_coefs_(another_strahlkorper.coefficients()) {} | ||
|
||
/// Prolong or restrict another surface to the given `l_max` and `m_max`. | ||
/// | ||
/// \note The `OtherFrame` is ignored. | ||
template <typename OtherFrame> | ||
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. [Arbitrary line] Do you want a frame-change constructor that doesn't do prolongation or similar? 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. The 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. Strahlkorper(const Strahlkorper&) = default;
Strahlkorper(Strahlkorper&&) = default;
template <typename OtherFrame>
Strahlkorper(const Strahlkorper<OtherFrame>& other) : /* ... */ {} ? (Probably |
||
Strahlkorper(size_t l_max, size_t m_max, | ||
const Strahlkorper& another_strahlkorper); | ||
const Strahlkorper<OtherFrame>& another_strahlkorper) | ||
: l_max_(l_max), | ||
m_max_(m_max), | ||
ylm_(l_max, m_max), | ||
center_(another_strahlkorper.expansion_center()), | ||
strahlkorper_coefs_( | ||
another_strahlkorper.ylm_spherepack().prolong_or_restrict( | ||
another_strahlkorper.coefficients(), ylm_)) {} | ||
|
||
/// Construct a Strahlkorper from another Strahlkorper, | ||
/// but explicitly specifying the coefficients. | ||
/// Here coefficients are in the same storage scheme | ||
/// as the `coefficients()` member function returns. | ||
Strahlkorper(DataVector coefs, const Strahlkorper& another_strahlkorper); | ||
|
||
/// Move-construct a Strahlkorper from another Strahlkorper, | ||
/// explicitly specifying the coefficients. | ||
Strahlkorper(DataVector coefs, Strahlkorper&& another_strahlkorper); | ||
/// | ||
/// \note The `OtherFrame` is ignored. | ||
template <typename OtherFrame> | ||
Strahlkorper(DataVector coefs, | ||
const Strahlkorper<OtherFrame>& another_strahlkorper) | ||
: l_max_(another_strahlkorper.l_max()), | ||
m_max_(another_strahlkorper.m_max()), | ||
ylm_(another_strahlkorper.ylm_spherepack()), | ||
center_(another_strahlkorper.expansion_center()), | ||
strahlkorper_coefs_(std::move(coefs)) { | ||
ASSERT( | ||
strahlkorper_coefs_.size() == | ||
another_strahlkorper.ylm_spherepack().spectral_size(), | ||
"Bad size " << strahlkorper_coefs_.size() << ", expected " | ||
<< another_strahlkorper.ylm_spherepack().spectral_size()); | ||
} | ||
|
||
/// Serialization for Charm++ | ||
// NOLINTNEXTLINE(google-runtime-references) | ||
|
@@ -186,7 +223,7 @@ struct Strahlkorper { | |
using type = ylm::Strahlkorper<Frame>; | ||
static constexpr Options::String help{"A star-shaped surface"}; | ||
}; | ||
} // namespace OptionTags | ||
} // namespace OptionTags | ||
|
||
template <typename Frame> | ||
bool operator==(const Strahlkorper<Frame>& lhs, | ||
|
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.
For all of these, document that
OtherFrame
is ignored.