diff options
Diffstat (limited to 'src/nuc_eos_cxx/nuc_eos_press.cc')
-rw-r--r-- | src/nuc_eos_cxx/nuc_eos_press.cc | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/nuc_eos_cxx/nuc_eos_press.cc b/src/nuc_eos_cxx/nuc_eos_press.cc index 215adf8..13b0558 100644 --- a/src/nuc_eos_cxx/nuc_eos_press.cc +++ b/src/nuc_eos_cxx/nuc_eos_press.cc @@ -7,7 +7,7 @@ namespace nuc_eos { extern "C" -void CCTK_FNAME(nuc_eos_m_kt1_press_eps)(const int *restrict n, +void CCTK_FNAME(nuc_eos_m_kt1_press_eps)(const int *restrict n_in, const double *restrict rho, const double *restrict temp, const double *restrict ye, @@ -19,8 +19,10 @@ void CCTK_FNAME(nuc_eos_m_kt1_press_eps)(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) { @@ -29,7 +31,7 @@ void CCTK_FNAME(nuc_eos_m_kt1_press_eps)(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]); @@ -49,7 +51,7 @@ void CCTK_FNAME(nuc_eos_m_kt1_press_eps)(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; } @@ -59,7 +61,7 @@ void CCTK_FNAME(nuc_eos_m_kt1_press_eps)(const int *restrict n, } extern "C" -void CCTK_FNAME(nuc_eos_m_kt0_press)(const int *restrict n, +void CCTK_FNAME(nuc_eos_m_kt0_press)(const int *restrict n_in, const double *restrict rho, double *restrict temp, const double *restrict ye, @@ -72,9 +74,11 @@ void CCTK_FNAME(nuc_eos_m_kt0_press)(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 @@ -90,7 +94,7 @@ void CCTK_FNAME(nuc_eos_m_kt0_press)(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; @@ -148,7 +152,7 @@ void CCTK_FNAME(nuc_eos_m_kt0_press)(const int *restrict n, } // loop i<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]); } |