libMesh::DenseVectorBase< T > Class Template Referenceabstract

#include <dense_matrix_base.h>

Inheritance diagram for libMesh::DenseVectorBase< T >:

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 libMesh::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.

Author
John W. Peterson, 2003

Definition at line 33 of file dense_matrix_base.h.

Constructor & Destructor Documentation

template<typename T>
libMesh::DenseVectorBase< T >::DenseVectorBase ( )
inline

Constructor. Empty.

Definition at line 53 of file dense_vector_base.h.

53 {}
template<typename T>
virtual libMesh::DenseVectorBase< T >::~DenseVectorBase ( )
inlinevirtual

Destructor. Does nothing.

Definition at line 58 of file dense_vector_base.h.

58 {}

Member Function Documentation

template<typename T>
virtual T libMesh::DenseVectorBase< T >::el ( const unsigned int  i) const
pure virtual
template<typename T>
virtual T& libMesh::DenseVectorBase< T >::el ( const unsigned int  i)
pure virtual
Returns
the (i) element of the vector as a writeable reference.

Implemented in libMesh::DenseVector< T >, and libMesh::DenseVector< Number >.

template<typename T >
void libMesh::DenseVectorBase< T >::print ( std::ostream &  os) const

Pretty-print the vector to stdout.

Definition at line 62 of file dense_vector_base.C.

63 {
64  for (unsigned int i=0; i<this->size(); i++)
65  os << std::setw(8)
66  << this->el(i)
67  << std::endl;
68 }
template<typename T >
void libMesh::DenseVectorBase< T >::print_scientific ( std::ostream &  os) const

Prints the entries of the vector with additional decimal places in scientific notation.

Definition at line 30 of file dense_vector_base.C.

31 {
32 #ifndef LIBMESH_BROKEN_IOSTREAM
33 
34  // save the initial format flags
35  std::ios_base::fmtflags os_flags = os.flags();
36 
37  // Print the vector entries.
38  for (unsigned int i=0; i<this->size(); i++)
39  os << std::setw(10)
40  << std::scientific
41  << std::setprecision(8)
42  << this->el(i)
43  << std::endl;
44 
45  // reset the original format flags
46  os.flags(os_flags);
47 
48 #else
49 
50  // Print the matrix entries.
51  for (unsigned int i=0; i<this->size(); i++)
52  os << std::setprecision(8)
53  << this->el(i)
54  << std::endl;
55 
56 #endif
57 }
template<typename T>
virtual void libMesh::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 libMesh::DenseVector< T >, and libMesh::DenseVector< Number >.

Referenced by libMesh::DofMap::extract_local_vector().

Friends And Related Function Documentation

template<typename T>
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 91 of file dense_vector_base.h.

92  {
93  v.print(os);
94  return os;
95  }

The documentation for this class was generated from the following files:

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

Hosted By:
SourceForge.net Logo