SheafSystem  0.0.0.0
t2_e2.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 T2_E2_IMPL_H
22 #define T2_E2_IMPL_H
23 
24 #ifndef SHEAF_DLL_SPEC_H
25 #include "SheafSystem/sheaf_dll_spec.h"
26 #endif
27 
28 #ifndef T2_E2_H
29 #include "SheafSystem/t2_e2.h"
30 #endif
31 
32 namespace fiber_bundle
33 {
34 
35 //==============================================================================
36 // CLASS T2_E2_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("t2_e2_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 = 4;
69 
70  // Postconditions:
71 
72  ensure(result == 4);
73 
74  // Exit:
75 
76  return result;
77 
78 }
79 
80 template <typename T>
81 T&
83 operator[] (int xindex)
84 {
85  // Preconditions:
86 
87  ensure(xindex>=0 && xindex<d());
88 
89  // Body:
90 
91  T& result = components[xindex];
92 
93  // Postconditions:
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  ensure(xindex>=0 && xindex<d());
108 
109  // Body:
110 
111  const T& result = components[xindex];
112 
113  // Postconditions:
114 
115  // Exit:
116 
117  return result;
118 }
119 
120 template <typename T>
123 {
124  // Preconditions:
125 
126  // Body:
127 
128  matrix_type& result = reinterpret_cast<matrix_type&>(*this);
129 
130  // Postconditions:
131 
132  // Exit:
133 
134  return result;
135 }
136 
137 template <typename T>
139 operator const typename t2_e2_row_dofs_type<T>::matrix_type& () const
140 {
141  // Preconditions:
142 
143  // Body:
144 
145  t2_e2_row_dofs_type<T>& lthis = const_cast<t2_e2_row_dofs_type<T>&>(*this);
146  const matrix_type& result = reinterpret_cast<matrix_type&>(lthis);
147 
148  // Postconditions:
149 
150  // Exit:
151 
152  return result;
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 // NON-MEMBER FUNCTIONS
176 //==============================================================================
177 
178 #ifndef DOXYGEN_SKIP_IMPLEMENTATIONS
179 template <typename T>
180 std::ostream& operator<<(std::ostream& xos, const t2_e2_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 #endif // ifndef DOXYGEN_SKIP_IMPLEMENTATIONS
191 
192 } // namespace fiber_bundle
193 
194 #endif // ifndef T2_E2_IMPL_H
static int d()
The dimension of the row dof components.
Definition: t2_e2.impl.h:62
General matrix with 2 rows and 2 columns.
Row dofs type for class t2_e2.
Definition: t2_e2.h:53
static const std::string & static_class_name()
The name of this class.
Definition: t2_e2.impl.h:42
T & operator[](int xindex)
Value of xindex-th component (row dof) (non const version).
Definition: t2_e2.impl.h:83
t2_e2_row_dofs_type< T > * clone() const
Creates a new instance of the same type as this.
Definition: t2_e2.impl.h:157
Namespace for the fiber_bundles component of the sheaf system.