File spacestateinterface.h
File List > algebra > spacestateinterface.h
Go to the documentation of this file
#ifndef TEMPLAT_LATTICE_ALGEBRA_SPACESTATEINTERFACE_H
#define TEMPLAT_LATTICE_ALGEBRA_SPACESTATEINTERFACE_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 <string>
#include "TempLat/lattice/memory/memorylayouts/layoutstruct.h"
#include "TempLat/lattice/memory/memorytoolbox.h"
#include "TempLat/lattice/algebra/helpers/gettoolbox.h"
namespace TempLat
{
enum class SpaceStateType { Configuration, Fourier, undefined };
template <size_t NDim> class SpaceStateInterface
{
public:
// Put public methods here. These should change very little over time.
virtual void confirmSpace(const LayoutStruct<NDim> &newLayout, const SpaceStateType &spaceType) = 0;
// virtual
// device::Idx confirmGhostsUpToDate(FieldShiftedViewDetection detector) = 0;
virtual inline device::memory::host_ptr<MemoryToolBox<3>> getToolBox() = 0;
static inline std::string SpaceTypeString(SpaceStateType st)
{
std::string result;
switch (st) {
case SpaceStateType::Configuration:
result = "configuration space";
break;
case SpaceStateType::Fourier:
result = "fourier space";
break;
default:
case SpaceStateType::undefined:
result = "undefined space type";
break;
}
return result;
}
static inline std::string SpaceTypetoCanonicalCharacter(SpaceStateType st)
{
std::string result;
switch (st) {
case SpaceStateType::Configuration:
result = "x";
break;
case SpaceStateType::Fourier:
result = "k";
break;
default:
case SpaceStateType::undefined:
result = "[x or k]";
break;
}
return result;
}
private:
/* Put all member variables and private methods here. These may change arbitrarily. */
};
template <size_t NDim> inline std::ostream &operator<<(std::ostream &ostream, SpaceStateType st)
{
ostream << "SpaceType::" + SpaceStateInterface<NDim>::SpaceTypeString(st);
return ostream;
}
} // namespace TempLat
#endif