Skip to content

File complexfieldunaryoperator.h

File List > algebra > complexalgebra > complexfieldunaryoperator.h

Go to the documentation of this file

#ifndef TEMPLAT_LATTICE_ALGEBRA_COMPLEXALGEBRA_COMPLEXFIELDUNARYOPERATOR_H
#define TEMPLAT_LATTICE_ALGEBRA_COMPLEXALGEBRA_COMPLEXFIELDUNARYOPERATOR_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, Franz R. Sattler, Year: 2025

#include "TempLat/lattice/algebra/complexalgebra/helpers/complexfieldget.h"
#include "TempLat/util/containsspace.h"
#include "TempLat/lattice/algebra/helpers/getstring.h"
#include "TempLat/lattice/algebra/helpers/getdx.h"
#include "TempLat/lattice/algebra/helpers/getndim.h"
#include "TempLat/lattice/algebra/helpers/getkir.h"
#include "TempLat/lattice/algebra/helpers/doeval.h"

#include "TempLat/lattice/algebra/helpers/preget.h"
#include "TempLat/lattice/algebra/helpers/postget.h"

namespace TempLat
{
  template <typename R> class ComplexFieldUnaryOperator
  {
  public:
    // Put public methods here. These should change very little over time.
    ComplexFieldUnaryOperator(const R &pR) : mR(pR) {}

    static consteval size_t getNDim() { return GetNDim::get<R>(); }

    virtual std::string operatorString() const { return " "; }

    std::string toString() const
    {
      std::string result = GetString::get(mR);

      if (ContainsSpace::test(result)) result = "(" + result + ")";

      return operatorString() + result;
    }

    auto getDx() const { return GetDx::getDx(mR); }
    auto getKIR() const { return GetKIR::getKIR(mR); }

    void preGet() { PreGet::apply(mR); }
    void postGet() { PostGet::apply(mR); }

    static constexpr size_t size = 2;
    using Getter = ComplexFieldGetter;

  protected:
    /* Put all member variables and private methods here. These may change arbitrarily. */

    R mR;
  };

} // namespace TempLat

#endif