void GeneralisedCoordinatesFromStorageFile::updateKinematicsSplines(double fc) {

        //reinitialise because I modify the storage with padding and filtering..
        OpenSim::Storage kinematics(kinematicsStorageFilename_);
        if (fc > 0) {
            kinematics.pad(kinematics.getSize() / 2.);
            kinematics.lowpassIIR(fc);
        }
        if (kinematics.isInDegrees()){
            model_.getSimbodyEngine().convertDegreesToRadians(kinematics);
        }
        // Create differentiable splines of the coordinate data
        OpenSim::GCVSplineSet kinematicsSplines(5, &kinematics);
        //Functions must correspond to model coordinates and their order for the solver
        OpenSim::Array<string> coordinateNamesOS;
        model_.getCoordinateSet().getNames(coordinateNamesOS);
        for (size_t i(0); i < coordinateNamesOS.getSize(); ++i){
            if (kinematicsSplines.contains(coordinateNamesOS.get(i))){
                kinematicsSplines.insert(i, kinematicsSplines.get(coordinateNamesOS.get(i)));
            }
            else{
                kinematicsSplines.insert(i, OpenSim::Constant(model_.getCoordinateSet().get(i).getDefaultValue()));
            }
        }
        if (kinematicsSplines.getSize() > coordinateNamesOS.getSize()){
            kinematicsSplines.setSize(coordinateNamesOS.getSize());
        }
        splines_ = kinematicsSplines;
    }
/**
 * Set the list of muscles to analyze.
 *
 * @param aMuscles is the array of names of muscles to analyze.
 */
void MuscleAnalysis::setMuscles(OpenSim::Array<std::string>& aMuscles)
{
    int size = aMuscles.getSize();
    _muscleListProp.getValueStrArray().setSize(aMuscles.getSize());
    for(int i=0; i<size; i++){
        _muscleListProp.getValueStrArray().updElt(i) = aMuscles.get(i);
    }
}
void PrescribedForce::setForceFunctionNames
   (const OpenSim::Array<std::string>& aFunctionNames, 
    const Storage& kineticsStore)  
{
    FunctionSet& forceFunctions = updForceFunctions();

    int forceSize = kineticsStore.getSize();
    if(forceSize<=0) return;
    double *t=0;
    // Expected column labels for the file
    kineticsStore.getTimeColumn(t);
    double *column=0;
    SimmSpline** tSpline = new SimmSpline*[3];
    for(int i=0;i<aFunctionNames.getSize();i++)
    {
        kineticsStore.getDataColumn(aFunctionNames[i], column);
        tSpline[i]= new SimmSpline((forceSize>10?10:forceSize), t, column, aFunctionNames[i]);
    }
    setForceFunctions(tSpline[0], tSpline[1], tSpline[2]);
    for (int i=0; i<aFunctionNames.getSize();i++)
        forceFunctions[i].setName(aFunctionNames.get(i));
}