vector_value.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2014 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 
19 
20 #ifndef LIBMESH_VECTOR_VALUE_H
21 #define LIBMESH_VECTOR_VALUE_H
22 
23 // Local includes
24 #include "libmesh/type_vector.h"
25 
26 // C++ includes
27 
28 namespace libMesh
29 {
30 
39 template <typename T>
40 class VectorValue : public TypeVector<T>
41 {
42 public:
43 
48  VectorValue ();
49 
54  VectorValue (const T x,
55  const T y=0,
56  const T z=0);
57 
62  template <typename Scalar>
63  VectorValue (const Scalar x,
64  const Scalar y=0,
65  typename
66  boostcopy::enable_if_c<ScalarTraits<Scalar>::value,
67  const Scalar>::type z=0);
68 
72  template <typename T2>
73  VectorValue (const VectorValue<T2>& p);
74 
78  template <typename T2>
79  VectorValue (const TypeVector<T2>& p);
80 
81 #ifdef LIBMESH_USE_COMPLEX_NUMBERS
82 
87  VectorValue (const TypeVector<Real>& p_re,
88  const TypeVector<Real>& p_im);
89 #endif
90 
94  template <typename Scalar>
95  typename boostcopy::enable_if_c<
96  ScalarTraits<Scalar>::value,
97  VectorValue&>::type
98  operator = (const Scalar& p)
99  { libmesh_assert_equal_to (p, Scalar(0)); this->zero(); return *this; }
100 
101 
102 private:
103 
104 
105 };
106 
107 
108 
113 typedef VectorValue<Real> RealVectorValue;
114 typedef VectorValue<Number> NumberVectorValue;
117 
118 
119 
120 //------------------------------------------------------
121 // Inline functions
122 
123 template <typename T>
124 inline
126  TypeVector<T> ()
127 {
128 }
129 
130 
131 template <typename T>
132 inline
134  const T y,
135  const T z) :
136  TypeVector<T> (x,y,z)
137 {
138 }
139 
140 
141 
142 template <typename T>
143 template <typename Scalar>
144 inline
146  const Scalar y,
147  typename
149  const Scalar>::type z) :
150  TypeVector<T> (x,y,z)
151 {
152 }
153 
154 
155 
156 template <typename T>
157 template <typename T2>
158 inline
160  TypeVector<T> (p)
161 {
162 }
163 
164 
165 
166 template <typename T>
167 template <typename T2>
168 inline
170  TypeVector<T> (p)
171 {
172 }
173 
174 #ifdef LIBMESH_USE_COMPLEX_NUMBERS
175 template <typename T>
176 inline
178  const TypeVector<Real>& p_im) :
179  TypeVector<T> (Complex (p_re(0), p_im(0)),
180  Complex (p_re(1), p_im(1)),
181  Complex (p_re(2), p_im(2)))
182 {
183 }
184 #endif
185 
186 
187 } // namespace libMesh
188 
189 #endif // LIBMESH_VECTOR_VALUE_H

Site Created By: libMesh Developers
Last modified: February 07 2014 16:57:07 UTC

Hosted By:
SourceForge.net Logo