SheafSystem  0.0.0.0
ed.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 ED_IMPL_H
22 #define ED_IMPL_H
23 
24 #ifndef SHEAF_DLL_SPEC_H
25 #include "SheafSystem/sheaf_dll_spec.h"
26 #endif
27 
28 #ifndef ED_H
29 #include "SheafSystem/ed.h"
30 #endif
31 
32 namespace fiber_bundle
33 {
34 
35 namespace ed_algebra
36 {
37 
38 template <typename T>
39 vd_value_type operator*(const T& x0, const T& x1)
40 {
41  // Preconditions:
42 
43  require(precondition_of(dot(x0, x1)));
44 
45  // Body:
46 
47  vd_value_type result = dot(x0, x1);
48 
49  // Postconditions:
50 
51  ensure(postcondition_of(dot(x0, x1)));
52 
53  // Exit:
54 
55  return result;
56 }
57 
58 template <typename T>
59 void normalize(T& x0, bool xauto_access)
60 {
61  // Preconditions:
62 
63  require(precondition_of(normalize(x0, x0, xauto_access)));
64 
65  // Body:
66 
67  normalize(x0, x0, xauto_access);
68 
69  // Postconditions:
70 
71  ensure(postcondition_of(normalize(x0, x0, xauto_access)));
72 
73  // Exit:
74 }
75 
76 template <typename T>
77 void normalize(T& x0)
78 {
79  // Preconditions:
80 
81  require(precondition_of(normalize(x0, x0)));
82 
83  // Body:
84 
85  normalize(x0, x0);
86 
87  // Postconditions:
88 
89  ensure(postcondition_of(normalize(x0, x0)));
90 
91  // Exit:
92 }
93 
94 } // namespace ed_algebra
95 
96 } // namespace fiber_bundle
97 
98 #endif // ifndef ED_IMPL_H
SHEAF_DLL_SPEC vd_value_type dot(const ed &x0, const ed &x1, bool xauto_access)
The Euclidean "dot" product of x0 with x1 (version for persistent types).
Definition: ed.cc:863
vd_value_type operator*(const T &x0, const T &x1)
The Euclidean "dot" product of x0 with x1 (for volatile types).
Definition: ed.impl.h:39
SHEAF_DLL_SPEC void normalize(const ed &x0, ed &xresult, bool xauto_access)
Normalize x0 (convert to a unit vector) (pre_allocated version for persistent types).
Definition: ed.cc:992
Namespace for the fiber_bundles component of the sheaf system.
double vd_value_type
The type of component in the fiber; the scalar type in the fiber vector space.
Definition: fiber_bundle.h:63