SCIRun  5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VField.h
Go to the documentation of this file.
1 /*
2  For more information, please see: http://software.sci.utah.edu
3 
4  The MIT License
5 
6  Copyright (c) 2009 Scientific Computing and Imaging Institute,
7  University of Utah.
8 
9 
10  Permission is hereby granted, free of charge, to any person obtaining a
11  copy of this software and associated documentation files (the "Software"),
12  to deal in the Software without restriction, including without limitation
13  the rights to use, copy, modify, merge, publish, distribute, sublicense,
14  and/or sell copies of the Software, and to permit persons to whom the
15  Software is furnished to do so, subject to the following conditions:
16 
17  The above copyright notice and this permission notice shall be included
18  in all copies or substantial portions of the Software.
19 
20  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26  DEALINGS IN THE SOFTWARE.
27 */
28 
29 
30 
31 #ifndef CORE_DATATYPES_VFIELD_H
32 #define CORE_DATATYPES_VFIELD_H 1
33 
38 
39 
41 
42 namespace SCIRun {
43 
44 // Define a handle to the virtual interface
45 
47 /// The FieldTypeInformation call introduces functions to check type of the field
48 /// Like is_pointcloudmesh() is_lineardata() is_vector() etc.
49 /// Check FieldInformation.h for a full list
50 
51 public:
52 
53  VField() :
54  field_(0),
55  mesh_(0),
56  pm_(0),
57  vmesh_(0),
58  vfdata_(0),
59  basis_order_(0),
60  number_of_nodes_(0),
61  number_of_enodes_(0),
62  element_dim_(0),
63  element_dofs_(0),
64  is_scalar_(false),
65  is_pair_(false),
66  is_vector_(false),
67  is_tensor_(false)
68  {
69  DEBUG_CONSTRUCTOR("VField")
70  }
71 
72  virtual ~VField()
73  {
74  DEBUG_DESTRUCTOR("VField")
75  }
76 
77  /// Import a couple of useful typedefs from VMesh
82 
86 
87  /// mesh() and vmesh() get the handle to the mesh and its virtual interface
88  inline MeshHandle mesh() { return (MeshHandle(mesh_)); }
89  inline VMesh* vmesh() { return (vmesh_); }
90 
91  /// get a handle to the field
92  inline FieldHandle field() { return (FieldHandle(field_)); }
93  /// for completeness get a pointer to itself
94  inline VField* vfield() { return (this); }
95 
96  /// Get the basis_order of the field data, -1 = nodata, 0 = constant, 1 = linear
97  /// 2 = quadratic 3 = cubic
98  inline int basis_order() { return (basis_order_); }
99 
100  /// get the number of values in the field (data at corner nodes of the elements)
101  inline VMesh::size_type num_values() { return (vfdata_->fdata_size()); }
102  /// get the number of edge values in the field (for quadratic approximation)
103  inline VMesh::size_type num_evalues() { return (vfdata_->efdata_size()); }
104 
105  /// resize the data fields to match the number of nodes/edges in the mesh
106  inline void resize_fdata()
107  {
108  if (basis_order_ == -1)
109  {
111  dim.resize(1); dim[0] = 0;
112  vfdata_->resize_fdata(dim);
113  // do nothing
114  }
115  else if (basis_order_ == 0)
116  {
118  vmesh_->get_elem_dimensions(dim);
119  vfdata_->resize_fdata(dim);
120  }
121  else if (basis_order_ == 1)
122  {
124  vmesh_->get_dimensions(dim);
125  vfdata_->resize_fdata(dim);
126  }
127  else if (basis_order_ == 2)
128  {
130  vmesh_->get_dimensions(dim);
131  vfdata_->resize_fdata(dim);
132  vfdata_->resize_efdata(dim);
133  }
134  }
135 
136  /// same function but now uses the systematic naming
137  /// (resize_fdata is the old call, SCIRun was using)
138  inline void resize_values() { resize_fdata(); }
139 
141  {
142  if (basis_order_ == -1) { dims.clear(); }
143  else if (basis_order_ == 0) { vmesh_->get_elem_dimensions(dims); }
144  else { vmesh_->get_dimensions(dims); }
145  }
146 
147 
149  {
150  if (basis_order_ == -1) return (false);
151  if (basis_order_ == 0)
152  {
153  vmesh_->get_center(p,VMesh::Elem::index_type(idx));
154  return (true);
155  }
156  else
157  {
158  vmesh_->get_center(p,VMesh::Node::index_type(idx));
159  return (true);
160  }
161  }
162 
163  /// Get values from field (different varieties for different index types)
164  /// Unlike the direct interface, we do not check index_type here
165  /// all calls are rerouted to the same function call
166 
167  /// NOTE THE FOLLOWING TEMPLATES WILL COMPILE
168  /// Template T can be of the following types:
169  /// char, unsigned char, short, unsigned short, int, unsigned int, long,
170  /// unsigned long, long long, unsigned long long, float, double,
171  /// Vector, and Tensor
172 
173  template<class T> inline void get_value(T& val, index_type idx) const
174  { vfdata_->get_value(val,idx); }
175  /// evalue stands for edge value used in quadratic approximation, the latter
176  /// can be accessed using direct indices or ENode::index_type
177  template<class T> inline void get_evalue(T& val, index_type idx) const
178  { vfdata_->get_evalue(val,idx); }
179  template<class T> inline void get_value(T& val, VMesh::Node::index_type idx) const
180  { vfdata_->get_value(val,static_cast<VMesh::index_type>(idx)); }
181  template<class T> inline void get_value(T& val, VMesh::Edge::index_type idx) const
182  { vfdata_->get_value(val,static_cast<VMesh::index_type>(idx)); }
183  template<class T> inline void get_value(T& val, VMesh::Face::index_type idx) const
184  { vfdata_->get_value(val,static_cast<VMesh::index_type>(idx)); }
185  template<class T> inline void get_value(T& val, VMesh::Cell::index_type idx) const
186  { vfdata_->get_value(val,static_cast<VMesh::index_type>(idx)); }
187  template<class T> inline void get_value(T& val, VMesh::Elem::index_type idx) const
188  { vfdata_->get_value(val,static_cast<VMesh::index_type>(idx)); }
189  template<class T> inline void get_value(T& val, VMesh::DElem::index_type idx) const
190  { vfdata_->get_value(val,static_cast<VMesh::index_type>(idx)); }
191  template<class T> inline void get_value(T& val, VMesh::ENode::index_type idx) const
192  { vfdata_->get_evalue(val,static_cast<VMesh::index_type>(idx)); }
193 
194  /// Ensure compatibility with old field class, these are equivalent with get_value()
195  /// unlike the direct interface we do not use ASSERTs to check bounds and this function
196  /// calls are thus exactly the same. They are provided for compatibility with the old
197  /// classes
198  template<class T> inline bool value(T& val, index_type idx) const
199  { vfdata_->get_value(val,idx); return (true); }
200  template<class T> inline bool value(T& val, VMesh::Node::index_type idx) const
201  { vfdata_->get_value(val,static_cast<VMesh::index_type>(idx));return (true); }
202  template<class T> inline bool value(T& val, VMesh::Edge::index_type idx) const
203  { vfdata_->get_value(val,static_cast<VMesh::index_type>(idx));return (true); }
204  template<class T> inline bool value(T& val, VMesh::Face::index_type idx) const
205  { vfdata_->get_value(val,static_cast<VMesh::index_type>(idx));return (true); }
206  template<class T> inline bool value(T& val, VMesh::Cell::index_type idx) const
207  { vfdata_->get_value(val,static_cast<VMesh::index_type>(idx));return (true); }
208  template<class T> inline bool value(T& val, VMesh::Elem::index_type idx) const
209  { vfdata_->get_value(val,static_cast<VMesh::index_type>(idx));return (true); }
210  template<class T> inline bool value(T& val, VMesh::DElem::index_type idx) const
211  { vfdata_->get_value(val,static_cast<VMesh::index_type>(idx));return (true); }
212 
213  /// Functions for getting a weighted value
214  template<class T> inline void get_weighted_value(T& val, const index_type* idx, const weight_type* w, size_type sz) const
215  { vfdata_->get_weighted_value(val,idx,w,sz); }
216  template<class T> inline void get_weighted_value(T& val, index_array_type idx, weight_array_type w) const
217  { vfdata_->get_weighted_value(val,&(idx[0]),&(w[0]),idx.size()); }
218  template<class T> inline void get_weighted_evalue(T& val, const index_type* idx, const weight_type* w, size_type sz) const
219  { vfdata_->get_weighted_evalue(val,idx,w,sz); }
220  template<class T> inline void get_weighted_evalue(T& val, index_array_type idx, weight_array_type w) const
221  { vfdata_->get_weighted_value(val,&(idx[0]),&(w[0]),idx.size()); }
222 
223 
224  /// Insert values into field, for every get_value there is an equivalent set_value
225  /// likewise get_evalue is replaced by set set_evalue
226  template<class T> inline void set_value(const T& val, index_type idx)
227  { vfdata_->set_value(val,idx); }
228  template<class T> inline void set_evalue(const T& val, index_type idx)
229  { vfdata_->set_evalue(val,idx); }
230  template<class T> inline void set_value(const T& val, VMesh::Node::index_type idx)
231  { vfdata_->set_value(val,static_cast<VMesh::index_type>(idx)); }
232  template<class T> inline void set_value(const T& val, VMesh::Edge::index_type idx)
233  { vfdata_->set_value(val,static_cast<VMesh::index_type>(idx)); }
234  template<class T> inline void set_value(const T& val, VMesh::Face::index_type idx)
235  { vfdata_->set_value(val,static_cast<VMesh::index_type>(idx)); }
236  template<class T> inline void set_value(const T& val, VMesh::Cell::index_type idx)
237  { vfdata_->set_value(val,static_cast<VMesh::index_type>(idx)); }
238  template<class T> inline void set_value(const T& val, VMesh::Elem::index_type idx)
239  { vfdata_->set_value(val,static_cast<VMesh::index_type>(idx)); }
240  template<class T> inline void set_value(const T& val, VMesh::DElem::index_type idx)
241  { vfdata_->set_value(val,static_cast<VMesh::index_type>(idx)); }
242  template<class T> inline void set_value(const T& val, VMesh::ENode::index_type idx)
243  { vfdata_->set_evalue(val,static_cast<VMesh::index_type>(idx)); }
244 
245  /// Get/Set all values at once
246  template<class T> inline void set_values(const std::vector<T>& values)
247  { if (!values.empty()) vfdata_->set_values(&(values[0]),values.size(),0); }
248  template<class T> inline void set_values(const T* data, size_type sz, index_type offset = 0)
249  { vfdata_->set_values(data,sz,offset); }
250  template<class T> inline void get_values(std::vector<T>& values) const
251  { values.resize(vfdata_->fdata_size()); if (values.size()) vfdata_->get_values(&(values[0]),values.size(),0); }
252  template<class T> inline void get_values(T* data, size_type sz, index_type offset = 0) const
253  { vfdata_->get_values(data,sz,offset); }
254 
255  // Set/Get values per element array or node array
256  template<class T> inline void set_values(const std::vector<T>& values, VMesh::Node::array_type nodes)
257  { if (values.size() > 0) vfdata_->set_values(&(values[0]),nodes); }
258  template<class T> inline void set_values(const std::vector<T>& values, VMesh::Elem::array_type elems)
259  { if (values.size() > 0) vfdata_->set_values(&(values[0]),elems); }
260  template<class T,class ARRAY> inline void set_values(const std::vector<T>& values, ARRAY& idx)
261  { if (values.size() > 0) vfdata_->set_values(&(values[0]),&(idx[0]),static_cast<size_type>(idx.size())); }
262  template<class T> inline void set_values(const T* values, VMesh::Node::array_type nodes)
263  { vfdata_->set_values(values,nodes); }
264  template<class T> inline void set_values(const T* values, VMesh::Elem::array_type elems)
265  { vfdata_->set_values(values,elems); }
266  template<class T,class ARRAY> inline void set_values(const T* values, ARRAY& idx)
267  { vfdata_->set_values(values,&(idx[0]),static_cast<size_type>(idx.size())); }
268 
269  template<class T> inline void get_values(std::vector<T>& values, VMesh::Node::array_type nodes) const
270  { values.resize(nodes.size()); if (values.size() > 0) vfdata_->get_values(&(values[0]),nodes); }
271  template<class T> inline void get_values(std::vector<T>& values, VMesh::Elem::array_type elems) const
272  { values.resize(elems.size()); if (values.size() > 0) vfdata_->get_values(&(values[0]),elems); }
273  template<class T,class ARRAY> inline void get_values(std::vector<T>& values, ARRAY& idx) const
274  { values.resize(idx.size()); if (values.size() > 0) vfdata_->get_values(&(values[0]),&(idx[0]),idx.size()); }
275  template<class T> inline void get_values(T* values, VMesh::Node::array_type nodes) const
276  { vfdata_->get_values(values,nodes); }
277  template<class T> inline void get_values(T* values, VMesh::Elem::array_type elems) const
278  { vfdata_->get_values(values,elems); }
279  template<class T,class ARRAY> inline void get_values(T* values, ARRAY& idx) const
280  { vfdata_->get_values(values,&(idx[0]),idx.size()); }
281 
282  /// Set all values to a specific value
283  template<class T> inline void set_all_values(const T val)
284  { vfdata_->set_all_values(val); }
285 
286  /// Functions for getting a weighted value
287  template<class INDEX> inline void copy_weighted_value(VField* field, index_type* idx, weight_type* w, size_type sz, INDEX i) const
288  { vfdata_->copy_weighted_value(field->vfdata_,idx,w,sz,index_type(i)); }
289  template<class INDEX, class ARRAY> inline void copy_weighted_value(VField* field, ARRAY idx, weight_array_type w, INDEX i) const
290  { vfdata_->copy_weighted_value(field->vfdata_,&(idx[0]),&(w[0]),idx.size(),index_type(i)); }
291  template<class INDEX> inline void copy_weighted_evalue(VField* field, index_type* idx, weight_type* w, size_type sz, INDEX i) const
292  { vfdata_->copy_weighted_evalue(field->vfdata_,idx,w,sz,index_type(i)); }
293  template<class INDEX, class ARRAY> inline void copy_weighted_evalue(VField* field, ARRAY idx, weight_array_type w, INDEX i) const
294  { vfdata_->copy_weighted_value(field->vfdata_,&(idx[0]),&(w[0]),idx.size(),index_type(i)); }
295 
296  /// Set all values to zero or its equivalent, all none double data will be casted
297  /// to the proper value automatically. This way we do not need an additional
298  /// virtual function call
299  inline void clear_all_values()
300  { vfdata_->set_all_values(static_cast<double>(0)); }
301 
302  /// The following cases are more specialized cases for copying entiry sets of
303  /// data. These functions need to know the size of the inserted data as they
304  /// perform a safety check on the length of the fdata array.
305  template<class T> inline void set_evalues(const std::vector<T>& values)
306  { vfdata_->set_evalues(&(values[0]),values.size(),0); }
307  template<class T> inline void set_evalues(const T* data, size_type sz, index_type offset=0)
308  { vfdata_->set_evalues(data,sz,offset); }
309 
310  template<class T> inline void get_evalues(std::vector<T>& values) const
311  {
312  values.resize(vfdata_->efdata_size());
313  if (values.size())
314  vfdata_->get_evalues(&(values[0]),values.size(),0);
315  }
316  template<class T> inline void get_evalues(T* data, size_type sz, index_type offset = 0) const
317  { vfdata_->get_evalues(data,sz,offset); }
318 
319  /// Copy a value from one vfdata container to another, without having to know
320  /// its type. Often for geometric operations one only has to copy the data.
321  /// in tota this function will do to virtual function calls to move data from
322  /// one container to the next. It however does direct casting between types.
323  /// call these functions from the destination field to import data from another field
324  template<class INDEX1, class INDEX2>
325  inline void copy_value(VField* field, INDEX1 idx1, INDEX2 idx2)
326  {
327  vfdata_->copy_value(field->vfdata_,index_type(idx1),index_type(idx2));
328  }
329 
330  /// Same for edge values
331  template<class INDEX1, class INDEX2>
332  inline void copy_evalue(VField* field, INDEX1 idx1, INDEX2 idx2)
333  {
334  vfdata_->copy_evalue(field->vfdata_,index_type(idx1),index_type(idx2));
335  }
336 
337  template<class INDEX1, class INDEX2>
338  inline void copy_values(VField* field, INDEX1 idx1, INDEX2 idx2, size_type sz)
339  {
340  if (sz > 0)
341  vfdata_->copy_values(field->vfdata_,index_type(idx1),index_type(idx2),sz);
342  }
343 
344  /// Same for edge values
345  template<class INDEX1, class INDEX2>
346  inline void copy_evalues(VField* field, INDEX1 idx1, INDEX2 idx2, size_type sz)
347  {
348  if (sz > 0)
349  vfdata_->copy_evalues(field->vfdata_,index_type(idx1),index_type(idx2),sz);
350  }
351 
352  /// Copy all the values from one container to another container
353  /// call these functions from the destination field to import data from another field
354  inline void copy_values(VField* field)
355  { vfdata_->copy_values(field->vfdata_); }
356 
357  inline void copy_evalues(VField* field)
358  { vfdata_->copy_evalues(field->vfdata_); }
359 
360  /// Maximum and minimum of values (with index to see where maximum is located)
361  inline bool min(double& mn,index_type& idx)
362  { mn = 0.0; return(vfdata_->min(mn,idx)); }
363 
364  inline bool min(double& mn)
365  { mn = 0.0; index_type idx; return(vfdata_->min(mn,idx)); }
366 
367  inline bool max(double& mx,index_type& idx) const
368  { mx = 0.0; return(vfdata_->max(mx,idx)); }
369  inline bool max(double& mx) const
370  { index_type idx; mx =0.0; return(vfdata_->max(mx,idx)); }
371 
372  /// Combined min max for efficiency
373  inline bool minmax(double& mn, index_type& idxmn,
374  double& mx, index_type idxmx) const
375  {
376  mn = 0.0;
377  mx = 0.0;
378  return(vfdata_->minmax(mn,idxmn,mx,idxmx));
379  }
380 
381  /// version of minmax without indices
382  inline bool minmax(double& mn, double& mx) const
383  {
384  index_type idxmn;
385  index_type idxmx;
386  mn = 0.0;
387  mx = 0.0;
388  return(vfdata_->minmax(mn,idxmn,mx,idxmx));
389  }
390 
391  inline void size(VMesh::Node::size_type& sz) { sz = number_of_nodes_; }
392  inline void size(VMesh::ENode::size_type& sz) { sz = number_of_enodes_; }
393 
394  /// dimensions of the element 0 .. 3
395  inline int dimension() { return(element_dim_); }
396  /// number of degree of freedoms in each element type in the mesh
397  inline int dofs() { return(element_dofs_); }
398 
399 
400  /// NOTE FOR INTERPOLATE AND GRADIENT
401  /// Interpolate and Gradient functions are only available for the following
402  /// datatypes: double, Vector, and Tensor
403 
404  /// General interpolation function. This function does at most two virtual
405  /// function calls per call. It first will retrieve proper interpolation
406  /// weights from the mesh and then will apply it to the data inside the
407  /// data container. All objects needed for interpolation are reserved on
408  /// the stack for efficiency.
409  /// Note that different data orders have different implementations as non linear
410  /// interpolation requires far more data, these are handled in separate classes
411 
412  template<class ARRAY, class DATA>
413  inline void minterpolate(ARRAY& val,
414  const VMesh::coords_array_type &coords,
415  VMesh::index_type idx,
416  DATA def_value) const
417  {
419  vmesh_->get_minterpolate_weights(coords,idx,ei,basis_order_);
420  vfdata_->minterpolate(val,ei, static_cast<typename ARRAY::value_type>(def_value));
421  }
422 
423 
424  template<class ARRAY>
425  inline void minterpolate(ARRAY& val,
426  const VMesh::coords_array_type &coords,
427  VMesh::index_type idx) const
428  {
430  vmesh_->get_minterpolate_weights(coords,idx,ei,basis_order_);
431  vfdata_->minterpolate(val,ei, typename ARRAY::value_type(0));
432  }
433 
434  template<class T>
435  inline void interpolate(T& val,
436  const VMesh::coords_type &coords,
437  VMesh::index_type idx,
438  T def_value = (static_cast<T>(0))) const
439  {
441  vmesh_->get_interpolate_weights(coords,idx,ei,basis_order_);
442  vfdata_->interpolate(val,ei,def_value);
443  }
444 
445  template<class ARRAY, class DATA>
446  inline void minterpolate(ARRAY& val,
447  const std::vector<Core::Geometry::Point>& points,
448  DATA def_value = (static_cast<DATA>(0))) const
449  {
451  vmesh_->get_minterpolate_weights(points,ei,basis_order_);
452  vfdata_->minterpolate(val,ei, static_cast<typename ARRAY::value_type>(def_value));
453  }
454 
455  template<class ARRAY, class DATA>
456  inline void minterpolate(ARRAY& val,
457  const std::vector<Core::Geometry::Point>& points,
458  DATA def_value,
459  VMesh::MultiElemInterpolate& ei) const
460  {
461  vmesh_->get_minterpolate_weights(points,ei,basis_order_);
462  vfdata_->minterpolate(val,ei, static_cast<typename ARRAY::value_type>(def_value));
463  }
464 
465  template<class T>
466  inline bool interpolate(T& val,const Core::Geometry::Point& point, T def_value = (static_cast<T>(0))) const
467  {
469  vmesh_->get_interpolate_weights(point,ei,basis_order_);
470 
471  if (ei.elem_index >= 0)
472  {
473  vfdata_->interpolate(val,ei,def_value);
474  return (true);
475  }
476  val = def_value;
477  return (false);
478  }
479 
480 
481  template<class T>
482  inline bool interpolate(T& val,const Core::Geometry::Point& point,
483  T def_value, VMesh::ElemInterpolate& ei) const
484  {
485  vmesh_->get_interpolate_weights(point,ei,basis_order_);
486  if (ei.elem_index >= 0)
487  {
488  vfdata_->interpolate(val,ei,def_value);
489  return (true);
490  }
491  val = def_value;
492  return (false);
493  }
494 
495  inline void interpolate(Core::Geometry::Point& val,const VMesh::coords_type &coords, VMesh::index_type idx) const
496  {
497  vmesh_->interpolate(val,coords,idx);
498  }
499 
500  // inline conversion using other index types.
501  template<class T> inline void interpolate(T& val, const VMesh::coords_type &coords, VMesh::Edge::index_type idx) const
502  { interpolate(val, coords, static_cast<VMesh::index_type>(idx)); }
503  template<class T> inline void interpolate(T& val, const VMesh::coords_type &coords, VMesh::Face::index_type idx) const
504  { interpolate(val, coords, static_cast<VMesh::index_type>(idx)); }
505  template<class T> inline void interpolate(T& val, const VMesh::coords_type &coords, VMesh::Cell::index_type idx) const
506  { interpolate(val, coords, static_cast<VMesh::index_type>(idx)); }
507  template<class T> inline void interpolate(T& val, const VMesh::coords_type &coords, VMesh::Elem::index_type idx) const
508  { interpolate(val, coords, static_cast<VMesh::index_type>(idx)); }
509  template<class T> inline void interpolate(T& val, const VMesh::coords_type &coords, VMesh::DElem::index_type idx) const
510  { interpolate(val, coords, static_cast<VMesh::index_type>(idx)); }
511 
512  template<class ARRAY> inline void minterpolate(ARRAY& val, const VMesh::coords_array_type &coords, VMesh::Edge::index_type idx) const
513  { minterpolate(val, coords, static_cast<VMesh::index_type>(idx)); }
514  template<class ARRAY> inline void minterpolate(ARRAY& val, const VMesh::coords_array_type &coords, VMesh::Face::index_type idx) const
515  { minterpolate(val, coords, static_cast<VMesh::index_type>(idx)); }
516  template<class ARRAY> inline void minterpolate(ARRAY& val, const VMesh::coords_array_type &coords, VMesh::Cell::index_type idx) const
517  { minterpolate(val, coords, static_cast<VMesh::index_type>(idx)); }
518  template<class ARRAY> inline void minterpolate(ARRAY& val, const VMesh::coords_array_type &coords, VMesh::Elem::index_type idx) const
519  { minterpolate(val, coords, static_cast<VMesh::index_type>(idx)); }
520  template<class ARRAY> inline void minterpolate(ARRAY& val, const VMesh::coords_array_type &coords, VMesh::DElem::index_type idx) const
521  { minterpolate(val, coords, static_cast<VMesh::index_type>(idx)); }
522 
523  /// Similar to interpolation, but now this one derives the first derivative of
524  /// the field (i.e. the gradient). Again the implementation is similar to the
525  /// implementation of interpolate
526  template<class T> inline void gradient(StackVector<T,3>& val, const VMesh::coords_type &coords, VMesh::index_type idx,T def_value = (static_cast<T>(0))) const
527  {
529  vmesh_->get_gradient_weights(coords,idx,eg,basis_order_);
530  vfdata_->gradient(val,eg,def_value);
531  }
532 
533  template<class T> inline void mgradient(std::vector<StackVector<T,3> >& val, const VMesh::coords_array_type &coords, VMesh::index_type idx,T def_value = (static_cast<T>(0))) const
534  {
536  vmesh_->get_mgradient_weights(coords,idx,eg,basis_order_);
537  vfdata_->mgradient(val,eg,def_value);
538  }
539 
540  template<class T> inline bool gradient(StackVector<T,3>& val, const Core::Geometry::Point& point,T def_value = (static_cast<T>(0))) const
541  {
543  vmesh_->get_gradient_weights(point,eg,basis_order_);
544  if (eg.elem_index >= 0)
545  {
546  vfdata_->gradient(val,eg,def_value);
547  return (true);
548  }
549  val[0] = def_value;
550  val[1] = def_value;
551  val[2] = def_value;
552  return (false);
553  }
554 
555  template<class T> inline bool gradient(StackVector<T,3>& val, const Core::Geometry::Point& point,T def_value,VMesh::ElemGradient& eg) const
556  {
557  vmesh_->get_gradient_weights(point,eg,basis_order_);
558  if (eg.elem_index >= 0)
559  {
560  vfdata_->gradient(val,eg,def_value);
561  return (true);
562  }
563  val[0] = def_value;
564  val[1] = def_value;
565  val[2] = def_value;
566  return (false);
567  }
568 
569  template<class T> inline void mgradient(std::vector<StackVector<T,3> >& val, const std::vector<Core::Geometry::Point>& points,T def_value = (static_cast<T>(0))) const
570  {
572  vmesh_->get_mgradient_weights(points,eg,basis_order_);
573  vfdata_->mgradient(val,eg,def_value);
574  }
575 
576  template<class T> inline void mgradient(std::vector<StackVector<T,3> >& val, const std::vector<Core::Geometry::Point>& points,T def_value, VMesh::MultiElemGradient& eg) const
577  {
578  vmesh_->get_mgradient_weights(points,eg,basis_order_);
579  vfdata_->mgradient(val,eg,def_value);
580  }
581 
582  /// Different versions for different index types
583  template<class T> inline void gradient(StackVector<T,3>& val, const VMesh::coords_type &coords, VMesh::Edge::index_type idx) const
584  { gradient(val, coords, static_cast<VMesh::index_type>(idx)); }
585  template<class T> inline void gradient(StackVector<T,3>& val, const VMesh::coords_type &coords, VMesh::Face::index_type idx) const
586  { gradient(val, coords, static_cast<VMesh::index_type>(idx)); }
587  template<class T> inline void gradient(StackVector<T,3>& val, const VMesh::coords_type &coords, VMesh::Cell::index_type idx) const
588  { gradient(val, coords, static_cast<VMesh::index_type>(idx)); }
589  template<class T> inline void gradient(StackVector<T,3>& val, const VMesh::coords_type &coords, VMesh::Elem::index_type idx) const
590  { gradient(val, coords, static_cast<VMesh::index_type>(idx)); }
591  template<class T> inline void gradient(StackVector<T,3>& val, const VMesh::coords_type &coords, VMesh::DElem::index_type idx) const
592  { gradient(val, coords, static_cast<VMesh::index_type>(idx)); }
593 
594  /// internal function - this one may change in the future
596  {
597  vmesh_ = mesh->vmesh();
598  mesh_ = mesh;
599  }
600 
601  // Use these two functions with extra care, as they can cause segmentation
602  // errors if the type of the data is not taken into account
603  inline void* get_values_pointer() { return (vfdata_->fdata_pointer()); }
604  inline void* get_evalues_pointer() { return (vfdata_->efdata_pointer()); }
605 
606  inline void* fdata_pointer() { return (vfdata_->fdata_pointer()); }
607  inline void* efdata_pointer() { return (vfdata_->efdata_pointer()); }
608 
609  inline bool is_nodata() { return (basis_order_ == -1); }
610  inline bool is_constantdata() { return (basis_order_ == 0); }
611  inline bool is_lineardata() { return (basis_order_ == 1); }
612  inline bool is_nonlineardata() { return (basis_order_ > 1); }
613  inline bool is_quadraticdata() { return (basis_order_ == 2); }
614  inline bool is_cubicdata() { return (basis_order_ == 3); }
615 
616  inline bool is_constantmesh() { return (vmesh_->basis_order() == 0); }
617  inline bool is_linearmesh() { return (vmesh_->basis_order() == 1); }
618  inline bool is_nonlinearmesh() { return (vmesh_->basis_order() > 1); }
619  inline bool is_quadraticmesh() { return (vmesh_->basis_order() == 2); }
620  inline bool is_cubicmesh() { return (vmesh_->basis_order() == 3); }
621 
622  inline bool is_isomorphic() { return (basis_order_ == vmesh_->basis_order()); }
623 
624  inline bool is_scalar() { return (is_scalar_); }
625  inline bool is_pair() { return (is_pair_); }
626  inline bool is_vector() { return (is_vector_); }
627  inline bool is_tensor() { return (is_tensor_); }
628 
629  inline bool is_char() { return ((data_type_=="char")||(data_type_=="signed char")); }
630  inline bool is_unsigned_char() { return ((data_type_=="unsigned char")); }
631  inline bool is_short() { return ((data_type_=="short")||(data_type_=="signed short")); }
632  inline bool is_unsigned_short() { return (data_type_=="unsigned short"); }
633  inline bool is_int() { return ((data_type_=="int")||(data_type_=="signed int")); }
634  inline bool is_unsigned_int() { return (data_type_=="unsigned int"); }
635  inline bool is_long() { return ((data_type_=="long")||(data_type_=="signed long")); }
636  inline bool is_unsigned_long() { return (data_type_=="unsigned long"); }
637  inline bool is_longlong() { return ((data_type_=="long long")||(data_type_=="signed long long")); }
638  inline bool is_unsigned_longlong() { return (data_type_=="unsigned long long"); }
639  inline bool is_float() { return (data_type_=="float"); }
640  inline bool is_double() { return (data_type_=="double"); }
641 
642  inline bool is_type(char* ) { return (is_char()); }
643  inline bool is_type(unsigned char* ) { return (is_unsigned_char()); }
644  inline bool is_type(short* ) { return (is_short()); }
645  inline bool is_type(unsigned short* ) { return (is_unsigned_short()); }
646  inline bool is_type(int* ) { return (is_int()); }
647  inline bool is_type(unsigned int* ) { return (is_unsigned_int()); }
648  inline bool is_type(long* ) { return (is_long()); }
649  inline bool is_type(unsigned long* ) { return (is_unsigned_long()); }
650  inline bool is_type(long long* ) { return (is_longlong()); }
651  inline bool is_type(unsigned long long* ) { return (is_unsigned_longlong()); }
652  inline bool is_type(double* ) { return (is_double()); }
653  inline bool is_type(float* ) { return (is_float()); }
654  inline bool is_type(Core::Geometry::Vector* ) { return (is_vector()); }
655  inline bool is_type(Core::Geometry::Tensor* ) { return (is_tensor()); }
656  template<class T> bool is_type(T*) { return (false); }
657 
658  inline std::string get_data_type() { return (data_type_); }
659  // check whether it is of integer class
660  inline bool is_signed_integer() { return (is_char()||is_short()||is_int()); }
661  inline bool is_unsigned_integer() { return (is_unsigned_char()||is_unsigned_short()||is_unsigned_int()); }
662  inline bool is_integer() { return (is_signed_integer()||is_unsigned_integer()); }
663 
664  // Shortcuts to property manager
665  inline void copy_properties(VField* ifield)
666  {
667  if (pm_)
668  pm_->copy_properties(ifield->pm_);
669  }
670 
671  template<class T>
672  inline void set_property(const std::string &name, const T &val, bool is_transient)
673  {
674  if (pm_)
675  pm_->set_property(name,val,is_transient);
676  }
677 
678  template<class T>
679  inline bool get_property( const std::string &name, T &val)
680  {
681  if (pm_)
682  return(pm_->get_property(name,val));
683  return false;
684  }
685 
686  inline bool is_property( const std::string &name)
687  {
688  if (pm_)
689  return(pm_->is_property(name));
690  return false;
691  }
692 protected:
693 
694  // Pointers to structures to access the data virtually
695 
696  // Interface to Field
699 
700  // Add this one separately to avoid circular dependencies
702 
703  // Interface to the data in the field
706 
707  // Information from the basis
713 
715  bool is_pair_;
718  bool is_time_;
719 
720  std::string data_type_;
721 
722 };
723 
724 
725 }
726 
727 #endif
void gradient(StackVector< T, 3 > &val, const VMesh::coords_type &coords, VMesh::Edge::index_type idx) const
Different versions for different index types.
Definition: VField.h:583
bool is_type(unsigned int *)
Definition: VField.h:647
bool is_type(T *)
Definition: VField.h:656
Mesh * mesh_
Definition: VField.h:698
bool gradient(StackVector< T, 3 > &val, const Core::Geometry::Point &point, T def_value=(static_cast< T >(0))) const
Definition: VField.h:540
void get_evalue(T &val, index_type idx) const
Definition: VField.h:177
bool get_center(Core::Geometry::Point &p, index_type idx)
Definition: VField.h:148
void get_values(T *values, ARRAY &idx) const
Definition: VField.h:279
bool is_double()
Definition: VField.h:640
void set_values(const T *values, ARRAY &idx)
Definition: VField.h:266
void interpolate(T &val, const VMesh::coords_type &coords, VMesh::DElem::index_type idx) const
Definition: VField.h:509
void get_values(T *values, VMesh::Node::array_type nodes) const
Definition: VField.h:275
void interpolate(T &val, const VMesh::coords_type &coords, VMesh::Cell::index_type idx) const
Definition: VField.h:505
std::vector< ElemInterpolate > MultiElemInterpolate
Definition: VMesh.h:208
int basis_order_
Definition: VField.h:708
bool is_vector_
Definition: VField.h:716
bool value(T &val, VMesh::Cell::index_type idx) const
Definition: VField.h:206
void set_values(const std::vector< T > &values, ARRAY &idx)
Definition: VField.h:260
void minterpolate(ARRAY &val, const VMesh::coords_array_type &coords, VMesh::DElem::index_type idx) const
Definition: VField.h:520
Distinct type for elem index.
Definition: FieldVIndex.h:228
int element_dim_
Definition: VField.h:711
void get_weighted_value(T &val, index_array_type idx, weight_array_type w) const
Definition: VField.h:216
std::vector< StackVector< double, 3 > > coords_array_type
An array of coords.
Definition: VMesh.h:83
void set_value(const T &val, VMesh::Elem::index_type idx)
Definition: VField.h:238
void * efdata_pointer()
Definition: VField.h:607
bool is_cubicmesh()
Definition: VField.h:620
VMesh::weight_type weight_type
Definition: VField.h:81
bool is_constantmesh()
Definition: VField.h:616
FieldHandle field()
get a handle to the field
Definition: VField.h:92
void get_weighted_evalue(T &val, index_array_type idx, weight_array_type w) const
Definition: VField.h:220
void minterpolate(ARRAY &val, const VMesh::coords_array_type &coords, VMesh::Edge::index_type idx) const
Definition: VField.h:512
VMesh::size_type num_values()
get the number of values in the field (data at corner nodes of the elements)
Definition: VField.h:101
void get_weighted_evalue(T &val, const index_type *idx, const weight_type *w, size_type sz) const
Definition: VField.h:218
Definition: VMesh.h:212
void gradient(StackVector< T, 3 > &val, const VMesh::coords_type &coords, VMesh::Face::index_type idx) const
Definition: VField.h:585
void get_values(std::vector< T > &values, VMesh::Node::array_type nodes) const
Definition: VField.h:269
void get_evalues(std::vector< T > &values) const
Definition: VField.h:310
std::string get_data_type()
Definition: VField.h:658
bool is_longlong()
Definition: VField.h:637
void gradient(StackVector< T, 3 > &val, const VMesh::coords_type &coords, VMesh::index_type idx, T def_value=(static_cast< T >(0))) const
Definition: VField.h:526
bool is_time_
Definition: VField.h:718
VMesh * vmesh_
Definition: VField.h:704
VMesh::index_array_type index_array_type
Definition: VField.h:83
void set_values(const T *data, size_type sz, index_type offset=0)
Definition: VField.h:248
void get_values_dimension(dimension_type &dims)
Definition: VField.h:140
index_type elem_index
Definition: VMesh.h:198
bool is_vector()
Definition: VField.h:626
FieldHandle mesh()
Definition: BuildTDCSMatrixTests.cc:56
bool min(double &mn, index_type &idx)
Maximum and minimum of values (with index to see where maximum is located)
Definition: VField.h:361
bool is_long()
Definition: VField.h:635
Definition: Point.h:49
bool is_unsigned_longlong()
Definition: VField.h:638
#define SCISHARE
Definition: share.h:39
bool is_pair_
Definition: VField.h:715
void copy_values(VField *field)
Definition: VField.h:354
bool is_isomorphic()
Definition: VField.h:622
Definition: Mesh.h:45
void set_value(const T &val, VMesh::Edge::index_type idx)
Definition: VField.h:232
Distinct type for face index.
Definition: FieldVIndex.h:210
bool minmax(double &mn, double &mx) const
version of minmax without indices
Definition: VField.h:382
boost::shared_ptr< Mesh > MeshHandle
Definition: DatatypeFwd.h:67
bool is_property(const std::string &name)
Definition: VField.h:686
void copy_evalues(VField *field, INDEX1 idx1, INDEX2 idx2, size_type sz)
Same for edge values.
Definition: VField.h:346
void get_values(std::vector< T > &values, VMesh::Elem::array_type elems) const
Definition: VField.h:271
Distinct type for edge index.
Definition: FieldVIndex.h:200
VMesh * vmesh()
Definition: VField.h:89
void set_values(const std::vector< T > &values, VMesh::Node::array_type nodes)
Definition: VField.h:256
void set_values(const std::vector< T > &values)
Get/Set all values at once.
Definition: VField.h:246
Definition: StackBasedVector.h:47
Distinct type for elem index.
Definition: FieldVIndex.h:237
void mgradient(std::vector< StackVector< T, 3 > > &val, const std::vector< Core::Geometry::Point > &points, T def_value=(static_cast< T >(0))) const
Definition: VField.h:569
bool value(T &val, VMesh::Elem::index_type idx) const
Definition: VField.h:208
void mgradient(std::vector< StackVector< T, 3 > > &val, const VMesh::coords_array_type &coords, VMesh::index_type idx, T def_value=(static_cast< T >(0))) const
Definition: VField.h:533
virtual ~VField()
Definition: VField.h:72
list values
Definition: readAllFields.py:22
void get_value(T &val, VMesh::DElem::index_type idx) const
Definition: VField.h:189
bool minmax(double &mn, index_type &idxmn, double &mx, index_type idxmx) const
Combined min max for efficiency.
Definition: VField.h:373
void set_value(const T &val, index_type idx)
Definition: VField.h:226
Definition: VMesh.h:193
void set_property(const std::string &name, const T &val, bool is_transient)
Definition: VField.h:672
bool is_type(long *)
Definition: VField.h:648
void get_values(T *values, VMesh::Elem::array_type elems) const
Definition: VField.h:277
bool is_integer()
Definition: VField.h:662
void copy_weighted_evalue(VField *field, ARRAY idx, weight_array_type w, INDEX i) const
Definition: VField.h:293
Distinct type for node index.
Definition: FieldVIndex.h:181
bool is_nodata()
Definition: VField.h:609
void set_value(const T &val, VMesh::Node::index_type idx)
Definition: VField.h:230
void get_value(T &val, VMesh::Face::index_type idx) const
Definition: VField.h:183
void * get_values_pointer()
Definition: VField.h:603
Definition: Vector.h:63
Manage dynamic properties of persistent objects.
void copy_evalue(VField *field, INDEX1 idx1, INDEX2 idx2)
Same for edge values.
Definition: VField.h:332
void get_values(T *data, size_type sz, index_type offset=0) const
Definition: VField.h:252
void get_values(std::vector< T > &values, ARRAY &idx) const
Definition: VField.h:273
void minterpolate(ARRAY &val, const VMesh::coords_array_type &coords, VMesh::Elem::index_type idx) const
Definition: VField.h:518
bool is_tensor_
Definition: VField.h:717
virtual VMesh::size_type size()
Definition: VFData.cc:209
int element_dofs_
Definition: VField.h:712
void mgradient(std::vector< StackVector< T, 3 > > &val, const std::vector< Core::Geometry::Point > &points, T def_value, VMesh::MultiElemGradient &eg) const
Definition: VField.h:576
bool is_unsigned_short()
Definition: VField.h:632
void set_values(const T *values, VMesh::Elem::array_type elems)
Definition: VField.h:264
bool is_tensor()
Definition: VField.h:627
const char * name[]
Definition: BoostGraphExampleTests.cc:87
bool value(T &val, VMesh::Edge::index_type idx) const
Definition: VField.h:202
bool is_quadraticmesh()
Definition: VField.h:619
Distinct type for additional lagrangian node.
Definition: FieldVIndex.h:190
void copy_values(VField *field, INDEX1 idx1, INDEX2 idx2, size_type sz)
Definition: VField.h:338
void clear_all_values()
Definition: VField.h:299
void interpolate(T &val, const VMesh::coords_type &coords, VMesh::Elem::index_type idx) const
Definition: VField.h:507
Definition: VFData.h:86
VField()
Definition: VField.h:53
void copy_properties(VField *ifield)
Definition: VField.h:665
dictionary data
Definition: eabLatVolData.py:11
std::string data_type_
Definition: VField.h:720
double weight_type
Weights for interpolation.
Definition: VMesh.h:65
bool interpolate(T &val, const Core::Geometry::Point &point, T def_value=(static_cast< T >(0))) const
Definition: VField.h:466
bool get_property(const std::string &name, T &val)
Definition: VField.h:679
bool is_type(unsigned char *)
Definition: VField.h:643
void size(VMesh::ENode::size_type &sz)
Definition: VField.h:392
void set_evalues(const T *data, size_type sz, index_type offset=0)
Definition: VField.h:307
void copy_evalues(VField *field)
Definition: VField.h:357
bool min(double &mn)
Definition: VField.h:364
void get_value(T &val, VMesh::Edge::index_type idx) const
Definition: VField.h:181
bool is_lineardata()
Definition: VField.h:611
PropertyManager * pm_
Definition: VField.h:701
bool is_constantdata()
Definition: VField.h:610
Definition: Tensor.h:65
void interpolate(T &val, const VMesh::coords_type &coords, VMesh::index_type idx, T def_value=(static_cast< T >(0))) const
Definition: VField.h:435
Definition: Field.h:41
virtual VMesh * vmesh()
Definition: Mesh.cc:413
bool is_cubicdata()
Definition: VField.h:614
bool is_type(float *)
Definition: VField.h:653
void get_value(T &val, VMesh::Cell::index_type idx) const
Definition: VField.h:185
void set_evalue(const T &val, index_type idx)
Definition: VField.h:228
void update_mesh_pointer(Mesh *mesh)
internal function - this one may change in the future
Definition: VField.h:595
void resize_values()
Definition: VField.h:138
void set_all_values(const T val)
Set all values to a specific value.
Definition: VField.h:283
bool is_scalar_
Definition: VField.h:714
int number_of_enodes_
Definition: VField.h:710
void minterpolate(ARRAY &val, const VMesh::coords_array_type &coords, VMesh::Cell::index_type idx) const
Definition: VField.h:516
void copy_value(VField *field, INDEX1 idx1, INDEX2 idx2)
Definition: VField.h:325
void minterpolate(ARRAY &val, const std::vector< Core::Geometry::Point > &points, DATA def_value, VMesh::MultiElemInterpolate &ei) const
Definition: VField.h:456
void copy_weighted_value(VField *field, ARRAY idx, weight_array_type w, INDEX i) const
Definition: VField.h:289
void size(VMesh::Node::size_type &sz)
Definition: VField.h:391
void get_value(T &val, index_type idx) const
Definition: VField.h:173
bool is_unsigned_integer()
Definition: VField.h:661
void get_value(T &val, VMesh::Elem::index_type idx) const
Definition: VField.h:187
bool is_nonlineardata()
Definition: VField.h:612
bool is_type(short *)
Definition: VField.h:644
bool is_linearmesh()
Definition: VField.h:617
Field * field_
Definition: VField.h:697
bool is_char()
Definition: VField.h:629
VFData * vfdata_
Definition: VField.h:705
bool is_type(unsigned short *)
Definition: VField.h:645
void minterpolate(ARRAY &val, const VMesh::coords_array_type &coords, VMesh::index_type idx) const
Definition: VField.h:425
void * get_evalues_pointer()
Definition: VField.h:604
bool is_nonlinearmesh()
Definition: VField.h:618
bool is_unsigned_long()
Definition: VField.h:636
bool is_float()
Definition: VField.h:639
bool is_pair()
Definition: VField.h:625
bool is_type(unsigned long long *)
Definition: VField.h:651
bool max(double &mx) const
Definition: VField.h:369
bool is_type(Core::Geometry::Tensor *)
Definition: VField.h:655
VField * vfield()
for completeness get a pointer to itself
Definition: VField.h:94
bool is_signed_integer()
Definition: VField.h:660
Distinct type for cell index.
Definition: FieldVIndex.h:219
void interpolate(T &val, const VMesh::coords_type &coords, VMesh::Face::index_type idx) const
Definition: VField.h:503
VMesh::size_type size_type
Definition: VField.h:79
void * fdata_pointer()
Definition: VField.h:606
void set_value(const T &val, VMesh::DElem::index_type idx)
Definition: VField.h:240
bool is_int()
Definition: VField.h:633
void interpolate(T &val, const VMesh::coords_type &coords, VMesh::Edge::index_type idx) const
Definition: VField.h:501
long long index_type
Definition: Types.h:39
int basis_order()
Definition: VField.h:98
void get_values(std::vector< T > &values) const
Definition: VField.h:250
void gradient(StackVector< T, 3 > &val, const VMesh::coords_type &coords, VMesh::Elem::index_type idx) const
Definition: VField.h:589
bool gradient(StackVector< T, 3 > &val, const Core::Geometry::Point &point, T def_value, VMesh::ElemGradient &eg) const
Definition: VField.h:555
void get_evalues(T *data, size_type sz, index_type offset=0) const
Definition: VField.h:316
bool is_unsigned_int()
Definition: VField.h:634
void copy_weighted_value(VField *field, index_type *idx, weight_type *w, size_type sz, INDEX i) const
Functions for getting a weighted value.
Definition: VField.h:287
bool max(double &mx, index_type &idx) const
Definition: VField.h:367
VMesh::weight_array_type weight_array_type
Definition: VField.h:84
bool is_scalar()
Definition: VField.h:624
void get_value(T &val, VMesh::Node::index_type idx) const
Definition: VField.h:179
boost::shared_ptr< Field > FieldHandle
Definition: DatatypeFwd.h:65
void minterpolate(ARRAY &val, const std::vector< Core::Geometry::Point > &points, DATA def_value=(static_cast< DATA >(0))) const
Definition: VField.h:446
void set_values(const T *values, VMesh::Node::array_type nodes)
Definition: VField.h:262
bool is_type(double *)
Definition: VField.h:652
bool is_unsigned_char()
Definition: VField.h:630
void gradient(StackVector< T, 3 > &val, const VMesh::coords_type &coords, VMesh::DElem::index_type idx) const
Definition: VField.h:591
bool is_type(char *)
Definition: VField.h:642
Definition: VField.h:46
void set_value(const T &val, VMesh::Face::index_type idx)
Definition: VField.h:234
bool is_type(Core::Geometry::Vector *)
Definition: VField.h:654
void copy_weighted_evalue(VField *field, index_type *idx, weight_type *w, size_type sz, INDEX i) const
Definition: VField.h:291
bool is_type(long long *)
Definition: VField.h:650
void gradient(StackVector< T, 3 > &val, const VMesh::coords_type &coords, VMesh::Cell::index_type idx) const
Definition: VField.h:587
bool is_type(unsigned long *)
Definition: VField.h:649
bool is_short()
Definition: VField.h:631
bool value(T &val, VMesh::DElem::index_type idx) const
Definition: VField.h:210
bool value(T &val, VMesh::Node::index_type idx) const
Definition: VField.h:200
void resize_fdata()
resize the data fields to match the number of nodes/edges in the mesh
Definition: VField.h:106
void set_evalues(const std::vector< T > &values)
Definition: VField.h:305
void get_weighted_value(T &val, const index_type *idx, const weight_type *w, size_type sz) const
Functions for getting a weighted value.
Definition: VField.h:214
VMesh::size_type num_evalues()
get the number of edge values in the field (for quadratic approximation)
Definition: VField.h:103
VMesh::coords_type coords_type
Definition: VField.h:80
void set_values(const std::vector< T > &values, VMesh::Elem::array_type elems)
Definition: VField.h:258
#define DEBUG_CONSTRUCTOR(type)
Definition: Debug.h:64
bool value(T &val, VMesh::Face::index_type idx) const
Definition: VField.h:204
MeshHandle mesh()
mesh() and vmesh() get the handle to the mesh and its virtual interface
Definition: VField.h:88
std::vector< size_type > dimension_type
Definition: VMesh.h:76
int number_of_nodes_
Definition: VField.h:709
bool interpolate(T &val, const Core::Geometry::Point &point, T def_value, VMesh::ElemInterpolate &ei) const
Definition: VField.h:482
Mesh::size_type size_type
Definition: VMesh.h:68
Definition: PropertyManager.h:193
void set_value(const T &val, VMesh::ENode::index_type idx)
Definition: VField.h:242
int dofs()
number of degree of freedoms in each element type in the mesh
Definition: VField.h:397
Definition: VMesh.h:53
VMesh::dimension_type dimension_type
Definition: VField.h:85
void interpolate(Core::Geometry::Point &val, const VMesh::coords_type &coords, VMesh::index_type idx) const
Definition: VField.h:495
bool is_type(int *)
Definition: VField.h:646
VMesh::index_type index_type
Import a couple of useful typedefs from VMesh.
Definition: VField.h:78
bool is_quadraticdata()
Definition: VField.h:613
void minterpolate(ARRAY &val, const VMesh::coords_array_type &coords, VMesh::index_type idx, DATA def_value) const
Definition: VField.h:413
index_type elem_index
Definition: VMesh.h:217
Mesh::index_type index_type
VIRTUAL INTERFACE.
Definition: VMesh.h:63
void get_value(T &val, VMesh::ENode::index_type idx) const
Definition: VField.h:191
void minterpolate(ARRAY &val, const VMesh::coords_array_type &coords, VMesh::Face::index_type idx) const
Definition: VField.h:514
std::vector< ElemGradient > MultiElemGradient
Multiple gradient calculations in parallel.
Definition: VMesh.h:229
#define DEBUG_DESTRUCTOR(type)
Definition: Debug.h:65
int dimension()
dimensions of the element 0 .. 3
Definition: VField.h:395
bool value(T &val, index_type idx) const
Definition: VField.h:198
void set_value(const T &val, VMesh::Cell::index_type idx)
Definition: VField.h:236