//#####################################################################
// Copyright 2003-2007, Ron Fedkiw, Geoffrey Irving, Igor Neverov, Eftychios Sifakis, Joseph Teran.
// This file is part of PhysBAM whose distribution is governed by the license contained in the accompanying file PHYSBAM_COPYRIGHT.txt.
//#####################################################################
// Class GENERAL_CONSTITUTIVE_MODEL_PROGRAM
//#####################################################################
#ifndef __GENERAL_CONSTITUTIVE_MODEL_PROGRAM__
#define __GENERAL_CONSTITUTIVE_MODEL_PROGRAM__

#include <Core/Symbolics/PROGRAM.h>
#include <Core/Symbolics/PROGRAM_CONTEXT.h>
#include <Deformables/Constitutive_Models/GENERAL_CONSTITUTIVE_MODEL.h>
namespace PhysBAM{

template<class T,int d>
class GENERAL_CONSTITUTIVE_MODEL_PROGRAM:public GENERAL_CONSTITUTIVE_MODEL<T,d>
{
    typedef VECTOR<T,d> TV;
public:
    typedef GENERAL_CONSTITUTIVE_MODEL<T,d> BASE;
    PROGRAM<T> prog_psi,prog_P,prog_dP_dF;
    mutable PROGRAM_CONTEXT<T> context_psi,context_P,context_dP_dF;

    GENERAL_CONSTITUTIVE_MODEL_PROGRAM(const std::string& code,bool want_dP_dF);
    virtual ~GENERAL_CONSTITUTIVE_MODEL_PROGRAM();

    virtual MATRIX<T,d> Stress(const MATRIX<T,d>& F) const override;
    virtual T Energy_Density(const MATRIX<T,d>& F) const override;
    virtual void Stress_Derivative(const MATRIX<T,d>& F,GENERAL_STRESS_DERIVATIVE<TV>& dP_dF) const override;
//#####################################################################
};
}
#endif
