Skip to content

File latticeparameters.h

File List > code_source > templat > include > TempLat > lattice > latticeparameters.h

Go to the documentation of this file

#ifndef TEMPLAT_LATTICE_LATTICEPARAMETERS_H
#define TEMPLAT_LATTICE_LATTICEPARAMETERS_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/util/constants.h"
#include "TempLat/util/exception.h"
#include "TempLat/util/almostequal.h"

namespace TempLat
{

  MakeException(LatticeParametersInconsistent);

  template <typename T> struct LatticeParameters {
  public:
    // Put public methods here. These should change very little over time.
    LatticeParameters(T pDx, T pLSide, T pKIR) : dx(pDx), lSide(pLSide), kIR(pKIR)
    {
      if (!AlmostEqual(kIR, 2 * Constants::pi<T> / lSide))
        throw(LatticeParametersInconsistent("kIR = " + std::to_string(kIR) + " and lSide = " + std::to_string(lSide) +
                                            " are not consistent. "));
    }

    LatticeParameters() : dx(1), lSide(1), kIR(1) {}

    T getDx() const { return dx; }
    T getKIR() const { return kIR; }
    T getLSide() const { return lSide; }

  private:
    T dx, lSide, kIR;
    /* Put all member variables and private methods here. These may change arbitrarily. */
  };
} // namespace TempLat

#endif