diff options
Diffstat (limited to 'src/nuc_eos_cxx/nuc_eos_short.cc')
-rw-r--r-- | src/nuc_eos_cxx/nuc_eos_short.cc | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/src/nuc_eos_cxx/nuc_eos_short.cc b/src/nuc_eos_cxx/nuc_eos_short.cc index fbdf5d0..06e66d8 100644 --- a/src/nuc_eos_cxx/nuc_eos_short.cc +++ b/src/nuc_eos_cxx/nuc_eos_short.cc @@ -7,7 +7,7 @@ namespace nuc_eos { extern "C" -void CCTK_FNAME(nuc_eos_m_kt1_short)(const int *restrict n, +void CCTK_FNAME(nuc_eos_m_kt1_short)(const int *restrict n_in, const double *restrict rho, const double *restrict temp, const double *restrict ye, @@ -25,8 +25,10 @@ void CCTK_FNAME(nuc_eos_m_kt1_short)(const int *restrict n, using namespace nuc_eos; + const int n = *n_in; + *anyerr = 0; - for(int i=0;i<*n;i++) { + for(int i=0;i<n;i++) { // check if we are fine keyerr[i] = checkbounds(rho[i], temp[i], ye[i]); if(keyerr[i] != 0) { @@ -35,7 +37,7 @@ void CCTK_FNAME(nuc_eos_m_kt1_short)(const int *restrict n, } } - for(int i=0;i<*n;i++) { + for(int i=0;i<n;i++) { int idx[8]; double delx,dely,delz; @@ -84,7 +86,7 @@ void CCTK_FNAME(nuc_eos_m_kt1_short)(const int *restrict n, } } - for(int i=0;i<*n;i++) { + for(int i=0;i<n;i++) { prs[i] = exp(prs[i]); eps[i] = exp(eps[i]) - energy_shift; #if HAVEGR @@ -96,7 +98,7 @@ void CCTK_FNAME(nuc_eos_m_kt1_short)(const int *restrict n, } extern "C" - void CCTK_FNAME(nuc_eos_m_kt0_short)(const int *restrict n, + void CCTK_FNAME(nuc_eos_m_kt0_short)(const int *restrict n_in, const double *restrict rho, double *restrict temp, const double *restrict ye, @@ -115,9 +117,11 @@ extern "C" using namespace nuc_eos; + const int n = *n_in; + *anyerr = 0; - for(int i=0;i<*n;i++) { + for(int i=0;i<n;i++) { // check if we are fine // Note that this code now requires that the @@ -133,7 +137,7 @@ extern "C" // a fatal error anyway. No point in doing any further EOS calculations. if(*anyerr) return; - for(int i=0;i<*n;i++) { + for(int i=0;i<n;i++) { const double lr = log(rho[i]); const double lt = log(MIN(MAX(temp[i],eos_tempmin),eos_tempmax)); double ltout; @@ -198,7 +202,7 @@ extern "C" } } - for(int i=0;i<*n;i++) { + for(int i=0;i<n;i++) { prs[i] = exp(prs[i]); #if HAVEGR cs2[i] = cs2[i] / (1.0 + eps[i] + prs[i]/rho[i]); @@ -209,7 +213,7 @@ extern "C" } extern "C" - void CCTK_FNAME(nuc_eos_m_kt2_short)(const int *restrict n, + void CCTK_FNAME(nuc_eos_m_kt2_short)(const int *restrict n_in, const double *restrict rho, double *restrict temp, const double *restrict ye, @@ -228,9 +232,11 @@ extern "C" using namespace nuc_eos; + const int n = *n_in; + *anyerr = 0; - for(int i=0;i<*n;i++) { + for(int i=0;i<n;i++) { // check if we are fine // Note that this code now requires that the // temperature guess be within the table bounds @@ -245,7 +251,7 @@ extern "C" // a fatal error anyway. No point in doing any further EOS calculations. if(*anyerr) return; - for(int i=0;i<*n;i++) { + for(int i=0;i<n;i++) { const double lr = log(rho[i]); const double lt = log(MIN(MAX(temp[i],eos_tempmin),eos_tempmax)); double ltout; @@ -295,7 +301,7 @@ extern "C" } } - for(int i=0;i<*n;i++) { + for(int i=0;i<n;i++) { prs[i] = exp(prs[i]); eps[i] = exp(eps[i]) - energy_shift; #if HAVEGR |