Commit 6dcfd38870e212ae8e28eab2d5f83bc468f6487f

Authored by Jürgen Knödlseder
1 parent 9bc7ebde

Add contains() method to GModelSpatialDiffuse class.

include/GModelSpatialDiffuse.hpp
... ... @@ -57,7 +57,7 @@ public:
57 57 // Operators
58 58 virtual GModelSpatialDiffuse& operator=(const GModelSpatialDiffuse& model);
59 59  
60   - // Pure virtual base class methods
  60 + // Pure virtual methods
61 61 virtual void clear(void) = 0;
62 62 virtual GModelSpatialDiffuse* clone(void) const = 0;
63 63 virtual std::string classname(void) const = 0;
... ... @@ -68,6 +68,8 @@ public:
68 68 GRan& ran) const = 0;
69 69 virtual double norm(const GSkyDir& dir,
70 70 const double& radius) const = 0;
  71 + virtual bool contains(const GSkyDir& dir,
  72 + const double& margin = 0.0) const = 0;
71 73 virtual void read(const GXmlElement& xml) = 0;
72 74 virtual void write(GXmlElement& xml) const = 0;
73 75 virtual std::string print(const GChatter& chatter = NORMAL) const = 0;
... ...
include/GModelSpatialDiffuseConst.hpp
1 1 /***************************************************************************
2 2 * GModelSpatialDiffuseConst.hpp - Spatial isotropic model class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2010-2014 by Juergen Knoedlseder *
  4 + * copyright (C) 2010-2015 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -69,6 +69,8 @@ public:
69 69 GRan& ran) const;
70 70 virtual double norm(const GSkyDir& dir,
71 71 const double& radius) const;
  72 + virtual bool contains(const GSkyDir& dir,
  73 + const double& margin = 0.0) const;
72 74 virtual void read(const GXmlElement& xml);
73 75 virtual void write(GXmlElement& xml) const;
74 76 virtual std::string print(const GChatter& chatter = NORMAL) const;
... ... @@ -158,4 +160,23 @@ double GModelSpatialDiffuseConst::norm(const GSkyDir& dir,
158 160 return (value());
159 161 }
160 162  
  163 +
  164 +/***********************************************************************//**
  165 + * @brief Signals whether model contains sky direction
  166 + *
  167 + * @param[in] dir Sky direction.
  168 + * @param[in] margin Margin to be added to sky direction (degrees)
  169 + * @return True.
  170 + *
  171 + * Signals whether a sky direction falls within the diffuse model. As the
  172 + * constrant model is defined on the entire sphere, the method returns always
  173 + * true.
  174 + ***************************************************************************/
  175 +inline
  176 +bool GModelSpatialDiffuseConst::contains(const GSkyDir& dir,
  177 + const double& margin) const
  178 +{
  179 + return (true);
  180 +}
  181 +
