Add a lagrange file wrapper for the particles system
We should be able to use lagrange or spline as interpolator for the particles.
Merge request reports
Activity
the "deriv" may be used in the future for the splines. what you call "mode" is smoothness, (I wanted to have n for neighbours and m for smoothness), and it is used --- we actually used it in the scaling workshop. In any case, "deriv" will never be used for Lagrange, and "smoothness" is irrelevant for Lagrange. Hence I think the easiest solution is to generalize the interpolation thus: if "m" is 0, use Lagrange for the given number of points, if it's bigger than 0 use the corresponding spline. I realize that I defined splines with m=0, but they are all equivalent, and equivalent to Lagrange with 0 neighbours. I can give more details later this afternoon.
Yes, I know what it is, but I would like to know if I should consider that smoothness will be used for Lagrange (so it looks like smoothness is not and will not be used for Lagrange). You wrote
"deriv" will never be used for Lagrange
, but it is used right?void beta_Lagrange_n7(int deriv, double x, double *poly_val){ switch(deriv) { case 0:
Thanks.
You're right, deriv can be used with the Lagrange polynomials, but I did it that way so that the function prototypes would be the same. I don't plan on using the "deriv" parameter with Lagrange interpolation for actual work. Since I had to put it there, I did make it usable, in the sense that I can do pathological tests where I do differentiate the Lagrange polynomials, just to show why that is wrong.
And yes, smoothness is irrelevant for Lagrange (hence my suggestion with the 0).
So, if we look to the builder prototype:
inline std::unique_ptr<abstract_particles_system<partsize_t, particles_rnumber>> particles_system_builder( const field<field_rnumber, be, THREE>* fs_field, // (field object) const kspace<be, SMOOTH>* fs_kk, // (kspace object, contains dkx, dky, dkz) const int nsteps, // to check coherency between parameters and hdf input file (nb rhs) const partsize_t nparticles, // to check coherency between parameters and hdf input file const std::string& fname_input, // particles input filename const std::string& inDatanameState, const std::string& inDatanameRhs, // input dataset names const int interpolation_size, const int spline_mode, MPI_Comm mpi_comm, const int in_current_iteration){
What you have in mind, is that
spline_mode
will actually be used to select between Lagrange and Spline? (if 0 => Lagrange, else Spline where smoothness = spline_mode-1 , such that Spline with smoothness = 0 is never used?).added 1 commit
- 15cc4028 - Update interpolator wrapper to redirect to Lagrange or Spline
Ok therefore, I made it simple but it should work.
However, you will find:
void compute_beta(const int in_derivative, const double in_part_val, double poly_val[]) const { // TODO use beta_Lagrange_n10(in_derivative, in_part_val, poly_val); beta_n10_m0(in_derivative, in_part_val, poly_val); }
That should be updated once Lagrange is available for 9 and 10.
mentioned in commit 83592d8f