// // CDDL HEADER START // // The contents of this file are subject to the terms of the Common Development // and Distribution License Version 1.0 (the "License"). // // You can obtain a copy of the license at // http://www.opensource.org/licenses/CDDL-1.0. See the License for the // specific language governing permissions and limitations under the License. // // When distributing Covered Code, include this CDDL HEADER in each file and // include the License file in a prominent location with the name LICENSE.CDDL. // If applicable, add the following below this CDDL HEADER, with the fields // enclosed by brackets "[]" replaced with your own identifying information: // // Portions Copyright (c) [yyyy] [name of copyright owner]. All rights reserved. // // CDDL HEADER END // // // Copyright (c) 2014, Regents of the University of Minnesota. // All rights reserved. // // Contributors: // Ryan S. Elliott // Mingjian Wen // #include "EAM_Implementation.hpp" #include "EAM_QuinticClampedSpline.hpp" //****************************************************************************** void EAM_Implementation::SplineInterpolate(double const* const dat, double const delta, int const n, double* const coe) { // setup convenient pointers (spline) into the coefficients (coe) array double** const spline = new double*[n]; // deleted at end of function for (int i = 0; i < n; ++i) { spline[i] = &coe[i * NUMBER_SPLINE_COEFF]; } // B.C.s end first and second derivatives four point finite difference spline[0][F_LINEAR] =(-11*dat[0]+18*dat[1]-9*dat[2]+2*dat[3])/6; spline[0][F_QUADRATIC] =(2*dat[0]-5*dat[1]+4*dat[2]-dat[3])/2; spline[n-1][F_LINEAR] =(-2*dat[n-4]+9*dat[n-3]-18*dat[n-2]+11*dat[n-1])/6; spline[n-1][F_QUADRATIC] =(-dat[n-4]+4*dat[n-3]-5*dat[n-2]+2*dat[n-1])/2; //local variables double * a =new double [2*(n-2)]; double * b =new double [2*(n-2)]; double * c =new double [2*(n-2)]; double * d =new double [2*(n-2)]; double * e =new double [2*(n-2)]; double * f =new double [2*(n-2)]; double * g =new double [2*(n-2)]; double * h =new double [2*(n-2)]; double * xn=new double [2*(n-2)]; double xmult; // put the matrix values into the variables for (int i=0; i=0;--i) { xn[i]=(h[i]-e[i]*xn[i+1]-f[i]*xn[i+2]-g[i]*xn[i+3])/d[i]; } // put the coefficinets into coe for (int i=1; i