SheafSystem  0.0.0.0
tp.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 TP_H
22 #define TP_H
23 
24 #ifndef SHEAF_DLL_SPEC_H
25 #include "SheafSystem/sheaf_dll_spec.h"
26 #endif
27 
28 #ifndef VD_H
29 #include "SheafSystem/vd.h"
30 #endif
31 
32 #ifndef TENSOR_VARIANCE_H
33 #include "SheafSystem/tensor_variance.h"
34 #endif
35 
36 #ifndef TP_TABLE_DOFS_TYPE_H
37 #include "SheafSystem/tp_table_dofs_type.h"
38 #endif
39 
40 
41 namespace fiber_bundle
42 {
43  //
44  // Forward declarations
45  //
46 
47  class tp_space;
48  class at1;
49 
50 //==============================================================================
51 // CLASS TP_LITE
52 //==============================================================================
53 
59 class SHEAF_DLL_SPEC tp_lite : public vd_lite
60 {
61  //============================================================================
63  //============================================================================
65 
66 public:
67 
72 
78 
84  enum static_const_int {P = -1};
85 
89  tp_lite();
90 
94  tp_lite(const tp_lite& xother);
95 
99  tp_lite& operator=(const tp_lite& xother);
100 
104  virtual ~tp_lite();
105 
109  tp_lite(const row_dofs_type& xrow_dofs);
110 
114  tp_lite& operator=(const row_dofs_type& xrow_dofs);
115 
119  virtual int p() const;
120 
124  virtual int dd() const;
125 
129  virtual pod_index_type vector_space_index() const;
130 
134  table_dofs_type table_dofs() const;
135 
136 protected:
137 private:
138 
140 
141 
142  //============================================================================
144  //============================================================================
146 
147 public:
148 
152  virtual int d() const;
153 
154 protected:
155 private:
156 
158 
159 
160  //============================================================================
162  //============================================================================
164 
165 public:
166 protected:
167 private:
168 
170 
171 
172  //============================================================================
174  //============================================================================
176 
177 public:
178 
182  virtual const std::string& class_name() const;
183 
187  static const std::string& static_class_name();
188 
192  virtual tp_lite* clone() const;
193 
194 protected:
195 private:
196 
198 
199 
200  //============================================================================
202  //============================================================================
204 
205 public:
206 
210  virtual bool is_ancestor_of(const any_lite& xother) const;
211 
212 
216  bool invariant() const;
217 
218 protected:
219 private:
220 
222 };
223 
224 
225 //==============================================================================
226 // CLASS TP
227 //==============================================================================
228 
253 class SHEAF_DLL_SPEC tp : public vd
254 {
255 
256  // ===========================================================
258  // ===========================================================
260 
261 public:
262 
267 
272 
276  static const poset_path& standard_schema_path();
277 
281  static void make_standard_schema(namespace_poset& xns);
282 
288  static host_type& new_host(namespace_type& xns,
289  const poset_path& xhost_path,
290  const poset_path& xschema_path,
291  int xp,
292  const poset_path& xvector_space_path,
293  bool xauto_access);
294 
295 protected:
296 
297 private:
298 
300 
301 
302  //============================================================================
304  //============================================================================
306 
307 public:
308 
309  // Typedefs:
310 
315 
320 
324  tp();
325 
330  tp(const poset_state_handle* xhost, pod_index_type xhub_id);
331 
336  tp(const poset_state_handle* xhost, const scoped_index& xid);
337 
342  tp(const poset_state_handle* xhost, const std::string& xname);
343 
347  explicit tp(abstract_poset_member* xother);
348 
352  tp(poset_state_handle* xhost, bool xauto_access = true);
353 
357  virtual tp& operator=(const abstract_poset_member& xother);
358 
362  tp& operator=(const tp& xother);
363 
367  virtual ~tp();
368 
374  enum static_const_int {P = -1};
375 
380  virtual int p() const;
381 
386  int p(bool xauto_access) const;
387 
391  virtual int dd() const;
392 
396  virtual int dd(bool xauto_access) const;
397 
401  poset_path vector_space_path() const;
402 
406  poset_path vector_space_path(bool xauto_access) const;
407 
411  virtual tp_space& vector_space() const;
412 
416  virtual tp_space& vector_space(bool xauto_access) const;
417 
421  static const std::string create_tensor_space_name(const std::string& xvector_space_name, const std::string& xname);
422 
426  virtual const volatile_type& lite_prototype() const;
427 
431  virtual volatile_type* lite_type() const;
432 
436  virtual tensor_variance variance(bool xauto_access) const;
437 
442  virtual bool variance(int xi, bool xauto_access) const;
443 
447  void put_variance(const tensor_variance& xvariance, bool xauto_access);
448 
452  void put_variance(int xi, bool xvariance, bool xauto_access);
453 
457  virtual bool is_covariant(bool xauto_access) const;
458 
462  virtual bool is_covariant(int xi, bool xauto_access) const;
463 
467  virtual void put_is_covariant(bool xauto_access);
468 
472  void put_is_covariant(int xi, bool xauto_access);
473 
477  virtual bool is_contravariant(bool xauto_access) const;
478 
482  virtual bool is_contravariant(int xi, bool xauto_access) const;
483 
487  virtual void put_is_contravariant(bool xauto_access);
488 
492  void put_is_contravariant(int xi, bool xauto_access);
493 
494 protected:
495 
496 private:
497 
499 
500 
501  //============================================================================
503  //============================================================================
505 
506 public:
507 
508 // ///
509 // /// True if this is a covector, false if it is a vector.
510 // ///
511 // virtual bool is_dual(bool xauto_access) const;
512 
513 // ///
514 // /// Set the duality of this to that of xother if
515 // /// xis_opposite is false and to the opposite of
516 // /// xother if xis_opposite is true.
517 // ///
518 // virtual void put_is_dual(const vd& xother, bool xis_opposite, bool xauto_access);
519 
520 protected:
521 private:
522 
524 
525  //============================================================================
527  //============================================================================
529 
530 public:
531 
535  virtual const std::string& class_name() const;
536 
540  static const std::string& static_class_name();
541 
547  inline tp* clone(bool xnew_state, bool xauto_access = true) const
548  {
549  return static_cast<tp*>(vd::clone(xnew_state, xauto_access));
550  }
551 
552 protected:
553 private:
554 
556 
557 
558  // ===========================================================
560  // ===========================================================
562 
563 public:
564 
568  host_type* host() const;
569 
573  virtual bool host_is_ancestor_of(const poset_state_handle* other) const;
574 
575 protected:
576 
577 private:
578 
580 
581  //============================================================================
583  //============================================================================
585 
586 public:
587 
591  bool is_ancestor_of(const any* other) const;
592 
596  virtual tp* clone() const;
597 
601  bool invariant() const;
602 
603 
604 protected:
605 private:
606 
608 };
609 
610 
611 //==============================================================================
612 // NON-MEMBER FUNCTIONS
613 //==============================================================================
614 
615 #ifndef DOXYGEN_1_5_4_SKIP_UNKNOWN
616 
620 SHEAF_DLL_SPEC std::ostream& operator<<(std::ostream& xos, tp_lite::table_dofs_type& xt);
621 
622 #endif // ifndef DOXYGEN_1_5_4_SKIP_UNKNOWN
623 
624 //==============================================================================
625 // TP FACET
626 //==============================================================================
627 
632 namespace tp_algebra
633 {
634 
641 SHEAF_DLL_SPEC void contract(const tp_lite& x0, int xp, int xq, tp_lite& xresult);
642 
649 SHEAF_DLL_SPEC void contract(const tp& x0, int xp, int xq, tp& xresult,
650  bool xauto_access);
651 
652 //==============================================================================
653 
658 SHEAF_DLL_SPEC void alt(const tp_lite& x0, tp_lite& xresult);
659 
664 template <typename T0>
666 alt(const T0& x0);
667 
672 SHEAF_DLL_SPEC void alt(const tp& x0, tp& xresult, bool xauto_access);
673 
678 SHEAF_DLL_SPEC void sym(const tp_lite& x0, tp_lite& xresult);
679 
684 template <typename T0>
686 sym(const T0& x0);
687 
692 SHEAF_DLL_SPEC void sym(const tp& x0, tp& xresult, bool xauto_access);
693 
698 template <typename T0>
700 sym(const T0& x0, bool xauto_access);
701 
702 //==============================================================================
703 
708 SHEAF_DLL_SPEC void tensor(const tp_lite& x0, const tp_lite& x1, tp_lite& xresult);
709 
714 SHEAF_DLL_SPEC void tensor(const tp& x0, const tp& x1, tp& xresult, bool xauto_access);
715 
720 template <typename T0, typename T1>
722 tensor(const T0& x0, const T1& x1);
723 
728 template <typename T0, typename T1>
730 tensor(const T0& x0, const T1& x1, bool xauto_access);
731 
732 
733 //==============================================================================
734 
735 } // namespace tp_algebra
736 
737 } // namespace fiber_bundle
738 
739 
740 #endif // ifndef TP_H
static_const_int
The degree of this tensor space.
Definition: tp.h:374
void alt(const GT &x0, AT &xresult, bool xauto_access)
Definition: sec_tp.impl.h:140
void sym(const GT &x0, ST &xresult, bool xauto_access)
Definition: sec_tp.impl.h:184
The "type" of a tensor; specifies the degree and the co- or contra-variance for each index of a tenso...
The default name space; a poset which contains other posets as members.
A general antisymmetric tensor of degree 1 over an abstract vector space (persistent version)...
Definition: at1.h:211
The standard fiber bundles name space; extends the standard sheaves namespace by defining base space...
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
tp_lite volatile_type
The associated volatile type.
Definition: tp.h:314
static_const_int
The degree of this tensor space.
Definition: tp.h:84
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
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
Tensor types of degree P over VECTOR_TYPE. No generic implementation defined, must be specialized for...
Definition: vd.h:714
at1 vector_space_type
The type of the underlying vector space.
Definition: tp.h:271
An index within the external ("client") scope of a given id space.
Definition: scoped_index.h:116
vd_lite vector_space_type
Type of underlying vector space.
Definition: tp.h:77
tp_table_dofs_type table_dofs_type
The type of the table dofs.
Definition: tp.h:319
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. ...
A general tensor of degree p over an abstract vector space (volatile version). Volatile version does ...
Definition: tp.h:59
tp * 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: tp.h:547
Table dofs type for class tp.
tp_table_dofs_type table_dofs_type
The type of the table dofs.
Definition: tp.h:71
T::table_dofs_type & table_dofs(T &x0)
The table dofs pod type for x0 (mutable version).
int_type pod_index_type
The plain old data index type.
Definition: pod_types.h:49
tp_space host_type
The type of host poset.
Definition: tp.h:266
virtual vd * clone() const
Make a new handle, no state instance of current.
Definition: vd.cc:1543
An abstract client handle for a member of a poset.
An abstract tensor space of degree p.
Definition: tp_space.h:47
Namespace for the fiber_bundles component of the sheaf system.
Abstract vector space over dof_type.
Definition: vd.h:350
Row dofs type for class vd.
Definition: vd.h:61
void tensor(const S0 &x0, const S1 &x1, SR &xresult, bool xauto_access)
Definition: sec_tp.impl.h:228
SHEAF_DLL_SPEC std::ostream & operator<<(std::ostream &os, const binary_index &xbi)
Insert binary_index& xbi into ostream& os.
Definition: binary_index.cc:35