SheafSystem  0.0.0.0
jcb_e33.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 JCB_E33_IMPL_H
22 #define JCB_E33_IMPL_H
23 
24 #ifndef SHEAF_DLL_SPEC_H
25 #include "SheafSystem/sheaf_dll_spec.h"
26 #endif
27 
28 #ifndef JCB_E33_H
29 #include "SheafSystem/jcb_e33.h"
30 #endif
31 
32 namespace fiber_bundle
33 {
34 
35 //==============================================================================
36 // CLASS JCB_E33_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("jcb_e33_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 = 9;
69 
70  // Postconditions:
71 
72  ensure(result == 9);
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  // Exit:
95 
96  return result;
97 }
98 
99 template <typename T>
100 const T&
102 operator[] (int xindex) const
103 {
104  // Preconditions:
105 
106  ensure(xindex>=0 && xindex<d());
107 
108  // Body:
109 
110  const T& result = components[xindex];
111 
112  // Postconditions:
113 
114  // Exit:
115 
116  return result;
117 }
118 
119 template <typename T>
122 {
123  // Preconditions:
124 
125  // Body:
126 
127  matrix_type& result = reinterpret_cast<matrix_type&>(*this);
128 
129  // Postconditions:
130 
131  // Exit:
132 
133  return result;
134 }
135 
136 template <typename T>
138 operator const typename jcb_e33_row_dofs_type<T>::matrix_type& () const
139 {
140  // Preconditions:
141 
142  // Body:
143 
144  jcb_e33_row_dofs_type<T>& lthis = const_cast<jcb_e33_row_dofs_type<T>&>(*this);
145  const matrix_type& result = reinterpret_cast<matrix_type&>(lthis);
146 
147  // Postconditions:
148 
149  // Exit:
150 
151  return result;
152 }
153 
154 template <typename T>
157 {
158  // Preconditions:
159 
160  // Body:
161 
163 
164  // Postconditions:
165 
166  ensure(result != 0);
167 
168  // Exit:
169 
170  return result;
171 }
172 
173 //==============================================================================
174 // NON-MEMBER FUNCTIONS
175 //==============================================================================
176 
177 #ifndef DOXYGEN_SKIP_IMPLEMENTATIONS
178 template <typename T>
179 std::ostream& operator<<(std::ostream& xos, const jcb_e33_row_dofs_type<T>& xrdt)
180 {
181  int ld = xrdt.d();
182  for(int i=0; i<ld; ++i)
183  {
184  xos << " " << xrdt.components[i];
185  }
186 
187  return xos;
188 }
189 #endif // ifndef DOXYGEN_SKIP_IMPLEMENTATIONS
190 
191 } // namespace fiber_bundle
192 
193 #endif // ifndef JCB_E33_IMPL_H
T & operator[](int xindex)
Value of xindex-th component (row dof) (non const version).
Definition: jcb_e33.impl.h:82
static int d()
The dimension of the row dof components.
Definition: jcb_e33.impl.h:62
static const std::string & static_class_name()
The name of this class.
Definition: jcb_e33.impl.h:42
Row dofs type for class jcb_e33.
Definition: jcb_e33.h:48
General matrix with 3 rows and 3 columns.
Namespace for the fiber_bundles component of the sheaf system.
jcb_e33_row_dofs_type< T > * clone() const
Creates a new instance of the same type as this.
Definition: jcb_e33.impl.h:156