[Debian-astro-commits] [gyoto] 150/221: + Bugfix: fix Star::rMax() to not SIGFPE and to compute the right thing. + Bugfix: v=Worldine::initCoord(): make sure v[4] is 0 if initial coordinate was not set.

Thibaut Jean-Claude Paumard thibaut at moszumanska.debian.org
Fri May 22 20:52:42 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 24a436d4ed82043a588489aab75da41416df1041
Author: Thibaut Paumard <paumard at users.sourceforge.net>
Date:   Mon Dec 15 15:22:25 2014 +0100

    + Bugfix: fix Star::rMax() to not SIGFPE and to compute the right thing.
    + Bugfix: v=Worldine::initCoord(): make sure v[4] is 0 if initial coordinate was not set.
---
 lib/Star.C      | 14 ++++++++++++--
 lib/Worldline.C |  2 +-
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/lib/Star.C b/lib/Star.C
index 0c6934b..90d6b49 100644
--- a/lib/Star.C
+++ b/lib/Star.C
@@ -180,10 +180,20 @@ void Star::getCartesian(double const * const t,
 
 
 double Star::rMax() {
-  if (rmax_==DBL_MAX) {
+  if (rmax_==DBL_MAX && i0_>=imin_ && i0_<=imax_) {
     size_t i;
-    for (i=imin_;i<=imax_;++i) if (x1_[i]>rmax_) rmax_=x1_[i];
+    rmax_=x1_[i0_];
+    int ck=gg_->coordKind();
+    for (i=imin_;i<=imax_;++i) {
+      if (x1_[i]>rmax_) rmax_=x1_[i];
+      if (ck==GYOTO_COORDKIND_CARTESIAN) {
+	if (x2_[i]>rmax_) rmax_=x2_[i];
+	if (x3_[i]>rmax_) rmax_=x3_[i];
+      }
+    }
     rmax_ *= 3.;
   }
   return rmax_;
 }
+  
+  
diff --git a/lib/Worldline.C b/lib/Worldline.C
index 1494343..f97b30d 100644
--- a/lib/Worldline.C
+++ b/lib/Worldline.C
@@ -311,7 +311,7 @@ std::vector<double> Worldline::initCoord() const {
   coord[1] = x1_[i0_];
   coord[2] = x2_[i0_];
   coord[3] = x3_[i0_];
-  coord[4] = x0dot_[i0_];
+  coord[4] = (i0_<=imax_ && imin_<=i0_)?x0dot_[i0_]:0.;
   coord[5] = x1dot_[i0_];
   coord[6] = x2dot_[i0_];
   coord[7] = x3dot_[i0_];

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