SheafSystem  0.0.0.0
e4.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 E4_H
22 #define E4_H
23 
24 #ifndef SHEAF_DLL_SPEC_H
25 #include "SheafSystem/sheaf_dll_spec.h"
26 #endif
27 
28 #ifndef ED_H
29 #include "SheafSystem/ed.h"
30 #endif
31 
32 namespace fiber_bundle
33 {
34 
35 //==============================================================================
36 // CLASS E4_ROW_DOFS_TYPE
37 //==============================================================================
38 
42 template <typename T>
44 {
45 public:
46 
50  typedef T dof_type;
51 
56 
60  static const std::string& static_class_name();
61 
65  static int d();
66 
71  T& operator[] (int xindex);
72 
77  const T& operator[] (int xindex) const;
78 
82  e4_row_dofs_type<T>* clone() const;
83 
88  e4_row_dofs_type<T>* clone(bool xnew_state, bool xauto_access) const
89  {
90  return clone();
91  }
92 
96  T components[4];
97 
98 protected:
99 private:
100 
101 };
102 
103 //==============================================================================
104 // CLASS E4_LITE
105 //==============================================================================
106 
111 class SHEAF_DLL_SPEC e4_lite : public ed_lite
112 {
113  //============================================================================
115  //============================================================================
117 
118 public:
119 
120  // Typedefs:
121 
126 
130  e4_lite();
131 
135  e4_lite(const e4_lite& xother);
136 
140  e4_lite& operator=(const e4_lite& xother);
141 
145  virtual ~e4_lite();
146 
150  e4_lite(const row_dofs_type& xrow_dofs);
151 
155  e4_lite& operator=(const row_dofs_type& xrow_dofs);
156 
160  e4_lite(const value_type& x0,
161  const value_type& x1,
162  const value_type& x2,
163  const value_type& x3);
164 
169  operator row_dofs_type& ();
170 
175  operator const row_dofs_type& () const;
176 
178 
182  virtual void put_components(const value_type& x0,
183  const value_type& x1,
184  const value_type& x2,
185  const value_type& x3);
186 
187 
188 protected:
189 
193  row_dofs_type _row_dofs;
194 
195 private:
196 
198 
199 
200  //============================================================================
202  //============================================================================
204 
205 public:
206 protected:
207 private:
208 
210 
211 
212  //============================================================================
214  //============================================================================
216 
217 public:
218 protected:
219 private:
220 
222 
223 
224  //============================================================================
226  //============================================================================
228 
229 public:
230 protected:
231 private:
232 
234 
235 
236  //============================================================================
238  //============================================================================
240 
241 public:
242 
247 
251  virtual int dd() const;
252 
253 protected:
254 private:
255 
257 
258 
259  //============================================================================
261  //============================================================================
263 
264 public:
265 
269  bool operator==(const e4_lite& xother) const;
270 
275  static const tp_lite& static_tp_prototype(int xp);
276 
281  virtual const tp_lite& tp_prototype(int xp) const;
282 
287  static const atp_lite& static_atp_prototype(int xp);
288 
293  virtual const atp_lite& atp_prototype(int xp) const;
294 
299  static const stp_lite& static_stp_prototype(int xp);
300 
305  virtual const stp_lite& stp_prototype(int xp) const;
306 
307 
308 protected:
309 private:
310 
312 
313 
314  //============================================================================
316  //============================================================================
318 
319 public:
320 protected:
321 private:
322 
324 
325 
326  //============================================================================
328  //============================================================================
330 
331 public:
332 
336  virtual const std::string& class_name() const;
337 
341  static const std::string& static_class_name();
342 
346  virtual e4_lite* clone() const;
347 
352  virtual e4_lite* clone(bool xnew_state, bool xauto_access) const
353  {
354  return clone();
355  }
356 
357 protected:
358 private:
359 
361 
362 
363  //============================================================================
365  //============================================================================
367 
368 public:
369 
373  virtual bool is_ancestor_of(const any_lite& xother) const;
374 
378  bool invariant() const;
379 
383  virtual void* row_dofs();
384 
388  virtual const void* row_dofs() const;
389 
390 protected:
391 private:
392 
394 };
395 
396 
397 //==============================================================================
398 // CLASS E4
399 //==============================================================================
400 
401 class tp_space;
402 class tp;
403 class atp;
404 class stp;
405 
410 class SHEAF_DLL_SPEC e4 : public ed
411 {
412 
413  // ===========================================================
415  // ===========================================================
417 
418 public:
419 
423  static const poset_path& standard_schema_path();
424 
428  static void make_standard_schema(namespace_poset& xns);
429 
435  static host_type& new_host(namespace_type& xns,
436  const poset_path& xhost_path,
437  const poset_path& xschema_path,
438  const poset_path& xscalar_space_path,
439  bool xauto_access);
440 
447  static host_type& standard_host(namespace_type& xns, const std::string& xsuffix, bool xauto_access);
448 
449 protected:
450 
451 private:
452 
454 
455 
456  //============================================================================
458  //============================================================================
460 
461 public:
462 
463  // Typedefs:
464 
469 
474 
479 
483  e4();
484 
485  // New handle/old state constructors.
486 
491  e4(const poset_state_handle* xhost, pod_index_type xhub_id);
492 
497  e4(const poset_state_handle* xhost, const scoped_index& xid);
498 
503  e4(const poset_state_handle* xhost, const std::string& xname);
504 
508  explicit e4(abstract_poset_member* xother);
509 
513  e4(poset_state_handle* xhost, bool xauto_access = true);
514 
518  e4(poset_state_handle& xhost,
519  const row_dofs_type& xrdt,
520  bool xauto_access = true);
521 
525  e4& operator=(const row_dofs_type& xrdt);
526 
530  virtual e4& operator=(const abstract_poset_member& xother);
531 
535  e4& operator=(const e4& xother);
536 
540  ~e4();
541 
545  virtual const volatile_type& lite_prototype() const;
546 
550  virtual volatile_type* lite_type() const;
551 
552 
553 protected:
554 private:
555 
557 
558  //============================================================================
560  //============================================================================
562 
563 public:
564 protected:
565 private:
566 
568 
569 
570  //===========================================================================
572  //===========================================================================
574 
575 public:
576 protected:
577 private:
578 
580 
581 
582  //===========================================================================
584  //===========================================================================
586 
587 public:
588 protected:
589 private:
590 
592 
593 
594  //===========================================================================
596  //===========================================================================
598 
599 public:
600 protected:
601 private:
602 
604 
605 
606  //===========================================================================
608  //===========================================================================
610 
611 public:
612 
613  using ed::put_components;
614 
618  virtual void put_components(dof_type x0,
619  dof_type x1,
620  dof_type x2,
621  dof_type x3);
622 
627  operator row_dofs_type& ();
628 
633  operator const row_dofs_type& () const;
634 
635 protected:
636 private:
637 
639 
640 
641  //===========================================================================
643  //===========================================================================
645 
646 public:
647 
648  //@todo: Reword comments.
653  static tp* new_tp(tp_space& xvector_space, int xp);
654 
659  static atp* new_atp(tp_space& xvector_space, int xp);
660 
665  static stp* new_stp(tp_space& xvector_space, int xp);
666 
667 
673  virtual tp* new_tp(int xp, bool xauto_access) const;
674 
679  virtual atp* new_atp(int xp, bool xauto_access) const;
680 
685  virtual stp* new_stp(int xp, bool xauto_access) const;
686 
687 protected:
688 private:
689 
691 
692 
693  //============================================================================
695  //============================================================================
697 
698 public:
699 
703  virtual const std::string& class_name() const;
704 
708  static const std::string& static_class_name();
709 
713  virtual e4* clone() const;
714 
720  inline e4* clone(bool xnew_state, bool xauto_access = true) const
721  {
722  return static_cast<e4*>(ed::clone(xnew_state, xauto_access));
723  }
724 
725 protected:
726 public:
727 
729 
730 
731  //============================================================================
733  //============================================================================
735 
736 public:
737 
741  bool is_ancestor_of(const any* xother) const;
742 
746  bool invariant() const;
747 
748 
749 protected:
750 private:
751 
753 };
754 
755 //==============================================================================
756 // NON-MEMBER FUNCTIONS
757 //==============================================================================
758 
762 template <typename T>
763 std::ostream& operator<<(std::ostream& xos, const e4_row_dofs_type<T>& xrdt);
764 
765 
766 //==============================================================================
767 // TP FACET
768 //==============================================================================
769 
770 // Forward declarations needed for specialization:
771 
772 class at0_lite;
773 class at2_e4_lite;
774 class at3_e4_lite;
775 class st2_e4_lite;
776 class st3_e4_lite;
777 class st4_e4_lite;
778 class t2_e4_lite;
779 class t3_e4_lite;
780 class t4_e4_lite;
781 
782 class at0;
783 class at2_e4;
784 class at3_e4;
785 class st2_e4;
786 class st3_e4;
787 class st4_e4;
788 class t2_e4;
789 class t3_e4;
790 class t4_e4;
791 
792 
796 template<> class tensor_traits<0, e4_lite>
797 {
798 public:
802  typedef at0_lite tp_type;
803 
808 
813 };
814 
818 template<> class tensor_traits<1, e4_lite>
819 {
820 public:
824  typedef e4_lite tp_type;
825 
829  typedef e4_lite atp_type;
830 
834  typedef e4_lite stp_type;
835 };
836 
840 template<> class tensor_traits<2, e4_lite>
841 {
842 public:
846  typedef t2_e4_lite tp_type;
847 
851  typedef at2_e4_lite atp_type;
852 
856  typedef st2_e4_lite stp_type;
857 };
858 
862 template<> class tensor_traits<3, e4_lite>
863 {
864 public:
868  typedef t3_e4_lite tp_type;
869 
873  typedef at3_e4_lite atp_type;
874 
878  typedef st3_e4_lite stp_type;
879 };
880 
884 template<> class tensor_traits<4, e4_lite>
885 {
886 public:
890  typedef t4_e4_lite tp_type;
891 
895  typedef void atp_type;
896 
900  typedef st4_e4_lite stp_type;
901 };
902 
903 //==============================================================================
904 
908 template<> class tensor_traits<0, e4>
909 {
910 public:
914  typedef at0 tp_type;
915 
919  typedef at0 atp_type;
920 
924  typedef at0 stp_type;
925 };
926 
930 template<> class tensor_traits<1, e4>
931 {
932 public:
936  typedef e4 tp_type;
937 
941  typedef e4 atp_type;
942 
946  typedef e4 stp_type;
947 };
948 
952 template<> class tensor_traits<2, e4>
953 {
954 public:
958  typedef t2_e4 tp_type;
959 
963  typedef at2_e4 atp_type;
964 
968  typedef st2_e4 stp_type;
969 };
970 
974 template<> class tensor_traits<3, e4>
975 {
976 public:
980  typedef t3_e4 tp_type;
981 
985  typedef at3_e4 atp_type;
986 
990  typedef st3_e4 stp_type;
991 };
992 
996 template<> class tensor_traits<4, e4>
997 {
998 public:
1002  typedef t4_e4 tp_type;
1003 
1007  typedef void atp_type;
1008 
1012  typedef st4_e4 stp_type;
1013 };
1014 
1015 
1016 } // namespace fiber_bundle
1017 
1018 
1019 #endif // ifndef E4_H
at2_e4_lite atp_type
Type of antisymmetric tensor of degree 2 over e4_lite.
Definition: e4.h:851
Row dofs type for class e4.
Definition: e4.h:43
at0 atp_type
Type of antisymmetric tensor of degree 0 over e4.
Definition: e4.h:919
st2_e4_lite stp_type
Type of symmetric tensor of degree 2 over e4_lite.
Definition: e4.h:856
A symmetric tensor of degree p over an abstract vector space.
Definition: stp.h:190
vd_value_type value_type
The type of component in the fiber; the scalar type in the fiber vector space.
Definition: vd.h:129
at0_lite atp_type
Type of antisymmetric tensor of degree 0 over e4_lite.
Definition: e4.h:807
An antisymmetric tensor of degree p.
Definition: atp.h:190
at3_e4 atp_type
Type of antisymmetric tensor of degree 3 over e4.
Definition: e4.h:985
Euclidean vector space of dimension 4 (persistent version).
Definition: e4.h:410
T dof_type
The type of the dofs.
Definition: e4.h:50
The default name space; a poset which contains other posets as members.
The standard fiber bundles name space; extends the standard sheaves namespace by defining base space...
e4 atp_type
Type of antisymmetric tensor of degree 1 over e4.
Definition: e4.h:941
A client handle for a general, abstract partially order set.
at0_lite tp_type
Type of general tensor of degree 0 over e4_lite.
Definition: e4.h:802
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
e4_row_dofs_type< T > * clone() const
Creates a new instance of the same type as this.
Definition: e4.impl.h:125
st2_e4 stp_type
Type of symmetric tensor of degree 2 over e4.
Definition: e4.h:968
at0 tp_type
Type of general tensor of degree 0 over e4.
Definition: e4.h:914
e4_row_dofs_type< T > * clone(bool xnew_state, bool xauto_access) const
Virtual constructor, makes a new instance of the same type as this; synonym for clone(), intended for use only in certain templates.
Definition: e4.h:88
e4_lite stp_type
Type of symmetric tensor of degree 1 over e4_lite.
Definition: e4.h:834
t4_e4 tp_type
Type of general tensor of degree 4 over e4.
Definition: e4.h:1002
T & operator[](int xindex)
Value of xindex-th component (row dof) (non const version).
Definition: e4.impl.h:82
virtual void put_components(const dof_type xcomps[], int xcomps_dimension)
Set values of all the components to the values in xcomps.
Definition: vd.cc:278
static int d()
The dimension of the row dof components.
Definition: e4.impl.h:62
at2_e4 atp_type
Type of antisymmetric tensor of degree 2 over e4.
Definition: e4.h:963
T::row_dofs_type & row_dofs(T &x0)
The row dofs pod type for x0 (mutable version).
e4_lite volatile_type
The associated volatile type.
Definition: e4.h:473
An antisymmetric tensor of degree p over an abstract vector space (volatile version).
Definition: atp.h:44
A general tensor of "degree" p and given "variance" over an abstract vector space.
Definition: tp.h:253
Abstract base class with useful features for all volatile objects.
Definition: any_lite.h:48
t3_e4 tp_type
Type of general tensor of degree 3 over e4.
Definition: e4.h:980
Abstract base class with useful features for all objects.
Definition: any.h:39
st4_e4_lite stp_type
Type of symmetric tensor of degree 4 over e4_lite.
Definition: e4.h:900
T components[4]
The components (row_dofs).
Definition: e4.h:96
Tensor types of degree P over VECTOR_TYPE. No generic implementation defined, must be specialized for...
Definition: vd.h:714
e4 * 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: e4.h:720
Euclidean vector space of dimension d (volatile version).
Definition: ed.h:44
e4 tp_type
Type of general tensor of degree 1 over e4.
Definition: e4.h:936
e4_row_dofs_type< double > row_dofs_type
The type of the row dofs.
Definition: e4.h:125
An index within the external ("client") scope of a given id space.
Definition: scoped_index.h:116
st3_e4_lite stp_type
Type of symmetric tensor of degree 3 over e4_lite.
Definition: e4.h:878
t3_e4_lite tp_type
Type of general tensor of degree 3 over e4_lite.
Definition: e4.h:868
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
static const std::string & static_class_name()
The name of this class.
Definition: e4.impl.h:42
Antisymetric tensor of degree 0 (volatile version).
Definition: at0.h:127
e4_lite atp_type
Type of antisymmetric tensor of degree 1 over e4_lite.
Definition: e4.h:829
at0_lite stp_type
Type of symmetric tensor of degree 0 over e4_lite.
Definition: e4.h:812
Euclidean vector space of dimension 4 (volatile version).
Definition: e4.h:111
at0 stp_type
Type of symmetric tensor of degree 0 over e4.
Definition: e4.h:924
A general tensor of degree p over an abstract vector space (volatile version). Volatile version does ...
Definition: tp.h:59
t2_e4_lite tp_type
Type of general tensor of degree 2 over e4_lite.
Definition: e4.h:846
t2_e4 tp_type
Type of general tensor of degree 2 over e4.
Definition: e4.h:958
virtual ed * clone() const
Make a new handle, no state instance of current.
Definition: ed.cc:759
void atp_type
Type of antisymmetric tensor of degree 4 over e4_lite.
Definition: e4.h:895
row_dofs_type _row_dofs
Row_dofs_type.
Definition: e4.h:193
e4_row_dofs_type< double > row_dofs_type
The type of the row dofs.
Definition: e4.h:468
e4_lite vector_space_type
Type of underlying vector space.
Definition: e4.h:246
void atp_type
Type of antisymmetric tensor of degree 4 over e4.
Definition: e4.h:1007
bool operator==(const singly_linked_list< T, Alloc > &lhs, const singly_linked_list< T, Alloc > &rhs)
Checks if the contents of lhs and rhs are equal, that is, whether lhs.size() == rhs.size() and each element in lhs compares equal with the element in rhs at the same position.
e4 vector_space_type
Type of underlying vector space.
Definition: e4.h:478
An abstract vector space viewed as an antisymmetric tensor space of degree 1.
Definition: at1_space.h:42
Euclidean vector space of dimension d (peresistent version).
Definition: ed.h:210
virtual e4_lite * clone(bool xnew_state, bool xauto_access) const
Virtual constructor, makes a new instance of the same type as this; synonym for clone(), intended for use only in certain templates.
Definition: e4.h:352
int_type pod_index_type
The plain old data index type.
Definition: pod_types.h:49
e4_row_dofs_type< T > row_dofs_type
The type of the row dofs (type of this).
Definition: e4.h:55
e4 stp_type
Type of symmetric tensor of degree 1 over e4.
Definition: e4.h:946
t4_e4_lite tp_type
Type of general tensor of degree 4 over e4_lite.
Definition: e4.h:890
An abstract client handle for a member of a poset.
st4_e4 stp_type
Type of symmetric tensor of degree 4 over e4.
Definition: e4.h:1012
e4_lite tp_type
Type of general tensor of degree 1 over e4_lite.
Definition: e4.h:824
st3_e4 stp_type
Type of symmetric tensor of degree 3 over e4.
Definition: e4.h:990
vd_dof_type dof_type
The type of the degrees of freedom. Note that although dof_type == value_type in this implementation...
Definition: vd.h:431
An abstract tensor space of degree p.
Definition: tp_space.h:47
A symmetric tensor of degree p over an abstract vector space (volatile version).
Definition: stp.h:44
void put_components(const dof_type comps[], int comps_dimension)
Sets values of all the components to the values in comps.
Definition: vd.cc:1252
Namespace for the fiber_bundles component of the sheaf system.
at3_e4_lite atp_type
Type of antisymmetric tensor of degree 3 over e4_lite.
Definition: e4.h:873