8#ifndef model_LatticePlane_cpp_
9#define model_LatticePlane_cpp_
11#include <LatticeModule.h>
19 for (
int k = 0;
k < dim; ++
k)
37 if(r.squaredNorm()==0)
39 throw std::runtime_error(
"LatticePlaneKey::correct_h_sign: A zero normal cannot be used as valid GlidePlane normal.");
41 for (
int d = 0; d < dim; ++d)
43 const int sgnrd(
sgn(r(d)));
101 return array[dim + 1];
116 if(r.base().squaredNorm()==0)
118 throw std::runtime_error(
"LatticePlane::computeHeight: A zero normal cannot be used as valid GlidePlane normal");
120 const double hd(P.dot(r.cartesian()));
121 const long int h(std::lround(hd));
122 return std::make_pair(fabs(hd -
h) < FLT_EPSILON,
h);
129 if(r.base().squaredNorm()==0)
131 throw std::runtime_error(
"LatticePlane::computeHeight: A zero normal cannot be used as valid GlidePlane normal");
133 return std::make_pair(
true, L.
dot(r));
164 return planeIndex *
n.planeSpacing() *
n.cartesian().normalized();
long int dot(const ReciprocalLatticeVectorType &other) const
static std::pair< bool, long int > computeHeight(const ReciprocalLatticeDirection< dim > &r, const VectorDimD &P)
const LatticePlaneKey< dim >::LongIntType planeIndex
Eigen::Matrix< double, dim, 1 > VectorDimD
const LatticePlaneKey< dim > key
const ReciprocalLatticeDirection< dim > n
LatticePlane(const VectorDimD &P, const ReciprocalLatticeDirection< dim > &r)
VectorDimD planeOrigin() const
Eigen::Matrix< double, dim, 1 > VectorDimD
static int sgn(const LongIntType &val)
static ArrayType hr2array(const VectorDimI &r, const LongIntType &h, const LongIntType &latticeID)
bool operator<(const LatticePlaneKey< dim > &other) const
Eigen::Matrix< LongIntType, dim, 1 > VectorDimI
LatticePlaneKey(const VectorDimI &r, const LongIntType &h, const LongIntType &latticeID)
const LongIntType & latticeID() const
std::array< LongIntType, dim+2 > ArrayType
const LongIntType & planeIndex() const
static ArrayType correct_h_sign(VectorDimI r, LongIntType h, const LongIntType &latticeID)
VectorDimI reciprocalDirectionComponents() const