SheafSystem  0.0.0.0
e2.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 E2_H
22 #define E2_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 E2_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  e2_row_dofs_type<T>* clone() const;
83 
88  e2_row_dofs_type<T>* clone(bool xnew_state, bool xauto_access) const
89  {
90  return clone();
91  }
92 
96  T components[2];
97 
98 protected:
99 private:
100 
101 };
102 
103 
104 //==============================================================================
105 // CLASS E2_LITE
106 //==============================================================================
107 
112 class SHEAF_DLL_SPEC e2_lite : public ed_lite
113 {
114 
115  //============================================================================
117  //============================================================================
119 
120 public:
121 
122  // Typedefs:
123 
128 
132  e2_lite();
133 
137  e2_lite(const e2_lite& xother);
138 
142  e2_lite& operator=(const e2_lite& xother);
143 
147  virtual ~e2_lite();
148 
152  e2_lite(const row_dofs_type& xrow_dofs);
153 
157  e2_lite& operator=(const row_dofs_type& xrow_dofs);
158 
162  e2_lite(const value_type& x_comp, const value_type& y_comp);
163 
165 
169  virtual void put_components(const value_type& x_comp,
170  const value_type& y_comp);
171 
176  operator row_dofs_type& ();
177 
182  operator const row_dofs_type& () const;
183 
184 protected:
185 
189  row_dofs_type _row_dofs;
190 
191 private:
192 
194 
195 
196  //============================================================================
198  //============================================================================
200 
201 public:
202 protected:
203 private:
204 
206 
207 
208  //============================================================================
210  //============================================================================
212 
213 public:
214 protected:
215 private:
216 
218 
219 
220  //============================================================================
222  //============================================================================
224 
225 public:
226 protected:
227 private:
228 
230 
231 
232  //============================================================================
234  //============================================================================
236 
237 public:
238 
243 
247  virtual int dd() const;
248 
249 protected:
250 private:
251 
253 
254 
255  //============================================================================
257  //============================================================================
259 
260 public:
261 
265  bool operator==(const e2_lite& xother) const;
266 
271  static const tp_lite& static_tp_prototype(int xp);
272 
277  virtual const tp_lite& tp_prototype(int xp) const;
278 
283  static const atp_lite& static_atp_prototype(int xp);
284 
289  virtual const atp_lite& atp_prototype(int xp) const;
290 
295  static const stp_lite& static_stp_prototype(int xp);
296 
301  virtual const stp_lite& stp_prototype(int xp) const;
302 
303 protected:
304 private:
305 
307 
308 
309  //============================================================================
311  //============================================================================
313 
314 public:
315 protected:
316 private:
317 
319 
320 
321  //============================================================================
323  //============================================================================
325 
326 public:
327 
331  virtual const std::string& class_name() const;
332 
336  static const std::string& static_class_name();
337 
341  virtual e2_lite* clone() const;
342 
347  virtual e2_lite* clone(bool xnew_state, bool xauto_access) const
348  {
349  return clone();
350  }
351 
352 protected:
353 private:
354 
356 
357 
358  //============================================================================
360  //============================================================================
362 
363 public:
364 
368  virtual bool is_ancestor_of(const any_lite& xother) const;
369 
373  bool invariant() const;
374 
378  virtual void* row_dofs();
379 
383  virtual const void* row_dofs() const;
384 
385 protected:
386 private:
387 
389 };
390 
391 
392 //==============================================================================
393 // CLASS E2
394 //==============================================================================
395 
396 class tp_space;
397 class tp;
398 class atp;
399 class stp;
400 
405 class SHEAF_DLL_SPEC e2 : public ed
406 {
407  // ===========================================================
409  // ===========================================================
411 
412 public:
413 
417  static const poset_path& standard_schema_path();
418 
422  static void make_standard_schema(namespace_poset& xns);
423 
429  static host_type& new_host(namespace_type& xns,
430  const poset_path& xhost_path,
431  const poset_path& xschema_path,
432  const poset_path& xscalar_space_path,
433  bool xauto_access);
434 
441  static host_type& standard_host(namespace_type& xns, const std::string& xsuffix, bool xauto_access);
442 
443 protected:
444 
445 private:
446 
448 
449 
450  //============================================================================
452  //============================================================================
454 
455 public:
456 
457  // Typedefs:
458 
463 
468 
473 
477  e2();
478 
479  // New handle/old state constructors.
480 
485  e2(const poset_state_handle* xhost, pod_index_type xhub_id);
486 
491  e2(const poset_state_handle* xhost, const scoped_index& xid);
492 
497  e2(const poset_state_handle* xhost, const std::string& xname);
498 
502  explicit e2(abstract_poset_member* xother);
503 
507  e2(poset_state_handle* xhost, bool xauto_access = true);
508 
512  e2(poset_state_handle& xhost,
513  const row_dofs_type& xrdt,
514  bool xauto_access = true);
515 
519  e2& operator=(const row_dofs_type& xrdt);
520 
524  virtual e2& operator=(const abstract_poset_member& xother);
525 
529  e2& operator=(const e2& xother);
530 
534  ~e2();
535 
539  virtual const volatile_type& lite_prototype() const;
540 
544  virtual volatile_type* lite_type() const;
545 
546 
547 protected:
548 private:
549 
551 
552 
553  //============================================================================
555  //============================================================================
557 
558 public:
559 protected:
560 private:
561 
563 
564 
565  //============================================================================
567  //============================================================================
569 
570 public:
571 protected:
572 private:
573 
575 
576 
577  //===========================================================================
579  //===========================================================================
581 
582 public:
583 protected:
584 private:
585 
587 
588 
589  //===========================================================================
591  //===========================================================================
593 
594 public:
595 protected:
596 private:
597 
599 
600 
601  //===========================================================================
603  //===========================================================================
605 
606 public:
607 
608  using ed::put_components;
609 
613  virtual void put_components(dof_type x_comp, dof_type y_comp);
614 
619  operator row_dofs_type& ();
620 
625  operator const row_dofs_type& () const;
626 
627 protected:
628 private:
629 
631 
632 
633  //===========================================================================
635  //===========================================================================
637 
638 public:
639 
644  static tp* new_tp(tp_space& xvector_space, int xp);
645 
650  static atp* new_atp(tp_space& xvector_space, int xp);
651 
656  static stp* new_stp(tp_space& xvector_space, int xp);
657 
658 
664  virtual tp* new_tp(int xp, bool xauto_access) const;
665 
670  virtual atp* new_atp(int xp, bool xauto_access) const;
671 
676  virtual stp* new_stp(int xp, bool xauto_access) const;
677 
678 protected:
679 private:
680 
682 
683 
684  //============================================================================
686  //============================================================================
688 
689 public:
690 
694  virtual const std::string& class_name() const;
695 
699  static const std::string& static_class_name();
700 
704  virtual e2* clone() const;
705 
711  inline e2* clone(bool xnew_state, bool xauto_access = true) const
712  {
713  return static_cast<e2*>(ed::clone(xnew_state, xauto_access));
714  }
715 
716 protected:
717 private:
718 
720 
721 
722  //============================================================================
724  //============================================================================
726 
727 public:
728 
732  bool is_ancestor_of(const any* xother) const;
733 
737  bool invariant() const;
738 
739 protected:
740 private:
741 
743 };
744 
745 //==============================================================================
746 // NON-MEMBER FUNCTIONS
747 //==============================================================================
748 
752 template <typename T>
753 std::ostream& operator<<(std::ostream& xos, const e2_row_dofs_type<T>& xrdt);
754 
759 namespace e2_algebra
760 {
761 
766 SHEAF_DLL_SPEC vd_value_type perp_dot(const e2_lite& x0, const e2_lite& x1);
767 
768 } // namespace e2_algebra
769 
770 //==============================================================================
771 // TP FACET
772 //==============================================================================
773 
774 // Forward declarations needed for specialization:
775 
776 class at0_lite;
777 class at2_e2_lite;
778 class at3_e2_lite;
779 class st2_e2_lite;
780 class st3_e2_lite;
781 class st4_e2_lite;
782 class t2_e2_lite;
783 class t3_e2_lite;
784 class t4_e2_lite;
785 
786 class at0;
787 class at2_e2;
788 class at3_e2;
789 class st2_e2;
790 class st3_e2;
791 class st4_e2;
792 class t2_e2;
793 class t3_e2;
794 class t4_e2;
795 
799 template<> class tensor_traits<0, e2_lite>
800 {
801 public:
805  typedef at0_lite tp_type;
806 
811 
816 };
817 
821 template<> class tensor_traits<1, e2_lite>
822 {
823 public:
827  typedef e2_lite tp_type;
828 
832  typedef e2_lite atp_type;
833 
837  typedef e2_lite stp_type;
838 };
839 
843 template<> class tensor_traits<2, e2_lite>
844 {
845 public:
850 
855 
860 };
861 
865 template<> class tensor_traits<3, e2_lite>
866 {
867 public:
871  typedef t3_e2_lite tp_type;
872 
876  typedef at3_e2_lite atp_type;
877 
881  typedef st3_e2_lite stp_type;
882 };
883 
887 template<> class tensor_traits<4, e2_lite>
888 {
889 public:
894 
898  typedef void atp_type;
899 
904 };
905 
906 //==============================================================================
907 
911 template<> class tensor_traits<0, e2>
912 {
913 public:
917  typedef at0 tp_type;
918 
922  typedef at0 atp_type;
923 
927  typedef at0 stp_type;
928 };
929 
933 template<> class tensor_traits<1, e2>
934 {
935 public:
939  typedef e2 tp_type;
940 
944  typedef e2 atp_type;
945 
949  typedef e2 stp_type;
950 };
951 
955 template<> class tensor_traits<2, e2>
956 {
957 public:
961  typedef t2_e2 tp_type;
962 
966  typedef at2_e2 atp_type;
967 
971  typedef st2_e2 stp_type;
972 };
973 
977 template<> class tensor_traits<3, e2>
978 {
979 public:
983  typedef t3_e2 tp_type;
984 
988  typedef at3_e2 atp_type;
989 
993  typedef st3_e2 stp_type;
994 };
995 
999 template<> class tensor_traits<4, e2>
1000 {
1001 public:
1005  typedef t4_e2 tp_type;
1006 
1010  typedef void atp_type;
1011 
1015  typedef st4_e2 stp_type;
1016 };
1017 
1018 } // namespace fiber_bundle
1019 
1020 #endif // ifndef E2_H
T components[2]
The components (row_dofs).
Definition: e2.h:96
at3_e2_lite atp_type
Type of antisymmetric tensor of degree 3 over e2_lite.
Definition: e2.h:876
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
An antisymmetric rank 2 tensor over a Euclidean vector space of dimension 2 (persistent version)...
Definition: at2_e2.h:412
An antisymmetric tensor of degree p.
Definition: atp.h:190
at0 atp_type
Type of antisymmetric tensor of degree 0 over e2.
Definition: e2.h:922
Euclidean vector space of dimension 2 (persistent version).
Definition: e2.h:405
A tensor of degree 2 over a Euclidean vector space of dimension 2 (volatile version).
Definition: t2_e2.h:148
e2_lite stp_type
Type of symmetric tensor of degree 1 over e2_lite.
Definition: e2.h:837
T dof_type
The type of the dofs.
Definition: e2.h:50
The default name space; a poset which contains other posets as members.
at0 tp_type
Type of general tensor of degree 0 over e2.
Definition: e2.h:917
The standard fiber bundles name space; extends the standard sheaves namespace by defining base space...
A tensor of degree 2 over a Euclidean vector space of dimension 2 (persistent version).
Definition: t2_e2.h:444
t2_e2_lite tp_type
Type of general tensor of degree 2 over e2_lite.
Definition: e2.h:849
A client handle for a general, abstract partially order set.
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
at0_lite atp_type
Type of antisymmetric tensor of degree 0 over e2_lite.
Definition: e2.h:810
t4_e2 tp_type
Type of general tensor of degree 4 over e2.
Definition: e2.h:1005
st4_e2_lite stp_type
Type of symmetric tensor of degree 4 over e2_lite.
Definition: e2.h:903
e2_row_dofs_type< T > * clone() const
Creates a new instance of the same type as this.
Definition: e2.impl.h:125
e2_row_dofs_type< T > row_dofs_type
The type of the row dofs (type of this).
Definition: e2.h:55
A tensor of degree 4 over a Euclidean vector space of dimension 2 (persistent version).
Definition: t4_e2.h:378
at0 stp_type
Type of symmetric tensor of degree 0 over e2.
Definition: e2.h:927
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
An antisymmetric rank 2 tensor over a Euclidean vector space of dimension 2 (volatile version)...
Definition: at2_e2.h:146
void atp_type
Type of antisymmetric tensor of degree 4 over e2_lite.
Definition: e2.h:898
T::row_dofs_type & row_dofs(T &x0)
The row dofs pod type for x0 (mutable version).
e2_lite tp_type
Type of general tensor of degree 1 over e2_lite.
Definition: e2.h:827
at2_e2 atp_type
Type of antisymmetric tensor of degree 2 over e2.
Definition: e2.h:966
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
static const std::string & static_class_name()
The name of this class.
Definition: e2.impl.h:42
at2_e2_lite atp_type
Type of antisymmetric tensor of degree 2 over e2_lite.
Definition: e2.h:854
e2 stp_type
Type of symmetric tensor of degree 1 over e2.
Definition: e2.h:949
Abstract base class with useful features for all volatile objects.
Definition: any_lite.h:48
Abstract base class with useful features for all objects.
Definition: any.h:39
e2 atp_type
Type of antisymmetric tensor of degree 1 over e2.
Definition: e2.h:944
Tensor types of degree P over VECTOR_TYPE. No generic implementation defined, must be specialized for...
Definition: vd.h:714
e2_lite atp_type
Type of antisymmetric tensor of degree 1 over e2_lite.
Definition: e2.h:832
st3_e2_lite stp_type
Type of symmetric tensor of degree 3 over e2_lite.
Definition: e2.h:881
static int d()
The dimension of the row dof components.
Definition: e2.impl.h:62
Euclidean vector space of dimension d (volatile version).
Definition: ed.h:44
Euclidean vector space of dimension 2 (volatile version).
Definition: e2.h:112
e2_row_dofs_type< double > row_dofs_type
The type of the row dofs.
Definition: e2.h:462
e2 vector_space_type
Type of underlying vector space.
Definition: e2.h:472
t3_e2_lite tp_type
Type of general tensor of degree 3 over e2_lite.
Definition: e2.h:871
An index within the external ("client") scope of a given id space.
Definition: scoped_index.h:116
t4_e2_lite tp_type
Type of general tensor of degree 4 over e2_lite.
Definition: e2.h:893
st2_e2 stp_type
Type of symmetric tensor of degree 2 over e2.
Definition: e2.h:971
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
void atp_type
Type of antisymmetric tensor of degree 4 over e2.
Definition: e2.h:1010
st2_e2_lite stp_type
Type of symmetric tensor of degree 2 over e2_lite.
Definition: e2.h:859
Antisymetric tensor of degree 0 (volatile version).
Definition: at0.h:127
SHEAF_DLL_SPEC vd_value_type perp_dot(const e2_lite &x0, const e2_lite &x1)
The perp-dot pseudo cross product of x0 with x1 (version for persistent types).
Definition: e2.cc:1648
A symmetric rank 3 tensor over a 3D Euclidean vector space (persistent version).
Definition: st4_e2.h:376
T & operator[](int xindex)
Value of xindex-th component (row dof) (non const version).
Definition: e2.impl.h:82
A general tensor of degree p over an abstract vector space (volatile version). Volatile version does ...
Definition: tp.h:59
e2 * 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: e2.h:711
virtual ed * clone() const
Make a new handle, no state instance of current.
Definition: ed.cc:759
A symmetric rank 4 tensor over a Euclidean vector space of dimension 3. (volatile version)...
Definition: st4_e2.h:124
st4_e2 stp_type
Type of symmetric tensor of degree 4 over e2.
Definition: e2.h:1015
row_dofs_type _row_dofs
Row_dofs_type.
Definition: e2.h:189
t2_e2 tp_type
Type of general tensor of degree 2 over e2.
Definition: e2.h:961
e2 tp_type
Type of general tensor of degree 1 over e2.
Definition: e2.h:939
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.
e2_lite vector_space_type
Type of underlying vector space.
Definition: e2.h:242
An abstract vector space viewed as an antisymmetric tensor space of degree 1.
Definition: at1_space.h:42
e2_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: e2.h:88
t3_e2 tp_type
Type of general tensor of degree 3 over e2.
Definition: e2.h:983
Euclidean vector space of dimension d (peresistent version).
Definition: ed.h:210
at0_lite stp_type
Type of symmetric tensor of degree 0 over e2_lite.
Definition: e2.h:815
e2_row_dofs_type< double > row_dofs_type
The type of the row dofs.
Definition: e2.h:127
int_type pod_index_type
The plain old data index type.
Definition: pod_types.h:49
A symmetric tensor of degree 2 over a Euclidean vector space of dimension 2 (persistent version)...
Definition: st2_e2.h:431
e2_lite volatile_type
The associated volatile type.
Definition: e2.h:467
A symmetric tensor of degree 2 over a Euclidean vector space of dimension 2 (volatile version)...
Definition: st2_e2.h:150
virtual e2_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: e2.h:347
at0_lite tp_type
Type of general tensor of degree 0 over e2_lite.
Definition: e2.h:805
An abstract client handle for a member of a poset.
A tensor of degree 4 over a Euclidean vector space of dimension 2 (volatile version).
Definition: t4_e2.h:140
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
at3_e2 atp_type
Type of antisymmetric tensor of degree 3 over e2.
Definition: e2.h:988
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.
Row dofs type for class e2.
Definition: e2.h:43
double vd_value_type
The type of component in the fiber; the scalar type in the fiber vector space.
Definition: fiber_bundle.h:63
st3_e2 stp_type
Type of symmetric tensor of degree 3 over e2.
Definition: e2.h:993