ITK  4.4.0
Insight Segmentation and Registration Toolkit
itkFEMLoadLandmark.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 
19 #ifndef __itkFEMLoadLandmark_h
20 #define __itkFEMLoadLandmark_h
21 
22 #include "itkFEMLoadElementBase.h"
23 
24 #include "vnl/vnl_vector.h"
25 
26 namespace itk
27 {
28 namespace fem
29 {
38 class LoadLandmark : public LoadElement
39 {
40 public:
41 
43  typedef LoadLandmark Self;
47 
49  itkSimpleNewMacro(Self);
50 
52  itkTypeMacro(LoadLandmark, LoadElement);
53 
56  virtual::itk::LightObject::Pointer CreateAnother(void) const;
57 
62  {
63  m_Solution = ptr;
64  }
66  {
67  return m_Solution;
68  }
69  Float GetSolution(unsigned int i, unsigned int v = 0)
70  {
71  return m_Solution->GetSolutionValue(i, v);
72  }
74 
79  {
80  return m_Point;
81  }
82 
86  void SetPoint(const vnl_vector<Float> & pt)
87  {
88  m_Point = pt;
89  }
90 
95  {
96  return m_Source;
97  }
98 
100  {
101  return m_Source;
102  }
103 
108  {
109  return m_Force;
110  }
111 
113  {
114  return m_Force;
115  }
116 
120  void SetForce(const vnl_vector<Float> & force)
121  {
122  if( m_Force.size() != force.size() )
123  {
124  m_Force.set_size( force.size() );
125  }
126  for( unsigned int i = 0; i < force.size(); i++ )
127  {
128  m_Force[i] = force[i];
129  }
130  }
132 
136  void SetSource(const vnl_vector<Float> & source)
137  {
138  if( m_Source.size() != source.size() )
139  {
140  m_Source.set_size( source.size() );
141  }
142  for( unsigned int i = 0; i < source.size(); i++ )
143  {
144  m_Source[i] = source[i];
145  }
146  }
148 
153  {
154  return m_Target;
155  }
157  {
158  return m_Target;
159  }
161 
165  void SetTarget(const vnl_vector<Float> & target)
166  {
167  if( m_Target.size() != target.size() )
168  {
169  m_Target.set_size( target.size() );
170  }
171  for( unsigned int i = 0; i < target.size(); i++ )
172  {
173  m_Target[i] = target[i];
174  }
175  }
177 
178  void ScalePointAndForce(double *spacing, double fwt)
179  {
180  for( unsigned int i = 0; i < m_Target.size(); i++ )
181  {
182  m_Target[i] /= spacing[i];
183  m_Source[i] /= spacing[i];
184  this->m_Eta *= fwt;
185  }
186  }
187 
192  {
193  this->m_Element[0] = e;
194  }
195 
199  const Element * GetContainedElement() const
200  {
201  return this->m_Element[0];
202  }
203 
207  virtual bool AssignToElement(Element::ArrayType::Pointer elements);
208 
209  virtual bool AssignToElement(Element::ArrayType1::Pointer elements);
210 
212 
217  m_Eta(0),
218  m_Target(0),
219  m_Source(0),
220  m_Force(0),
221  m_Solution(0)
222  {
223  }
224 
226  void SetEta(double e);
227 
228  double GetEta() const;
229 
231  virtual void ApplyLoad(Element::ConstPointer element, Element::VectorType & Fe);
232 
233 protected:
234 
235  virtual void PrintSelf(std::ostream& os, Indent indent) const;
236 
240  double m_Eta;
241 
245  vnl_vector<Float> m_Point;
246 
250  vnl_vector<Float> m_Target;
251 
252  vnl_vector<Float> m_Source;
253 
254  vnl_vector<Float> m_Force;
255 
260  // Element::ConstPointer m_element;
261 
266 };
267 
268 }
269 } // end namespace itk::fem
270 
271 #endif // #ifndef __itkFEMLoadLandmark_h
272