7#ifndef gbLAB_ReciprocalLatticeVector_cpp_
8#define gbLAB_ReciprocalLatticeVector_cpp_
49 assert(&lattice == &other.
lattice &&
"ReciprocalLatticeVector<dim> belong to different Lattices.");
50 base() = other.
base();
57 assert(&lattice == &other.lattice &&
"LatticeVectors belong to different Lattices.");
58 base() = other.base();
65 assert(&lattice == &other.
lattice &&
"LatticeVectors belong to different Lattices.");
73 assert(&lattice == &other.
lattice &&
"LatticeVectors belong to different Lattices.");
74 base() += other.
base();
81 assert(&lattice == &other.
lattice &&
"LatticeVectors belong to different Lattices.");
89 assert(&lattice == &other.
lattice &&
"LatticeVectors belong to different Lattices.");
90 base() -= other.
base();
104 assert(&lattice == &other.
lattice &&
"LatticeVectors belong to different Lattices.");
111 assert(&lattice == &other.
lattice &&
"LatticeVectors belong to different Lattices.");
120 return lattice.reciprocalBasis * this->
template cast<double>();
127 assert(this->squaredNorm() > 0 &&
"A null ReciprocalLatticeVector cannot be used to compute planeIndexOfPoint");
128 const double hd(cartesian().dot(P));
129 return std::lround(hd);
135 assert(this->squaredNorm() > 0 &&
"A null ReciprocalLatticeVector cannot be used to compute planeIndexOfPoint");
136 const double hd(cartesian().dot(P));
138 if (fabs(hd - h) > FLT_EPSILON)
140 std::cout <<
"P=" << P.transpose() << std::endl;
141 std::cout <<
"r=" << this->cartesian().transpose() << std::endl;
142 std::cout <<
"hd=" << std::setprecision(15) << std::scientific << hd << std::endl;
143 std::cout <<
"h=" << h << std::endl;
144 assert(0 &&
"P in not on a lattice plane.");
152 assert(this->squaredNorm() > 0 &&
"A null ReciprocalLatticeVector cannot be used to compute planeIndexOfPoint");
169 template<
int dim>
template<
int dm>
170 typename std::enable_if<dm==2,LatticeDirection<dim>>::type
173 assert(&lattice == &other.
lattice &&
"LatticeVectors belong to different Lattices.");
178 template<
int dim>
template<
int dm>
179 typename std::enable_if<dm==2,LatticeDirection<dim>>::type
185 template<
int dim>
template<
int dm>
186 typename std::enable_if<dm==3,LatticeDirection<dim>>::type
189 assert(&lattice == &other.
lattice &&
"LatticeVectors belong to different Lattices.");
192 template<
int dim>
template<
int dm>
193 typename std::enable_if<dm==3,LatticeDirection<dim>>::type
195 return LatticeDirection<dm>(
196 LatticeVector<dm>((VectorDimI() << -(*
this)(1), (*
this)(0), 0).finished(), lattice));
199template class ReciprocalLatticeVector<1>;
const Lattice< dim > & lattice
LatticeCore< dim >::VectorDimD VectorDimD
LatticeCore< dim >::VectorDimI VectorDimI
IntScalarType dot(const LatticeVector< dim > &other) const
IntScalarType closestPlaneIndexOfPoint(const VectorDimD &P) const
VectorDimD cartesian() const
ReciprocalLatticeVector< dim > & operator=(const ReciprocalLatticeVector< dim > &other)
std::enable_if< dm==2, LatticeDirection< dim > >::type cross() const
IntScalarType planeIndexOfPoint(const VectorDimD &P) const
ReciprocalLatticeVector< dim > & operator+=(const ReciprocalLatticeVector< dim > &other)
ReciprocalLatticeVector(const Lattice< dim > &lat)
LatticeCore< dim >::IntScalarType IntScalarType
const Lattice< dim > & lattice
Eigen::Matrix< typename LatticeCore< dim >::IntScalarType, dim, 1 > BaseType
ReciprocalLatticeVector< dim > operator-(const ReciprocalLatticeVector< dim > &other) const
ReciprocalLatticeVector< dim > & operator-=(const ReciprocalLatticeVector< dim > &other)
ReciprocalLatticeVector< dim > operator+(const ReciprocalLatticeVector< dim > &other) const
ReciprocalLatticeVector< dim > operator*(const IntScalarType &scalar) const
LatticeVector< dim > operator*(const typename LatticeVector< dim >::IntScalarType &scalar, const LatticeVector< dim > &L)
const LatticeVector< dim > & latticeVector() const