diff options
Diffstat (limited to 'src/nuc_eos_cxx/nuc_eos_press_cs2.cc')
-rw-r--r-- | src/nuc_eos_cxx/nuc_eos_press_cs2.cc | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/nuc_eos_cxx/nuc_eos_press_cs2.cc b/src/nuc_eos_cxx/nuc_eos_press_cs2.cc index 5a47ba2..08ab8c2 100644 --- a/src/nuc_eos_cxx/nuc_eos_press_cs2.cc +++ b/src/nuc_eos_cxx/nuc_eos_press_cs2.cc @@ -7,7 +7,7 @@ namespace nuc_eos { extern "C" -void CCTK_FNAME(nuc_eos_m_kt1_press_eps_cs2)(const int *restrict n, +void CCTK_FNAME(nuc_eos_m_kt1_press_eps_cs2)(const int *restrict n_in, const double *restrict rho, const double *restrict temp, const double *restrict ye, @@ -20,8 +20,10 @@ void CCTK_FNAME(nuc_eos_m_kt1_press_eps_cs2)(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) { @@ -30,7 +32,7 @@ void CCTK_FNAME(nuc_eos_m_kt1_press_eps_cs2)(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; const double xrho = log(rho[i]); @@ -53,7 +55,7 @@ void CCTK_FNAME(nuc_eos_m_kt1_press_eps_cs2)(const int *restrict n, } // now get rid of ln: - 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 @@ -66,7 +68,7 @@ void CCTK_FNAME(nuc_eos_m_kt1_press_eps_cs2)(const int *restrict n, } extern "C" -void CCTK_FNAME(nuc_eos_m_kt0_press_cs2)(const int *restrict n, +void CCTK_FNAME(nuc_eos_m_kt0_press_cs2)(const int *restrict n_in, const double *restrict rho, double *restrict temp, const double *restrict ye, @@ -80,14 +82,16 @@ void CCTK_FNAME(nuc_eos_m_kt0_press_cs2)(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 // Note that this code now requires that the // temperature guess be within the table bounds - keyerr[i] = checkbounds_kt0_noTcheck(rho[i], ye[i]);; + keyerr[i] = checkbounds_kt0_noTcheck(rho[i], ye[i]); if(keyerr[i] != 0) { *anyerr = 1; } @@ -99,7 +103,7 @@ void CCTK_FNAME(nuc_eos_m_kt0_press_cs2)(const int *restrict n, if(*anyerr) return; // first must find the temperature - 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; @@ -164,7 +168,7 @@ void CCTK_FNAME(nuc_eos_m_kt0_press_cs2)(const int *restrict n, } // now get rid of ln: - 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]); |