Mechanics of Defect Evolution Library
Loading...
Searching...
No Matches
FieldPoint.h
Go to the documentation of this file.
1/* This file is part of MoDELib, the Mechanics Of Defects Evolution 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_FieldPoint_h
9#define _model_FieldPoint_h
10
11#include <SpatialCellObserver.h>
12#include <FieldPointBase.h>
13
14
15namespace model {
16
28 template<typename Derived,
29 /* */ short unsigned int _dim,
30 /* */ typename ...FieldTypes>
31 struct FieldPoint;
32
33 /**************************************************************************/
34 /**************************************************************************/
35 // template specialization: one or more fields
36 template<typename Derived,
37 /* */ short unsigned int _dim,
38 /* */ typename FieldType,
39 /* */ typename ...MoreFieldTypes>
40 struct FieldPoint<Derived,_dim,FieldType,MoreFieldTypes...> :
41 /* inheritance */ public FieldPoint<Derived,_dim,MoreFieldTypes...>,
42 /* inheritance */ public FieldPointBase<Derived,FieldType>
43 {
44
45 typedef typename FieldPoint<Derived,_dim,MoreFieldTypes...>::VectorDimD VectorDimD;
46
47 /**********************************************************************/
48 template<typename...T>
49 FieldPoint(const bool& enb, const T&...moreEnb) :
50 /* base init */ FieldPoint<Derived,_dim,MoreFieldTypes...>(moreEnb...),
51 /* base init */ FieldPointBase<Derived,FieldType>(enb)
52 {
54 }
55
56// /**********************************************************************/
57// template <typename OtherFieldType>
58// FieldPointBase<Derived,OtherFieldType>& field()
59// {
60// return *static_cast<FieldPointBase<Derived,OtherFieldType>* const>(this);
61// }
62
63// /**********************************************************************/
64// template <typename OtherFieldType>
65// const FieldPointBase<Derived,OtherFieldType>& field() const
66// {
67// return *static_cast<const FieldPointBase<Derived,OtherFieldType>* const>(this);
68// }
69
70 /**********************************************************************/
71 template <typename OtherFieldType>
72 typename OtherFieldType::MatrixType field() const
73 {
74 return OtherFieldType::get(*static_cast<const FieldPointBase<Derived,OtherFieldType>* const>(this));
75 }
76
77 /**********************************************************************/
78 template <typename OtherFieldType>
83
84 /**********************************************************************/
85 template <typename OtherFieldType>
87 {
88 return *static_cast<const FieldPointBase<Derived,OtherFieldType>* const>(this);
89 }
90
91
92#ifdef _MODEL_MPI_
93
95
101#endif
102
103 };
104
105 /**************************************************************************/
106 /**************************************************************************/
107 // template specialization: zero fields
108 template<typename Derived,
109 /* */ short unsigned int _dim>
110 struct FieldPoint<Derived,_dim>
111 {
112
113 typedef SpatialCellObserver<Derived,_dim> SpatialCellObserverType;
114 typedef typename SpatialCellObserverType::VectorDimD VectorDimD;
115
116#ifdef _MODEL_MPI_
117 private:
118 size_t _mpiID;
119#endif
120
121 public:
122
123#ifdef _MODEL_MPI_
124 /**********************************************************************/
125 const size_t& mpiID() const
126 {
127 return _mpiID;
128 }
129
130 /**********************************************************************/
131 void set_mpiID(const size_t& k)
132 {
133 _mpiID=k;
134 }
135#endif
136
137 /**********************************************************************/
138 template <typename SourcePointType>
139 typename SpatialCellObserver<SourcePointType,_dim>::CellMapType neighborCells() const
140 {
142 return SpatialCellObserver<SourcePointType,_dim>::neighborCells(static_cast<const Derived*>(this)->P);
143 }
144
145 /**********************************************************************/
146 template <typename SourcePointType>
147 typename SpatialCellObserver<SourcePointType,_dim>::CellMapType farCells() const
148 {
150 return SpatialCellObserver<SourcePointType,_dim>::farCells(static_cast<const Derived*>(this)->P);
151 }
152
153
154 };
155
156} // end namespace
157#endif
FieldPointBase< Derived, FieldType >::EigenMapType EigenMapType
Definition FieldPoint.h:94
FieldPoint< Derived, _dim, MoreFieldTypes... >::VectorDimD VectorDimD
Definition FieldPoint.h:45
const FieldPointBase< Derived, OtherFieldType > & fieldPointBase() const
Definition FieldPoint.h:86
FieldPointBase< Derived, OtherFieldType > & fieldPointBase()
Definition FieldPoint.h:79
SpatialCellObserver< SourcePointType, _dim >::CellMapType farCells() const
Definition FieldPoint.h:147
SpatialCellObserverType::VectorDimD VectorDimD
Definition FieldPoint.h:114
const size_t & mpiID() const
Definition FieldPoint.h:125
SpatialCellObserver< SourcePointType, _dim >::CellMapType neighborCells() const
Definition FieldPoint.h:139
void set_mpiID(const size_t &k)
Definition FieldPoint.h:131
SpatialCellObserver< Derived, _dim > SpatialCellObserverType
Definition FieldPoint.h:113
void set_mpiID(const size_t &k)
FieldPointBase(const bool &enb)
Eigen::Map< Eigen::Matrix< typename FieldType::Scalar, FieldType::rows, FieldType::cols > > EigenMapType
A class template that contains the underlying FieldType data of the Derived particle.
Definition FieldPoint.h:31
int k