initial_state_spline.cpp 589 B

1234567891011121314151617181920212223242526
  1. #include "initial_state_spline.hpp"
  2. void
  3. InitialStateSpline::update(Spline* _Ssat){
  4. Ssat=_Ssat;
  5. if(hsat!=nullptr){
  6. delete[] hsat;
  7. for(size_t i=0;i<geometry_spline->nX;++i){
  8. delete[] Pinit[i];
  9. }
  10. delete[] Pinit;
  11. }
  12. size_t nX=geometry_spline->nX;
  13. hsat=new double[nX];
  14. Pinit=new double*[nX];
  15. for(size_t i=0;i<nX;++i){
  16. size_t nZ=geometry_spline->nZ[i];
  17. Pinit[i]=new double[nZ];
  18. }
  19. for(size_t i=0;i<geometry_spline->nX;++i){
  20. double x=double(i)/(geometry_spline->nX-1);
  21. hsat[i]=(*Ssat)(x)*geometry_spline->factor;
  22. }
  23. updatePressure();
  24. }