[Debian-astro-commits] [gyoto] 23/221: Allow fixed star to be "rotating", i.e. velocity is given by Metric::circularVelocity()

Thibaut Jean-Claude Paumard thibaut at moszumanska.debian.org
Fri May 22 20:52:30 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 64d65a086a1238557e68b8fff0b595d5062ed538
Author: Thibaut Paumard <paumard at users.sourceforge.net>
Date:   Thu Oct 9 21:20:37 2014 +0200

    Allow fixed star to be "rotating", i.e. velocity is given by Metric::circularVelocity()
---
 include/GyotoFixedStar.h         |  7 ++++++-
 lib/FixedStar.C                  | 21 ++++++++++++++++-----
 yorick/stdplug/gyoto_FixedStar.C |  5 +++--
 3 files changed, 25 insertions(+), 8 deletions(-)

diff --git a/include/GyotoFixedStar.h b/include/GyotoFixedStar.h
index f90a7dc..6a1262b 100644
--- a/include/GyotoFixedStar.h
+++ b/include/GyotoFixedStar.h
@@ -54,7 +54,8 @@ class Gyoto::Astrobj::FixedStar : public Astrobj::UniformSphere {
  protected:
   
   double pos_[3];///< x, y, z or r, theta, phi
-  
+  bool rotating_; ///< Whether the blob is rotating at Metric::circularVelocity()
+
   // Constructors - Destructor
   // -------------------------
  public:
@@ -79,6 +80,10 @@ class Gyoto::Astrobj::FixedStar : public Astrobj::UniformSphere {
  public:
   double const * getPos() const; ///< Get const pointer to pos_
   void getPos(double* dst) const; ///< Get a copy of the pos_ array
+
+  bool rotating() const ;
+  void rotating(bool) ;
+
   using Generic::metric;
   virtual void metric(SmartPointer<Metric::Generic> metric) ;
   using UniformSphere::radius;
diff --git a/lib/FixedStar.C b/lib/FixedStar.C
index d55d1a3..82ec0e0 100644
--- a/lib/FixedStar.C
+++ b/lib/FixedStar.C
@@ -37,7 +37,7 @@ using namespace std;
 using namespace Gyoto;
 using namespace Gyoto::Astrobj;
 
-FixedStar::FixedStar() : UniformSphere("FixedStar")
+FixedStar::FixedStar() : UniformSphere("FixedStar"), rotating_(false)
 {
 # if GYOTO_DEBUG_ENABLED
   GYOTO_DEBUG << endl;
@@ -47,7 +47,7 @@ FixedStar::FixedStar() : UniformSphere("FixedStar")
 
 FixedStar::FixedStar(SmartPointer<Gyoto::Metric::Generic> gg, double StPsn[3],
 		     double rad) :
-  UniformSphere("FixedStar", gg, rad)
+  UniformSphere("FixedStar", gg, rad), rotating_(false)
 {
 # if GYOTO_DEBUG_ENABLED
   GYOTO_DEBUG << "(metric, pos, rad)" << endl;
@@ -60,7 +60,7 @@ FixedStar::FixedStar(SmartPointer<Gyoto::Metric::Generic> gg, double StPsn[3],
 }
 
 FixedStar::FixedStar(const FixedStar& orig) :
-  UniformSphere(orig)
+  UniformSphere(orig), rotating_(orig.rotating_)
 {
   for (int i=0; i<3; ++i) pos_[i] = orig.pos_[i];
 }
@@ -112,10 +112,16 @@ void FixedStar::getCartesian(double const * const , size_t const n_dates,
 }
 
 void FixedStar::getVelocity(double const pos[4], double vel[4]) {
-  for (size_t i=0; i<4; ++i) vel[i]=0.;
-  vel[0]=gg_->SysPrimeToTdot(pos, vel+1);
+  if (rotating_) gg_->circularVelocity(pos, vel);
+  else {
+    for (size_t i=0; i<4; ++i) vel[i]=0.;
+    vel[0]=gg_->SysPrimeToTdot(pos, vel+1);
+  }
 }
 
+void FixedStar::rotating(bool rot) {rotating_=rot;}
+bool FixedStar::rotating() const { return rotating_; }
+
 double const * FixedStar::getPos() const { return pos_; }
 
 void FixedStar::getPos(double dst[3]) const
@@ -163,6 +169,10 @@ int FixedStar::setParameter(string name, string content, string unit) {
     double pos[3];
     for (int i=0;i<3;++i) pos[i] = strtod(tc, &tc);
     setPos(pos);
+  } else if (name=="Rotating") {
+    rotating(true);
+  } else if (name=="NonRotating") {
+    rotating(false);
   } else return UniformSphere::setParameter(name, content, unit);
   return 0;
 }
@@ -170,6 +180,7 @@ int FixedStar::setParameter(string name, string content, string unit) {
 #ifdef GYOTO_USE_XERCES
 void FixedStar::fillElement(FactoryMessenger *fmp) const {
   fmp -> setParameter ("Position", const_cast<double*>(pos_), 3);
+  fmp -> setParameter (rotating_?"Rotating":"NonRotating");
   UniformSphere::fillElement(fmp);
 }
 #endif
diff --git a/yorick/stdplug/gyoto_FixedStar.C b/yorick/stdplug/gyoto_FixedStar.C
index f87be8a..54a76bf 100644
--- a/yorick/stdplug/gyoto_FixedStar.C
+++ b/yorick/stdplug/gyoto_FixedStar.C
@@ -34,17 +34,18 @@ using namespace Gyoto::Astrobj;
 void ygyoto_FixedStar_eval(SmartPointer<Astrobj::Generic>* ao_, int argc) {
 
   static char const * knames[]={
-    "unit", "radius", "position", "spectrum", "opacity", 
+    "unit", "radius", "position", "rotating", "spectrum", "opacity", 
     "deltamaxoverradius", "deltamaxoverdistance",
     YGYOTO_ASTROBJ_GENERIC_KW,
     0
   };
 
-  YGYOTO_WORKER_INIT(Astrobj, FixedStar, knames, YGYOTO_ASTROBJ_GENERIC_KW_N+7);
+  YGYOTO_WORKER_INIT(Astrobj, FixedStar, knames, YGYOTO_ASTROBJ_GENERIC_KW_N+8);
 
   YGYOTO_WORKER_SET_UNIT;
   YGYOTO_WORKER_GETSET_DOUBLE2_UNIT(radius);
   YGYOTO_WORKER_GETSET_VECTOR(Pos, 3);
+  YGYOTO_WORKER_GETSET_LONG2(rotating);
   YGYOTO_WORKER_GETSET_OBJECT2(spectrum,Spectrum);
   YGYOTO_WORKER_GETSET_OBJECT2(opacity,Spectrum);
   YGYOTO_WORKER_GETSET_DOUBLE2(deltaMaxOverRadius);

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