161 182 #endif /* GMODELSPATIALDIFFUSECONST_HPP */
... ...
include/GModelSpatialDiffuseCube.hpp
1 1 /***************************************************************************
2 2 * GModelSpatialDiffuseCube.hpp - Spatial map cube model class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2010-2014 by Juergen Knoedlseder *
  4 + * copyright (C) 2010-2015 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -80,6 +80,8 @@ public:
80 80 GRan& ran) const;
81 81 virtual double norm(const GSkyDir& dir,
82 82 const double& radius) const;
  83 + virtual bool contains(const GSkyDir& dir,
  84 + const double& margin = 0.0) const;
83 85 virtual void read(const GXmlElement& xml);
84 86 virtual void write(GXmlElement& xml) const;
85 87 virtual std::string print(const GChatter& chatter = NORMAL) const;
... ...
include/GModelSpatialDiffuseMap.hpp
1 1 /***************************************************************************
2 2 * GModelSpatialDiffuseMap.hpp - Spatial map model class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2012-2014 by Juergen Knoedlseder *
  4 + * copyright (C) 2012-2015 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -75,6 +75,8 @@ public:
75 75 GRan& ran) const;
76 76 virtual double norm(const GSkyDir& dir,
77 77 const double& radius) const;
  78 + virtual bool contains(const GSkyDir& dir,
  79 + const double& margin = 0.0) const;
78 80 virtual void read(const GXmlElement& xml);
79 81 virtual void write(GXmlElement& xml) const;
80 82 virtual std::string print(const GChatter& chatter = NORMAL) const;
... ...
pyext/GModelSpatialDiffuse.i
... ... @@ -52,6 +52,8 @@ public:
52 52 GRan& ran) const = 0;
53 53 virtual double norm(const GSkyDir& dir,
54 54 const double& radius) const = 0;
  55 + virtual bool contains(const GSkyDir& dir,
  56 + const double& margin = 0.0) const = 0;
55 57 virtual void read(const GXmlElement& xml) = 0;
56 58 virtual void write(GXmlElement& xml) const = 0;
57 59 };
... ...
pyext/GModelSpatialDiffuseConst.i
... ... @@ -55,6 +55,8 @@ public:
55 55 GRan& ran) const;
56 56 virtual double norm(const GSkyDir& dir,
57 57 const double& radius) const;
  58 + virtual bool contains(const GSkyDir& dir,
  59 + const double& margin = 0.0) const;
58 60 virtual void read(const GXmlElement& xml);
59 61 virtual void write(GXmlElement& xml) const;
60 62  
... ...
pyext/GModelSpatialDiffuseCube.i
... ... @@ -59,6 +59,8 @@ public:
59 59 GRan& ran) const;
60 60 virtual double norm(const GSkyDir& dir,
61 61 const double& radius) const;
  62 + virtual bool contains(const GSkyDir& dir,
  63 + const double& margin = 0.0) const;
62 64 virtual void read(const GXmlElement& xml);
63 65 virtual void write(GXmlElement& xml) const;
64 66  
... ...
pyext/GModelSpatialDiffuseMap.i
... ... @@ -60,6 +60,8 @@ public:
60 60 GRan& ran) const;
61 61 virtual double norm(const GSkyDir& dir,
62 62 const double& radius) const;
  63 + virtual bool contains(const GSkyDir& dir,
  64 + const double& margin = 0.0) const;
63 65 virtual void read(const GXmlElement& xml);
64 66 virtual void write(GXmlElement& xml) const;
65 67  
... ...
src/model/GModelSpatialDiffuseCube.cpp
1 1 /***************************************************************************
2 2 * GModelSpatialDiffuseCube.cpp - Spatial map cube model class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2010-2014 by Juergen Knoedlseder *
  4 + * copyright (C) 2010-2015 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -473,6 +473,24 @@ GSkyDir GModelSpatialDiffuseCube::mc(const GEnergy& energy,
473 473  
474 474  
475 475 /***********************************************************************//**
  476 + * @brief Signals whether model contains sky direction
  477 + *
  478 + * @param[in] dir Sky direction.
  479 + * @param[in] margin Margin to be added to sky direction (degrees)
  480 + * @return True if the model contains the sky direction.
  481 + *
  482 + * Signals whether a sky direction falls within the diffuse model.
  483 + *
  484 + * @todo To be implemented.
  485 + ***************************************************************************/
  486 +bool GModelSpatialDiffuseCube::contains(const GSkyDir& dir,
  487 + const double& margin) const
  488 +{
  489 + return (true);
  490 +}
  491 +
  492 +
  493 +/***********************************************************************//**
476 494 * @brief Read model from XML element
477 495 *
478 496 * @param[in] xml XML element.
... ...
src/model/GModelSpatialDiffuseMap.cpp
... ... @@ -393,6 +393,24 @@ GSkyDir GModelSpatialDiffuseMap::mc(const GEnergy& energy,
393 393  
394 394  
395 395 /***********************************************************************//**
  396 + * @brief Signals whether model contains sky direction
  397 + *
  398 + * @param[in] dir Sky direction.
  399 + * @param[in] margin Margin to be added to sky direction (degrees)
  400 + * @return True if the model contains the sky direction.
  401 + *
  402 + * Signals whether a sky direction falls within the diffuse model.
  403 + *
  404 + * @todo To be implemented.
  405 + ***************************************************************************/
  406 +bool GModelSpatialDiffuseMap::contains(const GSkyDir& dir,
  407 + const double& margin) const
  408 +{
  409 + return (true);
  410 +}
  411 +
  412 +
  413 +/***********************************************************************//**
396 414 * @brief Read model from XML element
397 415 *
398 416 * @param[in] xml XML element.
... ...