/usr/include/Gyoto/GyotoSpectrum.h is in libgyoto4-dev 1.0.2-2ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | /**
* \file GyotoSpectrum.h
* \brief Spectrum of a simple object (e.g. Star)
*
* Light emitted by an astronomical object
*/
/*
Copyright 2011-2012 Thibaut Paumard
This file is part of Gyoto.
Gyoto is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Gyoto is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Gyoto. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GyotoSpectrum_H_
#define __GyotoSpectrum_H_
#include "GyotoRegister.h"
#include "GyotoObject.h"
namespace Gyoto{
namespace Register { class Entry; }
class FactoryMessenger;
/// Spectrum of a simple object (e.g. a Gyoto::Astrobj::Star)
namespace Spectrum {
class Generic;
/// A function to build instances of a specific Spectrum::Generic sub-class
/**
* This is a more specific version of the
* SmartPointee::Subcontractor_t type. A Spectrum::Subcontrator_t
* is called by the Gyoto::Factory to build an instance of the
* kind of spectrum specified in an XML file (see
* Register()). The Factory and Subcontractor_t function
* communicate through a Gyoto::FactoryMessenger. A template is
* provided so that you may not have to code anything.
*/
typedef Gyoto::SmartPointer<Gyoto::Spectrum::Generic>
Subcontractor_t(Gyoto::FactoryMessenger* fmp);
/**
* \brief Subcontractor template
*
* Instead of reimplementing the wheel, your subcontractor can simply be
* Gyoto::Spectrum::Subcontractor<MyKind>
*
* \tparam T Sub-class of Spectrum::Generic
*/
template<typename T> SmartPointer<Spectrum::Generic> Subcontractor
(FactoryMessenger* fmp) {
SmartPointer<T> sp = new T();
#ifdef GYOTO_USE_XERCES
if (fmp) sp -> setParameters(fmp);
#endif
return sp;
}
/// Make a Spectrum kind known to the Factory
/**
* Register a new Spectrum::Generic sub-class so that the
* Gyoto::Factory knows it.
*
* \param kind The kind name which identifies this object type in
* an XML file, as in <Spectrum kind="name">
*
* \param scp A pointer to the subcontractor, which will
* communicate whith the Gyoto::Factory to build an instance of
* the class from its XML description
*/
void Register(std::string kind, Gyoto::Spectrum::Subcontractor_t* scp);
/// Query the Spectrum register
/**
* Query the Spectrum register to get the Metric::Subcontractor_t
* correspondig to a given kind name. This function is normally
* called only from the Factory.
*
* \param name e.g. "PowerLaw"
* \param errmode int=0. If errmode==0, failure to find a
* registered Spectrum by that name is an error. Else, simply
* return NULL pointer in that case.
* \return pointer to the corresponding subcontractor.
*/
Gyoto::Spectrum::Subcontractor_t*
getSubcontractor(std::string name, int errmode=0);
/// The Spectrum register
/**
* Use the Spectrum::initRegister() once in your program to
* initiliaze it, the Spectrum::Register() function to fill it, and
* the Spectrum::getSubcontractor() function to query it.
*/
extern Register::Entry* Register_;
/// Empty the Spectrum register.
/**
* This must be called once. It is called by
* Gyoto::Register::init().
*/
void initRegister();
}
}
#include <GyotoSmartPointer.h>
#include <string>
/**
* \class Gyoto::Spectrum::Generic
* \brief Spectrum emitted by an Astrobj
*
* Light emitted by e.g. a Star
*
*/
class Gyoto::Spectrum::Generic
: public Gyoto::SmartPointee,
public Gyoto::Object
{
friend class Gyoto::SmartPointer<Gyoto::Spectrum::Generic>;
protected:
public:
GYOTO_OBJECT;
Generic(const std::string kind); ///< Set kind in constructor
Generic(const Spectrum::Generic &);
virtual Generic * clone() const; ///< Cloner
virtual ~Generic() ; ///< Destructor: does nothing.
const std::string kind() const; ///< Get spectrum kind
virtual double operator()(double nu) const =0;
///< I_nu = mySpectrum(nu), nu in Hz. Assumes optically thick regime.
/**
* Generic implementation assumes emissivity = opacity.
*
* \param nu frequency in Hz
* \param opacity such that opacity*ds=optical thickness.
* \param ds in geometrical units
*/
virtual double operator()(double nu, double opacity, double ds) const;
///< I_nu in optically thin regime.
/**
* \brief Integrate optically thick I_nu
*
* See operator()(double nu) const
*
* \param nu1, nu2 boundaries for the integration
* \result I, the integral of I_nu between nu1 and nu2
*/
virtual double integrate(double nu1, double nu2) ;
/**
* \brief Integrate optically thin I_nu
*
* See operator()(double nu, double opacity, double ds) const
*
* \param nu1, nu2 boundaries for the integration
* \param opacity the frequency-dependent opacity law given as a
* pointer to a Gyoto::Spectrum::Generic sub-class instance
* \param ds the element length for spatial integration
* \result I, the integral of I_nu between nu1 and nu2
*/
virtual double integrate(double nu1, double nu2,
const Spectrum::Generic * opacity, double ds) ;
};
#endif
|