[Debian-astro-commits] [gyoto] 127/221: Convert all the remaining Astrobj classes to Object/Property mechanism
Thibaut Jean-Claude Paumard
thibaut at moszumanska.debian.org
Fri May 22 20:52:40 UTC 2015
This is an automated email from the git hooks/post-receive script.
thibaut pushed a commit to branch master
in repository gyoto.
commit 7a3e7857c06a6532e02895c49559016c20dfa0a7
Author: Thibaut Paumard <paumard at users.sourceforge.net>
Date: Wed Dec 3 17:04:33 2014 +0100
Convert all the remaining Astrobj classes to Object/Property mechanism
---
include/GyotoDefs.h | 8 +++
include/GyotoDirectionalDisk.h | 21 +++---
include/GyotoDisk3D.h | 24 ++++---
include/GyotoDynamicalDisk.h | 15 +++--
include/GyotoDynamicalDisk3D.h | 33 ++++++----
include/GyotoPageThorneDisk.h | 22 +++----
include/GyotoPatternDisk.h | 27 ++++----
include/GyotoPatternDiskBB.h | 13 ++--
include/GyotoPolishDoughnut.h | 48 ++++++++++----
include/GyotoStarTrace.h | 14 ++--
include/GyotoThinDisk.h | 46 +++++--------
include/GyotoThinDiskIronLine.h | 17 +++--
include/GyotoThinDiskPL.h | 15 +++--
lib/DirectionalDisk.C | 71 ++++++++++----------
lib/Disk3D.C | 67 ++++++++++---------
lib/DynamicalDisk.C | 46 ++++++-------
lib/DynamicalDisk3D.C | 60 +++++++++--------
lib/Factory.C | 18 ++++--
lib/NumericalMetricLorene.C | 6 +-
lib/Object.C | 7 +-
lib/PageThorneDisk.C | 41 ++++++------
lib/PatternDisk.C | 68 ++++++++++----------
lib/PatternDiskBB.C | 69 +++++++-------------
lib/PolishDoughnut.C | 139 +++++++++++++++++++++++-----------------
lib/StarTrace.C | 25 +++-----
lib/ThinDisk.C | 73 +++++++++------------
lib/ThinDiskIronLine.C | 56 ++++++----------
lib/ThinDiskPL.C | 36 +++++------
yorick/gyoto_ThinDisk.C | 16 ++---
29 files changed, 555 insertions(+), 546 deletions(-)
diff --git a/include/GyotoDefs.h b/include/GyotoDefs.h
index 0117a1f..98c7fc3 100644
--- a/include/GyotoDefs.h
+++ b/include/GyotoDefs.h
@@ -600,6 +600,14 @@ namespace Gyoto {
# define setIntensityConverter intensityConverter
# define getSafetyValue safetyValue;
# define setSafetyValue safetyValue;
+# define setInnerRadius innerRadius;
+# define getInnerRadius innerRadius;
+# define setOuterRadius outerRadius;
+# define getOuterRadius outerRadius;
+# define setThickness thickness;
+# define getThickness thickness;
+# define setDir dir;
+# define getDir dir;
//\}
#endif
diff --git a/include/GyotoDirectionalDisk.h b/include/GyotoDirectionalDisk.h
index e724ba3..e21d035 100644
--- a/include/GyotoDirectionalDisk.h
+++ b/include/GyotoDirectionalDisk.h
@@ -72,12 +72,16 @@ class Gyoto::Astrobj::DirectionalDisk : public Astrobj::ThinDisk {
size_t ni_; ///< Number of direction cosine
size_t nr_; ///< Number of radius values
- int average_over_angle_; ///< 1 to average over emission angle
+ bool average_over_angle_; ///< true to average over emission angle
// Constructors - Destructor
// -------------------------
public:
+ GYOTO_OBJECT;
+ // fillProperty is overridden to remove leading "!" from FITS filename
+ void fillProperty(Gyoto::FactoryMessenger *fmp, Property const &p) const;
+
DirectionalDisk(); ///< Standard constructor
DirectionalDisk(const DirectionalDisk& ) ;///< Copy constructor
@@ -89,6 +93,11 @@ class Gyoto::Astrobj::DirectionalDisk : public Astrobj::ThinDisk {
// ---------
public:
+ void file(std::string const &f);
+ std::string file() const ;
+ void averageOverAngle(bool t);
+ bool averageOverAngle()const;
+
#ifdef GYOTO_USE_CFITSIO
/// Read parameters and arrays from FITS file
virtual void fitsRead(std::string filename_);
@@ -138,10 +147,6 @@ class Gyoto::Astrobj::DirectionalDisk : public Astrobj::ThinDisk {
size_t ni = 0 );
virtual double const * getGridFreq() const; ///< Get DirectionalDisk::freq_
- virtual int setParameter(std::string name,
- std::string content,
- std::string unit);
-
protected:
void getIndices(size_t i[3], double const co[4], double cosi, double nu=0.) const ;
///< Get emission_ cell corresponding to position co[4]
@@ -151,12 +156,6 @@ class Gyoto::Astrobj::DirectionalDisk : public Astrobj::ThinDisk {
virtual double emission(double nu_em, double dsem,
double c_ph[8], double c_obj[8]) const;
- public:
-#ifdef GYOTO_USE_XERCES
- virtual void fillElement(FactoryMessenger *fmp) const ;
- virtual void setParameters(FactoryMessenger *fmp);
-#endif
-
};
#endif
diff --git a/include/GyotoDisk3D.h b/include/GyotoDisk3D.h
index 2316ef5..bc6240b 100644
--- a/include/GyotoDisk3D.h
+++ b/include/GyotoDisk3D.h
@@ -108,6 +108,10 @@ class Gyoto::Astrobj::Disk3D : public Gyoto::Astrobj::Generic {
// Constructors - Destructor
// -------------------------
public:
+ GYOTO_OBJECT;
+ // fillProperty is overridden to remove leading "!" from FITS filename
+ void fillProperty(Gyoto::FactoryMessenger *fmp, Property const &p) const;
+
Disk3D(); ///< Standard constructor.
Disk3D(const Disk3D& ) ;///< Copy constructor.
@@ -127,6 +131,16 @@ class Gyoto::Astrobj::Disk3D : public Gyoto::Astrobj::Generic {
virtual void fitsWrite(std::string filename_);
#endif
+ void file(std::string const &f);
+ std::string file() const;
+ void zsym(bool t);
+ bool zsym() const;
+ void tPattern(double t);
+ double tPattern() const;
+ void omegaPattern(double t);
+ double omegaPattern() const;
+
+
/// Set Disk3D::emissquant_.
/**
* The pointer is copied directly, not the array content.
@@ -243,10 +257,6 @@ class Gyoto::Astrobj::Disk3D : public Gyoto::Astrobj::Generic {
/// Get Disk3D::phimax_.
double phimax() const;
- virtual int setParameter(std::string name,
- std::string content,
- std::string unit);
-
protected:
void getIndices(size_t i[4], double const co[4], double nu=0.) const ;
///< Get emissquant_ cell corresponding to position co[4].
@@ -264,12 +274,6 @@ class Gyoto::Astrobj::Disk3D : public Gyoto::Astrobj::Generic {
*/
virtual void getVelocity(double const pos[4], double vel[4]) ;
- public:
-#ifdef GYOTO_USE_XERCES
- virtual void fillElement(FactoryMessenger *fmp) const ;
- virtual void setParameters(FactoryMessenger *fmp);
-#endif
-
};
#endif
diff --git a/include/GyotoDynamicalDisk.h b/include/GyotoDynamicalDisk.h
index 1c58553..71532b6 100644
--- a/include/GyotoDynamicalDisk.h
+++ b/include/GyotoDynamicalDisk.h
@@ -93,6 +93,8 @@ class Gyoto::Astrobj::DynamicalDisk : public Astrobj::PatternDiskBB {
// Constructors - Destructor
// -------------------------
public:
+ GYOTO_OBJECT;
+
DynamicalDisk(); ///< Standard constructor
DynamicalDisk(const DynamicalDisk& ) ;///< Copy constructor
@@ -104,9 +106,12 @@ class Gyoto::Astrobj::DynamicalDisk : public Astrobj::PatternDiskBB {
// ---------
public:
- virtual int setParameter(std::string name,
- std::string content,
- std::string unit);
+ std::string file() const;
+ void file(std::string const &fname);
+ void tinit(double t);
+ double tinit()const;
+ void dt(double t);
+ double dt()const;
using PatternDiskBB::emission;
virtual double emission(double nu_em, double dsem,
@@ -123,10 +128,6 @@ class Gyoto::Astrobj::DynamicalDisk : public Astrobj::PatternDiskBB {
*/
void copyQuantities(int iq) ;
- public:
-#ifdef GYOTO_USE_XERCES
- virtual void fillElement(FactoryMessenger *fmp) const ;
-#endif
};
diff --git a/include/GyotoDynamicalDisk3D.h b/include/GyotoDynamicalDisk3D.h
index 2e633b5..101777e 100644
--- a/include/GyotoDynamicalDisk3D.h
+++ b/include/GyotoDynamicalDisk3D.h
@@ -61,13 +61,13 @@ class Gyoto::Astrobj::DynamicalDisk3D : public Astrobj::Disk3D {
SmartPointer<Spectrum::BlackBody> spectrumBB_; ///< disk black body
///< emission law
private:
- int temperature_; ///< 1 if temperature is given in fits data file, 0 if emission coef is directly given
+ bool temperature_; ///< 1 if temperature is given in fits data file, 0 if emission coef is directly given
char* dirname_; ///< FITS files directory
double tinit_; ///< Time of the first FITS file
double dt_; ///< Time increment between two FITS (assumed constant)
int nb_times_; ///< Number of times
double PLindex_; ///< power law index such that density_elec(E) ∝ E<SUP>-p</SUP>
- int novel_; ///< put to 1 if velocity of emitting particle is not provided
+ bool novel_; ///< put to true if velocity of emitting particle is not provided
double floortemperature_; ///< if non-zero, emission and absorption are 0 for temperatures below this floor, emission=blackbody and absorption is infty for temperatures above (this is a kind of fake optically thick case, when the emitting surface is inside the grid, not at the boundary of the grid)
/**
@@ -95,6 +95,8 @@ class Gyoto::Astrobj::DynamicalDisk3D : public Astrobj::Disk3D {
// Constructors - Destructor
// -------------------------
public:
+ GYOTO_OBJECT;
+
DynamicalDisk3D(); ///< Standard constructor
DynamicalDisk3D(const DynamicalDisk3D& ) ;///< Copy constructor
@@ -105,13 +107,25 @@ class Gyoto::Astrobj::DynamicalDisk3D : public Astrobj::Disk3D {
// Accessors
// ---------
public:
-
using Generic::metric;
void metric(SmartPointer<Metric::Generic> gg);
- virtual int setParameter(std::string name,
- std::string content,
- std::string unit);
-
+ void file(std::string const &f);
+ std::string file() const;
+ void tinit(double t);
+ double tinit()const;
+ void dt(double t);
+ double dt()const;
+ void PLindex(double t);
+ double PLindex()const;
+ void floorTemperature(double t);
+ double floorTemperature()const;
+ void temperature(bool t);
+ bool temperature() const;
+ void withVelocity(bool t);
+ bool withVelocity() const;
+
+ // Stuff
+ // -----
/// Compute emission at one grid date.
double emission1date(double nu_em, double dsem,
double c_ph[8], double c_obj[8]) const;
@@ -140,11 +154,6 @@ class Gyoto::Astrobj::DynamicalDisk3D : public Astrobj::Disk3D {
*/
void copyQuantities(int iq) ;
- public:
-#ifdef GYOTO_USE_XERCES
- virtual void fillElement(FactoryMessenger *fmp) const ;
-#endif
-
};
#endif
diff --git a/include/GyotoPageThorneDisk.h b/include/GyotoPageThorneDisk.h
index 7396342..e2c2284 100644
--- a/include/GyotoPageThorneDisk.h
+++ b/include/GyotoPageThorneDisk.h
@@ -75,14 +75,15 @@ class Gyoto::Astrobj::PageThorneDisk
double x3_; ///< Value cached for bolometricEmission()
int blackbody_; ///< Flag for computing BB flux (for spectra)
double mdot_; ///< accretion rate (for BB spectrum computation)
- int uniflux_; ///< Flag for uniform flux = 1
+ bool uniflux_; ///< Flag for uniform flux = 1
SmartPointer<Spectrum::BlackBody> spectrumBB_; ///< disk black body
///< emission law
// Constructors - Destructor
// -------------------------
public:
-
+ GYOTO_OBJECT;
+
PageThorneDisk(); ///< Standard constructor
PageThorneDisk(const PageThorneDisk& ) ;///< Copy constructor
@@ -97,6 +98,14 @@ class Gyoto::Astrobj::PageThorneDisk
virtual void metric(SmartPointer<Metric::Generic>);
///< Set metric, checking that it is either KerrBL or KerrKS
+ /// Set #mdot_ to v, and #blackbody_ to true
+ void BlackbodyMdot(double v);
+ double BlackbodyMdot() const;
+ void blackBody(bool t) ;
+ bool blackBody() const ;
+ void uniFlux(bool t) ;
+ bool uniFlux() const ;
+
private:
virtual void updateSpin() ;
///< Get spin from metric, which must be KerrBL or KerrKS
@@ -128,10 +137,6 @@ virtual double bolometricEmission(double nuem, double dsem,
double* coord_obj_hit, double dt,
Astrobj::Properties* data) const;
- int setParameter(std::string name,
- std::string content,
- std::string unit);
-
Quantity_t getDefaultQuantities();
// Hook::Listener API //
@@ -145,11 +150,6 @@ virtual double bolometricEmission(double nuem, double dsem,
*/
virtual void tell(Gyoto::Hook::Teller *msg);
- public:
-#ifdef GYOTO_USE_XERCES
- virtual void fillElement(FactoryMessenger *fmp) const ; ///< called from Factory
-#endif
-
};
#endif
diff --git a/include/GyotoPatternDisk.h b/include/GyotoPatternDisk.h
index 63f49cb..7f7f5ac 100644
--- a/include/GyotoPatternDisk.h
+++ b/include/GyotoPatternDisk.h
@@ -107,6 +107,10 @@ class Gyoto::Astrobj::PatternDisk : public Astrobj::ThinDisk {
// Constructors - Destructor
// -------------------------
public:
+ GYOTO_OBJECT;
+ // fillProperty is overridden to remove leading "!" from FITS filename
+ void fillProperty(Gyoto::FactoryMessenger *fmp, Property const &p) const;
+
PatternDisk(); ///< Standard constructor
PatternDisk(const PatternDisk& ) ;///< Copy constructor
@@ -117,16 +121,19 @@ class Gyoto::Astrobj::PatternDisk : public Astrobj::ThinDisk {
// Accessors
// ---------
public:
- using ThinDisk::setInnerRadius;
- virtual void setInnerRadius(double);
- using ThinDisk::setOuterRadius;
- virtual void setOuterRadius(double);
+ using ThinDisk::innerRadius;
+ virtual void innerRadius(double);
+ using ThinDisk::outerRadius;
+ virtual void outerRadius(double);
/**
* Unit: radians per geometrical unit time.
*/
virtual void patternVelocity(double); ///< Set PatternDisk::Omega_
- virtual double patternVelocity(); ///< Get PatternDisk::Omega_
+ virtual double patternVelocity() const; ///< Get PatternDisk::Omega_
+
+ virtual void file(std::string const &f);
+ virtual std::string file() const ;
#ifdef GYOTO_USE_CFITSIO
/// Read parameters and arrays from FITS file
@@ -256,10 +263,6 @@ class Gyoto::Astrobj::PatternDisk : public Astrobj::ThinDisk {
void phimax(double phimax); ///< Set PatternDisk::phimax_
double phimax() const; ///< Get PatternDisk::phimax_
- virtual int setParameter(std::string name,
- std::string content,
- std::string unit);
-
protected:
void getIndices(size_t i[3], double const co[4], double nu=0.) const ;
///< Get emission_ cell corresponding to position co[4]
@@ -272,12 +275,6 @@ class Gyoto::Astrobj::PatternDisk : public Astrobj::ThinDisk {
virtual void getVelocity(double const pos[4], double vel[4]) ;
- public:
-#ifdef GYOTO_USE_XERCES
- virtual void fillElement(FactoryMessenger *fmp) const ;
- virtual void setParameters(FactoryMessenger *fmp);
-#endif
-
};
#endif
diff --git a/include/GyotoPatternDiskBB.h b/include/GyotoPatternDiskBB.h
index 0d7a3b5..6de130b 100644
--- a/include/GyotoPatternDiskBB.h
+++ b/include/GyotoPatternDiskBB.h
@@ -69,6 +69,8 @@ class Gyoto::Astrobj::PatternDiskBB : public Astrobj::PatternDisk {
// Constructors - Destructor
// -------------------------
public:
+ GYOTO_OBJECT;
+
PatternDiskBB(); ///< Standard constructor
PatternDiskBB(const PatternDiskBB& ) ;///< Copy constructor
@@ -79,8 +81,10 @@ class Gyoto::Astrobj::PatternDiskBB : public Astrobj::PatternDisk {
// Accessors
// ---------
public:
-
- int setParameter(std::string name, std::string content, std::string unit);
+ bool spectralEmission() const;
+ void spectralEmission(bool t);
+ double risco() const;
+ void risco(double r);
public:
using PatternDisk::emission;
@@ -93,11 +97,6 @@ class Gyoto::Astrobj::PatternDiskBB : public Astrobj::PatternDisk {
using Generic::metric;
void metric(SmartPointer<Metric::Generic> gg); ///< Insures metric is KerrBL or alike
- public:
-#ifdef GYOTO_USE_XERCES
- void fillElement(FactoryMessenger *fmp) const ;
-#endif
-
};
#endif
diff --git a/include/GyotoPolishDoughnut.h b/include/GyotoPolishDoughnut.h
index 0f12401..86e702b 100644
--- a/include/GyotoPolishDoughnut.h
+++ b/include/GyotoPolishDoughnut.h
@@ -81,17 +81,26 @@ protected:
size_t spectral_oversampling_;///< Oversampling used in integrateEmission()
bool komissarov_; ///< 1 if Komissarov model is integrated
bool angle_averaged_; ///< 1 if Komissarov model should be angle averaged
- bool nonthermal_; ///< 1 to take into account non-thermal electrons
- double deltaPL_; ///< fraction of thermal energy in non-thermal electrons
+
+ /// fraction of thermal energy in non-thermal electrons
+ /**
+ * Obsiously, 0 means no non-thermal electrons at all. In this case,
+ * the (trivial) non-thermal computations are skipped. Ther is thus
+ * non need for an additional "nonthermal_" flag.
+ */
+ double deltaPL_;
double expoPL_; ///< exponent of the non-thermal powerlaw = -expoPL_
- int adaf_; ///< 1 to switch to an ADAF model rather tha Polish doughnut
+
+ bool adaf_; ///< true to switch to an ADAF model rather tha Polish doughnut
double ADAFtemperature_; ///< ADAF central temperature
double ADAFdensity_; ///< ADAF central density
- int changecusp_; ///< 1 to apply the fishy rcusp_ change (to be changed)
+
+ bool changecusp_; ///< true to apply the fishy rcusp_ change (to be changed)
// Constructors - Destructor
// -------------------------
public:
+ GYOTO_OBJECT;
PolishDoughnut() ; ///< Default constructor
PolishDoughnut(const PolishDoughnut& ) ; ///< Copy constructor
virtual PolishDoughnut* clone() const;
@@ -114,9 +123,9 @@ public:
void lambda(double lambda); ///< Set PolishDoughnut::lambda_
double centralDensity() const; ///< Get PolishDoughnut::central_density_
- double centralDensity(std::string unit) const; ///< Get PolishDoughnut::central_density_ in specified unit
+ double centralDensity(std::string const &unit) const; ///< Get PolishDoughnut::central_density_ in specified unit
void centralDensity(double density); ///< Set PolishDoughnut::central_density_
- void centralDensity(double density, std::string unit); ///< Set PolishDoughnut::central_density_ in specified unit
+ void centralDensity(double density, std::string const &unit); ///< Set PolishDoughnut::central_density_ in specified unit
double centralTempOverVirial() const; ///< Get PolishDoughnut::centraltemp_over_virial_
void centralTempOverVirial(double val); ///< Set PolishDoughnut::centraltemp_over_virial_
@@ -127,8 +136,28 @@ public:
void spectralOversampling(size_t); ///< Set PolishDoughnut::spectral_oversampling_
size_t spectralOversampling() const ; ///< Get PolishDoughnut::spectral_oversampling_
+ bool changeCusp() const; ///< Get PolishDoughnut::komissarov_
+ void changeCusp(bool t); ///< Set PolishDoughnut::komissarov_
bool komissarov() const; ///< Get PolishDoughnut::komissarov_
void komissarov(bool komis); ///< Set PolishDoughnut::komissarov_
+ bool angleAveraged() const; ///< Get PolishDoughnut::angle_averaged_
+
+ /**
+ * if komis, also sets komissarov_ to true
+ */
+ void angleAveraged(bool komis); ///< Set PolishDoughnut::angle_averaged_
+
+ void nonThermalDeltaExpo(std::vector<double> const &v);
+ std::vector<double> nonThermalDeltaExpo() const;
+ void adafparams(std::vector<double> const &v);
+ std::vector<double> adafparams() const;
+ void adaf(bool t);
+ bool adaf() const;
+ void setParameter(Gyoto::Property const &p,
+ std::string const & name,
+ std::string const & content,
+ std::string const & unit);
+
// Read only members, depend on lambda
double getWsurface() const; ///< Get PolishDoughnut::W_surface_
@@ -146,13 +175,6 @@ public:
virtual double operator()(double const coord[4]) ;
- virtual int setParameter(std::string name,
- std::string content,
- std::string unit) ;
-#ifdef GYOTO_USE_XERCES
- virtual void fillElement(FactoryMessenger *fmp) const ;
-#endif
-
// ASTROBJ processHitQuantities API
// --------------------------------
protected:
diff --git a/include/GyotoStarTrace.h b/include/GyotoStarTrace.h
index 6f59aff..b3ca6da 100644
--- a/include/GyotoStarTrace.h
+++ b/include/GyotoStarTrace.h
@@ -82,6 +82,8 @@ class Gyoto::Astrobj::StarTrace :
// Constructors - Destructor
// -------------------------
public:
+ GYOTO_OBJECT;
+
/**
* Create Star object and set initial condition.
* \param gg Gyoto::SmartPointer to the Gyoto::Metric in this part of the Universe
@@ -133,21 +135,13 @@ class Gyoto::Astrobj::StarTrace :
virtual std::string className() const ; ///< "StarTrace"
virtual std::string className_l() const ; ///< "startrace"
- double TMin(); ///< Get tmin_
+ double TMin()const; ///< Get tmin_
void TMin(double); ///< Set tmin_
- double TMax(); ///< Get tmax_
+ double TMax()const; ///< Get tmax_
void TMax(double); ///< Set tmax_
virtual void setInitialCondition(double coord[8]); ///< Same as Worldline::setInitialCondition(gg, coord, sys,1)
- virtual int setParameter(std::string name,
- std::string content,
- std::string unit);
-
-#ifdef GYOTO_USE_XERCES
- virtual void fillElement(FactoryMessenger *fmp) const ; ///< called from Factory
-#endif
-
virtual double operator()(double const coord[4]) ;
};
diff --git a/include/GyotoThinDisk.h b/include/GyotoThinDisk.h
index 5853c8b..8d01db8 100644
--- a/include/GyotoThinDisk.h
+++ b/include/GyotoThinDisk.h
@@ -88,6 +88,7 @@ class Gyoto::Astrobj::ThinDisk :
// Constructors - Destructor
// -------------------------
public:
+ GYOTO_OBJECT;
/**
* Create direct ThinDisk object. When initializing a derived class,
@@ -103,20 +104,22 @@ class Gyoto::Astrobj::ThinDisk :
// Accessors
// ---------
public:
- virtual double getInnerRadius() const ; ///< Get rin_
- virtual double getInnerRadius(std::string unit) const ; ///< Get rin_
- virtual void setInnerRadius(double); ///< Set rin_
- virtual void setInnerRadius(double, std::string unit); ///< Set rin_
- virtual double getOuterRadius() const ; ///< Get rout_
- virtual double getOuterRadius(std::string unit) const ; ///< Get rout_
- virtual void setOuterRadius(double); ///< Set rout_
- virtual void setOuterRadius(double, std::string unit); ///< Set rout_
- virtual double getThickness() const ; ///< Get thickness_
- virtual double getThickness(std::string unit) const ; ///< Get thickness_
- virtual void setThickness(double); ///< Set thickness_
- virtual void setThickness(double, std::string unit); ///< Set thickness_
- virtual int getDir() const ; ///< Get dir_
- virtual void setDir(int); ///< Set dir_
+ virtual double innerRadius() const ; ///< Get rin_
+ virtual double innerRadius(std::string const &) const ; ///< Get rin_
+ virtual void innerRadius(double); ///< Set rin_
+ virtual void innerRadius(double, std::string const &); ///< Set rin_
+ virtual double outerRadius() const ; ///< Get rout_
+ virtual double outerRadius(std::string const &) const ; ///< Get rout_
+ virtual void outerRadius(double); ///< Set rout_
+ virtual void outerRadius(double, std::string const &); ///< Set rout_
+ virtual double thickness() const ; ///< Get thickness_
+ virtual double thickness(std::string const &) const ; ///< Get thickness_
+ virtual void thickness(double); ///< Set thickness_
+ virtual void thickness(double, std::string const&); ///< Set thickness_
+ virtual int dir() const ; ///< Get dir_
+ virtual void dir(int); ///< Set dir_
+ virtual bool corotating() const; /// Get dir_==1
+ virtual void corotating(bool t); /// Set dir_=t?1:-1
/**
* A function which changes sign on the equatorial plane.
@@ -141,21 +144,6 @@ class Gyoto::Astrobj::ThinDisk :
*/
virtual void getVelocity(double const pos[4], double vel[4]) ;
- public:
- virtual int setParameter(std::string name,
- std::string content,
- std::string unit) ;
-
-#ifdef GYOTO_USE_XERCES
- /**
- * The sub-classes implementations of the
- * Astrobj::Generic::fillElement() method should call
- * Astrobj::ThinDisk::fillElement() to fill the common bits.
- */
- virtual void fillElement(FactoryMessenger *fmp) const ;
- ///< Fill the generic XML bits
-#endif
-
public:
virtual int Impact(Gyoto::Photon* ph, size_t index,
Astrobj::Properties *data=NULL) ;
diff --git a/include/GyotoThinDiskIronLine.h b/include/GyotoThinDiskIronLine.h
index 701795c..af3db07 100644
--- a/include/GyotoThinDiskIronLine.h
+++ b/include/GyotoThinDiskIronLine.h
@@ -17,6 +17,7 @@ class Gyoto::Astrobj::ThinDiskIronLine
double linefreq_; ///< intrinsic line frequency (Hz)
double cutradius_; ///< r<cutradius_ -> emission = 0
public:
+ GYOTO_OBJECT;
ThinDiskIronLine();
ThinDiskIronLine(const ThinDiskIronLine &o);
virtual ~ThinDiskIronLine();
@@ -27,11 +28,13 @@ class Gyoto::Astrobj::ThinDiskIronLine
double c_ph[8], double c_obj[8]) const;
void getVelocity(double const pos[4], double vel[4]);
- virtual int setParameter(std::string name,
- std::string content,
- std::string unit);
-#ifdef GYOTO_USE_XERCES
- virtual void fillElement(FactoryMessenger *fmp) const ;
-#endif
-#endif
+ void PowerLawIndex(double v);
+ double PowerLawIndex()const;
+
+ void LineFreq(double v);
+ double LineFreq()const;
+
+ void CutRadius(double v);
+ double CutRadius()const;
};
+#endif
diff --git a/include/GyotoThinDiskPL.h b/include/GyotoThinDiskPL.h
index fb1c77f..324c33d 100644
--- a/include/GyotoThinDiskPL.h
+++ b/include/GyotoThinDiskPL.h
@@ -64,6 +64,7 @@ class Gyoto::Astrobj::ThinDiskPL : public Astrobj::ThinDisk {
// Constructors - Destructor
// -------------------------
public:
+ GYOTO_OBJECT;
ThinDiskPL(); ///< Standard constructor
@@ -75,6 +76,14 @@ class Gyoto::Astrobj::ThinDiskPL : public Astrobj::ThinDisk {
// Accessors
// ---------
public:
+ void PLSlope(double);
+ double PLSlope()const;
+ void PLRho(double);
+ double PLRho()const;
+ void PLRadRef(double);
+ double PLRadRef()const;
+
+ public:
using ThinDisk::emission;
virtual double emission(double nu_em, double dsem,
double c_ph[8],double c_obj[8]) const;
@@ -85,12 +94,6 @@ class Gyoto::Astrobj::ThinDiskPL : public Astrobj::ThinDisk {
*/
double emissionBB(double nu, double co[8]) const;
- public:
- int setParameter(std::string name, std::string content, std::string unit);
-#ifdef GYOTO_USE_XERCES
- virtual void fillElement(FactoryMessenger *fmp) const ; ///< called from Factory
-#endif
-
};
#endif
diff --git a/lib/DirectionalDisk.C b/lib/DirectionalDisk.C
index 2fcfbab..9c596f5 100644
--- a/lib/DirectionalDisk.C
+++ b/lib/DirectionalDisk.C
@@ -20,6 +20,7 @@
#include "GyotoDirectionalDisk.h"
#include "GyotoUtils.h"
#include "GyotoFactoryMessenger.h"
+#include "GyotoProperty.h"
#include "GyotoKerrBL.h"
#include "GyotoKerrKS.h"
@@ -42,6 +43,26 @@ using namespace std;
using namespace Gyoto;
using namespace Gyoto::Astrobj;
+//// Properties:
+
+GYOTO_PROPERTY_START(DirectionalDisk)
+GYOTO_PROPERTY_FILENAME(DirectionalDisk, File, file)
+GYOTO_PROPERTY_BOOL(DirectionalDisk,
+ AverageOverAngle, DontAverageOverAngle,
+ averageOverAngle)
+GYOTO_PROPERTY_END(DirectionalDisk, ThinDisk::properties)
+
+void DirectionalDisk::fillProperty(Gyoto::FactoryMessenger *fmp,
+ Property const &p) const {
+ if (p.name == "File")
+ fmp->setParameter("File", (filename_.compare(0,1,"!") ?
+ filename_ :
+ filename_.substr(1)) );
+ else ThinDisk::fillProperty(fmp, p);
+}
+
+////
+
DirectionalDisk::DirectionalDisk() :
ThinDisk("DirectionalDisk"), filename_(""),
emission_(NULL), radius_(NULL), cosi_(NULL), freq_(NULL),
@@ -189,6 +210,21 @@ void DirectionalDisk::copyGridFreq(double const *const freq, size_t nnu) {
}
double const * DirectionalDisk::getGridFreq() const { return freq_; }
+void DirectionalDisk::averageOverAngle(bool t) {average_over_angle_=t;}
+bool DirectionalDisk::averageOverAngle()const {return average_over_angle_;}
+
+void DirectionalDisk::file(std::string const &f) {
+# ifdef GYOTO_USE_CFITSIO
+ fitsRead(f);
+# else
+ throwError("This Gyoto has no FITS i/o");
+# endif
+}
+
+std::string DirectionalDisk::file() const {
+ return filename_;
+}
+
#ifdef GYOTO_USE_CFITSIO
void DirectionalDisk::fitsRead(string filename) {
GYOTO_MSG << "DirectionalDisk reading FITS file: " << filename << endl;
@@ -529,38 +565,3 @@ double DirectionalDisk::emission(double nu, double,
//cout << "return= " << Iem << endl;
return Iem;
}
-
-int DirectionalDisk::setParameter(std::string name,
- std::string content,
- std::string unit) {
- if (name == "File"){
-#ifdef GYOTO_USE_CFITSIO
- fitsRead( content );
-#else
- throwError("This Gyoto has no FITS i/o");
-#endif
- } else if (name == "AverageOverAngle"){
- average_over_angle_=1;
- } else {
- return ThinDisk::setParameter(name, content, unit);
- }
- return 0;
-}
-
-#ifdef GYOTO_USE_XERCES
-void DirectionalDisk::fillElement(FactoryMessenger *fmp) const {
- fmp->setParameter("File", (filename_.compare(0,1,"!") ?
- filename_ :
- filename_.substr(1)));
- ThinDisk::fillElement(fmp);
-}
-
-void DirectionalDisk::setParameters(FactoryMessenger* fmp) {
- string name, content, unit;
- metric(fmp->metric());
- while (fmp->getNextParameter(&name, &content, &unit)) {
- if (name == "File") setParameter(name, fmp -> fullPath(content), unit);
- else setParameter(name, content, unit);
- }
-}
-#endif
diff --git a/lib/Disk3D.C b/lib/Disk3D.C
index 41e35ee..9ab5913 100644
--- a/lib/Disk3D.C
+++ b/lib/Disk3D.C
@@ -18,6 +18,7 @@
*/
#include "GyotoPhoton.h"
#include "GyotoDisk3D.h"
+#include "GyotoProperty.h"
#include "GyotoUtils.h"
#include "GyotoFactoryMessenger.h"
#include "GyotoKerrBL.h"
@@ -42,6 +43,38 @@ using namespace std;
using namespace Gyoto;
using namespace Gyoto::Astrobj;
+GYOTO_PROPERTY_START(Disk3D)
+GYOTO_PROPERTY_FILENAME(Disk3D, File, file)
+GYOTO_PROPERTY_BOOL(Disk3D, ZsymmetrizeGrid, NoZsymmetrizeGrid, zsym)
+GYOTO_PROPERTY_DOUBLE(Disk3D, tPattern, tPattern)
+GYOTO_PROPERTY_DOUBLE(Disk3D, omegaPattern, omegaPattern)
+GYOTO_PROPERTY_END(Disk3D, Generic::properties)
+
+void Disk3D::fillProperty(Gyoto::FactoryMessenger *fmp,
+ Property const &p) const {
+ if (p.name == "File")
+ fmp->setParameter("File", (filename_.compare(0,1,"!") ?
+ filename_ :
+ filename_.substr(1)) );
+ else Generic::fillProperty(fmp, p);
+}
+
+
+void Disk3D::file(std::string const &f) {
+#ifdef GYOTO_USE_CFITSIO
+ fitsRead(f);
+#else
+ throwError("This Gyoto has no FITS i/o");
+#endif
+}
+std::string Disk3D::file() const {return filename_;}
+void Disk3D::zsym(bool t) {zsym_=t;}
+bool Disk3D::zsym() const {return zsym_;}
+void Disk3D::tPattern(double t) {tPattern_=t;}
+double Disk3D::tPattern() const {return tPattern_;}
+void Disk3D::omegaPattern(double t) {omegaPattern_=t;}
+double Disk3D::omegaPattern() const {return omegaPattern_;}
+
Disk3D::Disk3D() :
Generic("Disk3D"), filename_(""),
emissquant_(NULL), opacity_(NULL), velocity_(NULL),
@@ -782,37 +815,3 @@ int Disk3D::Impact(Photon *ph, size_t index,
return 1;
}
-
-int Disk3D::setParameter(std::string name,
- std::string content,
- std::string unit) {
- if (name == "File")
-#ifdef GYOTO_USE_CFITSIO
- fitsRead( content );
-#else
- throwError("This Gyoto has no FITS i/o");
-#endif
- if (name == "NoZsymmetrizeGrid") zsym_ = 0;
- else if (name=="tPattern") tPattern_=atof(content.c_str());
- else if (name=="omegaPattern") omegaPattern_=atof(content.c_str());
- else return Generic::setParameter(name, content, unit);
- return 0;
-}
-
-#ifdef GYOTO_USE_XERCES
-void Disk3D::fillElement(FactoryMessenger *fmp) const {
- fmp->setParameter("File", (filename_.compare(0,1,"!") ?
- filename_ :
- filename_.substr(1)));
- Generic::fillElement(fmp);
-}
-
-void Disk3D::setParameters(FactoryMessenger* fmp) {
- string name, content, unit;
- metric(fmp->metric());
- while (fmp->getNextParameter(&name, &content, &unit)) {
- if (name == "File") setParameter(name, fmp -> fullPath(content), unit);
- else setParameter(name, content, unit);
- }
-}
-#endif
diff --git a/lib/DynamicalDisk.C b/lib/DynamicalDisk.C
index b412f23..64a544f 100644
--- a/lib/DynamicalDisk.C
+++ b/lib/DynamicalDisk.C
@@ -18,6 +18,7 @@
*/
#include "GyotoPhoton.h"
#include "GyotoDynamicalDisk.h"
+#include "GyotoProperty.h"
#include "GyotoUtils.h"
#include "GyotoFactoryMessenger.h"
#include "GyotoKerrBL.h"
@@ -38,6 +39,16 @@ using namespace std;
using namespace Gyoto;
using namespace Gyoto::Astrobj;
+/// Properties
+
+GYOTO_PROPERTY_START(DynamicalDisk)
+GYOTO_PROPERTY_DOUBLE(DynamicalDisk, tinit, tinit)
+GYOTO_PROPERTY_DOUBLE(DynamicalDisk, dt, dt)
+GYOTO_PROPERTY_END(DynamicalDisk, PatternDiskBB::properties)
+
+///
+
+
DynamicalDisk::DynamicalDisk() :
PatternDiskBB(),
tinit_(0.), dt_(1.)
@@ -128,13 +139,11 @@ double DynamicalDisk::emission(double nu, double dsem,
return 0.;
}
-int DynamicalDisk::setParameter(std::string name,
- std::string content,
- std::string unit) {
- if (name == "File") {
+std::string DynamicalDisk::file() const {return dirname_;}
+void DynamicalDisk::file(std::string const &fname) {
#ifdef GYOTO_USE_CFITSIO
- dirname_ = new char[strlen(content.c_str())+1];
- strcpy(dirname_,content.c_str());
+ dirname_ = new char[strlen(fname.c_str())+1];
+ strcpy(dirname_,fname.c_str());
DIR *dp;
struct dirent *dirp;
if((dp = opendir(dirname_)) == NULL) {
@@ -189,7 +198,7 @@ int DynamicalDisk::setParameter(std::string name,
emission_array_[i-1] = new double[nel1];
for (size_t j=0;j<nel1;++j)
emission_array_[i-1][j]=emtemp[j];
- }else throwError("In DynmicalDisk::setParameter: Emission must be supplied");
+ }else throwError("In DynmicalDisk::file: Emission must be supplied");
//save opacity
if (opacity()){
double * optemp = const_cast<double*>(opacity());
@@ -203,14 +212,14 @@ int DynamicalDisk::setParameter(std::string name,
velocity_array_[i-1] = new double[nel2];
for (size_t j=0;j<nel2;++j)
velocity_array_[i-1][j]=veltemp[j];
- }else throwError("In DynmicalDisk::setParameter: Velocity must be supplied");
+ }else throwError("In DynmicalDisk::file: Velocity must be supplied");
//save radius
if (getGridRadius()){
double * radtemp = const_cast<double*>(getGridRadius());
radius_array_[i-1] = new double[nr];
for (size_t j=0;j<nr;++j)
radius_array_[i-1][j]=radtemp[j];
- }else throwError("In DynmicalDisk::setParameter: Radius must be supplied");
+ }else throwError("In DynmicalDisk::file: Radius must be supplied");
//save other quantities
dnu_array_[i-1]=dnu();
nu0_array_[i-1]=nu0();
@@ -221,18 +230,11 @@ int DynamicalDisk::setParameter(std::string name,
#else
throwError("This Gyoto has no FITS i/o");
#endif
- }
- else if (name=="tinit") tinit_=atof(content.c_str());
- else if (name=="dt") dt_=atof(content.c_str());
- else return PatternDiskBB::setParameter(name, content, unit);
- return 0;
-}
-
-#ifdef GYOTO_USE_XERCES
-void DynamicalDisk::fillElement(FactoryMessenger *fmp) const {
- fmp->setParameter("tinit", tinit_);
- fmp->setParameter("dt", dt_);
- PatternDiskBB::fillElement(fmp);
}
-#endif
+void DynamicalDisk::tinit(double t) {tinit_=t;}
+double DynamicalDisk::tinit()const{return tinit_;}
+
+void DynamicalDisk::dt(double t) {dt_=t;}
+double DynamicalDisk::dt()const{return dt_;}
+
diff --git a/lib/DynamicalDisk3D.C b/lib/DynamicalDisk3D.C
index 554c2ae..d3d413c 100644
--- a/lib/DynamicalDisk3D.C
+++ b/lib/DynamicalDisk3D.C
@@ -38,6 +38,18 @@ using namespace std;
using namespace Gyoto;
using namespace Gyoto::Astrobj;
+#include "GyotoProperty.h"
+GYOTO_PROPERTY_START(DynamicalDisk3D)
+GYOTO_PROPERTY_DOUBLE(DynamicalDisk3D, tinit, tinit)
+GYOTO_PROPERTY_DOUBLE(DynamicalDisk3D, dt, dt)
+GYOTO_PROPERTY_BOOL(DynamicalDisk3D,
+ TemperatureGrid, IntensityGrid, temperature)
+GYOTO_PROPERTY_DOUBLE(DynamicalDisk3D, PLindex, PLindex)
+GYOTO_PROPERTY_BOOL(DynamicalDisk3D,
+ WithVelocity, NoVelocity, withVelocity)
+GYOTO_PROPERTY_DOUBLE(DynamicalDisk3D, FloorTemperature, floorTemperature)
+GYOTO_PROPERTY_END(DynamicalDisk3D, Disk3D::properties)
+
DynamicalDisk3D::DynamicalDisk3D() :
Disk3D(),
spectrumBB_(NULL),
@@ -457,10 +469,7 @@ void DynamicalDisk3D::metric(SmartPointer<Metric::Generic> gg) {
Disk3D::metric(gg);
}
-int DynamicalDisk3D::setParameter(std::string name,
- std::string content,
- std::string unit) {
- if (name == "File") {
+void DynamicalDisk3D::file(std::string const &content) {
#ifdef GYOTO_USE_CFITSIO
int withopacity=0;
@@ -535,7 +544,7 @@ int DynamicalDisk3D::setParameter(std::string name,
for (size_t j=0;j<nel1;j++)
emission_array_[i-1][j]=emtemp[j];
}else {
- throwError("In DynamicalDisk3D::setParameter: "
+ throwError("In DynamicalDisk3D::file(fname): "
"Emission must be supplied");
}
@@ -548,7 +557,7 @@ int DynamicalDisk3D::setParameter(std::string name,
absorption_array_[i-1][j]=abstemp[j];
//cout << "SAVING ABS ARRAY" << endl;
}else{
- throwError("In DynamicalDisk3D::setParameter: "
+ throwError("In DynamicalDisk3D::file(fname): "
"Absorption should be supplied here");
}
}
@@ -560,7 +569,7 @@ int DynamicalDisk3D::setParameter(std::string name,
for (size_t j=0;j<nel2;j++)
velocity_array_[i-1][j]=veltemp[j];
}else{
- throwError("In DynmicalDisk::setParameter: "
+ throwError("In DynmicalDisk::file(fname): "
"Velocity must be supplied");
}
@@ -577,27 +586,28 @@ int DynamicalDisk3D::setParameter(std::string name,
|| nphi!=nphib
|| zmin()!=zminb || zmax()!=zmaxb || nz!=nzb
|| rin()!=rinb || rout()!=routb || nr!=nrb
- ) throwError("DynamicalDisk3D::setParameter Grid is not constant!");
+ ) throwError("DynamicalDisk3D::file(fname) Grid is not constant!");
}
#else
throwError("This Gyoto has no FITS i/o");
#endif
- }
- else if (name=="tinit") tinit_=atof(content.c_str());
- else if (name=="dt") dt_=atof(content.c_str());
- else if (name=="IntensityGrid") temperature_=0;
- else if (name=="PLindex") PLindex_=atof(content.c_str());
- else if (name=="NoVelocity") novel_=1;
- else if (name=="FloorTemperature") floortemperature_=atof(content.c_str());
- else return Disk3D::setParameter(name, content, unit);
- return 0;
-}
-
-#ifdef GYOTO_USE_XERCES
-void DynamicalDisk3D::fillElement(FactoryMessenger *fmp) const {
- fmp->setParameter("tinit", tinit_);
- fmp->setParameter("dt", dt_);
- Disk3D::fillElement(fmp);
}
+std::string DynamicalDisk3D::file() const {return dirname_;}
+
+void DynamicalDisk3D::tinit(double t) {tinit_=t;}
+double DynamicalDisk3D::tinit()const{return tinit_;}
+
+void DynamicalDisk3D::dt(double t) {dt_=t;}
+double DynamicalDisk3D::dt()const{return dt_;}
+
+void DynamicalDisk3D::PLindex(double t) {PLindex_=t;}
+double DynamicalDisk3D::PLindex()const{return PLindex_;}
+
+void DynamicalDisk3D::floorTemperature(double t) {floortemperature_=t;}
+double DynamicalDisk3D::floorTemperature()const{return floortemperature_;}
+
+void DynamicalDisk3D::temperature(bool t) {temperature_=t;}
+bool DynamicalDisk3D::temperature() const {return temperature_;}
-#endif
+void DynamicalDisk3D::withVelocity(bool t) {novel_=!t;}
+bool DynamicalDisk3D::withVelocity() const {return !novel_;}
diff --git a/lib/Factory.C b/lib/Factory.C
index 4a313ce..9ee1e97 100644
--- a/lib/Factory.C
+++ b/lib/Factory.C
@@ -767,15 +767,19 @@ void Factory::setParameter(std::string name,
std::vector<double> const &val,
DOMElement *pel, FactoryMessenger **child){
- ostringstream ss;
- ss << setprecision(GYOTO_PREC) << setw(GYOTO_WIDTH) << val[0];
- size_t n=val.size();
- for (size_t i=1; i<n; ++i) {
- ss << " " << setprecision(GYOTO_PREC) << setw(GYOTO_WIDTH) << val[i];
- }
DOMElement* el = doc_->createElement(X(name.c_str()));
pel -> appendChild(el);
- el->appendChild( doc_->createTextNode(X(ss.str().c_str())) );
+
+ size_t n=val.size();
+
+ if (n) {
+ ostringstream ss;
+ ss << setprecision(GYOTO_PREC) << setw(GYOTO_WIDTH) << val[0];
+ for (size_t i=1; i<n; ++i) {
+ ss << " " << setprecision(GYOTO_PREC) << setw(GYOTO_WIDTH) << val[i];
+ }
+ el->appendChild( doc_->createTextNode(X(ss.str().c_str())) );
+ }
if (child) *child = new FactoryMessenger(this, el);
}
diff --git a/lib/NumericalMetricLorene.C b/lib/NumericalMetricLorene.C
index 2bf435a..ff1338d 100644
--- a/lib/NumericalMetricLorene.C
+++ b/lib/NumericalMetricLorene.C
@@ -1617,7 +1617,7 @@ bool NumericalMetricLorene::hasSurface() const {return has_surface_;}
void NumericalMetricLorene::hasSurface(bool s) {
has_surface_ = s;
if (filename_!=NULL){
- throwError("In NumericalMetricLorene::setParameter "
+ throwError("In NumericalMetricLorene::hasSurface "
"please provide Surface information before File in XML");
}
}
@@ -1628,7 +1628,7 @@ bool NumericalMetricLorene::specifyMarginalOrbits() const {
void NumericalMetricLorene::specifyMarginalOrbits(bool s) {
specify_marginalorbits_=s;
if (filename_!=NULL){
- throwError("In NumericalMetricLorene::setParameter "
+ throwError("In NumericalMetricLorene::specifyMarginalOrbits "
"please provide Marginal orbits information "
"before File in XML");
}
@@ -1638,7 +1638,7 @@ bool NumericalMetricLorene::mapEt() const {return mapet_;}
void NumericalMetricLorene::mapEt(bool s) {
mapet_ = s;
if (filename_!=NULL){
- throwError("In NumericalMetricLorene::setParameter "
+ throwError("In NumericalMetricLorene::mapEt "
"please provide MapET/MapAF information before File in XML");
}
}
diff --git a/lib/Object.C b/lib/Object.C
index a0c7871..c27a312 100644
--- a/lib/Object.C
+++ b/lib/Object.C
@@ -150,7 +150,9 @@ Property const * Object::property(std::string const pname) const {
Property const * prop = getProperties();
while (prop) {
if (*prop) {
- if (prop->name == pname) return prop;
+ if (prop->name == pname ||
+ (prop->type==Property::bool_t && prop->name_false == pname))
+ return prop;
++prop;
} else prop=prop->parent;
}
@@ -216,10 +218,13 @@ void Object::setParameters(Gyoto::FactoryMessenger *fmp) {
<< "' (unit='"<<unit<<"')" << endl;
Property const * prop = property(name);
if (!prop) {;
+ GYOTO_DEBUG << "'" << name << "' not found, calling setParameter()"
+ << endl;
// The specific setParameter() implementation may well know
// this entity
setParameter(name, content, unit);
} else {
+ GYOTO_DEBUG << "'" << name << "' found "<< endl;
switch (prop->type) {
case Property::metric_t:
set(*prop, fmp->metric());
diff --git a/lib/PageThorneDisk.C b/lib/PageThorneDisk.C
index ee64db5..7fc5bed 100644
--- a/lib/PageThorneDisk.C
+++ b/lib/PageThorneDisk.C
@@ -19,6 +19,7 @@
#include "GyotoPhoton.h"
#include "GyotoPageThorneDisk.h"
+#include "GyotoProperty.h"
#include "GyotoUtils.h"
#include "GyotoFactoryMessenger.h"
#include "GyotoKerrBL.h"
@@ -41,6 +42,26 @@ using namespace std;
using namespace Gyoto;
using namespace Gyoto::Astrobj;
+GYOTO_PROPERTY_START(PageThorneDisk)
+// Since BlackbodyMdot also sets BlackBody, it's important to keep the
+// later after the former
+GYOTO_PROPERTY_DOUBLE(PageThorneDisk, BlackbodyMdot, BlackbodyMdot)
+GYOTO_PROPERTY_BOOL(PageThorneDisk, BlackBody, NonBlackBody, blackBody)
+GYOTO_PROPERTY_BOOL(PageThorneDisk, UniFlux, NonUniFlux, uniFlux)
+GYOTO_PROPERTY_END(PageThorneDisk, ThinDisk::properties)
+
+void PageThorneDisk::BlackbodyMdot(double v) {
+ blackbody_=true;
+ mdot_=v;
+}
+double PageThorneDisk::BlackbodyMdot() const { return mdot_; }
+
+void PageThorneDisk::blackBody(bool t) {blackbody_=t;}
+bool PageThorneDisk::blackBody() const {return blackbody_;}
+
+void PageThorneDisk::uniFlux(bool t) {uniflux_=t;}
+bool PageThorneDisk::uniFlux() const {return uniflux_;}
+
PageThorneDisk::PageThorneDisk() :
ThinDisk("PageThorneDisk"), aa_(0.), aa2_(0.),
x0_(0.), x1_(0.), x2_(0.), x3_(0.), blackbody_(0), mdot_(0),
@@ -285,23 +306,3 @@ void PageThorneDisk::processHitQuantities(Photon* ph, double* coord_ph_hit,
void PageThorneDisk::tell(Hook::Teller* msg) {
if (msg==gg_) updateSpin();
}
-
-int PageThorneDisk::setParameter(std::string name,
- std::string content,
- std::string unit) {
- char* tc = const_cast<char*>(content.c_str());
- if (name=="BlackbodyMdot") {
- blackbody_=1;
- mdot_=atof(tc);
- }
- if (name=="UniFlux") uniflux_=1;
- else return ThinDisk::setParameter(name, content, unit);
- return 0;
-}
-
-#ifdef GYOTO_USE_XERCES
-void PageThorneDisk::fillElement(FactoryMessenger *fmp) const {
- fmp->metric(gg_);
- ThinDisk::fillElement(fmp);
-}
-#endif
diff --git a/lib/PatternDisk.C b/lib/PatternDisk.C
index 42346f9..37e988e 100644
--- a/lib/PatternDisk.C
+++ b/lib/PatternDisk.C
@@ -18,6 +18,7 @@
*/
#include "GyotoPhoton.h"
#include "GyotoPatternDisk.h"
+#include "GyotoProperty.h"
#include "GyotoUtils.h"
#include "GyotoFactoryMessenger.h"
#include "GyotoKerrBL.h"
@@ -41,6 +42,24 @@ using namespace std;
using namespace Gyoto;
using namespace Gyoto::Astrobj;
+/// Properties
+
+GYOTO_PROPERTY_START(PatternDisk)
+GYOTO_PROPERTY_FILENAME(PatternDisk, File, file)
+GYOTO_PROPERTY_DOUBLE(PatternDisk, PatternVelocity, patternVelocity)
+GYOTO_PROPERTY_END(PatternDisk, ThinDisk::properties)
+
+void PatternDisk::fillProperty(Gyoto::FactoryMessenger *fmp,
+ Property const &p) const {
+ if (p.name == "File")
+ fmp->setParameter("File", (filename_.compare(0,1,"!") ?
+ filename_ :
+ filename_.substr(1)) );
+ else ThinDisk::fillProperty(fmp, p);
+}
+
+///
+
PatternDisk::PatternDisk() :
ThinDisk("PatternDisk"), filename_(""),
emission_(NULL), opacity_(NULL), velocity_(NULL), radius_(NULL),
@@ -747,48 +766,27 @@ double PatternDisk::transmission(double nu, double dsem, double*co) const {
return exp(-opac*dsem);
}
-void PatternDisk::setInnerRadius(double rin) {
- ThinDisk::setInnerRadius(rin);
+void PatternDisk::innerRadius(double rin) {
+ ThinDisk::innerRadius(rin);
if (nr_>1 && !radius_) dr_ = (rout_-rin_) / double(nr_-1);
}
-void PatternDisk::setOuterRadius(double rout) {
- ThinDisk::setOuterRadius(rout);
+void PatternDisk::outerRadius(double rout) {
+ ThinDisk::outerRadius(rout);
if (nr_>1 && !radius_) dr_ = (rout_-rin_) / double(nr_-1);
}
void PatternDisk::patternVelocity(double omega) { Omega_ = omega; }
-double PatternDisk::patternVelocity() { return Omega_; }
-
-int PatternDisk::setParameter(std::string name,
- std::string content,
- std::string unit) {
- if (name == "File")
-#ifdef GYOTO_USE_CFITSIO
- fitsRead( content );
-#else
- throwError("this gyoto has no FITS io");
-#endif
- else if (name=="PatternVelocity") patternVelocity(atof(content.c_str()));
- else return ThinDisk::setParameter(name, content, unit);
- return 0;
-}
-
-#ifdef GYOTO_USE_XERCES
-void PatternDisk::fillElement(FactoryMessenger *fmp) const {
- fmp->setParameter("File", (filename_.compare(0,1,"!") ?
- filename_ :
- filename_.substr(1)));
- fmp->setParameter("PatternVelocity", Omega_);
- ThinDisk::fillElement(fmp);
+double PatternDisk::patternVelocity() const { return Omega_; }
+
+void PatternDisk::file(std::string const &f) {
+# ifdef GYOTO_USE_CFITSIO
+ fitsRead(f);
+# else
+ throwError("This Gyoto has no FITS i/o");
+# endif
}
-void PatternDisk::setParameters(FactoryMessenger* fmp) {
- string name, content, unit;
- metric(fmp->metric());
- while (fmp->getNextParameter(&name, &content, &unit)) {
- if (name == "File") setParameter(name, fmp -> fullPath(content), unit);
- else setParameter(name, content, unit);
- }
+std::string PatternDisk::file() const {
+ return filename_;
}
-#endif
diff --git a/lib/PatternDiskBB.C b/lib/PatternDiskBB.C
index 75b4a9b..d7d05b3 100644
--- a/lib/PatternDiskBB.C
+++ b/lib/PatternDiskBB.C
@@ -18,6 +18,7 @@
*/
#include "GyotoPhoton.h"
#include "GyotoPatternDiskBB.h"
+#include "GyotoProperty.h"
#include "GyotoUtils.h"
#include "GyotoFactoryMessenger.h"
#include "GyotoKerrBL.h"
@@ -36,6 +37,27 @@ using namespace std;
using namespace Gyoto;
using namespace Gyoto::Astrobj;
+GYOTO_PROPERTY_START(PatternDiskBB)
+GYOTO_PROPERTY_BOOL(PatternDiskBB,
+ SpectralEmission, BolometricEmission, spectralEmission)
+GYOTO_PROPERTY_DOUBLE(PatternDiskBB, Risco, risco)
+GYOTO_PROPERTY_END(PatternDiskBB, PatternDisk::properties)
+
+bool PatternDiskBB::spectralEmission() const {return SpectralEmission_;}
+void PatternDiskBB::spectralEmission(bool t) {SpectralEmission_=t;}
+
+double PatternDiskBB::risco() const {
+ if (risco_>0.) return risco_;
+ switch (gg_->coordKind()) {
+ case GYOTO_COORDKIND_SPHERICAL:
+ return static_cast<SmartPointer<Metric::KerrBL> >(gg_) -> getRms();
+ default:
+ throwError("PatternDiskBB::getVelocity: bad COORDKIND");
+ }
+ return 0.; // avoid warning, never reached
+}
+void PatternDiskBB::risco(double r) {risco_=r;}
+
PatternDiskBB::PatternDiskBB() :
PatternDisk(),
spectrumBB_(NULL),
@@ -65,26 +87,13 @@ double const * PatternDiskBB::getVelocity() const { return PatternDisk::getVeloc
void PatternDiskBB::getVelocity(double const pos[4], double vel[4]) {
// The only use of this reimplementation: ensure nothing happens below ISCO
- double risco;
- if (risco_>0.) risco=risco_;
- else {
- switch (gg_->coordKind()) {
- case GYOTO_COORDKIND_SPHERICAL:
- risco = static_cast<SmartPointer<Metric::KerrBL> >(gg_) -> getRms();
- break;
- default:
- throwError("PatternDiskBB::getVelocity: bad COORDKIND");
- risco=0.;
- }
- }
-
double const * const rad=getGridRadius();
size_t i[3]; // {i_nu, i_phi, i_r}
getIndices(i, pos, 0.); //NB: last arg should be nu, don't care here
double rgrid=rad[i[2]-1]; // this is the smallest radius used
// when dealing with the current r value
- if (rgrid<risco){
+ if (rgrid<risco()){
//default velocity, emission will be 0 there anyway
vel[0]=1.;
for (int ii=1;ii<4;ii++)
@@ -103,26 +112,13 @@ double PatternDiskBB::emission(double nu, double dsem,
GYOTO_DEBUG << endl;
- double risco;
- if (risco_>0.) risco=risco_;
- else {
- switch (gg_->coordKind()) {
- case GYOTO_COORDKIND_SPHERICAL:
- risco = static_cast<SmartPointer<Metric::KerrBL> >(gg_) -> getRms();
- break;
- default:
- throwError("PatternDiskBB::emission: bad COORDKIND");
- risco=0.;
- }
- }
-
size_t i[3]; // {i_nu, i_phi, i_r}
getIndices(i, co, nu);
double const * const rad=getGridRadius();
double rgrid=rad[i[2]-1];
// no emission in any case above rmax_:
- if (rgrid > rmax_ || rgrid < risco) return 0.;
+ if (rgrid > rmax_ || rgrid < risco()) return 0.;
double Iem=0.;
size_t naxes[3];
@@ -162,20 +158,3 @@ void PatternDiskBB::metric(SmartPointer<Metric::Generic> gg) {
("PatternDiskBB::metric(): metric must be KerrBL or CS");
ThinDisk::metric(gg);
}
-
-int PatternDiskBB::setParameter(std::string name,
- std::string content,
- std::string unit) {
- if (name=="SpectralEmission") SpectralEmission_=1;
- else if (name=="Risco") risco_=atof(content.c_str());
- else return PatternDisk::setParameter(name, content, unit);
- return 0;
-}
-
-#ifdef GYOTO_USE_XERCES
-void PatternDiskBB::fillElement(FactoryMessenger *fmp) const {
- fmp -> setParameter ( SpectralEmission_? "SpectralEmission" : "BolometricEmission");
- PatternDisk::fillElement(fmp);
-}
-
-#endif
diff --git a/lib/PolishDoughnut.C b/lib/PolishDoughnut.C
index 195d771..2730ae9 100644
--- a/lib/PolishDoughnut.C
+++ b/lib/PolishDoughnut.C
@@ -14,6 +14,7 @@
*/
#include "GyotoUtils.h"
#include "GyotoPolishDoughnut.h"
+#include "GyotoProperty.h"
#include "GyotoPhoton.h"
#include "GyotoFactoryMessenger.h"
#include "GyotoDefs.h"
@@ -25,6 +26,31 @@
using namespace std;
using namespace Gyoto;
using namespace Gyoto::Astrobj;
+
+GYOTO_PROPERTY_START(PolishDoughnut)
+GYOTO_PROPERTY_DOUBLE(PolishDoughnut, Lambda, lambda)
+GYOTO_PROPERTY_DOUBLE_UNIT(PolishDoughnut, CentralDensity, centralDensity)
+GYOTO_PROPERTY_DOUBLE(PolishDoughnut,
+ CentralTempOverVirial, centralTempOverVirial)
+GYOTO_PROPERTY_DOUBLE(PolishDoughnut, Beta, beta)
+GYOTO_PROPERTY_SIZE_T(PolishDoughnut,
+ SpectralOversampling, spectralOversampling)
+// Since <KomissarovAngleAveraged/> also sets <Komissarov/>, it's
+// important to keep the later after the former.
+GYOTO_PROPERTY_BOOL(PolishDoughnut,
+ KomissarovAngleAveraged, NoKomissarovAngleAveraged,
+ angleAveraged)
+GYOTO_PROPERTY_BOOL(PolishDoughnut, Komissarov, NoKomissarov, komissarov)
+GYOTO_PROPERTY_VECTOR_DOUBLE(PolishDoughnut,
+ NonThermalDeltaExpo, nonThermalDeltaExpo)
+// Since adafparams(vector) sets adaf_ to true, ADAF must come after
+// ADAFParameters
+GYOTO_PROPERTY_VECTOR_DOUBLE(PolishDoughnut, ADAFParameters, adafparams)
+GYOTO_PROPERTY_BOOL(PolishDoughnut, ADAF, NonADAF, adaf)
+GYOTO_PROPERTY_BOOL(PolishDoughnut,
+ ChangeCusp, KeepCusp, changeCusp)
+GYOTO_PROPERTY_END(PolishDoughnut, Standard::properties)
+
#define CST_POLY_INDEX 1.5//polytropic index n (gamma=1+1/n=5/3)
#define CST_POLY_INDEX_M1 0.666666666666666666666666666666666666666667
#define CST_HYDRO_FRAC 0.75//hydrogen fraction
@@ -53,7 +79,6 @@ PolishDoughnut::PolishDoughnut() :
spectral_oversampling_(10),
komissarov_(0),
angle_averaged_(0),
- nonthermal_(0),
deltaPL_(0.),
expoPL_(0.),
adaf_(0),
@@ -85,7 +110,6 @@ PolishDoughnut::PolishDoughnut(const PolishDoughnut& orig) :
spectral_oversampling_(orig.spectral_oversampling_),
komissarov_(orig.komissarov_),
angle_averaged_(orig.angle_averaged_),
- nonthermal_(orig.nonthermal_),
deltaPL_(orig.deltaPL_),
expoPL_(orig.expoPL_),
adaf_(orig.adaf_),
@@ -181,7 +205,7 @@ void PolishDoughnut::lambda(double lam) {
GYOTO_ENDIF_DEBUG
}
double PolishDoughnut::centralDensity() const {return central_density_;}
-double PolishDoughnut::centralDensity(string unit) const {
+double PolishDoughnut::centralDensity(string const &unit) const {
double dens = centralDensity();
if (unit != "") {
# ifdef HAVE_UDUNITS
@@ -196,7 +220,7 @@ double PolishDoughnut::centralDensity(string unit) const {
void PolishDoughnut::centralDensity(double dens) {
central_density_=dens;
}
-void PolishDoughnut::centralDensity(double dens, string unit) {
+void PolishDoughnut::centralDensity(double dens, string const &unit) {
if (unit != "") {
# ifdef HAVE_UDUNITS
dens = Units::Converter(unit, "kg/L")(dens);
@@ -217,10 +241,56 @@ size_t PolishDoughnut::spectralOversampling() const
{ return spectral_oversampling_; }
void PolishDoughnut::spectralOversampling(size_t val)
{ spectral_oversampling_ = val; }
-bool PolishDoughnut::komissarov() const
-{return komissarov_;}
-void PolishDoughnut::komissarov(bool komis)
-{komissarov_=komis;}
+bool PolishDoughnut::changeCusp() const {return changecusp_;}
+void PolishDoughnut::changeCusp(bool t) {changecusp_=t;}
+bool PolishDoughnut::komissarov() const {return komissarov_;}
+void PolishDoughnut::komissarov(bool komis) {komissarov_=komis;}
+bool PolishDoughnut::angleAveraged() const
+{return angle_averaged_;}
+void PolishDoughnut::angleAveraged(bool komis)
+{angle_averaged_=komis; if (komis) komissarov(true); }
+void PolishDoughnut::nonThermalDeltaExpo(std::vector<double> const &v) {
+ if (v.size() != 2)
+ throwError("nonThermalDeltaExpo must have exactly 2 elements");
+ deltaPL_= v[0];
+ expoPL_ = v[1];
+}
+std::vector<double> PolishDoughnut::nonThermalDeltaExpo() const {
+ std::vector<double> v (2, deltaPL_);
+ v[1]=expoPL_;
+ return v;
+}
+
+void PolishDoughnut::adafparams(std::vector<double> const &v) {
+ if (v.size() != 2)
+ throwError("ADAF must have exactly 2 elements");
+ adaf(true);
+ ADAFtemperature_ = v[0];
+ ADAFdensity_ = v[1];
+}
+std::vector<double> PolishDoughnut::adafparams() const {
+ std::vector<double> v (2, ADAFtemperature_);
+ v[1]=ADAFdensity_;
+ return v;
+}
+
+void PolishDoughnut::adaf(bool t) {adaf_=t;}
+bool PolishDoughnut::adaf() const {return adaf_;}
+
+void PolishDoughnut::setParameter(Property const &p,
+ string const & name,
+ string const & content,
+ string const & unit) {
+ // Override default behaviour to support obsolete format where
+ // ADAFParameters was in ADAF
+ if (name=="ADAF") {
+ std::vector<double> v=FactoryMessenger::parseArray(content);
+ if (v.size()) adafparams(v);
+ return ;
+ }
+ Standard::setParameter(p, name, content, unit);
+}
+
PolishDoughnut::~PolishDoughnut() {
GYOTO_DEBUG << "PolishDoughnut Destruction" << endl;
if (gg_) gg_ -> unhook(this);
@@ -1148,7 +1218,7 @@ void PolishDoughnut::radiativeQ(double Inu[], // output
emissionSynchro_komissarov_direction(Theta_elec,number_density,
nuem,nuc,theta_mag);
abs_synch_ther=emis_synch_ther/Bnu;
- if (nonthermal_){
+ if (deltaPL_!=0.){
emis_synch_PL=
emissionSynchro_komissarov_PL_direction(number_density_PL,
nuem,nuc,theta_mag);
@@ -1161,7 +1231,7 @@ void PolishDoughnut::radiativeQ(double Inu[], // output
emissionSynchro_komissarov_averaged(Theta_elec,number_density,
nuem,nuc);
abs_synch_ther=emis_synch_ther/Bnu;
- if (nonthermal_){
+ if (deltaPL_!=0.){
emis_synch_PL=
emissionSynchro_komissarov_PL_averaged(number_density_PL,
nuem,nuc);
@@ -1402,52 +1472,3 @@ double PolishDoughnut::bessk(int nn,double xx) {
}
return bk;
}
-int PolishDoughnut::setParameter(string name, string content, string unit) {
- if (name=="Lambda") lambda(atof(content.c_str()));
- else if (name=="CentralDensity")
- centralDensity(atof(content.c_str()), unit);
- else if (name=="CentralTempOverVirial")
- centraltemp_over_virial_=atof(content.c_str());
- else if (name=="Beta") beta_=atof(content.c_str());
- else if (name=="SpectralOversampling")
- spectral_oversampling_=atoi(content.c_str());
- else if (name=="Komissarov") komissarov_=1;
- else if (name=="KomissarovAngleAveraged") {komissarov_=1;angle_averaged_=1;}
- else if (name=="NonThermalDeltaExpo") {nonthermal_=1;
- double parms[2];
- if (FactoryMessenger::parseArray(content, parms, 2) != 2)
- throwError("PolishDoughnut \"NonThermalDeltaExpo\" requires exactly 2 tokens");
- deltaPL_= parms[0];
- expoPL_ = parms[1];
- }
- else if (name=="ADAF") {adaf_ = 1;
- double parms[2];
- if (FactoryMessenger::parseArray(content, parms, 2) != 2)
- throwError("PolishDoughnut \"ADAF\" requires exactly 2 tokens");
- ADAFtemperature_ = parms[0];
- ADAFdensity_ = parms[1];
- }
- else if (name=="ChangeCusp") changecusp_=1;
- else return Standard::setParameter(name, content, unit);
- return 0;
-}
-#ifdef GYOTO_USE_XERCES
-void PolishDoughnut::fillElement(FactoryMessenger *fmp) const {
- fmp->setParameter("Lambda", lambda_);
- fmp->setParameter("CentralDensity", central_density_);
- fmp->setParameter("CentralTempOverVirial", centraltemp_over_virial_);
- fmp->setParameter("Beta", beta_);
- fmp->setParameter("SpectralOversampling", spectral_oversampling_);
- if (komissarov_) fmp->setParameter("Komissarov");
- if (angle_averaged_) fmp->setParameter("KomissarovAngleAveraged");
- if (nonthermal_){
- double param[2]={deltaPL_, expoPL_};
- fmp->setParameter("NonThermalDeltaExpo", param, 2);
- }
- if (adaf_){
- double param[2]={ADAFtemperature_, ADAFdensity_};
- fmp->setParameter("ADAF", param, 2);
- }
- Standard::fillElement(fmp);
-}
-#endif
diff --git a/lib/StarTrace.C b/lib/StarTrace.C
index d39e22c..8f81cf5 100644
--- a/lib/StarTrace.C
+++ b/lib/StarTrace.C
@@ -19,6 +19,7 @@
#include "GyotoUtils.h"
#include "GyotoStarTrace.h"
+#include "GyotoProperty.h"
#include "GyotoFactoryMessenger.h"
#include <iostream>
@@ -33,6 +34,11 @@ using namespace std;
using namespace Gyoto;
using namespace Gyoto::Astrobj;
+GYOTO_PROPERTY_START(StarTrace)
+GYOTO_PROPERTY_DOUBLE(StarTrace, TMin, TMin)
+GYOTO_PROPERTY_DOUBLE(StarTrace, TMax, TMax)
+GYOTO_PROPERTY_END(StarTrace, Star::properties)
+
StarTrace::StarTrace() : Star()
{
Generic::kind_="StarTrace";
@@ -172,22 +178,7 @@ void StarTrace::setInitialCondition(double coord[8]) {
Star::setInitialCondition(coord);
}
-int StarTrace::setParameter(string name, string content, string unit) {
- if (name=="TMin") tmin_=atof(content.c_str());
- else if (name=="TMax") tmax_=atof(content.c_str());
- else return Star::setParameter(name, content, unit);
- return 0;
-}
-
-#ifdef GYOTO_USE_XERCES
-void StarTrace::fillElement(FactoryMessenger *fmp) const {
- UniformSphere::fillElement(fmp);
- fmp->setParameter("TMin", tmin_);
- fmp->setParameter("TMax", tmax_);
-}
-#endif
-
-double StarTrace::TMin() { return tmin_; }
+double StarTrace::TMin() const { return tmin_; }
void StarTrace::TMin(double t)
{
if (t>tmax_) {
@@ -198,7 +189,7 @@ void StarTrace::TMin(double t)
GYOTO_DEBUG_EXPR(tmax_);
}
-double StarTrace::TMax() { return tmax_; }
+double StarTrace::TMax() const { return tmax_; }
void StarTrace::TMax(double t)
{
if (t<tmin_) {
diff --git a/lib/ThinDisk.C b/lib/ThinDisk.C
index cb02378..d3510e3 100644
--- a/lib/ThinDisk.C
+++ b/lib/ThinDisk.C
@@ -19,6 +19,7 @@
#include "GyotoPhoton.h"
#include "GyotoThinDisk.h"
+#include "GyotoProperty.h"
#include "GyotoUtils.h"
#include "GyotoFactoryMessenger.h"
@@ -36,6 +37,13 @@ using namespace std;
using namespace Gyoto;
using namespace Gyoto::Astrobj;
+GYOTO_PROPERTY_START(ThinDisk)
+GYOTO_PROPERTY_DOUBLE_UNIT(ThinDisk, InnerRadius, innerRadius)
+GYOTO_PROPERTY_DOUBLE_UNIT(ThinDisk, OuterRadius, outerRadius)
+GYOTO_PROPERTY_DOUBLE_UNIT(ThinDisk, Thickness, thickness)
+GYOTO_PROPERTY_BOOL(ThinDisk, CoRotating, CounterRotating, corotating)
+GYOTO_PROPERTY_END(ThinDisk, Generic::properties)
+
ThinDisk::ThinDisk(std::string kin) :
Generic(kin), rin_(0.), rout_(DBL_MAX), thickness_(1e-3), dir_(1)
{
@@ -55,36 +63,39 @@ ThinDisk::~ThinDisk() {
GYOTO_DEBUG << "ThinDisk Destruction" << endl;
}
-double ThinDisk::getInnerRadius() const { return rin_; }
-double ThinDisk::getInnerRadius(string unit) const {
- return Units::FromGeometrical(getInnerRadius(), unit, gg_);
+double ThinDisk::innerRadius() const { return rin_; }
+double ThinDisk::innerRadius(string const &unit) const {
+ return Units::FromGeometrical(innerRadius(), unit, gg_);
}
-void ThinDisk::setInnerRadius(double r) { rin_ = r; }
-void ThinDisk::setInnerRadius(double r, string unit) {
- setInnerRadius(Units::ToGeometrical(r, unit, gg_));
+void ThinDisk::innerRadius(double r) { rin_ = r; }
+void ThinDisk::innerRadius(double r, string const &unit) {
+ innerRadius(Units::ToGeometrical(r, unit, gg_));
}
-double ThinDisk::getOuterRadius() const { return rout_;}
-double ThinDisk::getOuterRadius(string unit) const {
- return Units::FromGeometrical(getOuterRadius(), unit, gg_);
+double ThinDisk::outerRadius() const { return rout_;}
+double ThinDisk::outerRadius(string const &unit) const {
+ return Units::FromGeometrical(outerRadius(), unit, gg_);
}
-void ThinDisk::setOuterRadius(double r) { rout_ = r; }
-void ThinDisk::setOuterRadius(double r, string unit) {
- setOuterRadius(Units::ToGeometrical(r, unit, gg_));
+void ThinDisk::outerRadius(double r) { rout_ = r; }
+void ThinDisk::outerRadius(double r, string const &unit) {
+ outerRadius(Units::ToGeometrical(r, unit, gg_));
}
-double ThinDisk::getThickness() const { return thickness_;}
-double ThinDisk::getThickness(string unit) const {
- return Units::FromGeometrical(getThickness(), unit, gg_);
+double ThinDisk::thickness() const { return thickness_;}
+double ThinDisk::thickness(string const &unit) const {
+ return Units::FromGeometrical(thickness(), unit, gg_);
}
-void ThinDisk::setThickness(double h) { thickness_ = h; }
-void ThinDisk::setThickness(double h, string unit) {
- setThickness(Units::ToGeometrical(h, unit, gg_));
+void ThinDisk::thickness(double h) { thickness_ = h; }
+void ThinDisk::thickness(double h, string const &unit) {
+ thickness(Units::ToGeometrical(h, unit, gg_));
}
-int ThinDisk::getDir() const { return dir_; }
-void ThinDisk::setDir(int dir) { dir_ = dir; }
+int ThinDisk::dir() const { return dir_; }
+void ThinDisk::dir(int dir) { dir_ = dir; }
+
+void ThinDisk::corotating(bool t) { dir_ = (t?1:-1);}
+bool ThinDisk::corotating() const { return dir_ == 1; }
double ThinDisk::operator()(double const coord[4]) {
double theta;
@@ -196,25 +207,3 @@ int ThinDisk::Impact(Photon *ph, size_t index,
return 1;
}
-
-int ThinDisk::setParameter(std::string name,
- std::string content,
- std::string unit) {
- char* tc = const_cast<char*>(content.c_str());
- if (name=="InnerRadius") setInnerRadius (atof(tc), unit);
- else if (name=="OuterRadius") setOuterRadius (atof(tc), unit);
- else if (name=="Thickness") setThickness (atof(tc), unit);
- else if (name=="CounterRotating") setDir (-1);
- else return Generic::setParameter(name, content, unit);
- return 0;
-}
-
-#ifdef GYOTO_USE_XERCES
-void ThinDisk::fillElement(FactoryMessenger *fmp) const {
- fmp->setParameter("InnerRadius", rin_);
- fmp->setParameter("OuterRadius", rout_);
- if (flag_radtransf_) fmp->setParameter("Thickness", thickness_);
- if (dir_==-1) fmp -> setParameter("CounterRotating");
- Generic::fillElement(fmp);
-}
-#endif
diff --git a/lib/ThinDiskIronLine.C b/lib/ThinDiskIronLine.C
index f5914ee..89e579e 100644
--- a/lib/ThinDiskIronLine.C
+++ b/lib/ThinDiskIronLine.C
@@ -18,6 +18,7 @@
*/
#include "GyotoThinDiskIronLine.h"
+#include "GyotoProperty.h"
#include <iostream>
#include <cmath>
@@ -28,6 +29,26 @@ using namespace Gyoto;
using namespace Gyoto::Astrobj;
using namespace std;
+GYOTO_PROPERTY_START(ThinDiskIronLine)
+GYOTO_PROPERTY_DOUBLE(ThinDiskIronLine, PowerLawIndex, PowerLawIndex)
+GYOTO_PROPERTY_DOUBLE(ThinDiskIronLine, LineFreq, LineFreq)
+GYOTO_PROPERTY_DOUBLE(ThinDiskIronLine, CutRadius, CutRadius)
+GYOTO_PROPERTY_END(ThinDiskIronLine, ThinDisk::properties)
+
+// ACCESSORS
+void ThinDiskIronLine::PowerLawIndex(double v) {plindex_=v;}
+double ThinDiskIronLine::PowerLawIndex()const{return plindex_;}
+#define ___local_f 1e3*1.60217657e-19/GYOTO_PLANCK;
+void ThinDiskIronLine::LineFreq(double v) {linefreq_=v*___local_f;}
+double ThinDiskIronLine::LineFreq()const{return linefreq_/___local_f;}
+#undef ___local_f
+void ThinDiskIronLine::CutRadius(double v) {cutradius_=v;}
+double ThinDiskIronLine::CutRadius()const{return cutradius_;}
+//
+
+
+
+
Gyoto::Astrobj::ThinDiskIronLine::ThinDiskIronLine()
: ThinDisk("ThinDiskIronLine"), plindex_(0.), linefreq_(0.),
cutradius_(-DBL_MAX)
@@ -79,38 +100,3 @@ void ThinDiskIronLine::getVelocity(double const pos[4], double vel[4]) {
}
-// to load from XML, we only need to implement this:
-int ThinDiskIronLine::setParameter(std::string name,
- std::string content,
- std::string unit) {
-
- char* tc = const_cast<char*>(content.c_str());
- if (name=="PowerLawIndex") {
- plindex_=atof(tc);
- }
- else if (name=="LineFreq") {
- double freq=atof(tc);
- linefreq_=freq*1e3*1.60217657e-19/GYOTO_PLANCK;
- }
- else if (name=="CutRadius") {
- cutradius_=atof(tc);
- }
- else return ThinDisk::setParameter(name, content, unit);
- return 0;
-}
-
-#ifdef GYOTO_USE_XERCES
-// to print/save XML (i.e. to prepare an XML from Yorick), we need this:
-void ThinDiskIronLine::fillElement(FactoryMessenger *fmp) const {
- GYOTO_SEVERE << "not fully implemented" << endl;
-// /* for instance:
-//
-// fmp -> setParameter("MyParameter", getMyParameter());
-//
-// Then call fillElement *on the direct parent*
-// */
- ThinDisk::fillElement(fmp);
-}
-#endif
-
-
diff --git a/lib/ThinDiskPL.C b/lib/ThinDiskPL.C
index 57d767f..6456707 100644
--- a/lib/ThinDiskPL.C
+++ b/lib/ThinDiskPL.C
@@ -19,6 +19,7 @@
#include "GyotoPhoton.h"
#include "GyotoThinDiskPL.h"
+#include "GyotoProperty.h"
#include "GyotoUtils.h"
#include "GyotoFactoryMessenger.h"
#include "GyotoKerrBL.h"
@@ -39,6 +40,21 @@ using namespace std;
using namespace Gyoto;
using namespace Gyoto::Astrobj;
+GYOTO_PROPERTY_START(ThinDiskPL)
+GYOTO_PROPERTY_DOUBLE(ThinDiskPL, PLSlope, PLSlope)
+GYOTO_PROPERTY_DOUBLE(ThinDiskPL, PLRho, PLRho)
+GYOTO_PROPERTY_DOUBLE(ThinDiskPL, PLRadRef, PLRadRef)
+GYOTO_PROPERTY_END(ThinDiskPL, ThinDisk::properties)
+
+// ACCESSORS
+void ThinDiskPL::PLSlope(double v) {PLSlope_=v;}
+double ThinDiskPL::PLSlope()const{return PLSlope_;}
+void ThinDiskPL::PLRho(double v) {PLRho_=v;}
+double ThinDiskPL::PLRho()const{return PLRho_;}
+void ThinDiskPL::PLRadRef(double v) {PLRadRef_=v;}
+double ThinDiskPL::PLRadRef()const{return PLRadRef_;}
+//
+
ThinDiskPL::ThinDiskPL() :
ThinDisk("ThinDiskPL"),
PLSlope_(0.), PLRho_(1.), PLRadRef_(1.),
@@ -102,23 +118,3 @@ double ThinDiskPL::emissionBB(double nu,
spectrumBB_->temperature(TT);
return (*spectrumBB_)(nu);
}
-
-int ThinDiskPL::setParameter(std::string name,
- std::string content,
- std::string unit) {
- if (name=="PLSlope") PLSlope_=atof(content.c_str());
- else if (name=="PLRho") PLRho_=atof(content.c_str());
- else if (name=="PLRadRef") PLRadRef_=atof(content.c_str());
- else return ThinDisk::setParameter(name, content, unit);
- return 0;
-}
-
-
-#ifdef GYOTO_USE_XERCES
-void ThinDiskPL::fillElement(FactoryMessenger *fmp) const {
- if (PLSlope_) fmp->setParameter("PLSlope", PLSlope_);
- if (PLRho_) fmp->setParameter("PLRho", PLRho_);
- if (PLRadRef_) fmp->setParameter("PLRadRef", PLRadRef_);
- ThinDisk::fillElement(fmp);
-}
-#endif
diff --git a/yorick/gyoto_ThinDisk.C b/yorick/gyoto_ThinDisk.C
index 5f0b6eb..9cea7be 100644
--- a/yorick/gyoto_ThinDisk.C
+++ b/yorick/gyoto_ThinDisk.C
@@ -93,9 +93,9 @@ ygyoto_ThinDisk_generic_eval(Gyoto::SmartPointer<Gyoto::Astrobj::Generic>*ao_,
iarg+=*rvset;
if (yarg_nil(iarg)) {
if ((*rvset)++) y_error(rmsg);
- ypush_double((*ao)->getInnerRadius(unit?unit:""));
+ ypush_double((*ao)->innerRadius(unit?unit:""));
} else
- (*ao)->setInnerRadius(ygets_d(iarg), unit?unit:"") ;
+ (*ao)->innerRadius(ygets_d(iarg), unit?unit:"") ;
}
/* OUTERRADIUS */
@@ -103,9 +103,9 @@ ygyoto_ThinDisk_generic_eval(Gyoto::SmartPointer<Gyoto::Astrobj::Generic>*ao_,
iarg+=*rvset;
if (yarg_nil(iarg)) {
if ((*rvset)++) y_error(rmsg);
- ypush_double((*ao)->getOuterRadius(unit?unit:""));
+ ypush_double((*ao)->outerRadius(unit?unit:""));
} else
- (*ao)->setOuterRadius(ygets_d(iarg), unit?unit:"") ;
+ (*ao)->outerRadius(ygets_d(iarg), unit?unit:"") ;
}
/* THICKNESS */
@@ -113,9 +113,9 @@ ygyoto_ThinDisk_generic_eval(Gyoto::SmartPointer<Gyoto::Astrobj::Generic>*ao_,
iarg+=*rvset;
if (yarg_nil(iarg)) {
if ((*rvset)++) y_error(rmsg);
- ypush_double((*ao)->getThickness(unit?unit:""));
+ ypush_double((*ao)->thickness(unit?unit:""));
} else
- (*ao)->setThickness(ygets_d(iarg), unit?unit:"") ;
+ (*ao)->thickness(ygets_d(iarg), unit?unit:"") ;
}
/* DIR */
@@ -123,9 +123,9 @@ ygyoto_ThinDisk_generic_eval(Gyoto::SmartPointer<Gyoto::Astrobj::Generic>*ao_,
iarg+=*rvset;
if (yarg_nil(iarg)) {
if ((*rvset)++) y_error(rmsg);
- ypush_long((*ao)->getDir());
+ ypush_long((*ao)->dir());
} else
- (*ao)->setDir(ygets_l(iarg)) ;
+ (*ao)->dir(ygets_l(iarg)) ;
}
GYOTO_DEBUG << "calling ygyoto_Astrobj_generic_eval\n";
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-astro/packages/gyoto.git
More information about the Debian-astro-commits
mailing list