GammaLib  2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GModelSpatialRadialProfileDMEinasto.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GModelSpatialRadialProfileDMEinasto.cpp - Einasto radial profile class *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2016-2021 by Nathan Kelley-Hoskins *
5  * ----------------------------------------------------------------------- *
6  * *
7  * This program is free software: you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation, either version 3 of the License, or *
10  * (at your option) any later version. *
11  * *
12  * This program is distributed in the hope that it will be useful, *
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15  * GNU General Public License for more details. *
16  * *
17  * You should have received a copy of the GNU General Public License *
18  * along with this program. If not, see <http://www.gnu.org/licenses/>. *
19  * *
20  ***************************************************************************/
21 /**
22  * @file GModelSpatialRadialProfileDMEinasto.cpp
23  * @brief Radial DM Einasto profile model class implementation
24  * @author Nathan Kelley-Hoskins
25  */
26 
27 /* __ Includes ___________________________________________________________ */
28 #ifdef HAVE_CONFIG_H
29 #include <config.h>
30 #endif
31 #include "GException.hpp"
32 #include "GTools.hpp"
33 #include "GMath.hpp"
34 #include "GXmlElement.hpp"
37 
38 /* __ Constants __________________________________________________________ */
39 
40 /* __ Globals ____________________________________________________________ */
42 const GModelSpatialRegistry g_radial_disk_registry(&g_radial_disk_seed);
43 
44 /* __ Method name definitions ____________________________________________ */
45 #define G_READ "GModelSpatialRadialProfileDMEinasto::read(GXmlElement&)"
46 #define G_WRITE "GModelSpatialRadialProfileDMEinasto::write(GXmlElement&)"
47 
48 /* __ Macros _____________________________________________________________ */
49 
50 /* __ Coding definitions _________________________________________________ */
51 
52 /* __ Debug definitions __________________________________________________ */
53 
54 
55 /*==========================================================================
56  = =
57  = Constructors/destructors =
58  = =
59  ==========================================================================*/
60 
61 /***********************************************************************//**
62  * @brief Void constructor
63  *
64  * Constructs empty radial DMEinasto profile
65  ***************************************************************************/
68 {
69  // Initialise members
70  init_members();
71 
72  // Return
73  return;
74 }
75 
76 
77 /***********************************************************************//**
78  * @brief XML constructor
79  *
80  * @param[in] xml XML element.
81  *
82  * Constructs radial DMEinasto profile model by extracting information from
83  * an XML element. See the read() method for more information about the
84  * expected structure of the XML element.
85  ***************************************************************************/
88 {
89  // Initialise members
90  init_members();
91 
92  // Read information from XML element
93  read(xml);
94 
95  // Return
96  return;
97 }
98 
99 
100 /***********************************************************************//**
101  * @brief Copy constructor
102  *
103  * @param[in] model Radial DMEinasto profile model.
104  *
105  * Copies radial DMEinasto profile model from another radial profile model.
106  ***************************************************************************/
109 {
110  // Initialise members
111  init_members();
112 
113  // Copy members
114  copy_members(model);
115 
116  // Return
117  return;
118 }
119 
120 
121 /***********************************************************************//**
122  * @brief Destructor
123  *
124  * Destructs radial DMEinasto profile model.
125  ***************************************************************************/
127 {
128  // Free members
129  free_members();
130 
131  // Return
132  return;
133 }
134 
135 
136 /*==========================================================================
137  = =
138  = Operators =
139  = =
140  ==========================================================================*/
141 
142 /***********************************************************************//**
143  * @brief Assignment operator
144  *
145  * @param[in] model Radial DMEinasto profile model.
146  * @return Radial DMEinasto profile model.
147  *
148  * Assigns radial DMEinasto profile model.
149  ***************************************************************************/
151 {
152  // Execute only if object is not identical
153  if (this != &model) {
154 
155  // Copy base class members
157 
158  // Free members
159  free_members();
160 
161  // Initialise members
162  init_members();
163 
164  // Copy members
165  copy_members(model);
166 
167  } // endif: object was not identical
168 
169  // Return
170  return *this;
171 }
172 
173 
174 /*==========================================================================
175  = =
176  = Public methods =
177  = =
178  ==========================================================================*/
179 
180 /***********************************************************************//**
181  * @brief Clear radial DMEinasto profile model
182  *
183  * Clears radial DMEinasto profile model.
184  ***************************************************************************/
186 {
187  // Free class members
188  free_members();
192 
193  // Initialise members
197  init_members();
198 
199  // Return
200  return;
201 }
202 
203 
204 /***********************************************************************//**
205  * @brief Clone radial DMEinasto profile model
206  *
207  * @return Pointer to deep copy of radial DMEinasto profile model.
208  *
209  * Returns a deep copy of the radial DMEinasto profile model.
210  ***************************************************************************/
212 {
213  // Clone radial disk model
214  return new GModelSpatialRadialProfileDMEinasto(*this);
215 }
216 
217 
218 /***********************************************************************//**
219  * @brief Return minimum model radius (in radians)
220  *
221  * @return Minimum model radius (in radians).
222  ***************************************************************************/
224 {
225 
226  // update precomputation cache
227  update();
228 
229  // Return value
230  return m_theta_min.value();
231 }
232 
233 
234 /***********************************************************************//**
235  * @brief Return maximum model radius (in radians)
236  *
237  * @return Maximum model radius (in radians).
238  ***************************************************************************/
240 {
241 
242  // Update precomputation cache
243  update();
244 
245  // Initialise maximum theta angle
246  double theta = 0.0;
247 
248  // If Earth is within the significant radius, then theta_max must
249  // contain the entire profile (180deg) ...
251  theta = gammalib::pi;
252  }
253 
254  // ... otherwise if the halo is far enough away (further than the mass
255  // radius) then we just need to deal with the angles within the sphere
256  // of the significant radius.
257  else {
259  }
260 
261  // Always chose the lesser of mass_radius theta and theta_max
263  if (theta > theta_max) {
264  theta = theta_max;
265  }
266 
267  // Return maximum theta value
268  return theta;
269 }
270 
271 
272 /***********************************************************************//**
273  * @brief Read model from XML element
274  *
275  * @param[in] xml XML element.
276  *
277  * Reads the DMEinasto radial profile model information from an XML element.
278  * The XML element shall have the format
279  *
280  * <spatialModel type="DMEinastoProfile">
281  * <parameter name="RA" scale=.. value=.. min=.. max=.. free=../>
282  * <parameter name="DEC" scale=.. value=.. min=.. max=.. free=../>
283  * <parameter name="ScaleRadius" scale=.. value=.. min=.. max=.. free=../>
284  * <parameter name="ScaleDensity" scale=.. value=.. min=.. max=.. free=../>
285  * <parameter name="HaloDistance" scale=.. value=.. min=.. max=.. free=../>
286  * <parameter name="Alpha" scale=.. value=.. min=.. max=.. free=../>
287  * <parameter name="ThetaMin" scale=.. value=.. min=.. max=.. free=../>
288  * <parameter name="ThetaMax" scale=.. value=.. min=.. max=.. free=../>
289  * <parameter name="CoreRadius" scale=.. value=.. min=.. max=.. free=../>
290  * </spatialModel>
291  ***************************************************************************/
293 {
294  // Verify number of model parameters
296 
297  // Read DMEinasto location
299 
300  // Read ScaleRadius parameter
301  const GXmlElement* par1 = gammalib::xml_get_par(G_READ, xml, "ScaleRadius");
302  m_scale_radius.read(*par1);
303 
304  // Read ScaleDensity parameter
305  const GXmlElement* par2 = gammalib::xml_get_par(G_READ, xml, "ScaleDensity");
306  m_scale_density.read(*par2);
307 
308  // Read HaloDistance parameter
309  const GXmlElement* par3 = gammalib::xml_get_par(G_READ, xml, "HaloDistance");
310  m_halo_distance.read(*par3);
311 
312  // Read Alpha parameter
313  const GXmlElement* par4 = gammalib::xml_get_par(G_READ, xml, "Alpha");
314  m_alpha.read(*par4);
315 
316  // Read ThetaMin parameter
317  const GXmlElement* par5 = gammalib::xml_get_par(G_READ, xml, "ThetaMin");
318  m_theta_min.read(*par5);
319 
320  // Read ThetaMax parameter
321  const GXmlElement* par6 = gammalib::xml_get_par(G_READ, xml, "ThetaMax");
322  m_theta_max.read(*par6);
323 
324  // Read CoreRadius parameter
325  const GXmlElement* par7 = gammalib::xml_get_par(G_READ, xml, "CoreRadius");
326  m_core_radius.read(*par7);
327 
328  // Return
329  return;
330 }
331 
332 
333 /***********************************************************************//**
334  * @brief Write model into XML element
335  *
336  * @param[in] xml XML element into which model information is written.
337  *
338  * Writes the DMEinasto radial profile model information into an XML element.
339  * The XML element will have the format
340  *
341  * <spatialModel type="DMEinastoProfile">
342  * <parameter name="RA" scale=.. value=.. min=.. max=.. free=../>
343  * <parameter name="DEC" scale=.. value=.. min=.. max=.. free=../>
344  * <parameter name="ScaleRadius" scale=.. value=.. min=.. max=.. free=../>
345  * <parameter name="ScaleDensity" scale=.. value=.. min=.. max=.. free=../>
346  * <parameter name="HaloDistance" scale=.. value=.. min=.. max=.. free=../>
347  * <parameter name="Alpha" scale=.. value=.. min=.. max=.. free=../>
348  * <parameter name="ThetaMin" scale=.. value=.. min=.. max=.. free=../>
349  * <parameter name="ThetaMax" scale=.. value=.. min=.. max=.. free=../>
350  * <parameter name="CoreRadius" scale=.. value=.. min=.. max=.. free=../>
351  * </spatialModel>
352  ***************************************************************************/
354 {
355  // Verify model type
357 
358  // Write DMEinasto location
360 
361  // Write ScaleRadius parameter
362  GXmlElement* par1 = gammalib::xml_need_par(G_WRITE, xml, "ScaleRadius");
363  m_scale_radius.write(*par1);
364 
365  // Write ScaleDensity parameter
366  GXmlElement* par2 = gammalib::xml_need_par(G_WRITE, xml, "ScaleDensity");
367  m_scale_density.write(*par2);
368 
369  // Write HaloDistance parameter
370  GXmlElement* par3 = gammalib::xml_need_par(G_WRITE, xml, "HaloDistance");
371  m_halo_distance.write(*par3);
372 
373  // Write Alpha parameter
374  GXmlElement* par4 = gammalib::xml_need_par(G_WRITE, xml, "Alpha");
375  m_alpha.write(*par4);
376 
377  // Write ThetaMin parameter
378  GXmlElement* par5 = gammalib::xml_need_par(G_WRITE, xml, "ThetaMin");
379  m_theta_min.write(*par5);
380 
381  // Write ThetaMax parameter
382  GXmlElement* par6 = gammalib::xml_need_par(G_WRITE, xml, "ThetaMax");
383  m_theta_max.write(*par6);
384 
385  // Write CoreRadius parameter
386  GXmlElement* par7 = gammalib::xml_need_par(G_WRITE, xml, "CoreRadius");
387  m_core_radius.write(*par7);
388 
389  // Return
390  return;
391 }
392 
393 
394 /***********************************************************************//**
395  * @brief Print information
396  *
397  * @param[in] chatter Chattiness.
398  * @return String containing model information.
399  ***************************************************************************/
400 std::string GModelSpatialRadialProfileDMEinasto::print(const GChatter& chatter) const
401 {
402  // Initialise result string
403  std::string result;
404 
405  // Continue only if chatter is not silent
406  if (chatter != SILENT) {
407 
408  // Append header
409  result.append("=== GModelSpatialRadialProfileDMEinasto ===");
410 
411  // Append parameters
412  result.append("\n"+gammalib::parformat("Number of parameters"));
413  result.append(gammalib::str(size()));
414  for (int i = 0; i < size(); ++i) {
415  result.append("\n"+m_pars[i]->print(chatter));
416  }
417 
418  } // endif: chatter was not silent
419 
420  // Return result
421  return result;
422 }
423 
424 
425 /*==========================================================================
426  = =
427  = Private methods =
428  = =
429  ==========================================================================*/
430 
431 /***********************************************************************//**
432  * @brief Initialise class members
433  ***************************************************************************/
435 {
436  // Initialise model type
437  m_type = "DMEinastoProfile";
438 
439  // Initialise scale radius
441  m_scale_radius.name("ScaleRadius");
442  m_scale_radius.unit("kpc");
443  m_scale_radius.value(21.5); // default to GC scale radius
444  m_scale_radius.min(1.0e-6); // arbitrarily chosen :/
446  m_scale_radius.scale(1.0);
448  m_scale_radius.has_grad(false); // Radial components never have gradients
449 
450  // Initialise scale density
452  m_scale_density.name("ScaleDensity");
453  m_scale_density.unit("GeV/cm^3");
454  m_scale_density.value(0.2); // GeV/cm3, default to GC scale density
455  m_scale_density.min(1.0e-6);
457  m_scale_density.scale(1.0);
459  m_scale_density.has_grad(false); // Radial components never have gradients
460 
461  // Initialise halo distance
463  m_halo_distance.name("HaloDistance");
464  m_halo_distance.unit("kpc");
465  m_halo_distance.value(7.94); // default to GC halo distance
466  m_halo_distance.min(1.0e-6); // arbitrarily chosen
468  m_halo_distance.scale(1.0);
470  m_halo_distance.has_grad(false); // Radial components never have gradients
471 
472  // Initialise alpha
473  m_alpha.clear();
474  m_alpha.name("Alpha");
475  m_alpha.unit("unitless");
476  m_alpha.value(0.17); // default to GC alpha
477  m_alpha.min(0.01); // arbitrarily chosen
478  m_alpha.max(10.0); // arbitrarily chosen
479  m_alpha.free();
480  m_alpha.scale(1.0);
481  m_alpha.gradient(0.0);
482  m_alpha.has_grad(false); // Radial components never have gradients
483 
484  // Initialise theta max
485  m_theta_min.clear();
486  m_theta_min.name("ThetaMin");
487  m_theta_min.unit("degrees");
488  m_theta_min.value(180.0); // can only go from halo center to opposite halo center
489  m_theta_min.min(1.0e-6); // arbitrarily chosen
490  m_theta_min.fix(); // should always be fixed!
491  m_theta_min.scale(1.0);
492  m_theta_min.gradient(0.0);
493  m_theta_min.has_grad(false); // Radial components never have gradients
494 
495  // Initialise theta max
496  m_theta_max.clear();
497  m_theta_max.name("ThetaMax");
498  m_theta_max.unit("degrees");
499  m_theta_max.value(1.0e-6); // can only go from halo center to opposite halo center
500  m_theta_max.min(1.0e-10); // arbitrarily chosen
501  m_theta_max.fix(); // should always be fixed!
502  m_theta_max.scale(1.0);
503  m_theta_max.gradient(0.0);
504  m_theta_max.has_grad(false); // Radial components never have gradients
505 
506  // Initialise core radius
508  m_core_radius.name("CoreRadius");
509  m_core_radius.unit("kpc");
510  m_core_radius.value(0.5); // example: galactic center core
511  m_core_radius.min(0.0);
512  m_core_radius.fix();
513  m_core_radius.scale(1.0);
514  m_core_radius.gradient(0.0);
515  m_core_radius.has_grad(false);
516 
517  // Set parameter pointer(s)
518  m_pars.push_back(&m_scale_radius);
519  m_pars.push_back(&m_scale_density);
520  m_pars.push_back(&m_halo_distance);
521  m_pars.push_back(&m_alpha);
522  m_pars.push_back(&m_theta_min);
523  m_pars.push_back(&m_theta_max);
524  m_pars.push_back(&m_core_radius);
525 
526  // Initialize precomputation cache. Note that zero values flag
527  // uninitialised, as a zero radius is not meaningful
528  m_last_scale_radius = 0.0;
529  m_last_scale_density = 0.0;
530  m_mass_radius = 0.0;
532 
533  // Return
534  return;
535 }
536 
537 
538 /***********************************************************************//**
539  * @brief Copy class members
540  *
541  * @param[in] model Radial DMEinasto model.
542  *
543  * Copies class members from another radial profile model.
544  ***************************************************************************/
546 {
547  // Copy members. We do not have to push back the members on the parameter
548  // stack as this should have been done by init_members() that was called
549  // before.
550  m_type = model.m_type; // Needed to conserve model type
554  m_alpha = model.m_alpha;
555  m_theta_min = model.m_theta_min;
556  m_theta_max = model.m_theta_max;
558 
559  // copy cache values
564 
565  // Return
566  return;
567 }
568 
569 
570 /***********************************************************************//**
571  * @brief Delete class members
572  ***************************************************************************/
574 {
575  // Return
576  return;
577 }
578 
579 
580 /***********************************************************************//**
581  * @brief Radial profile
582  *
583  * @param[in] theta Angular distance from DMEinasto centre (radians).
584  * @return Profile value.
585  ***************************************************************************/
586 double GModelSpatialRadialProfileDMEinasto::profile_value(const double& theta) const
587 {
588  // Update precomputation cache
589  update();
590 
591  // Initialize integral value
592  double value = 0.0;
593 
594  // Set up integration limits
595  double los_min = m_halo_distance.value() - m_mass_radius;
596  double los_max = m_halo_distance.value() + m_mass_radius;
597 
598  // handle case where observer is within halo mass radius
599  if (los_min < 0.0) {
600  los_min = 0.0;
601  }
602 
603  // Set up integral
606  m_alpha.value(),
607  theta,
608  m_core_radius.value());
609  GIntegral integral(&integrand);
610  integral.max_iter(30);
611 
612  // Set up integration boundaries. As there is usually an infinity at the
613  // halo center, this splits the integral at the m_halo_distance.
614  std::vector<double> bounds;
615  bounds.push_back(los_min);
616  bounds.push_back(los_max);
617  bounds.push_back(m_halo_distance.value());
618 
619  // Compute value
620  value = integral.romberg(bounds);
621 
622  // Multiply in the density^2
623  value *= m_scale_density_squared;
624 
625  // Return value
626  return value;
627 }
628 
629 
630 /***********************************************************************//**
631  * @brief Kernel for halo density profile squared
632  *
633  * @param[in] los Distance from observer to point in space (meters)
634  * @return Halo density.
635  *
636  * Computes the value of an einasto halo density profile squared,
637  * at distance l from observer, at angle \f[\theta\f] from the halo center:
638  *
639  * \f[
640  * f(\theta, l) = E^{ -\frac{2}{\alpha} \left( g^{\alpha} - 1 \right) }
641  * \f]
642  *
643  * where
644  *
645  * \f[
646  * g = \frac{ \sqrt{l^2+d^2-2ldCos(\theta)} }{r_s}
647  * \f]
648  *
649  * This profile is detailed in:
650  * Springel et al, 2008
651  * "The Aquarius Project: the subhaloes of galactic haloes"
652  * Mon. Not. R. Astron. Soc. 391, 1685–1711
653  * http://mnras.oxfordjournals.org/content/391/4/1685
654  *
655  * which cites:
656  * J. Einasto, 1965
657  * "Kinematics and dynamics of stellar systems"
658  * Trudy Inst. Astrofiz. Alma-Ata 5, 87
659  ***************************************************************************/
661 {
662  // Calculate the scale distance g, the ( distance from integration point
663  // to the halo center ) divided by ( the halo scale radius )
664 
665  // First calculate the distance of the integration point from the halo
666  // center via the law of cosines
667  double g = los * los;
669  g -= 2.0 * los * m_halo_distance * std::cos(m_theta);
670  g = std::sqrt(g);
671 
672  // If we have a core radius specified, all halo values inside this core
673  // radius should be the same as at the core radius itself.
674  if (g < m_core_radius) {
675  g = m_core_radius;
676  }
677 
678  // Finish scaling the integration point by the halo's scale radius
679  g /= m_scale_radius;
680 
681  // Calculate the halo density f at the scale distance g
682  double f = std::pow(g, m_alpha);
683  f -= 1.0;
684  f *= -2.0 / m_alpha;
685  f = std::exp(f);
686 
687  // Squared, for annihilating DM, would just be f if it was decaying DM
688  f = f * f;
689 
690  // Return function value
691  return f;
692 }
693 
694 
695 /***********************************************************************//**
696  * @brief Update precomputation cache
697  *
698  * Computes the m_mass_radius calculation, determining the radius around
699  * the halo that contains 99.99% of the mass. For an Einasto halo profile,
700  * this is just 10.0 * scale_radius .
701  ***************************************************************************/
703 {
704  // Update if scale radius has changed
707 
708  // Store last values
711 
712  // Perform precomputations
713  m_mass_radius = 10.0 * scale_radius();
715 
716  }
717 
718  // Return
719  return;
720 }
721 
722 
723 /***********************************************************************//**
724  * @brief Calculate halo mass density
725  *
726  * @param[in] radius Distance from halo center (kpc).
727  * @return Halo mass density.
728  *
729  * Calculates the halo's mass density at a given radial distance from the
730  * halo center.
731  ***************************************************************************/
732 double GModelSpatialRadialProfileDMEinasto::mass_density(const double& radius) const
733 {
734  // Set-up kernel
735  halo_kernel_los halo_shape(m_scale_radius.value(),
737  m_alpha.value(),
738  0.0,
739  m_core_radius.value());
740 
741 
742  // eval produces a unitless density^2, so we must take its square root
743  double density = std::sqrt(halo_shape.eval(m_halo_distance.value() + radius));
744 
745  // Multiply in the missing scale density
746  density *= m_scale_density.value();
747 
748  // Return halo mass density
749  return density;
750 }
751 
752 
753 /***********************************************************************//**
754  * @brief Calculate J-factor
755  *
756  * @param[in] angle from halo center (radians)
757  * @return J-factor.
758  *
759  * Calculates the halo's J-factor at an angle from the halo center.
760  ***************************************************************************/
762 {
763  // Integration settings
764  const double minradian = 0.0;
765  const int npoints = 200;
766 
767  // Initialize other variables
768  double jfactor = 0.0;
769  double dr = (angle - minradian) / npoints;
770 
771  // Loop over different radii in the profile
772  for (int i = 0; i < npoints; ++i) {
773  double r = minradian + (i * dr);
774  jfactor += profile_value(r) * r * dr;
775  }
776 
777  // J-factor = 2 * pi * Int[ profile(r) * r * dr , {r,minradian,angle} ]
778  jfactor *= gammalib::twopi;
779 
780  // Return J-factor
781  return jfactor;
782 }
GModelPar m_scale_density
Scale density of halo profile.
const std::string & name(void) const
Return parameter name.
XML element node class interface definition.
const double pi
Definition: GMath.hpp:35
double gradient(void) const
Return parameter gradient.
int size(void) const
Return number of parameters.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print information.
void write(GXmlElement &xml) const
Set or update parameter attributes in XML element.
Definition: GModelPar.cpp:351
virtual double profile_value(const double &theta) const
Radial profile.
GVector cos(const GVector &vector)
Computes cosine of vector elements.
Definition: GVector.cpp:1190
XML element node class.
Definition: GXmlElement.hpp:48
GModelPar m_alpha
Einasto spatial power index.
double max(void) const
Return parameter maximum boundary.
const GModelSpatialRadialDisk g_radial_disk_seed
double scale_density(void) const
Return scale density.
Gammalib tools definition.
GIntegral class interface definition.
Definition: GIntegral.hpp:46
virtual double theta_max(void) const
Return maximum model radius (in radians)
Interface definition for the spatial model registry class.
double min(void) const
Return parameter minimum boundary.
void init_members(void)
Initialise class members.
GModelPar m_halo_distance
Distance from earth to halo center.
void init_members(void)
Initialise class members.
const double & scale(void) const
Return parameter scale.
const double deg2rad
Definition: GMath.hpp:43
GVector sqrt(const GVector &vector)
Computes square root of vector elements.
Definition: GVector.cpp:1358
virtual GModelSpatialRadialProfileDMEinasto * clone(void) const
Clone radial DMEinasto profile model.
bool has_grad(void) const
Signal if parameter gradient is computed analytically.
void free_members(void)
Delete class members.
virtual double theta_min(void) const
Return minimum model radius (in radians)
void free_members(void)
Delete class members.
void free(void)
Free a parameter.
std::vector< GModelPar * > m_pars
Parameter pointers.
GModelPar m_scale_radius
Scale radius of halo profile.
void fix(void)
Fix a parameter.
GXmlElement * xml_need_par(const std::string &origin, GXmlElement &xml, const std::string &name)
Return pointer to parameter with given name in XML element.
Definition: GTools.cpp:1637
virtual void read(const GXmlElement &xml)
Read model from XML element.
void clear(void)
Clear parameter.
Spatial model registry class definition.
virtual void write(GXmlElement &xml) const
Write model into XML element.
double jfactor(const double &angle) const
Calculate J-factor.
GChatter
Definition: GTypemaps.hpp:33
double angle(const GVector &a, const GVector &b)
Computes angle between vectors.
Definition: GVector.cpp:974
double mass_density(const double &radius) const
Calculate halo mass density.
std::string type(void) const
Return model type.
void xml_check_parnum(const std::string &origin, const GXmlElement &xml, const int &number)
Checks number of parameters.
Definition: GTools.cpp:1777
virtual void read(const GXmlElement &xml)
Read model from XML element.
virtual void write(GXmlElement &xml) const
Write model into XML element.
void copy_members(const GModelSpatialRadialProfileDMEinasto &model)
Copy class members.
void free_members(void)
Delete class members.
std::string m_type
Spatial model type.
double scale_radius(void) const
Return scale radius.
void read(const GXmlElement &xml)
Extract parameter attributes from XML element.
Definition: GModelPar.cpp:229
double value(void) const
Return parameter value.
virtual GModelSpatialRadialProfile & operator=(const GModelSpatialRadialProfile &model)
Assignment operator.
GVector pow(const GVector &vector, const double &power)
Computes tanh of vector elements.
Definition: GVector.cpp:1422
const std::string & unit(void) const
Return parameter unit.
virtual void clear(void)
Clear radial DMEinasto profile model.
Exception handler interface definition.
virtual GModelSpatialRadialProfileDMEinasto & operator=(const GModelSpatialRadialProfileDMEinasto &model)
Assignment operator.
Dark Matter Einasto profile model class interface definition.
GVector exp(const GVector &vector)
Computes exponential of vector elements.
Definition: GVector.cpp:1232
void init_members(void)
Initialise class members.
const double twopi
Definition: GMath.hpp:36
std::string parformat(const std::string &s, const int &indent=0)
Convert string in parameter format.
Definition: GTools.cpp:1143
void update(void) const
Update precomputation cache.
GVector atan(const GVector &vector)
Computes arctan of vector elements.
Definition: GVector.cpp:1148
const GXmlElement * xml_get_par(const std::string &origin, const GXmlElement &xml, const std::string &name)
Return pointer to parameter with given name in XML element.
Definition: GTools.cpp:1689
Mathematical function definitions.
double eval(const double &los)
Kernel for halo density profile squared.
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.
Definition: GTools.cpp:489
void xml_check_type(const std::string &origin, GXmlElement &xml, const std::string &type)
Checks the model type.
Definition: GTools.cpp:1819