#ifndef BSPLINES_AND_GRID_H #define BSPLINES_AND_GRID_H // coordinates in Bohr radii #define GRID_START_POINT 0.0 #define GRID_END_POINT 30.0 #define GRID_NUM_STEPS 300 typedef struct Grid Grid; struct Grid { F64 start; F64 end; U32 num_steps; F64 *points; }; typedef struct BSplineCtx BSplineCtx; struct BSplineCtx { Arena* arena; U32 order; F64 *knotpoints; U32 num_knotpoints; U32 num_bsplines; U32 num_phys_points; F64 *bsplines_grid; // In grid points F64 *dBsplines_grid; // First deriv in grid points F64 *bsplines; // In knotpoints F64 *dBsplines; // First deriv in knotpoints }; function void set_up_grid(Arena *arena); //~ Bspline functions function F64 bspline_recursion(F64 x, U32 k, U32 i); function F64 compute_bspline_F64(F64 x_coord, U32 index); function F64 compute_dBspline_F64(F64 x_coord, U32 index); function inline U32 get_bspline_index_size(U32 size1, U32 i, U32 j); function inline U32 get_bspline_index(U32 i, U32 j); function inline U32 get_bspline_grid_index(U32 i, U32 j); function void set_up_bspline_context(Arena* arena); function void write_bspline_matrix_F64(F64 *bsplines, U32 size1, U32 size2, String8 filename_path); function void set_up_bsplines_at_points_and_write_matrix_F64(Arena *arena); #endif /* BSPLINES_AND_GRID_H */