Remove from THE CODE error class, output class, move enclosed classes out, remove variabilities in function callings, change all enum's to strings. In that case, probably, the code can be understood.
globalScope> Member F_cap (double x, double y, double b, double s, double epsilon, DxxParameters_structure DxxParameters)
Function is never called anywhere. Most likely replaced by F_cap2. Should be removed.
globalScope> Member free_matrix (T ***m, int size_x, int size_y)
Member Matrix1D< T >::Spline (Matrix1D< T > &old_function, Matrix1D< T > &old_grid, Matrix1D< T > &new_grid, double lb, double ub, double lin_spline_coef=0, double max_second_der=0)
Check the index of the last argument of the spline interpolation.
Literally the only difference between KC version and original version is calling one custom method MakeModelMatrix_3D_KC. Find a way to compress two functions together.