7#ifndef gbLAB_ReciprocalLatticeVector_cpp_
8#define gbLAB_ReciprocalLatticeVector_cpp_
10#include "../../include/Lattices/LatticeModule.h"
48 assert(&lattice == &other.
lattice &&
"ReciprocalLatticeVector<dim> belong to different Lattices.");
49 base() = other.
base();
56 assert(&lattice == &other.lattice &&
"LatticeVectors belong to different Lattices.");
57 base() = other.base();
64 assert(&lattice == &other.
lattice &&
"LatticeVectors belong to different Lattices.");
72 assert(&lattice == &other.
lattice &&
"LatticeVectors belong to different Lattices.");
73 base() += other.
base();
80 assert(&lattice == &other.
lattice &&
"LatticeVectors belong to different Lattices.");
88 assert(&lattice == &other.
lattice &&
"LatticeVectors belong to different Lattices.");
89 base() -= other.
base();
103 assert(&lattice == &other.
lattice &&
"LatticeVectors belong to different Lattices.");
110 assert(&lattice == &other.
lattice &&
"LatticeVectors belong to different Lattices.");
119 return lattice.reciprocalBasis * this->
template cast<double>();
126 assert(this->squaredNorm() > 0 &&
"A null ReciprocalLatticeVector cannot be used to compute planeIndexOfPoint");
127 const double hd(cartesian().dot(P));
128 return std::lround(hd);
134 assert(this->squaredNorm() > 0 &&
"A null ReciprocalLatticeVector cannot be used to compute planeIndexOfPoint");
135 const double hd(cartesian().dot(P));
137 if (fabs(hd - h) > FLT_EPSILON)
139 std::cout <<
"P=" << P.transpose() << std::endl;
140 std::cout <<
"r=" << this->cartesian().transpose() << std::endl;
141 std::cout <<
"hd=" << std::setprecision(15) << std::scientific << hd << std::endl;
142 std::cout <<
"h=" << h << std::endl;
143 assert(0 &&
"P in not on a lattice plane.");
151 assert(this->squaredNorm() > 0 &&
"A null ReciprocalLatticeVector cannot be used to compute planeIndexOfPoint");
168 template<
int dim>
template<
int dm>
169 typename std::enable_if<dm==2,LatticeDirection<dim>>::type
172 assert(&lattice == &other.
lattice &&
"LatticeVectors belong to different Lattices.");
177 template<
int dim>
template<
int dm>
178 typename std::enable_if<dm==2,LatticeDirection<dim>>::type
184 template<
int dim>
template<
int dm>
185 typename std::enable_if<dm==3,LatticeDirection<dim>>::type
188 assert(&lattice == &other.
lattice &&
"LatticeVectors belong to different Lattices.");
191 template<
int dim>
template<
int dm>
192 typename std::enable_if<dm==3,LatticeDirection<dim>>::type
194 return LatticeDirection<dm>(
195 LatticeVector<dm>((VectorDimI() << -(*
this)(1), (*
this)(0), 0).finished(), lattice));
198template class ReciprocalLatticeVector<1>;
const Lattice< dim > & lattice
LatticeCore< dim >::VectorDimI VectorDimI
IntScalarType closestPlaneIndexOfPoint(const VectorDimD &P) const
LatticeCore< dim >::VectorDimD VectorDimD
ReciprocalLatticeVector< dim > & operator+=(const ReciprocalLatticeVector< dim > &other)
ReciprocalLatticeVector< dim > operator*(const IntScalarType &scalar) const
ReciprocalLatticeVector< dim > operator-(const ReciprocalLatticeVector< dim > &other) const
ReciprocalLatticeVector< dim > operator+(const ReciprocalLatticeVector< dim > &other) const
std::enable_if< dm==2, LatticeDirection< dim > >::type cross() const
const Lattice< dim > & lattice
IntScalarType dot(const LatticeVector< dim > &other) const
ReciprocalLatticeVector< dim > & operator-=(const ReciprocalLatticeVector< dim > &other)
VectorDimD cartesian() const
IntScalarType planeIndexOfPoint(const VectorDimD &P) const
ReciprocalLatticeVector< dim > & operator=(const ReciprocalLatticeVector< dim > &other)
Eigen::Matrix< typename LatticeCore< dim >::IntScalarType, dim, 1 > BaseType
ReciprocalLatticeVector(const Lattice< dim > &lat)
LatticeCore< dim >::IntScalarType IntScalarType
LatticeVector< dim > operator*(const typename LatticeVector< dim >::IntScalarType &scalar, const LatticeVector< dim > &L)
const LatticeVector< dim > & latticeVector() const