Mechanics of Defect Evolution Library
Loading...
Searching...
No Matches
Lattices/RationalLatticeDirection.cpp
Go to the documentation of this file.
1/* This file is part of PIL, the Particle Interaction Library.
2 *
3 *
4 * MODEL is distributed without any warranty under the
5 * GNU General Public License (GPL) v2 <http://www.gnu.org/licenses/>.
6 */
7
8#ifndef model_RationalLatticeDirection_cpp_
9#define model_RationalLatticeDirection_cpp_
10
11#include <LatticeModule.h>
12#include <RationalLatticeDirection.h>
13
14namespace model
15{
16
17 template <int dim>
19 /* init */ rat(_rat)
20 /* init */,dir(_dir)
21 {
22 }
23
24 template <int dim>
29
30 template <int dim>
32 /* init */ rat(Rational(LatticeGCD<dim>::gcd(v.base()), 1))
33 /* init */,dir(v)
34 {
35 }
37 template <int dim>
39 {
40 return dir.cartesian() * rat.asDouble();
41 }
42
43 template <int dim>
45 {
46 return rat * dir.dot(other);
47 }
48
49 template <int dim>
54
55 template <int dim>
60
61 template <int dim>
63 {
64 assert(&dir.lattice == &other.dir.lattice && "ReciprocalLatticeVectorType belong to different Lattices.");
65 const VectorDimI temp((rat.n * other.rat.d * dir + other.rat.n * rat.d * other.dir).base());
66 const long int gcd(LatticeGCD<dim>::gcd(temp));
67 const LatticeVector<dim> v((temp / gcd).eval(), dir.lattice);
69 }
70
71 template <int dim>
73 {
74 assert(&dir.lattice == &other.dir.lattice && "ReciprocalLatticeVectorType belong to different Lattices.");
75 const VectorDimI temp((rat.n * other.rat.d * dir - other.rat.n * rat.d * other.dir).base());
76 const long int gcd(LatticeGCD<dim>::gcd(temp));
77 const LatticeVector<dim> v((temp / gcd).eval(), dir.lattice);
79 }
80
81 template <int dim>
83 {
84 assert(&dir.lattice == &other.lattice && "ReciprocalLatticeVectorType belong to different Lattices.");
85 const long int gcd(LatticeGCD<dim>::gcd(other.base()));
87 }
88
89 template <int dim>
91 {
92 assert(&dir.lattice == &other.lattice && "ReciprocalLatticeVectorType belong to different Lattices.");
93 const long int gcd(LatticeGCD<dim>::gcd(other.base()));
95 }
96
97 template <int dim>
99 {
100 return dir.base().squaredNorm() * std::pow(rat.asDouble(), 2);
101 }
102
103 template<int dim>
105 {
106 return L*scalar;
107 }
108
109 template struct RationalLatticeDirection<3>;
110 template RationalLatticeDirection<3> operator*(const long int& scalar, const RationalLatticeDirection<3>& L);
111
112} // end namespace
113#endif
const LatticeType & lattice
long int d
Definition Rational.h:28
long int n
Definition Rational.h:27
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 eval(const std::shared_ptr< T > &t)
auto operator-(const std::shared_ptr< T1 > &x, const std::shared_ptr< T2 > &y)
static long int gcd(const long int &a, const long int &b)
Eigen::Matrix< long int, dim, 1 > VectorDimI
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
RationalLatticeDirection< dim > operator/(const long int &scalar) const
RationalLatticeDirection(const Rational &_rat, const LatticeDirection< dim > &_dir)
vertex temp
REAL v[4]