SheafSystem  0.0.0.0
st2_e2.impl.h
Go to the documentation of this file.
1 
2 
3 //
4 // Copyright (c) 2014 Limit Point Systems, Inc.
5 
6 // Licensed under the Apache License, Version 2.0 (the "License");
7 // you may not use this file except in compliance with the License.
8 // You may obtain a copy of the License at
9 
10 // http://www.apache.org/licenses/LICENSE-2.0
11 
12 // Unless required by applicable law or agreed to in writing, software
13 // distributed under the License is distributed on an "AS IS" BASIS,
14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 // See the License for the specific language governing permissions and
16 // limitations under the License.
17 
18 //
19 
22 
23 
24 #ifndef ST2_E2_IMPL_H
25 #define ST2_E2_IMPL_H
26 
27 #ifndef SHEAF_DLL_SPEC_H
28 #include "SheafSystem/sheaf_dll_spec.h"
29 #endif
30 
31 #ifndef ST2_E2_H
32 #include "SheafSystem/st2_e2.h"
33 #endif
34 
35 #ifndef GL2_H
36 #include "SheafSystem/gl2.h"
37 #endif
38 
39 #ifndef STD_CMATH_H
40 #include "SheafSystem/std_cmath.h"
41 #endif
42 
43 namespace fiber_bundle
44 {
45 
46 //==============================================================================
47 // CLASS ST2_E2_ROW_DOFS_TYPE
48 //==============================================================================
49 
50 template <typename T>
51 const std::string&
54 {
55  // Preconditions:
56 
57  // Body:
58 
59  static const std::string result("st2_e2_row_dofs_type");
60 
61  // Postconditions:
62 
63  ensure(!result.empty());
64 
65  // Exit:
66 
67  return result;
68 }
69 
70 template <typename T>
71 int
73 d()
74 {
75  // Preconditions:
76 
77  // Body:
78 
79  // Postconditions:
80 
81  // Exit:
82 
83  return 3;
84 }
85 
86 template <typename T>
87 T&
89 operator[] (int xindex)
90 {
91  // Preconditions:
92 
93  ensure(xindex>=0 && xindex<d());
94 
95  // Body:
96 
97  T& result = components[xindex];
98 
99  // Postconditions:
100 
101  // Exit:
102 
103  return result;
104 }
105 
106 template <typename T>
107 const T&
109 operator[] (int xindex) const
110 {
111  // Preconditions:
112 
113  ensure(xindex>=0 && xindex<d());
114 
115  // Body:
116 
117  const T& result = components[xindex];
118 
119  // Postconditions:
120 
121  // Exit:
122 
123  return result;
124 }
125 
126 template <typename T>
129 {
130  // Preconditions:
131 
132  // Body:
133 
134  // Postconditions:
135 
136  // Exit:
137 
138  return reinterpret_cast<matrix_type&>(*this);
139 }
140 
141 template <typename T>
143 operator const typename st2_e2_row_dofs_type<T>::matrix_type& () const
144 {
145  // Preconditions:
146 
147  // Body:
148 
149  // Postconditions:
150 
151  // Exit:
152 
153  st2_e2_row_dofs_type<T>& me = const_cast<st2_e2_row_dofs_type<T>&>(*this);
154 
155  return reinterpret_cast<matrix_type&>(me);
156 }
157 
158 template <typename T>
161 {
162  // Preconditions:
163 
164  // Body:
165 
167 
168  // Postconditions:
169 
170  ensure(result != 0);
171 
172  // Exit:
173 
174  return result;
175 }
176 
177 //==============================================================================
178 // NON-MEMBER FUNCTIONS
179 //==============================================================================
180 
181 #ifndef DOXYGEN_SKIP_IMPLEMENTATIONS
182 template <typename T>
183 std::ostream& operator<<(std::ostream& xos, const st2_e2_row_dofs_type<T>& xrdt)
184 {
185  int ld = xrdt.d();
186  for(int i=0; i<ld; ++i)
187  {
188  xos << " " << xrdt.components[i];
189  }
190 
191  return xos;
192 }
193 #endif // ifndef DOXYGEN_SKIP_IMPLEMENTATIONS
194 
195 } // namespace fiber_bundle
196 
197 #endif // ifndef ST2_E2_IMPL_H
Row dofs type for class st2_e2.
Definition: st2_e2.h:53
static int d()
The dimension of the row dof components.
Definition: st2_e2.impl.h:73
static const std::string & static_class_name()
The name of this class.
Definition: st2_e2.impl.h:53
T & operator[](int xindex)
Value of xindex-th component (row dof) (non const version).
Definition: st2_e2.impl.h:89
Symmetric matrix with 2 rows and 2 columns.
st2_e2_row_dofs_type< T > * clone() const
Creates a new instance of the same type as this.
Definition: st2_e2.impl.h:160
Namespace for the fiber_bundles component of the sheaf system.