Gyoto
GyotoSpectrum.h
Go to the documentation of this file.
1
8/*
9 Copyright 2011-2016 Thibaut Paumard
10
11 This file is part of Gyoto.
12
13 Gyoto is free software: you can redistribute it and/or modify
14 it under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 Gyoto is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with Gyoto. If not, see <http://www.gnu.org/licenses/>.
25 */
26
27#ifndef __GyotoSpectrum_H_
28#define __GyotoSpectrum_H_
29
30#include "GyotoRegister.h"
31#include "GyotoObject.h"
32
33namespace Gyoto{
34 namespace Register { class Entry; }
35 class FactoryMessenger;
36
38 namespace Spectrum {
39 class Generic;
40
42
52 Subcontractor_t(Gyoto::FactoryMessenger* fmp, std::vector<std::string> const &);
53
63 (FactoryMessenger* fmp, std::vector<std::string> const & plugins) {
64 SmartPointer<T> sp = new T();
65 sp -> plugins(plugins) ;
66#ifdef GYOTO_USE_XERCES
67 if (fmp) sp -> setParameters(fmp);
68#endif
69 return sp;
70 }
71
73
84 void Register(std::string kind, Gyoto::Spectrum::Subcontractor_t* scp);
85
87
105 std::vector<std::string> &plugins,
106 int errmode=0);
107
109
115
117
122 }
123}
124
125#include <GyotoSmartPointer.h>
126#include <string>
135: public Gyoto::SmartPointee,
136 public Gyoto::Object
137{
139 protected:
140
141 public:
143
144 Generic(const std::string kind);
145 Generic(const Spectrum::Generic &);
146 virtual Generic * clone() const;
147
148 virtual ~Generic() ;
149
150 const std::string kind() const;
151
152 virtual double operator()(double nu) const =0;
154
161 virtual double operator()(double nu, double opacity, double ds) const;
163
172 virtual double integrate(double nu1, double nu2) ;
173
185 virtual double integrate(double nu1, double nu2,
186 const Spectrum::Generic * opacity, double ds) ;
187
188};
189
190
191#endif
Introspectable objects.
#define GYOTO_OBJECT
Declare class::properties and class::getProperties()
Definition: GyotoObject.h:84
Gyoto registers.
Reference-counting pointers.
Factory / SmartPointee::Subcontractor_t interface.
Definition: GyotoFactoryMessenger.h:92
Object with properties.
Definition: GyotoObject.h:152
Entry in a register (or a full register)
Definition: GyotoRegister.h:117
Can be pointed to by a SmartPointer.
Definition: GyotoSmartPointer.h:81
Spectrum emitted by an Astrobj.
Definition: GyotoSpectrum.h:137
virtual Generic * clone() const
Cloner.
const std::string kind() const
Get spectrum kind.
virtual double integrate(double nu1, double nu2)
Integrate optically thick I_nu.
void Register(std::string kind, Gyoto::Spectrum::Subcontractor_t *scp)
Make a Spectrum kind known to the Factory.
SmartPointer< Spectrum::Generic > Subcontractor(FactoryMessenger *fmp, std::vector< std::string > const &plugins)
Subcontractor template.
Definition: GyotoSpectrum.h:63
Gyoto::SmartPointer< Gyoto::Spectrum::Generic > Subcontractor_t(Gyoto::FactoryMessenger *fmp, std::vector< std::string > const &)
A function to build instances of a specific Spectrum::Generic sub-class.
Definition: GyotoSpectrum.h:52
Register::Entry * Register_
The Spectrum register.
Gyoto::Spectrum::Subcontractor_t * getSubcontractor(std::string name, std::vector< std::string > &plugins, int errmode=0)
Query the Spectrum register.
void initRegister()
Empty the Spectrum register.
Namespace for the Gyoto library.
Definition: GyotoAstrobj.h:43