SourceXtractorPlusPlus 1.0.3
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
CircularlySymmetricModelComponent.icpp
Go to the documentation of this file.
1
22
23#include <utility> // for std::forward
24#include <cmath> // for std::sqrt, std::cos, std::sin
25#include <tuple> // for std::tie
26#include <functional> // for std::ref
27
28namespace ModelFitting {
29
30template <typename Profile>
31template <typename... ProfileParameters>
34 ProfileParameters&&... proj_parameters)
35 : m_sharp_manager{std::move(sharp_manager)},
36 m_profile(std::forward<ProfileParameters>(proj_parameters)...) {
37}
38
39template <typename Profile>
41
42template <typename Profile>
44 return m_profile(std::sqrt(x*x + y*y));
45}
46
47template <typename Profile>
49 double scale, double r_max) {
50 m_sharp_manager->updateRasterizationInfo(scale, r_max, std::ref(m_profile));
51}
52
53template <typename Profile>
57 double r1 {0.};
58 for (double r2=0.; m_sharp_manager->insideSharpRegion(r2); r1=r2) {
59 int angle_no {0};
60 std::tie(r2, angle_no) = m_sharp_manager->nextRadiusAndAngleNo(r1);
61 double r_half = (r1 + r2) / 2.;
62 double area = M_PI * (r2*r2 - r1*r1);
63 double integral = m_profile(r_half) * area / angle_no;
64 double angle_step = 2 * M_PI / angle_no;
65 for (double angle=0.; angle_no!=0; --angle_no, angle+=angle_step) {
66 double x = r_half * std::cos(angle);
67 double y = r_half * std::sin(angle);
68 result.emplace_back(x, y, integral);
69 }
70 }
71 return result;
72}
73
74template <typename Profile>
76 return m_sharp_manager->insideSharpRegion(std::sqrt(x*x + y*y));
77}
78
79} // end of namespace ModelFitting
CircularlySymmetricModelComponent(std::unique_ptr< SharpRegionManager > sharp_manager, ProfileParameters &&... proj_parameters)
T cos(T... args)
T emplace_back(T... args)
T forward(T... args)
T move(T... args)
STL namespace.
T ref(T... args)
T sin(T... args)
T sqrt(T... args)
T tie(T... args)