Skip to content

File ghostshunter.h

File List > algebra > helpers > ghostshunter.h

Go to the documentation of this file

#ifndef TEMPLAT_LATTICE_ALGEBRA_HELPERS_GHOSTSHUNTER_H
#define TEMPLAT_LATTICE_ALGEBRA_HELPERS_GHOSTSHUNTER_H

/* This file is part of TempLat, available at https://cosmolattice.github.io/templat .
   Copyright 2021-2026 The TempLat authors, see AUTHORS.md.
   Released under the MIT license, see LICENSE.md. */

// File info: Main contributor(s): Adrien Florio, Year: 2019

#include "TempLat/lattice/algebra/helpers/hasdoweneedghosts.h"

namespace TempLat
{
  class GhostsHunter
  {
  public:
    template <typename U>
      requires HasDoWeNeedGhostsMethod<U>
    static void apply(U &obj)
    {
      obj.doWeNeedGhosts();
    }

    template <typename U>
      requires(!HasDoWeNeedGhostsMethod<U>)
    static void apply(U &obj)
    {
    }

    // Put public methods here. These should change very little over time.
    template <int N, typename U>
      requires HasDoWeNeedGhostsMethodIndexed<N, U>
    static void apply(U &obj, Tag<N> i)
    {
      obj.doWeNeedGhosts(i);
    }

    template <int N, typename U>
      requires(!HasDoWeNeedGhostsMethodIndexed<N, U>)
    static void apply(U &obj, Tag<N> i)
    {
    }

    // Put public methods here. These should change very little over time.
    template <typename U>
      requires HasDoWeNeedGhostsMethodIndexedDyn<U>
    static void apply(U &obj, device::Idx i)
    {
      obj.doWeNeedGhosts(i);
    }

    template <typename U>
      requires(!HasDoWeNeedGhostsMethodIndexedDyn<U>)
    static void apply(U &obj, device::Idx i)
    {
    }

  private:
    /* Put all member variables and private methods here. These may change arbitrarily. */
    GhostsHunter() = default;
  };
} // namespace TempLat

#endif