//#####################################################################
// Copyright 2004-2009, Ronald Fedkiw, Geoffrey Irving, Nipun Kwatra, Michael Lentine, Andrew Selle, Tamar Shinar, 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 MPM_PARTICLES
//#####################################################################
#ifndef __MPM_PARTICLES__
#define __MPM_PARTICLES__

#include <Core/Arrays/ARRAY.h>
#include <Core/Matrices/MATRIX.h>
#include <Core/Particles/PARTICLES.h>
#include <Core/Tensors/SYMMETRIC_TENSOR.h>
#include <Deformables/Particles/DEFORMABLE_PARTICLES.h>
#include <Hybrid_Methods/Regions/REGION_ID.h>

namespace PhysBAM{

template<class TV>
class MPM_PARTICLES:public DEFORMABLE_PARTICLES<TV>
{
    typedef typename TV::SCALAR T;
    typedef DEFORMABLE_PARTICLES<TV> BASE;
public:
    using BASE::Add_Array;using BASE::Remove_Array;

    bool store_Fp=false,store_C=false,store_S=false,store_H=false;
    bool store_lame=false,store_lame0=false;
    bool store_plastic_def=false,store_region=false;
    ARRAY_VIEW<T> volume;
    ARRAY_VIEW<MATRIX<T,TV::m> > F,Fp,C;
    ARRAY_VIEW<SYMMETRIC_MATRIX<T,TV::m> > S;
    ARRAY_VIEW<SYMMETRIC_TENSOR<T,0,TV::m,TV::m> > H;
    ARRAY_VIEW<bool> valid;
    ARRAY_VIEW<T> mu,lambda,mu0,lambda0;
    ARRAY_VIEW<int> region;
    ARRAY_VIEW<VECTOR<T,3> > color;

    MPM_PARTICLES();
    virtual ~MPM_PARTICLES();
    void Store_Fp(bool store);
    void Store_C(bool store);
    void Store_H(bool store);
    void Store_S(bool store);
    void Store_Lame(bool store);
    void Store_Lame0(bool store);
    void Store_Region(bool store);
    REGION_ID Region(int p) const {return REGION_ID(region(p));}

//#####################################################################
};
}
#endif
