SheafSystem  0.0.0.0
e3.impl.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 //
19 
20 #ifndef E3_IMPL_H
21 #define E3_IMPL_H
22 
23 #ifndef SHEAF_DLL_SPEC_H
24 #include "SheafSystem/sheaf_dll_spec.h"
25 #endif
26 
27 #ifndef E3_H
28 #include "SheafSystem/e3.h"
29 #endif
30 
31 namespace fiber_bundle
32 {
33 
34 //==============================================================================
35 // CLASS E3_ROW_DOFS_TYPE
36 //==============================================================================
37 
38 template <typename T>
39 const std::string&
42 {
43  // Preconditions:
44 
45  // Body:
46 
47  static const std::string result("e3_row_dofs_type");
48 
49  // Postconditions:
50 
51  ensure(!result.empty());
52 
53  // Exit:
54 
55  return result;
56 }
57 
58 template <typename T>
59 int
61 d()
62 {
63  // Preconditions:
64 
65  // Body:
66 
67  int result = 3;
68 
69  // Postconditions:
70 
71  ensure(result == 3);
72 
73  // Exit:
74 
75  return result;
76 }
77 
78 template <typename T>
79 T&
81 operator[] (int xindex)
82 {
83  // Preconditions:
84 
85  require(xindex>=0 && xindex<d());
86 
87  // Body:
88 
89  T& result = components[xindex];
90 
91  // Postconditions:
92 
93  //ensure(result == components[xindex]);
94 
95  // Exit:
96 
97  return result;
98 }
99 
100 template <typename T>
101 const T&
103 operator[] (int xindex) const
104 {
105  // Preconditions:
106 
107  require(xindex>=0 && xindex<d());
108 
109  // Body:
110 
111  const T& result = components[xindex];
112 
113  // Postconditions:
114 
115  //ensure(result == components[xindex]);
116 
117  // Exit:
118 
119  return result;
120 }
121 
122 template <typename T>
125 {
126  // Preconditions:
127 
128  // Body:
129 
131 
132  // Postconditions:
133 
134  ensure(result != 0);
135 
136  // Exit:
137 
138  return result;
139 }
140 
141 //==============================================================================
142 // NON-MEMBER FUNCTIONS
143 //==============================================================================
144 
145 #ifndef DOXYGEN_SKIP_IMPLEMENTATIONS
146 template <typename T>
147 std::ostream& operator<<(std::ostream& xos, const e3_row_dofs_type<T>& xrdt)
148 {
149  int ld = xrdt.d();
150  for(int i=0; i<ld; ++i)
151  {
152  xos << " " << xrdt.components[i];
153  }
154 
155  return xos;
156 }
157 #endif // ifndef DOXYGEN_SKIP_IMPLEMENTATIONS
158 
159 } // namespace fiber_bundle
160 
161 #endif // ifndef E3_IMPL_H
static const std::string & static_class_name()
The name of this class.
Definition: e3.impl.h:41
e3_row_dofs_type< T > * clone() const
Creates a new instance of the same type as this.
Definition: e3.impl.h:124
T & operator[](int xindex)
Value of xindex-th component (row dof) (non const version).
Definition: e3.impl.h:81
static int d()
The dimension of the row dof components.
Definition: e3.impl.h:61
Namespace for the fiber_bundles component of the sheaf system.
Row dofs type for class e3.
Definition: e3.h:48