SheafSystem  0.0.0.0
st2_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 //
17 
20 
21 #ifndef ST2_E3_IMPL_H
22 #define ST2_E3_IMPL_H
23 
24 #ifndef SHEAF_DLL_SPEC_H
25 #include "SheafSystem/sheaf_dll_spec.h"
26 #endif
27 
28 #ifndef ST2_E3_H
29 #include "SheafSystem/st2_e3.h"
30 #endif
31 
32 #ifndef GL3_H
33 #include "SheafSystem/gl3.h"
34 #endif
35 
36 #ifndef STD_CMATH_H
37 #include "SheafSystem/std_cmath.h"
38 #endif
39 
40 namespace fiber_bundle
41 {
42 
43 //==============================================================================
44 // CLASS ST2_E3_ROW_DOFS_TYPE
45 //==============================================================================
46 
47 template <typename T>
48 const std::string&
51 {
52  // Preconditions:
53 
54  // Body:
55 
56  static const std::string result("st2_e3_row_dofs_type");
57 
58  // Postconditions:
59 
60  ensure(!result.empty());
61 
62  // Exit:
63 
64  return result;
65 }
66 
67 template <typename T>
68 int
70 d()
71 {
72  // Preconditions:
73 
74  // Body:
75 
76  // Postconditions:
77 
78  // Exit:
79 
80  return 6;
81 }
82 
83 template <typename T>
84 T&
86 operator[] (int xindex)
87 {
88  // Preconditions:
89 
90  ensure(xindex>=0 && xindex<d());
91 
92  // Body:
93 
94  T& result = components[xindex];
95 
96  // Postconditions:
97 
98  // Exit:
99 
100  return result;
101 }
102 
103 template <typename T>
104 const T&
106 operator[] (int xindex) const
107 {
108  // Preconditions:
109 
110  ensure(xindex>=0 && xindex<d());
111 
112  // Body:
113 
114  const T& result = components[xindex];
115 
116  // Postconditions:
117 
118  // Exit:
119 
120  return result;
121 }
122 
123 template <typename T>
126 {
127  // Preconditions:
128 
129  // Body:
130 
131  // Postconditions:
132 
133  // Exit:
134 
135  return reinterpret_cast<matrix_type&>(*this);
136 }
137 
138 template <typename T>
140 operator const typename st2_e3_row_dofs_type<T>::matrix_type& () const
141 {
142  // Preconditions:
143 
144  // Body:
145 
146  // Postconditions:
147 
148  // Exit:
149 
150  st2_e3_row_dofs_type<T>& lthis = const_cast<st2_e3_row_dofs_type<T>&>(*this);
151 
152  return reinterpret_cast<matrix_type&>(lthis);
153 }
154 
155 template <typename T>
158 {
159  // Preconditions:
160 
161  // Body:
162 
164 
165  // Postconditions:
166 
167  ensure(result != 0);
168 
169  // Exit:
170 
171  return result;
172 }
173 
174 
175 //==============================================================================
176 // NON-MEMBER FUNCTIONS
177 //==============================================================================
178 
179 template <typename T>
180 std::ostream& operator<<(std::ostream& xos, const st2_e3_row_dofs_type<T>& xrdt)
181 {
182  int ld = xrdt.d();
183  for(int i=0; i<ld; ++i)
184  {
185  xos << " " << xrdt.components[i];
186  }
187 
188  return xos;
189 }
190 
191 } // namespace fiber_bundle
192 
193 #endif // ifndef ST2_E3_IMPL_H
static int d()
The dimension of the row dof components.
Definition: st2_e3.impl.h:70
static const std::string & static_class_name()
The name of this class.
Definition: st2_e3.impl.h:50
Row dofs type for class st2_e3.
Definition: st2_e3.h:53
st2_e3_row_dofs_type< T > * clone() const
Creates a new instance of the same type as this.
Definition: st2_e3.impl.h:157
Namespace for the fiber_bundles component of the sheaf system.
T & operator[](int xindex)
Value of xindex-th component (row dof) (non const version).
Definition: st2_e3.impl.h:86
Symmetric matrix with 3 rows and 3 columns.