[Debian-astro-commits] [gyoto] 139/221: ThinDiskIronLine: Fix bug in LineFreq conversion, support unit in LineFreq and CutRadius

Thibaut Jean-Claude Paumard thibaut at moszumanska.debian.org
Fri May 22 20:52:41 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 fb57a49ada9b85019e08a18623d76d237e28b276
Author: Thibaut Paumard <paumard at users.sourceforge.net>
Date:   Wed Dec 10 16:43:18 2014 +0100

    ThinDiskIronLine: Fix bug in LineFreq conversion, support unit in LineFreq and CutRadius
---
 include/GyotoThinDiskIronLine.h | 14 ++++++++------
 lib/ThinDiskIronLine.C          | 33 ++++++++++++++++++++++++---------
 2 files changed, 32 insertions(+), 15 deletions(-)

diff --git a/include/GyotoThinDiskIronLine.h b/include/GyotoThinDiskIronLine.h
index af3db07..91f29d9 100644
--- a/include/GyotoThinDiskIronLine.h
+++ b/include/GyotoThinDiskIronLine.h
@@ -28,13 +28,15 @@ class Gyoto::Astrobj::ThinDiskIronLine
 			  double c_ph[8], double c_obj[8]) const;
   void getVelocity(double const pos[4], double vel[4]);
 
-  void PowerLawIndex(double v);
-  double PowerLawIndex()const;
 
-  void LineFreq(double v);
-  double LineFreq()const;
+  // standard pairs of accessors
+  GYOTO_OBJECT_ACCESSORS(double, PowerLawIndex);
+  GYOTO_OBJECT_ACCESSORS(double, LineFreq);
+  void LineFreq(double v, std::string const &u);
+  double LineFreq(std::string const &u)const;
+  GYOTO_OBJECT_ACCESSORS(double, CutRadius);
+  void CutRadius(double v, std::string const &u);
+  double CutRadius(std::string const &u)const;
 
-  void CutRadius(double v);
-  double CutRadius()const;
 };
 #endif
diff --git a/lib/ThinDiskIronLine.C b/lib/ThinDiskIronLine.C
index 89e579e..fc493fe 100644
--- a/lib/ThinDiskIronLine.C
+++ b/lib/ThinDiskIronLine.C
@@ -18,7 +18,7 @@
 */
 
 #include "GyotoThinDiskIronLine.h"
-#include "GyotoProperty.h"
+#include "GyotoConverters.h"
 
 #include <iostream>
 #include <cmath>
@@ -29,22 +29,37 @@ using namespace Gyoto;
 using namespace Gyoto::Astrobj;
 using namespace std;
 
+/// Properties
+#include "GyotoProperty.h"
 GYOTO_PROPERTY_START(ThinDiskIronLine)
 GYOTO_PROPERTY_DOUBLE(ThinDiskIronLine, PowerLawIndex, PowerLawIndex)
-GYOTO_PROPERTY_DOUBLE(ThinDiskIronLine, LineFreq, LineFreq)
-GYOTO_PROPERTY_DOUBLE(ThinDiskIronLine, CutRadius, CutRadius)
+GYOTO_PROPERTY_DOUBLE_UNIT(ThinDiskIronLine, LineFreq, LineFreq)
+GYOTO_PROPERTY_DOUBLE_UNIT(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;
+GYOTO_PROPERTY_ACCESSORS(ThinDiskIronLine, double, plindex_, PowerLawIndex)
+GYOTO_PROPERTY_ACCESSORS(ThinDiskIronLine, double, cutradius_, CutRadius)
+// Define the accessors with unit manually
+void ThinDiskIronLine::CutRadius(double v, std::string const &u) {
+  CutRadius(Units::ToGeometrical(v, u, gg_));
+}
+double ThinDiskIronLine::CutRadius(std::string const &u)const{
+  return Units::FromGeometrical(CutRadius(), u, gg_);
+}
+
+// The following is not completely standard, let's implement it manually:
+#define ___local_f 2.417989579752276e+17 //(1e3*1.60217657e-19/GYOTO_PLANCK);
 void ThinDiskIronLine::LineFreq(double v) {linefreq_=v*___local_f;}
 double ThinDiskIronLine::LineFreq()const{return linefreq_/___local_f;}
+void ThinDiskIronLine::LineFreq(double v, std::string const &u) {
+  LineFreq(Units::ToHerz(v, u));
+}
+double ThinDiskIronLine::LineFreq(std::string const &u)const{
+  return Units::FromHerz(LineFreq(), u);
+}
 #undef ___local_f
-void ThinDiskIronLine::CutRadius(double v) {cutradius_=v;}
-double ThinDiskIronLine::CutRadius()const{return cutradius_;}
-//
+///
 
 
 

-- 
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