Action #755

Updated by Knödlseder Jürgen over 11 years ago

The abstract base class of elliptical models should be @GModelSpatialElliptical@. It derives from the @GModelSpatial@.

Here is a proposal for the interface of the @GModelSpatialElliptical@ class:
<pre><code class="cpp">
class GModelSpatialElliptical : public GModelSpatial {

public:
// Constructors and destructors
GModelSpatialElliptical(void);
GModelSpatialElliptical(const GModelSpatialElliptical& model);
explicit GModelSpatialElliptical(const GXmlElement& xml);
virtual ~GModelSpatialElliptical(void);

// Operators
virtual GModelSpatialElliptical& operator=(const GModelSpatialElliptical& model);

// Pure virtual methods
virtual void clear(void) = 0;
virtual GModelSpatialElliptical* clone(void) const = 0;
virtual std::string type(void) const = 0;
virtual double eval(const double& theta, const double& posangle) posang) const = 0;
virtual double eval_gradients(const double& theta, const double& posangle) posang) const = 0;
virtual GSkyDir mc(GRan& ran) const = 0;
virtual double theta_max(void) const = 0;
virtual std::string print(void) const = 0;

// Implemented virtual base class methods
virtual double eval(const GSkyDir& srcDir) const;
virtual double eval_gradients(const GSkyDir& srcDir) const;
virtual void read(const GXmlElement& xml);
virtual void write(GXmlElement& xml) const;

// Other methods
double ra(void) const { return m_ra.real_value(); }
double dec(void) const { return m_dec.real_value(); }
double posangle(void) const { return m_posangle.real_value(); }
GSkyDir dir(void) const;
void dir(const GSkyDir& dir);
void posangle(const double& posangle) posang) { m_posangle.real_value(posangle); m_posangle=posangle; }

protected:
// Protected methods
void init_members(void);
void copy_members(const GModelSpatialElliptical& model);
void free_members(void);

// Proteced members
GModelPar m_ra; //!< Right Ascension (deg)
GModelPar m_dec; //!< Declination (deg)
GModelPar m_posangle; //!< Position angle from North, counterclockwise (deg)
};
</pre>
The base class stores the model centre and the position angle. The position angle is specified in celestial coordinates (Right Ascension, Declination), and is counted counterclockwise from North (usual convention).

There are variants of the @eval@ and @eval_gradients@ method that take an offset angle and a position angle as arguments.

Back