[yt-svn] commit/yt: ngoldbaum: Merged in MatthewTurk/yt (pull request #1979)
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Wed Feb 3 09:10:45 PST 2016
1 new commit in yt:
https://bitbucket.org/yt_analysis/yt/commits/07b81a8cb3eb/
Changeset: 07b81a8cb3eb
Branch: yt
User: ngoldbaum
Date: 2016-02-03 17:10:32+00:00
Summary: Merged in MatthewTurk/yt (pull request #1979)
Fix ARTIO table look ups
Affected #: 1 file
diff -r 187f84cc044157da920460ec8423f13d74659652 -r 07b81a8cb3eb2dbb24d4ba988539b760b784872d yt/frontends/artio/artio_headers/cosmology.c
--- a/yt/frontends/artio/artio_headers/cosmology.c
+++ b/yt/frontends/artio/artio_headers/cosmology.c
@@ -443,9 +443,18 @@
double cosmology_get_value_from_table(CosmologyParameters *c, double a, double table[])
{
- int idx = (int)(c->ndex*(log10(a)-c->la[0]));
+ // This is special case code for boundary conditions
+ double la = log10(a);
+ if (fabs(la - c->la[c->size-1]) < 1.0e-14) {
+ return table[c->size-1];
+ } else if (fabs(la - c->la[0]) < 1.0e-14) {
+ return table[0];
+ }
- ASSERT(idx>=0 && idx<c->size);
+ int idx = (int)(c->ndex*(la-c->la[0]));
+
+ // Note that because we do idx+1 below, we need -1 here.
+ ASSERT(idx>=0 && (idx<c->size-1));
/*
// Do it as a function of aUni rather than la to ensure exact inversion
Repository URL: https://bitbucket.org/yt_analysis/yt/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the yt-svn
mailing list