Public Types | |
| typedef double | value_type |
Public Member Functions | |
| Tensor () | |
| Tensor (const value_type &initializer) | |
| Tensor (const Tensor< 0, dim > &) | |
| operator double () const | |
| operator double & () | |
| Tensor< 0, dim > & | operator= (const Tensor< 0, dim > &) |
| Tensor< 0, dim > & | operator= (const double d) |
| bool | operator== (const Tensor< 0, dim > &) const |
| bool | operator!= (const Tensor< 0, dim > &) const |
| Tensor< 0, dim > & | operator+= (const Tensor< 0, dim > &) |
| Tensor< 0, dim > & | operator-= (const Tensor< 0, dim > &) |
| Tensor< 0, dim > & | operator*= (const double factor) |
| Tensor< 0, dim > & | operator/= (const double factor) |
| double | operator* (const Tensor< 0, dim > &) const |
| Tensor< 0, dim > | operator+ (const Tensor< 0, dim > &) const |
| Tensor< 0, dim > | operator- (const Tensor< 0, dim > &) const |
| Tensor< 0, dim > | operator- () const |
| double | norm () const |
| double | norm_square () const |
| void | clear () |
| template<class Archive > | |
| void | serialize (Archive &ar, const unsigned int version) |
Static Public Member Functions | |
| ::ExceptionBase & | ExcDimTooSmall (int arg1) throw (errortext << "dim must be positive, but was " << arg1 ) |
Static Public Attributes | |
| static const unsigned int | dimension = dim |
| static const unsigned int | rank = 0 |
Private Attributes | |
| double | value |
This class is a specialized version of the Tensor<rank,dim> class. It handles tensors of rank zero, i.e. scalars. The second template argument is ignored.
This class exists because in some cases we want to construct objects of type Tensor<spacedim-dim,dim>, which should expand to scalars, vectors, matrices, etc, depending on the values of the template arguments dim and spacedim. We therefore need a class that acts as a scalar (i.e. double) for all purposes but is part of the Tensor template family.
| typedef double Tensor< 0, dim >::value_type |
Type of stored objects. This is a double for a rank 1 tensor.
| Tensor< 0, dim >::Tensor | ( | const value_type & | initializer | ) |
Copy constructor, where the data is copied from a C-style array.
Conversion to double. Since rank-0 tensors are scalars, this is a natural operation.
Conversion to double. Since rank-0 tensors are scalars, this is a natural operation.
This is the non-const conversion operator that returns a writable reference.
Assignment operator.
Test for equality of two tensors.
Test for inequality of two tensors.
Add another vector, i.e. move this point by the given offset.
Subtract another vector.
Scale the vector by factor, i.e. multiply all coordinates by factor.
Scale the vector by 1/factor.
Returns the scalar product of two vectors.
Add two tensors. If possible, use operator += instead since this does not need to copy a point at least once.
Subtract two tensors. If possible, use operator += instead since this does not need to copy a point at least once.
Return the Frobenius-norm of a tensor, i.e. the square root of the sum of squares of all entries. For the present case of rank-1 tensors, this equals the usual l2 norm of the vector.
Return the square of the Frobenius-norm of a tensor, i.e. the square root of the sum of squares of all entries.
This function mainly exists because it makes computing the norm simpler recursively, but may also be useful in other contexts.
| void Tensor< 0, dim >::clear | ( | ) |
Reset all values to zero.
Note that this is partly inconsistent with the semantics of the clear() member functions of the STL and of several other classes within deal.II which not only reset the values of stored elements to zero, but release all memory and return the object into a virginial state. However, since the size of objects of the present type is determined by its template parameters, resizing is not an option, and indeed the state where all elements have a zero value is the state right after construction of such an object.
| void Tensor< 0, dim >::serialize | ( | Archive & | ar, |
| const unsigned int | version | ||
| ) |
Read or write the data of this object to or from a stream for the purpose of serialization
Provide a way to get the dimension of an object without explicit knowledge of it's data type. Implementation is this way instead of providing a function dimension() because now it is possible to get the dimension at compile time without the expansion and preevaluation of an inlined function; the compiler may therefore produce more efficient code and you may use this value to declare other data types.
Publish the rank of this tensor to the outside world.
documentation generated on Fri Aug 12 2011 15:01:07 by
doxygen
1.7.4