DenseVectorBase< T > Class Template Reference
#include <dense_vector_base.h>

Public Member Functions | |
| DenseVectorBase () | |
| virtual | ~DenseVectorBase () |
| virtual void | zero ()=0 |
| virtual T | el (const unsigned int i) const =0 |
| virtual T & | el (const unsigned int i)=0 |
| virtual unsigned int | size () const =0 |
| void | print (std::ostream &os) const |
| void | print_scientific (std::ostream &os) const |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const DenseVectorBase< T > &v) |
Detailed Description
template<typename T>
class DenseVectorBase< T >
Defines an abstract dense vector base class for use in Finite Element-type computations. Specialized dense vectors, for example DenseSubVectors, can be derived from this class.
Definition at line 43 of file dense_vector_base.h.
Constructor & Destructor Documentation
| DenseVectorBase< T >::DenseVectorBase | ( | ) | [inline] |
| virtual DenseVectorBase< T >::~DenseVectorBase | ( | ) | [inline, virtual] |
Member Function Documentation
| virtual T& DenseVectorBase< T >::el | ( | const unsigned int | i | ) | [pure virtual] |
- Returns:
- the
(i) element of the vector as a writeable reference.
Implemented in DenseVector< T >, and DenseVector< Real >.
| virtual T DenseVectorBase< T >::el | ( | const unsigned int | i | ) | const [pure virtual] |
- Returns:
- the
(i) element of the vector.
Implemented in DenseVector< T >, and DenseVector< Real >.
Referenced by DenseMatrixBase< T >::condense(), DofMap::extract_local_vector(), DenseVectorBase< T >::print(), and DenseVectorBase< T >::print_scientific().
| void DenseVectorBase< T >::print | ( | std::ostream & | os | ) | const [inline] |
Pretty-print the vector to stdout.
Definition at line 61 of file dense_vector_base.C.
References DenseVectorBase< T >::el(), and DenseVectorBase< T >::size().
00062 { 00063 for (unsigned int i=0; i<this->size(); i++) 00064 os << std::setw(8) 00065 << this->el(i) 00066 << std::endl; 00067 }
| void DenseVectorBase< T >::print_scientific | ( | std::ostream & | os | ) | const [inline] |
Prints the entries of the vector with additional decimal places in scientific notation.
Definition at line 29 of file dense_vector_base.C.
References DenseVectorBase< T >::el(), and DenseVectorBase< T >::size().
00030 { 00031 #ifndef LIBMESH_BROKEN_IOSTREAM 00032 00033 // save the initial format flags 00034 std::ios_base::fmtflags os_flags = os.flags(); 00035 00036 // Print the vector entries. 00037 for (unsigned int i=0; i<this->size(); i++) 00038 os << std::setw(10) 00039 << std::scientific 00040 << std::setprecision(8) 00041 << this->el(i) 00042 << std::endl; 00043 00044 // reset the original format flags 00045 os.flags(os_flags); 00046 00047 #else 00048 00049 // Print the matrix entries. 00050 for (unsigned int i=0; i<this->size(); i++) 00051 os << std::setprecision(8) 00052 << this->el(i) 00053 << std::endl; 00054 00055 #endif 00056 }
| virtual unsigned int DenseVectorBase< T >::size | ( | ) | const [pure virtual] |
- Returns:
- the size of the vector.
Implemented in DenseVector< T >, and DenseVector< Real >.
Referenced by DenseMatrixBase< T >::condense(), DofMap::extract_local_vector(), EpetraVector< T >::insert(), PetscVector< T >::insert(), LaspackVector< T >::insert(), DistributedVector< T >::insert(), DenseVectorBase< T >::print(), and DenseVectorBase< T >::print_scientific().
| virtual void DenseVectorBase< T >::zero | ( | ) | [pure virtual] |
Set every element in the vector to 0. Needs to be pure virtual since the storage method may be different in derived classes.
Implemented in DenseVector< T >, and DenseVector< Real >.
Referenced by DofMap::extract_local_vector().
Friends And Related Function Documentation
| std::ostream& operator<< | ( | std::ostream & | os, | |
| const DenseVectorBase< T > & | v | |||
| ) | [friend] |
Same as above, but allows you to print using the usual stream syntax.
Definition at line 88 of file dense_vector_base.h.
00089 { 00090 v.print(os); 00091 return os; 00092 }
The documentation for this class was generated from the following files: