//#####################################################################
// Copyright 2012.
// This file is part of PhysBAM whose distribution is governed by the license contained in the accompanying file PHYSBAM_COPYRIGHT.txt.
//#####################################################################
#ifndef __ANALYTIC_PROGRAM_HELPER__
#define __ANALYTIC_PROGRAM_HELPER__

#include <Core/Arrays/ARRAY.h>
#include <Core/Arrays/ARRAY_VIEW.h>
#include <Core/Symbolics/PROGRAM.h>
#include <Core/Symbolics/PROGRAM_CONTEXT.h>
#include <string>

namespace PhysBAM{
template<class T>
struct ANALYTIC_PROGRAM_HELPER
{
    PROGRAM<T> prog,prog_dt,prog_dx,prog_ddx;
    mutable PROGRAM_CONTEXT<T> context,context_dt,context_dx,context_ddx;
    ARRAY<MEM_OUT> idx_f,idx_dt,idx_dx,idx_ddx;
    int dim;

    ANALYTIC_PROGRAM_HELPER(const std::string& str,const std::string& out_name,
        int dim,int m,int n,bool want_ddx);
    void f(ARRAY_VIEW<const T> X,T t) const;
    void dt(ARRAY_VIEW<const T> X,T t) const;
    void dX(ARRAY_VIEW<const T> X,T t) const;
    void ddX(ARRAY_VIEW<const T> X,T t) const;
};
}
#endif
