SheafSystem  0.0.0.0
sec_vd.h
Go to the documentation of this file.
1 
2 //
3 // Copyright (c) 2014 Limit Point Systems, Inc.
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
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 
20 
21 #ifndef SEC_VD_H
22 #define SEC_VD_H
23 
24 #ifndef SHEAF_DLL_SPEC_H
25 #include "SheafSystem/sheaf_dll_spec.h"
26 #endif
27 
28 #ifndef SEC_TUPLE_H
29 #include "SheafSystem/sec_tuple.h"
30 #endif
31 
32 #ifndef AT0_H
33 #include "SheafSystem/at0.h"
34 #endif
35 
36 namespace fiber_bundle
37 {
38 
39 class at0;
40 class at0_lite;
41 class chart_point;
42 class sec_at0;
43 class sec_vd_space;
44 class vd;
45 class vd_lite;
46 
47 //==============================================================================
48 // CLASS SEC_VD
49 //==============================================================================
50 
54 class SHEAF_DLL_SPEC sec_vd : public sec_tuple
55 {
56 
57  // ===========================================================
59  // ===========================================================
61 
62 public:
63 
65 
70 
74  typedef vd fiber_type;
75 
81 
87 
92 
97 
103  static host_type& new_host(namespace_type& xns,
104  const poset_path& xhost_path,
105  const poset_path& xschema_path,
106  const poset_path& xscalar_space_path,
107  bool xauto_access);
108 
109 protected:
110 
111 private:
112 
114 
115 
116  //============================================================================
118  //============================================================================
120 
121 public:
122 
126  sec_vd();
127 
132  sec_vd(const sec_rep_space* xhost, pod_index_type xhub_id);
133 
138  sec_vd(const sec_rep_space* xhost, const scoped_index& xid);
139 
144  sec_vd(const sec_rep_space* xhost, const std::string& xname);
145 
150  sec_vd(const namespace_poset* xnamespace,
151  const poset_path& xpath,
152  bool xauto_access = true);
153 
157  explicit sec_vd(sec_rep_space_member* xother);
158 
162  sec_vd(sec_rep_space* xhost,
163  section_dof_map* xdof_map = 0,
164  bool xauto_access = true);
165 
171  sec_vd(sec_rep_space* xhost,
172  abstract_poset_member& xbase_mbr,
173  int xbase_version = CURRENT_HOST_VERSION,
174  bool xauto_access = true);
175 
179  virtual sec_vd& operator=(const abstract_poset_member& xother);
180 
184  sec_vd& operator=(const sec_vd& xother);
185 
189  sec_vd& operator=(const vd& xfiber);
190 
194  sec_vd& operator=(const vd_lite& xfiber);
195 
199  ~sec_vd();
200 
204  bool fiber_is_ancestor_of(const any* xother) const;
205 
209  virtual const fiber_type& fiber_prototype() const;
210 
214  virtual int d() const;
215 
219  virtual int d(bool xauto_access) const;
220 
224  poset_path scalar_space_path() const;
225 
229  poset_path scalar_space_path(bool xauto_access) const;
230 
234  virtual bool is_vector(bool xauto_access) const;
235 
239  virtual void put_is_vector(bool xauto_access);
240 
244  virtual bool is_covector(bool xauto_access) const;;
245 
249  virtual void put_is_covector(bool xauto_access);
250 
254  scalar_type* comp(int i) const;
255 
259  void set_comp(int i, scalar_type* xcomponent);
260 
264  vd* value_at_point(const chart_point& xpt, bool xauto_access = true) const;
265 
269  virtual void value_at_point_pa(const chart_point& xpt,
270  vd& xresult,
271  bool xauto_access = true) const;
272 
276  virtual void value_at_point_ua(const chart_point& xpt,
277  value_type* xresult,
278  size_type xresult_ub,
279  bool xauto_access = true) const;
280 
284  virtual int dof_packet_ub();
285 
289  void dof_tuple(dof_type* xbuf, int xbuflen) const;
290 
295  sec_vd* deep_copy(bool xauto_access);
296 
300  void deep_copy(sec_vd& xother, bool xauto_access);
301 
302 protected:
303 
308  virtual sec_tuple::scalar_type* new_comp();
309 
310 private:
311 
313 
314  //============================================================================
316  //============================================================================
318 
319 public:
320 
321 protected:
322 
323 private:
324 
326 
327 
328  //============================================================================
330  //============================================================================
332 
338  sec_vd* unify(bool xauto_access);
339 
345  void unify(sec_vd& xresult, bool xauto_access);
346 
347 protected:
348 
349 private:
350 
352 
353  //============================================================================
355  //============================================================================
357 
358 public:
359 
360  using sec_tuple::get_fiber;
361 
365  void get_fiber(pod_index_type xdisc_id, vd_lite& xfiber) const;
366 
370  void get_fiber(const scoped_index& xdisc_id, vd_lite& xfiber, bool xauto_access) const;
371 
372  using sec_tuple::put_fiber;
373 
377  void put_fiber(pod_index_type xdisc_id, const vd_lite& xfiber);
378 
382  void put_fiber(const scoped_index& xdisc_id, const vd_lite& xfiber, bool xauto_access);
383 
385 
389  void force_fiber(pod_index_type xdisc_id, const vd_lite& xfiber);
390 
394  void force_fiber(const scoped_index& xdisc_id, const vd_lite& xfiber, bool xauto_access);
395 
396 protected:
397 
398 private:
399 
401 
402  //============================================================================
404  //============================================================================
406 
407 public:
408 
412  virtual const std::string& class_name() const;
413 
417  static const std::string& static_class_name();
418 
422  virtual sec_vd* clone() const;
423 
429  inline sec_vd* clone(bool xnew_state, bool xauto_access = true) const
430  {
431  return static_cast<sec_vd*>(sec_tuple::clone(xnew_state, xauto_access));
432  }
433 
434 protected:
435 
436 private:
437 
439 
440 
441  // ===========================================================
443  // ===========================================================
445 
446 public:
447 
451  host_type* host() const;
452 
456  virtual bool host_is_ancestor_of(const poset_state_handle* other) const;
457 
458 protected:
459 
460 private:
461 
463 
464 
465  //============================================================================
467  //============================================================================
469 
470 public:
471 
475  bool is_ancestor_of(const any* xother) const;
476 
480  bool invariant() const;
481 
482 protected:
483 
484 private:
485 
487 
488 }; // end of class sec_vd
489 
490 
491 //==============================================================================
492 // NON-MEMBER CLASSES
493 //==============================================================================
494 
495 //==============================================================================
496 // TENSOR SECTION TRAITS
497 //==============================================================================
498 
499 // Forward declarations needed for specialization:
500 
501 class sec_tp;
502 class sec_t2;
503 class sec_t3;
504 class sec_t4;
505 class sec_atp;
506 class sec_at2;
507 class sec_at3;
508 class sec_stp;
509 class sec_st2;
510 class sec_st3;
511 class sec_st4;
512 
518 template <int P, typename VECTOR_TYPE>
520 {
521 public:
525  typedef void tp_type;
526 
530  typedef void atp_type;
531 
535  typedef void stp_type;
536 };
537 
541 template <int P>
543 {
544 public:
548  typedef sec_tp tp_type;
549 
553  typedef sec_atp atp_type;
554 
558  typedef sec_stp stp_type;
559 };
560 
564 template <>
566 {
567 public:
571  typedef at0 tp_type;
572 
576  typedef at0 atp_type;
577 
581  typedef at0 stp_type;
582 };
583 
587 template <>
589 {
590 public:
594  typedef sec_vd tp_type;
595 
599  typedef sec_vd atp_type;
600 
604  typedef sec_vd stp_type;
605 };
606 
610 template <>
612 {
613 public:
617  typedef sec_t2 tp_type;
618 
622  typedef sec_at2 atp_type;
623 
627  typedef sec_st2 stp_type;
628 };
629 
633 template <>
635 {
636 public:
640  typedef sec_t3 tp_type;
641 
645  typedef sec_at3 atp_type;
646 
650  typedef sec_st3 stp_type;
651 };
652 
656 template <>
658 {
659 public:
663  typedef sec_t4 tp_type;
664 
668  typedef void atp_type;
669  //typedef sec_at4 atp_type;
670 
674  typedef sec_st4 stp_type;
675 };
676 
677 //==============================================================================
678 // NON-MEMBER FUNCTIONS
679 //==============================================================================
680 
685 SHEAF_DLL_SPEC size_t deep_size(const sec_vd& x0, bool xinclude_shallow = true);
686 
691 namespace sec_vd_algebra
692 {
693 
697 SHEAF_DLL_SPEC void add(const sec_vd& x0, const sec_vd& x1, sec_vd& xresult,
698  bool xauto_access);
699 
704 SHEAF_DLL_SPEC void add_equal(sec_vd& xresult, const sec_vd& xother, bool xauto_access);
705 
709 SHEAF_DLL_SPEC void subtract(const sec_vd& x0, const sec_vd& x1, sec_vd& xresult,
710  bool xauto_access);
711 
716 SHEAF_DLL_SPEC void subtract_equal(sec_vd& xresult, const sec_vd& xother, bool xauto_access);
717 
718 #ifndef DOXYGEN_1_5_4_SKIP_UNKNOWN
719 
723 SHEAF_DLL_SPEC void multiply(const sec_vd& x0, const sec_at0& x1, sec_vd& xresult,
724  bool xauto_access);
725 
726 #endif // ifndef DOXYGEN_1_5_4_SKIP_UNKNOWN
727 
732 SHEAF_DLL_SPEC void multiply_equal(sec_vd& xresult, const sec_at0& xother, bool xauto_access);
733 
734 #ifndef DOXYGEN_1_5_4_SKIP_UNKNOWN
735 
739 SHEAF_DLL_SPEC void multiply(const sec_vd& x0, const vd_value_type& x1, sec_vd& xresult,
740  bool xauto_access);
741 
742 #endif // ifndef DOXYGEN_1_5_4_SKIP_UNKNOWN
743 
748 SHEAF_DLL_SPEC void multiply_equal(sec_vd& xresult, const vd_value_type& xother,
749  bool xauto_access);
750 
754 SHEAF_DLL_SPEC void divide(const sec_vd& x0, const sec_at0& x1, sec_vd& xresult,
755  bool xauto_access);
756 
761 SHEAF_DLL_SPEC void divide_equal(sec_vd& xresult, const sec_at0& xother, bool xauto_access);
762 
766 SHEAF_DLL_SPEC void divide(const sec_vd& x0, const vd_value_type& x1, sec_vd& xresult,
767  bool xauto_access);
768 
773 SHEAF_DLL_SPEC void divide_equal(sec_vd& xresult, const vd_value_type& xother,
774  bool xauto_access);
775 
780 SHEAF_DLL_SPEC void contract(const sec_vd& xvector, const sec_vd& xcovector, sec_at0& xresult,
781  bool xauto_access);
782 
783 //==============================================================================
784 
785 #ifndef DOXYGEN_1_5_4_SKIP_UNKNOWN
786 
790 SHEAF_DLL_SPEC void max(const sec_vd& x0, vd_lite& xresult, bool xauto_access);
791 
795 SHEAF_DLL_SPEC vd_lite* max(const sec_vd& x0, bool xauto_access);
796 
800 SHEAF_DLL_SPEC void min(const sec_vd& x0, vd_lite& xresult, bool xauto_access);
801 
805 SHEAF_DLL_SPEC vd_lite* min(const sec_vd& x0, bool xauto_access);
806 
807 #endif // ifndef DOXYGEN_1_5_4_SKIP_UNKNOWN
808 
812 SHEAF_DLL_SPEC void extrema(const sec_vd& x0, vd_lite& xmin, vd_lite& xmax, bool xauto_access);
813 
817 
821 SHEAF_DLL_SPEC void extrema(const sec_vd& x0,
822  sec_vd_value_type xmin[], size_type xmin_ub,
823  sec_vd_value_type xmax[], size_type xmax_ub);
824 
825 //==============================================================================
826 
827 #ifndef DOXYGEN_1_5_4_SKIP_UNKNOWN
828 
833 SHEAF_DLL_SPEC void assign(sec_vd& x0, const sec_vd& x1, bool xauto_access);
834 
838 SHEAF_DLL_SPEC void assign(sec_vd& x0, const vd_lite& x1, bool xauto_access);
839 
843 SHEAF_DLL_SPEC void assign(sec_vd& x0, const vd_value_type& xvalue, bool xauto_access);
844 
845 #endif // ifndef DOXYGEN_1_5_4_SKIP_UNKNOWN
846 
847 
848 //==============================================================================
849 // BINARY AND UNARY OPERATORS.
850 //==============================================================================
851 
855 template <typename S0, typename S1, typename SR, typename F>
856 void binary_op(const S0& x0, const S1& x1, SR& xresult, F xfunctor,
857  bool xauto_access);
858 
862 template <typename S0, typename SR, typename F>
863 void binary_op(const S0& x0, const vd_value_type& x1, SR& xresult, F xfunctor,
864  bool xauto_access);
865 
869 template <typename S0, typename SR, typename F>
870 void unary_op(const S0& x0, SR& xresult, F xfunctor,
871  bool xauto_access);
872 
876 template <typename S0, typename F>
877 void unary_op(S0& x0, const vd_value_type& x1, F xfunctor,
878  bool xauto_access);
879 
883 template <typename S0, typename SR, typename F>
884 void unary_op(const S0& x0, SR& xresult1, SR& xresult2, F xfunctor,
885  bool xauto_access);
886 
887 } // namespace sec_vd_algebra
888 
889 } // namespace fiber_bundle
890 
891 #endif // ifndef SEC_VD_H
892 
void get_fiber(pod_index_type xdisc_id, void *xfiber, size_type xfiber_size) const
Sets xfiber to the fiber referred to by discretization id xdisc_id.
double chart_point_coord_type
The type of local coordinate in the base space; the scalar type for the local coordinate vector space...
Definition: fiber_bundle.h:57
void put_fiber(pod_index_type xdisc_id, const void *xfiber, size_type xfiber_size)
Sets the fiber referred to by discretization id xdisc_id to xfiber.
sec_vd tp_type
Type of general tensor of degree 1 over sec_vd.
Definition: sec_vd.h:594
virtual sec_tuple * clone() const
Make a new handle, no state instance of current.
Definition: sec_tuple.cc:429
void atp_type
Type of antisymmetric tensor of degree P over VECTOR_TYPE.
Definition: sec_vd.h:530
sec_vd * clone(bool xnew_state, bool xauto_access=true) const
Make a new handle instance of current. Attach the new instance to a new state if xnew_state is true...
Definition: sec_vd.h:429
at0 stp_type
Type of symmetric tensor of degree 0 over sec_vd.
Definition: sec_vd.h:581
The abstract map from section dof ids to section dof values of heterogeneous type.
SHEAF_DLL_SPEC vd_lite * max(const sec_vd &x0, bool xauto_access)
Maximum (auto-allocated version).
Definition: sec_vd.cc:1933
A section of a bundle with fiber type tuple.
Definition: sec_tuple.h:53
The default name space; a poset which contains other posets as members.
SHEAF_DLL_SPEC void divide_equal(sec_vd &xresult, const vd_value_type &xother, bool xauto_access)
xresult divide_equal xresult (pre-allocated version); synonym for divide(xresult, xresult...
Definition: sec_vd.cc:1807
The standard fiber bundles name space; extends the standard sheaves namespace by defining base space...
sec_at3 atp_type
Type of antisymmetric tensor of degree 3 over sec_vd.
Definition: sec_vd.h:645
A client handle for a general, abstract partially order set.
SHEAF_DLL_SPEC void subtract_equal(sec_vd &xresult, const sec_vd &xother, bool xauto_access)
x0 subtract_equal x1 (self-allocated version); synonym for subtract(xresult, xother, xresult, xauto_access).
Definition: sec_vd.cc:1731
SHEAF_DLL_SPEC void extrema(const sec_vd &x0, sec_vd_value_type xmin[], size_type xmin_ub, sec_vd_value_type xmax[], size_type xmax_ub)
$$SCRIBBLE This function is called from point_locator::update_domain in Shell_components. We continue to provide it here until we can eliminate it.
Definition: sec_vd.cc:2059
sec_atp atp_type
Type of antisymmetric tensor of degree P over sec_vd.
Definition: sec_vd.h:553
sec_stp stp_type
Type of symmetric tensor of degree P over sec_vd.
Definition: sec_vd.h:558
A path defined by a poset name and a member name separated by a forward slash (&#39;/&#39;). For example: "cell_definitions/triangle".
Definition: poset_path.h:48
A member of a sec_rep_space; a section.
sec_vd atp_type
Type of antisymmetric tensor of degree 1 over sec_vd.
Definition: sec_vd.h:599
A point in chart space.
Definition: chart_point.h:52
sec_vd stp_type
Type of symmetric tensor of degree 1 over sec_vd.
Definition: sec_vd.h:604
An abstract vector section space of dimension d.
Definition: sec_vd_space.h:52
chart_point_coord_type coord_type
The type of local coordinate; the scalar type for the local coordinate vector space.
Definition: sec_vd.h:80
sec_st3 stp_type
Type of symmetric tensor of degree 3 over sec_vd.
Definition: sec_vd.h:650
SHEAF_DLL_SPEC void assign(sec_vd &x0, const vd_value_type &xvalue, bool xauto_access)
Assignment to a scalar constant.
Definition: sec_vd.cc:2331
A section of a bundle with fiber type t3.
Definition: sec_t3.h:46
sec_vd_value_type value_type
The type of component in the value; the scalar type in the fiber space.
Definition: sec_vd.h:86
Abstract base class with useful features for all objects.
Definition: any.h:39
Abstract vector space over dof_type (volatile version).
Definition: vd.h:111
sec_at2 atp_type
Type of antisymmetric tensor of degree 2 over sec_vd.
Definition: sec_vd.h:622
SHEAF_DLL_SPEC void subtract(const sec_vd &x0, const sec_vd &x1, sec_vd &xresult, bool xauto_access)
x0 subtract x1 (pre-allocated version).
Definition: sec_vd.cc:1568
sec_st4 stp_type
Type of symmetric tensor of degree 4 over sec_vd.
Definition: sec_vd.h:674
SHEAF_DLL_SPEC void multiply(const sec_vd &x0, const vd_value_type &x1, sec_vd &xresult, bool xauto_access)
x0 multiplied by x1 (a constant) (pre-allocated version).
Definition: sec_vd.cc:1628
An index within the external ("client") scope of a given id space.
Definition: scoped_index.h:116
SHEAF_DLL_SPEC void add_equal(sec_vd &xresult, const sec_vd &xother, bool xauto_access)
x0 add_equal x1 (self-allocated version); synonym for add(xresult, xother, xresult, xauto_access).
Definition: sec_vd.cc:1711
A section of a bundle with fiber type at2.
Definition: sec_at2.h:46
A section of a bundle with fiber type atp.
Definition: sec_atp.h:48
A scalar viewed as an antisymmetric tensor of degree 0. As the degree is 0 there is nothing to be sym...
Definition: at0.h:424
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
Definition: sheaf.h:52
Tensor types of degree P over VECTOR_TYPE. Must be specialized for every supported combination of VEC...
Definition: sec_vd.h:519
sec_t4 tp_type
Type of general tensor of degree 4 over sec_vd.
Definition: sec_vd.h:663
A section of a bundle with fiber type st2.
Definition: sec_st2.h:46
void atp_type
Type of antisymmetric tensor of degree 4 over sec_vd.
Definition: sec_vd.h:668
A section of a bundle with fiber type stp.
Definition: sec_stp.h:48
sec_st2 stp_type
Type of symmetric tensor of degree 2 over sec_vd.
Definition: sec_vd.h:627
void unary_op(const S0 &x0, SR &xresult1, SR &xresult2, F xfunctor, bool xauto_access)
Unary operator (has 2 return sections).
Definition: sec_vd.impl.h:357
A section of a bundle with fiber type t4.
Definition: sec_t4.h:46
A section of a bundle with fiber type at3.
Definition: sec_at3.h:46
sec_at0 scalar_type
The scalar type in the section space.
Definition: sec_vd.h:96
sec_t2 tp_type
Type of general tensor of degree 2 over sec_vd.
Definition: sec_vd.h:617
sec_vd_space host_type
Typedefs:
Definition: sec_vd.h:69
A section of a bundle with fiber type st3.
Definition: sec_st3.h:46
SHEAF_DLL_SPEC tensor_variance contract(const tensor_variance &x0, int xp, int xq)
The variance of the contration of a tensor with variance x0 on indices xp and xq. ...
void force_fiber(pod_index_type xdisc_id, const void *xfiber, size_type xfiber_size)
Sets the fiber referred to by discretization id xdisc_id to xfiber; reallocates dof map memory if nec...
SHEAF_DLL_SPEC void add(const sec_vd &x0, const sec_vd &x1, sec_vd &xresult, bool xauto_access)
x0 add x1 (pre-allocated version).
Definition: sec_vd.cc:1536
A section of a fiber bundle with a d-dimensional vector space fiber.
Definition: sec_vd.h:54
void binary_op(const S0 &x0, const vd_value_type &x1, SR &xresult, F xfunctor, bool xauto_access)
Binary operator.
Definition: sec_vd.impl.h:141
void stp_type
Type of symmetric tensor of degree P over VECTOR_TYPE.
Definition: sec_vd.h:535
vd fiber_type
The fiber type.
Definition: sec_vd.h:74
A section of a bundle with fiber type tp.
Definition: sec_t2.h:46
SHEAF_DLL_SPEC void multiply_equal(sec_vd &xresult, const vd_value_type &xother, bool xauto_access)
xresult multiply_equal xresult (pre-allocated version); synonym for multiply(xresult, xother, xresult, xauto_access).
Definition: sec_vd.cc:1769
int_type pod_index_type
The plain old data index type.
Definition: pod_types.h:49
sec_vd_dof_type dof_type
The type of degree of freedom.
Definition: sec_vd.h:91
sec_tp tp_type
Type of general tensor of degree P over sec_vd.
Definition: sec_vd.h:548
A section of a bundle with fiber type st4.
Definition: sec_st4.h:46
at0 atp_type
Type of antisymmetric tensor of degree 0 over sec_vd.
Definition: sec_vd.h:576
An abstract client handle for a member of a poset.
SHEAF_DLL_SPEC vd_lite * min(const sec_vd &x0, bool xauto_access)
Minimum (auto-allocated version).
Definition: sec_vd.cc:2035
double sec_vd_dof_type
The type of degree of freedom in the section space.
Definition: fiber_bundle.h:78
at0 tp_type
Type of general tensor of degree 0 over sec_vd.
Definition: sec_vd.h:571
Namespace for the fiber_bundles component of the sheaf system.
vd_value_type sec_vd_value_type
The type of component in the value of a section at a point.
Definition: fiber_bundle.h:73
SHEAF_DLL_SPEC void divide(const sec_vd &x0, const vd_value_type &x1, sec_vd &xresult, bool xauto_access)
x0 divided by x1 (a constant) (pre-allocated version).
Definition: sec_vd.cc:1682
Abstract vector space over dof_type.
Definition: vd.h:350
Antisymetric tensor of degree 0. As the degree is 0 there is nothing to be symmetric or antisymmetric...
Definition: sec_at0.h:51
double vd_value_type
The type of component in the fiber; the scalar type in the fiber vector space.
Definition: fiber_bundle.h:63
A section of a bundle with fiber type tp.
Definition: sec_tp.h:49
sec_t3 tp_type
Type of general tensor of degree 3 over sec_vd.
Definition: sec_vd.h:640
void tp_type
Type of general tensor of degree P over VECTOR_TYPE.
Definition: sec_vd.h:525
A handle for a poset whose members are numerical representations of sections of a fiber bundle...
Definition: sec_rep_space.h:61