SheafSystem  0.0.0.0
gl3.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 //
17 
20 
21 #ifndef GL3_IMPL_H
22 #define GL3_IMPL_H
23 
24 #ifndef SHEAF_DLL_SPEC_H
25 #include "SheafSystem/sheaf_dll_spec.h"
26 #endif
27 
28 #ifndef GL3_H
29 #include "SheafSystem/gl3.h"
30 #endif
31 
32 namespace fiber_bundle
33 {
34 
35 //==============================================================================
36 // CLASS GL3_ROW_DOFS_TYPE
37 //==============================================================================
38 
39 template <typename T>
40 const std::string&
43 {
44  // Preconditions:
45 
46  // Body:
47 
48  static const std::string result("gl3_row_dofs_type");
49 
50  // Postconditions:
51 
52  ensure(!result.empty());
53 
54  // Exit:
55 
56  return result;
57 }
58 
59 template <typename T>
60 int
62 d()
63 {
64  // Preconditions:
65 
66  // Body:
67 
68  int result = 18;
69 
70  // Postconditions:
71 
72  ensure(result == 18);
73 
74  // Exit:
75 
76  return result;
77 }
78 
79 template <typename T>
80 T&
82 operator[] (int xindex)
83 {
84  // Preconditions:
85 
86  ensure(xindex>=0 && xindex<d());
87 
88  // Body:
89 
90  T& result = components[xindex];
91 
92  // Postconditions:
93 
94  //ensure(invariant());
95 
96  // Exit:
97 
98  return result;
99 }
100 
101 template <typename T>
102 const T&
104 operator[] (int xindex) const
105 {
106  // Preconditions:
107 
108  ensure(xindex>=0 && xindex<d());
109 
110  // Body:
111 
112  const T& result = components[xindex];
113 
114  // Postconditions:
115 
116  //ensure(invariant());
117 
118  // Exit:
119 
120  return result;
121 }
122 
123 template <typename T>
126 {
127  // Preconditions:
128 
129  // Body:
130 
131  matrix_type& result = basis_matrix();
132 
133  // Postconditions:
134 
135  // Exit:
136 
137  return result;
138 }
139 
140 template <typename T>
142 operator const typename gl3_row_dofs_type<T>::matrix_type& () const
143 {
144  // Preconditions:
145 
146  // Body:
147 
148  const matrix_type& result = basis_matrix();
149 
150  // Postconditions:
151 
152  // Exit:
153 
154  return result;
155 }
156 
157 template <typename T>
161 {
162  // Preconditions:
163 
164  // Body:
165 
166  T& comp0 = components[0];
167  matrix_type& result = reinterpret_cast<matrix_type&>(comp0);
168 
169  // Postconditions:
170 
171  // Exit:
172 
173  return result;
174 }
175 
176 template <typename T>
177 const typename gl3_row_dofs_type<T>::matrix_type&
180 {
181  // Preconditions:
182 
183  // Body:
184 
185  T& comp0 = const_cast<T&>(components[0]);
186  const matrix_type& result = reinterpret_cast<matrix_type&>(comp0);
187 
188  // Postconditions:
189 
190  // Exit:
191 
192  return result;
193 }
194 
195 template <typename T>
199 {
200  // Preconditions:
201 
202  // Body:
203 
204  // Component part states at element 9.
205 
206  T& comp9 = components[9];
207  matrix_type& result = reinterpret_cast<matrix_type&>(comp9);
208 
209  // Postconditions:
210 
211  // Exit:
212 
213  return result;
214 }
215 
216 template <typename T>
217 const typename gl3_row_dofs_type<T>::matrix_type&
220 {
221  // Preconditions:
222 
223  // Body:
224 
225  // Component part states at element 9.
226 
227  T& comp9 = const_cast<T&>(components[9]);
228  const matrix_type& result = reinterpret_cast<matrix_type&>(comp9);
229 
230  // Postconditions:
231 
232  // Exit:
233 
234  return result;
235 }
236 
237 template <typename T>
240 {
241  // Preconditions:
242 
243  // Body:
244 
246 
247  // Postconditions:
248 
249  ensure(result != 0);
250 
251  // Exit:
252 
253  return result;
254 }
255 
256 
257 //==============================================================================
258 // NON-MEMBER FUNCTIONS
259 //==============================================================================
260 
261 #ifndef DOXYGEN_SKIP_IMPLEMENTATIONS
262 template <typename T>
263 std::ostream& operator<<(std::ostream& xos, const gl3_row_dofs_type<T>& xrdt)
264 {
265  int ld = xrdt.d();
266  for(int i=0; i<ld; ++i)
267  {
268  xos << " " << xrdt.components[i];
269  }
270 
271  return xos;
272 }
273 #endif // ifndef DOXYGEN_SKIP_IMPLEMENTATIONS
274 
275 } // namespace fiber_bundle
276 
277 #endif // ifndef GL3_IMPL_H
278 
gl3_row_dofs_type< T > * clone() const
Creates a new instance of the same type as this.
Definition: gl3.impl.h:239
static int d()
The dimension of the row dof components.
Definition: gl3.impl.h:62
T & operator[](int xindex)
Value of xindex-th component (row dof) (non const version).
Definition: gl3.impl.h:82
Row dofs type for class gl3.
Definition: gl3.h:50
matrix_type & basis_matrix()
The associated basis transformation matrix (non const version).
Definition: gl3.impl.h:160
matrix_type & component_matrix()
The associated component transformation matrix (non const version).
Definition: gl3.impl.h:198
General matrix with 3 rows and 3 columns.
Namespace for the fiber_bundles component of the sheaf system.
static const std::string & static_class_name()
The name of this class.
Definition: gl3.impl.h:42