Skip to content

File symtracelessunaryoperator.h

File List > algebra > matrix3x3algebra > symtracelessunaryoperator.h

Go to the documentation of this file

#ifndef TEMPLAT_LATTICE_ALGEBRA_MATRIX3X3ALGEBRA_SYMTRACELESSUNARYOPERATOR_H
#define TEMPLAT_LATTICE_ALGEBRA_MATRIX3X3ALGEBRA_SYMTRACELESSUNARYOPERATOR_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): Jorge Baeza-Ballesteros, Year: 2026

#include "TempLat/lattice/algebra/matrix3x3algebra/helpers/symtracelessget.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 SymTracelessUnaryOperator
  {
  public:
    // Put public methods here. These should change very little over time.
    SymTracelessUnaryOperator(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 = 5;
    using Getter = SymTracelessGetter;

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

    R mR;
  };

} // namespace TempLat

#endif