Mechanics of Defect Evolution Library
Loading...
Searching...
No Matches
SplineNode.h
Go to the documentation of this file.
1/* This file is part of MoDELib, the Mechanics Of Defects Evolution Library.
2 *
3 *
4 * MoDELib is distributed without any warranty under the
5 * GNU General Public License (GPL) v2 <http://www.gnu.org/licenses/>.
6 */
7
8#ifndef model_SplineNode_H_
9#define model_SplineNode_H_
10
11#include <Eigen/Dense>
12//#include <LoopNode.h>
13#include <CatmullRom.h>
14#include <Hermite.h>
15
16namespace model
17{
18
19// double chordal =1.0;
20// double centripetal=0.5;
21// double uniform =0.0;
22
23
24 /**************************************************************************/
25 /**************************************************************************/
26 template <typename Derived, short unsigned int dim, short unsigned int corder,typename TangentRule>
28 {
29
30 };
31
32 /**************************************************************************/
33 /* Template specialization for corder=0 */
34 /**************************************************************************/
35 template <typename Derived, short unsigned int dim>
36 class SplineNode<Derived, dim,0,Hermite> //: public LoopNode<Derived>
37 {
38
39 public:
40 constexpr static int corder=0;
41 constexpr static int NdofXnode=dim;
42
45 typedef Eigen::Matrix<double, dim, 1> VectorDim;
46 typedef Eigen::Matrix<double, dim, dim> MatrixDim;
47
48 private:
49
50 VectorDim P;
51 VectorDim deltaP;
52
53
54 public:
55
56 /*************************************************/
57 SplineNode(const VectorDim& P_in) :
58 /* init */ P(P_in)
59 /* init */,deltaP(VectorDim::Zero())
60 {
61
62 }
63
64 /*************************************************/
65 void set_P(const VectorDim& P_in)
66 {
67 deltaP=P_in-P;
68 P=P_in;
69 static_cast<Derived*>(this)->updateGeometry();
70// for(const auto& neighboor : this->neighbors())
71// {
72// std::get<1>(neighboor.second)->updateGeometry();
73// }
74
75// for(const auto& loop : this->loops())
76// {
77// loop->updateGeometry();
78// }
79 }
80
81 /*************************************************/
82 const VectorDim& get_P() const
83 {
84 return P;
85 }
86
87 const VectorDim& get_deltaP() const
88 {
89 return deltaP;
90 }
91
92 };
93
94
95
96// /**************************************************************************/
97// /* Template specialization for corder=1 */
98// /**************************************************************************/
99// template <typename Derived, short unsigned int dim,typename TangentRule>
100// class SplineNode<Derived, dim,1,TangentRule> :
101// /* */ public SplineNode<Derived, dim,0,Hermite>
102// {
103//
104// public:
105//
106// typedef LoopNode<Derived> LoopNodeType;
107// typedef typename LoopNode<Derived>::LinkByLoopContainerType LinkByLoopContainerType;
108// typedef typename LoopNode<Derived>::LoopLinkType LoopLinkType;
109// typedef typename TypeTraits<Derived>::LoopNetworkType LoopNetworkType;
110//
111//
112// constexpr static int corder=1;
113// constexpr static int NdofXnode=dim;
114//
115// typedef SplineNode<Derived, dim,0,Hermite> Base;
116// typedef typename Base::VectorDim VectorDim;
117// typedef typename Base::MatrixDim MatrixDim;
118//
119// private:
120//
121//
122// /**********************************************************************/
123// void computeLoopTangents()
124// {
125//
126// loopTangents.clear();
127// const LinkByLoopContainerType temp=this->linksByLoopID();
128// for(const auto& pair : temp)
129// {
130// loopTangents.emplace(pair.first,this->prjM*TangentRule::loopTangent(pair.second));
131// }
132// }
133//
134// std::map<size_t,VectorDim> loopTangents;
135//
136// public:
137//
138// SplineNode(LoopNetworkType* const ln,
139// const VectorDim& P_in) :
140// /* init list */ Base(ln,P_in)
141// {
142//
143// }
144//
145// /**********************************************************************/
146// void addLoopLink(LoopLinkType* const pL)
147// {/*@param[in] pL LoopLink pointer
148// *
149// * This functin overrides LoopNode::addLoopLink
150// */
151// LoopNodeType::addLoopLink(pL); // forward to base class
152// computeLoopTangents(); // update tangents due to new connectivity
153// }
154//
155// /**********************************************************************/
156// void removeLoopLink(LoopLinkType* const pL)
157// {/*@param[in] pL LoopLink pointer
158// *
159// * This functin overrides LoopNode::removeLoopLink
160// */
161// LoopNodeType::removeLoopLink(pL); // forward to base class
162// computeLoopTangents(); // update tangents due to new connectivity
163// }
164//
165// /*************************************************/
166// void set_P(const VectorDim& P_in)
167// {/*@param[in] P_in new position
168// *
169// * This functin overrides SplineNode<Derived, dim,0>::set_P
170// */
171//
172// Base::set_P(P_in); // forward to base class
173//
174// // Tangents of neighbors may change due to change in P, so updated them
175// for(const auto& neighboor : this->neighbors())
176// {
177// std::get<0>(neighboor.second)->computeLoopTangents();
178// }
179// }
180//
181// /**********************************************************************/
182// const std::map<size_t,VectorDim>& tangents() const
183// {
184// return loopTangents;
185// }
186//
187// /**********************************************************************/
188// std::map<size_t,std::map<size_t,std::pair<double,VectorDim>>> loopTangentCoeffs() const
189// {
190//
191// std::map<size_t,std::map<size_t,std::pair<double,VectorDim>>> temp;
192//
193// std::map<size_t,std::set<LoopLinkType*>> linksbyID=this->linksByLoopID();
194// for(const auto& pair : linksbyID)
195// {
196// temp.emplace(pair.first,TangentRule::loopTangentCoeffs(pair.second));
197// }
198//
199// return temp;
200// }
201//
202//
203// /*************************************************/
204// Eigen::Matrix<int,dim,1> node_dofID() const
205// {
206// /*! The IDs of DOFs of this node in the subnetwork
207// */
208// return ( (Eigen::Array<int,dim,1>() << 0, 1, 2).finished()+this->snID()*dim).matrix();
209// }
210// };
211
212
213}
214#endif
215
Eigen::Matrix< double, dim, dim > MatrixDim
Definition SplineNode.h:46
Eigen::Matrix< double, dim, 1 > VectorDim
Definition SplineNode.h:45
TypeTraits< Derived >::LoopNetworkType LoopNetworkType
Definition SplineNode.h:44