Mechanics of Defect Evolution Library
Loading...
Searching...
No Matches
Lattices/LatticeDirection.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_LatticeDirection_cpp_
9#define model_LatticeDirection_cpp_
10
11#include <LatticeModule.h>
12namespace model
13{
14
15 template <int dim>
20
21 template <int dim>
23 /* base init */ LatticeVectorType(((v.squaredNorm()==0)? v : (v/LatticeGCD<dim>::gcd(v)).eval()),lat)
24 {
25
26 }
27
28 template <int dim>
33
34 template <int dim>
36 {
40 const VectorDimD dc(this->cartesian());
41 return LatticeVectorType((round(dP.dot(dc) / dc.squaredNorm()) * dc).eval(),
42 this->lattice);
43 }
44
45 template <int dim>
47 {
48 VectorDimD dc(this->cartesian());
49 const double dNorm(dc.norm());
50 assert(dNorm > FLT_EPSILON);
51 dc /= dNorm;
52 return dP.dot(dc) * dc;
53 }
54
55 template struct LatticeDirection<3>;
56
57} // end namespace
58#endif
const LatticeType & lattice
ReciprocalLatticeDirectionType cross(const LatticeVectorType &other) const
auto eval(const std::shared_ptr< T > &t)
Eigen::Matrix< long int, dim, 1 > VectorDimI
Eigen::Matrix< double, dim, 1 > VectorDimD
VectorDimD snapToDirection(const VectorDimD &dP) const
LatticeDirection(const LatticeVectorType &v)
ReciprocalLatticeVector< dim > ReciprocalLatticeVectorType
LatticeVector< dim > LatticeVectorType
LatticeVectorType snapToLattice(const VectorDimD &dP) const
REAL v[4]