//#####################################################################
// Copyright 2002-2004, Zhaosheng Bao.
// This file is part of PhysBAM whose distribution is governed by the license contained in the accompanying file PHYSBAM_COPYRIGHT.txt.
//#####################################################################
// Class MESH_HIERARCHY
//##################################################################### 
#ifndef __MESH_HIERARCHY__
#define __MESH_HIERARCHY__

#include <Core/Geometry_Particles/GEOMETRY_PARTICLES.h>
#include <Core/Meshes/MESHES_FORWARD.h>
#include <Core/Spatial_Acceleration/BOX_HIERARCHY.h>
namespace PhysBAM{

template<class TV,class T_MESH>
class MESH_HIERARCHY:public BOX_HIERARCHY<TV>
{
    typedef typename TV::SCALAR T;
public:
    typedef BOX_HIERARCHY<TV> BASE;
    using BASE::Compute;

    const T_MESH& mesh;
    const GEOMETRY_PARTICLES<TV>& particles;

    MESH_HIERARCHY(const T_MESH& mesh,const GEOMETRY_PARTICLES<TV>& particles)
        :mesh(mesh),particles(particles)
    {
        Compute(true);
    }

    ~MESH_HIERARCHY() = default;

    void Compute(bool update_order)
    {Compute(particles.X,update_order);}
    void Compute(ARRAY_VIEW<const TV> X,bool update_order);
    void Compute(ARRAY_VIEW<const TV> X,ARRAY_VIEW<const TV> Y,bool update_order);
//#####################################################################
};   
}
#endif

