Skip to content

File getderiv.h

File List > algebra > helpers > getderiv.h

Go to the documentation of this file

#ifndef TEMPLAT_LATTICE_ALGEBRA_HELPERS_GETDERIV_H
#define TEMPLAT_LATTICE_ALGEBRA_HELPERS_GETDERIV_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): Wessel Valkenburg, Year: 2019

#include "TempLat/lattice/algebra/helpers/hasderivmethod.h"
#include "TempLat/lattice/algebra/constants/zerotype.h"

namespace TempLat
{
  class GetDeriv
  {
  public:
    // Put public methods here. These should change very little over time.
    template <typename U, typename T>
      requires HasDerivMethod<U>
    static inline auto get(U &obj, T &other)
    {
      return obj.d(other);
    }

    template <typename U, typename T>
      requires(!HasDerivMethod<U>)
    static inline auto get(U &obj, T &other)
    {
      return ZeroType();
    }

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

#endif