#include <TinyVector.hpp>


Public Types | |
| enum | { Dimension = N } |
| typedef T | ValueType |
| The type of values stored in the TinyVector. | |
Public Member Functions | |
| size_t | size () const |
| T & | operator[] (const size_t &i) |
| const T & | operator[] (const size_t &i) const |
| const TinyVector< N, T > & | operator= (const TinyVector< N, T > &V) |
| const TinyVector< N, T > & | operator= (const T &t) |
| TinyVector< N, T > | operator* (const T &t) const |
| real_t | operator* (const TinyVector< N, T > &V) const |
| const TinyVector< N, T > & | operator*= (const T &t) |
| const TinyVector< N, T > & | operator/= (const T &t) |
| TinyVector< N, T > | operator- (const TinyVector< N, T > &V) const |
| const TinyVector< N, T > & | operator-= (const TinyVector< N, T > &V) |
| TinyVector< N, T > | operator^ (const TinyVector< N, T > &V) const |
| TinyVector< N, T > | operator+ (const TinyVector< N, T > &V) const |
| TinyVector< N, T > & | operator+= (const TinyVector< N, T > &V) |
| bool | operator== (const TinyVector< N, T > &V) const |
| bool | operator!= (const TinyVector< N, T > &V) const |
| bool | operator< (const TinyVector< N, T > &V) const |
| TinyVector () | |
| TinyVector (const T &t) | |
| TinyVector (const TinyVector< N, T > &V) | |
| ~TinyVector () | |
Protected Attributes | |
| T | __x [N] |
| stored data | |
Friends | |
| TinyVector< N, T > | sqrt (const TinyVector< N, T > &V) |
| T | Norm (const TinyVector< N, T > &V) |
| TinyVector< N, T > | operator* (const T &a, const TinyVector< N, T > &V) |
| std::ostream & | operator<< (std::ostream &os, const TinyVector< N, T > &V) |
special vector of size 1 (ie lonely values)
Definition at line 42 of file TinyVector.hpp.
| typedef T TinyVector< N, T >::ValueType |
| anonymous enum |
| TinyVector< N, T >::TinyVector | ( | ) | [inline] |
| TinyVector< N, T >::TinyVector | ( | const T & | t | ) | [inline] |
Construct the vector setting its coordinates to t.
| t | the given value |
Definition at line 391 of file TinyVector.hpp.
00392 { 00393 for (size_t i=0; i<N; i++) { 00394 __x[i] = t; 00395 } 00396 }
| TinyVector< N, T >::TinyVector | ( | const TinyVector< N, T > & | V | ) | [inline] |
| TinyVector< N, T >::~TinyVector | ( | ) | [inline] |
| size_t TinyVector< N, T >::size | ( | ) | const [inline] |
Read-only access to the dimension of the TinyVector.
Definition at line 63 of file TinyVector.hpp.
Referenced by SurfaceMeshGenerator::Internals::__addList(), SurfaceMeshGenerator::Internals::__create2SD(), SurfaceMeshGenerator::Internals::__createLocalListIntersection(), GmshFormatReader::__proceedData(), and ConformTransformationQ1Hexahedron::invertT().
| T& TinyVector< N, T >::operator[] | ( | const size_t & | i | ) | [inline] |
Access to the i th coordinate.
| i | the component number |
Definition at line 75 of file TinyVector.hpp.
| const T& TinyVector< N, T >::operator[] | ( | const size_t & | i | ) | const [inline] |
Read-only access to the i th component.
| i | the component number |
Definition at line 88 of file TinyVector.hpp.
| const TinyVector<N, T>& TinyVector< N, T >::operator= | ( | const TinyVector< N, T > & | V | ) | [inline] |
Makes the current vector equal to a given one
| V | the vector to copy |
Definition at line 101 of file TinyVector.hpp.
Referenced by Vertex::operator=().
| const TinyVector<N, T>& TinyVector< N, T >::operator= | ( | const T & | t | ) | [inline] |
Copies the value t to every component of the vector
| t | the value to copy |
Definition at line 115 of file TinyVector.hpp.
00116 { 00117 for (size_t i=0; i<N; i++) 00118 __x[i] = t; 00119 return (*this); 00120 }
| TinyVector<N, T> TinyVector< N, T >::operator* | ( | const T & | t | ) | const [inline] |
Returns multiplication by a T from the right ...
| t | the value |
where
is the current vector Definition at line 129 of file TinyVector.hpp.
00130 { 00131 TinyVector<N, T> W; 00132 for (size_t i=0; i<N; i++) 00133 W.__x[i] = __x[i] * t; 00134 return W; 00135 }
| real_t TinyVector< N, T >::operator* | ( | const TinyVector< N, T > & | V | ) | const [inline] |
Computes the scalar product with another vector
| V | the other vector |
Definition at line 144 of file TinyVector.hpp.
00145 { 00146 ASSERT(typeid(T) == typeid(real_t)); 00147 real_t s=0; 00148 for (size_t i=0; i<N; i++) 00149 s += __x[i] * V.__x[i]; 00150 return s; 00151 }
| const TinyVector<N, T>& TinyVector< N, T >::operator*= | ( | const T & | t | ) | [inline] |
Multiplies the TinyVector by a T
| t | the given value |
Definition at line 160 of file TinyVector.hpp.
Referenced by TinyVector< 3, T >::operator/=(), and TinyVector< StaticPow< 2, Dimension >::value, Octree::__Node * >::operator/=().
00161 { 00162 for (size_t i=0; i<N; i++) 00163 __x[i] *= t; 00164 return (*this); 00165 }
| const TinyVector<N, T>& TinyVector< N, T >::operator/= | ( | const T & | t | ) | [inline] |
Multiplies the TinyVector by the inverse of a T
| t | the given value |
Definition at line 174 of file TinyVector.hpp.
00175 { 00176 const T temp = 1./t; 00177 this->operator*=(temp); 00178 return (*this); 00179 }
| TinyVector<N, T> TinyVector< N, T >::operator- | ( | const TinyVector< N, T > & | V | ) | const [inline] |
Computes the difference with an other vector
| V | the other vector |
Definition at line 188 of file TinyVector.hpp.
00189 { 00190 TinyVector<N, T> v = 0; 00191 for (size_t i=0; i<N; i++) 00192 v[i] = __x[i] - V.__x[i]; 00193 return v; 00194 }
| const TinyVector<N, T>& TinyVector< N, T >::operator-= | ( | const TinyVector< N, T > & | V | ) | [inline] |
Substracts a vector.
| V | the vector to remove |
Definition at line 203 of file TinyVector.hpp.
| TinyVector<N, T> TinyVector< N, T >::operator^ | ( | const TinyVector< N, T > & | V | ) | const [inline] |
Computes the vectorial product with a vector
| V | the given vector |
Definition at line 217 of file TinyVector.hpp.
00218 { 00219 TinyVector<N, T> W=0; 00220 for (size_t i=0; i<N; i++) 00221 W[i] += __x[(i+1)%N] * V.__x[(i+2)%N] - __x[(i+2)%N] * V.__x[(i+1)%N]; 00222 return W; 00223 }
| TinyVector<N, T> TinyVector< N, T >::operator+ | ( | const TinyVector< N, T > & | V | ) | const [inline] |
Computes the sum with another vector
| V | the other vector |
Definition at line 232 of file TinyVector.hpp.
00233 { 00234 TinyVector<N, T> W(*this); 00235 for (size_t i=0; i<N; i++) 00236 W.__x[i] += V.__x[i]; 00237 return W; 00238 }
| TinyVector<N, T>& TinyVector< N, T >::operator+= | ( | const TinyVector< N, T > & | V | ) | [inline] |
Adds a vector
| V | the vector to add |
Definition at line 247 of file TinyVector.hpp.
| bool TinyVector< N, T >::operator== | ( | const TinyVector< N, T > & | V | ) | const [inline] |
Compares two vectors
| V | the vector to compare with |
Definition at line 263 of file TinyVector.hpp.
00264 { 00265 for (size_t i=0; i<N; i++) { 00266 if (__x[i] != V.__x[i]) { 00267 return false; 00268 } 00269 } 00270 return true; 00271 }
| bool TinyVector< N, T >::operator!= | ( | const TinyVector< N, T > & | V | ) | const [inline] |
Compares 2 vectors. true if they are not exactly the same
| V | the vector to compare with |
Definition at line 280 of file TinyVector.hpp.
00281 { 00282 for (size_t i=0; i<N; i++) { 00283 if (__x[i] != V.__x[i]) { 00284 return true; 00285 } 00286 } 00287 return false; 00288 }
| bool TinyVector< N, T >::operator< | ( | const TinyVector< N, T > & | V | ) | const [inline] |
Compares two vectors
| V | the vector to compare with |
Definition at line 299 of file TinyVector.hpp.
00300 { 00301 for (size_t i=0; i<N; ++i) { 00302 if(__x[i] != V.__x[i]) { 00303 return (__x[i] < V.__x[i]); 00304 } 00305 } 00306 return false; 00307 }
| TinyVector<N, T> sqrt | ( | const TinyVector< N, T > & | V | ) | [friend] |
Returns the square root of a vector. (ie: it returns the vector whoose componnents are square roots of arg)
| V | the given vector |
Definition at line 317 of file TinyVector.hpp.
00318 { 00319 using namespace std; 00320 TinyVector<N, T> W; 00321 for (size_t i=0; i<N; i++) 00322 W.__x[i] = sqrt(V.__x[i]); 00323 return W; 00324 }
| T Norm | ( | const TinyVector< N, T > & | V | ) | [friend] |
Returns the Euclidean norm of the vector.
| V | the vector which norm is to compute |
Definition at line 333 of file TinyVector.hpp.
00334 { 00335 T t = 0; 00336 for (size_t i=0; i<N; i++) { 00337 t += V.__x[i]*V.__x[i]; 00338 } 00339 00340 using namespace std; 00341 return sqrt(t); 00342 }
| TinyVector<N, T> operator* | ( | const T & | a, | |
| const TinyVector< N, T > & | V | |||
| ) | [friend] |
Returns the multiplication of a TinyVector by a T on the left.
| a | the multiplicative constant | |
| V | the vector to multiply |
Definition at line 352 of file TinyVector.hpp.
| std::ostream& operator<< | ( | std::ostream & | os, | |
| const TinyVector< N, T > & | V | |||
| ) | [friend] |
Prints out the transposed of a vector in a stream
| os | the given stream | |
| V | the vector |
Definition at line 365 of file TinyVector.hpp.
00367 { 00368 ASSERT (N>0); 00369 os << '('; 00370 for (size_t i=0; i<N-1; i++) 00371 os << V[i] << ", "; 00372 os << V[N-1] << ')'; 00373 return os; 00374 }
T TinyVector< N, T >::__x[N] [protected] |
stored data
Definition at line 54 of file TinyVector.hpp.
Referenced by TinyVector< 1, T >::operator const T &(), TinyVector< 1, T >::operator T &(), TinyVector< 3, T >::operator!=(), TinyVector< StaticPow< 2, Dimension >::value, Octree::__Node * >::operator!=(), TinyVector< 3, T >::operator*(), TinyVector< StaticPow< 2, Dimension >::value, Octree::__Node * >::operator*(), TinyVector< 3, T >::operator*=(), TinyVector< StaticPow< 2, Dimension >::value, Octree::__Node * >::operator*=(), TinyVector< 3, T >::operator+(), TinyVector< StaticPow< 2, Dimension >::value, Octree::__Node * >::operator+(), TinyVector< 3, T >::operator+=(), TinyVector< StaticPow< 2, Dimension >::value, Octree::__Node * >::operator+=(), TinyVector< 3, T >::operator-(), TinyVector< StaticPow< 2, Dimension >::value, Octree::__Node * >::operator-(), TinyVector< 3, T >::operator-=(), TinyVector< StaticPow< 2, Dimension >::value, Octree::__Node * >::operator-=(), TinyVector< 3, T >::operator<(), TinyVector< StaticPow< 2, Dimension >::value, Octree::__Node * >::operator<(), TinyVector< 3, T >::operator=(), TinyVector< StaticPow< 2, Dimension >::value, Octree::__Node * >::operator=(), TinyVector< 3, T >::operator==(), TinyVector< StaticPow< 2, Dimension >::value, Octree::__Node * >::operator==(), TinyVector< 1, T >::operator[](), TinyVector< 3, T >::operator[](), TinyVector< StaticPow< 2, Dimension >::value, Octree::__Node * >::operator[](), TinyVector< 3, T >::operator^(), TinyVector< StaticPow< 2, Dimension >::value, Octree::__Node * >::operator^(), TinyVector< 3, T >::TinyVector(), and TinyVector< StaticPow< 2, Dimension >::value, Octree::__Node * >::TinyVector().
1.5.6