Mechanics of Defect Evolution Library
Loading...
Searching...
No Matches
Lattices_NEW/LatticeVector.cpp
Go to the documentation of this file.
1/* This file is part of model.
2 *
3 * MoDELib is distributed without any warranty under the MIT License.
4 */
5
6
7#ifndef model_LatticeVector_cpp_
8#define model_LatticeVector_cpp_
9
10#include<LatticeModule.h>
11
12namespace model
13{
14
15 /**********************************************************************/
16 template <int dim>
17 typename LatticeVectorBase<dim>::BaseType& LatticeVectorBase<dim>::base()
18 {
19 return *this;
20 }
21
22 /**********************************************************************/
23 template <int dim>
24 const typename LatticeVectorBase<dim>::BaseType& LatticeVectorBase<dim>::base() const
25 {
26 return *this;
27 }
28
29
30 /**********************************************************************/
31 template <int dim>
33 /* init */ BaseType(VectorDimI::Zero()),
34 /* init */ lattice(lat)
36 {
39 }
40
41 /**********************************************************************/
42 template <int dim>
44 const Lattice<dim> &lat) :
45 /* init */ BaseType(LatticeCore<dim>::integerCoordinates(d,lat.reciprocalBasis.transpose())),
46 /* init */ lattice(lat)
47 {
48 * Constructs *this by mapping d to the lattice
49 */
50 }
51
52 /**********************************************************************/
53 template <int dim>
55 {
56 assert(&lattice == &other.lattice && "LatticeVectors belong to different Lattices.");
57 base() = other.base();
58 return *this;
59 }
60
61 /**********************************************************************/
62 template <int dim>
64 {
65 assert(&lattice == &other.lattice && "LatticeVectors belong to different Lattices.");
66 base() = other.base();
67 return *this;
68 }
69
70 /**********************************************************************/
71 template <int dim>
73 {
74 assert(&lattice == &other.lattice && "LatticeVectors belong to different Lattices.");
75 return LatticeVectorBase<dim>(static_cast<VectorDimI>(*this) + static_cast<VectorDimI>(other), lattice);
76 }
77
78 /**********************************************************************/
79 template <int dim>
81 {
82 assert(&lattice == &other.lattice && "LatticeVectors belong to different Lattices.");
83 base() += other.base();
84 return *this;
85 }
86
87 /**********************************************************************/
88 template <int dim>
90 {
91 assert(&lattice == &other.lattice && "LatticeVectors belong to different Lattices.");
92 return LatticeVectorBase<dim>(static_cast<VectorDimI>(*this) - static_cast<VectorDimI>(other), lattice);
93 }
94
95 /**********************************************************************/
96 template <int dim>
98 {
99 assert(&lattice == &other.lattice && "LatticeVectors belong to different Lattices.");
100 base() -= other.base();
101 return *this;
102 }
103
104 /**********************************************************************/
105 template <int dim>
107 {
108 assert(&lattice == &other.lattice && "LatticeVectors belong to different Lattices.");
109 return static_cast<VectorDimI>(*this).dot(static_cast<VectorDimI>(other));
110 }
111
112 /**********************************************************************/
113 template <int dim>
115 {
116 return lattice.latticeBasis * this->template cast<double>();
117 }
118
119 template<int dim>
121 {
122 return L*scalar;
123 }
124
125template <int dim>
126LatticeVector<dim>::LatticeVector(const Lattice<dim> &lat) :
127/* init base */ LatticeVectorBase<dim>(lat)
128{
131}
132
133template <int dim>
134LatticeVector<dim>::LatticeVector(const VectorDimD &d,
135 const Lattice<dim> &lat) :
136/* init base */ LatticeVectorBase<dim>(d,lat)
137{
140}
141
143/* init base */ LatticeVectorBase<3>(lat)
144{
147}
148
150 const Lattice<3> &lat) :
151/* init base */ LatticeVectorBase<3>(d,lat)
152{
155}
156
158{
159 assert(&lattice == &other.lattice && "LatticeVectors belong to different Lattices.");
160 return ReciprocalLatticeDirection<3>(ReciprocalLatticeVector<3>(static_cast<VectorDimI>(*this).cross(static_cast<VectorDimI>(other)), lattice));
161}
162
163 template class LatticeVectorBase<1>;
165 template class LatticeVectorBase<2>;
167 template class LatticeVectorBase<3>;
169
170 template class LatticeVector<1>;
171 template class LatticeVector<2>;
172
173} // end namespace
174#endif
LatticeCore< 3 >::VectorDimD VectorDimD
LatticeCore< 3 >::VectorDimI VectorDimI
LatticeVectorBase(const Lattice< dim > &lat)
LatticeVectorBase< dim > operator+(const LatticeVectorBase< dim > &other) const
LatticeVectorBase< dim > & operator-=(const LatticeVectorBase< dim > &other)
LatticeCore< dim >::VectorDimI VectorDimI
LatticeVectorBase< dim > & operator=(const LatticeVectorBase< dim > &other)
LatticeCore< dim >::VectorDimD VectorDimD
LatticeVectorBase< dim > & operator+=(const LatticeVectorBase< dim > &other)
LatticeVectorBase< dim > operator-(const LatticeVectorBase< dim > &other) const
IntScalarType dot(const ReciprocalLatticeVectorBase< dim > &other) const
LatticeCore< dim >::IntScalarType IntScalarType
LatticeVector(const LatticeType &lat)
ReciprocalLatticeDirectionType cross(const LatticeVectorType &other) const
auto operator*(const std::shared_ptr< BilinearForm< T1, T2 > > &f, const IntegrationDomain< FE, D, Q, Rule > &dom)