7#ifndef model_RationalLatticeDirection_cpp_
8#define model_RationalLatticeDirection_cpp_
10#include <LatticeModule.h>
11#include <RationalLatticeDirection.h>
43 return dir.cartesian() * rat.asDouble();
50 return rat * dir.dot(other);
71 assert(&dir.lattice == &other.
dir.lattice &&
"ReciprocalLatticeVectorType belong to different Lattices.");
82 assert(&dir.lattice == &other.dir.lattice &&
"ReciprocalLatticeVectorType belong to different Lattices.");
83 const VectorDimI
temp(rat.n * other.rat.d * dir - other.rat.n * rat.d * other.dir);
85 const LatticeVector<dim>
v(
temp / gcd, dir.lattice);
86 return RationalLatticeDirection<dim>(Rational(gcd, rat.d * other.rat.d), LatticeDirection<dim>(
v));
93 assert(&dir.lattice == &other.lattice &&
"ReciprocalLatticeVectorType belong to different Lattices.");
102 assert(&dir.lattice == &other.lattice &&
"ReciprocalLatticeVectorType belong to different Lattices.");
111 return dir.squaredNorm() * std::pow(rat.asDouble(), 2);
120 template struct RationalLatticeDirection<1>;
auto operator+(const std::shared_ptr< T1 > &x, const std::shared_ptr< T2 > &y)
auto operator*(const std::shared_ptr< BilinearForm< T1, T2 > > &f, const IntegrationDomain< FE, D, Q, Rule > &dom)
auto operator-(const std::shared_ptr< T1 > &x, const std::shared_ptr< T2 > &y)
static IntScalarType gcd(const IntScalarType &a, const IntScalarType &b)
Eigen::Matrix< double, dim, 1 > VectorDimD
RationalLatticeDirection< dim > operator-(const RationalLatticeDirection< dim > &other) const
Rational dot(const ReciprocalLatticeVector< dim > &other) const
RationalLatticeDirection< dim > operator+(const RationalLatticeDirection< dim > &other) const
RationalLatticeDirection< dim > operator*(const long int &scalar) const
LatticeCore< dim >::IntScalarType IntScalarType
VectorDimD cartesian() const
double squaredNorm() const
const LatticeDirection< dim > dir
RationalLatticeDirection< dim > operator/(const long int &scalar) const
RationalLatticeDirection(const Rational &_rat, const LatticeDirection< dim > &_dir)