20#ifndef LIBMESH_DENSE_VECTOR_BASE_H
21#define LIBMESH_DENSE_VECTOR_BASE_H
25#include "libmesh/libmesh_common.h"
26#include "libmesh/int_range.h"
70 virtual T
el(
const unsigned int i)
const = 0;
75 virtual T &
el(
const unsigned int i) = 0;
80 virtual unsigned int size()
const = 0;
85 virtual bool empty()
const {
return (this->
size() == 0); }
90 void print(std::ostream & os)
const;
Defines an abstract dense vector base class for use in Finite Element-type computations.
void print(std::ostream &os) const
Pretty-print the vector to stdout.
virtual ~DenseVectorBase()=default
virtual void zero()=0
Set every element in the vector to 0.
DenseVectorBase & operator=(const DenseVectorBase &)=default
virtual T el(const unsigned int i) const =0
DenseVectorBase()=default
Constructor.
virtual unsigned int size() const =0
DenseVectorBase(DenseVectorBase &&)=default
The 5 special functions can be defaulted for this class, as it does not manage any memory itself.
virtual bool empty() const
DenseVectorBase(const DenseVectorBase &)=default
void print_scientific(std::ostream &os, unsigned precision=8) const
Prints the entries of the vector with additional decimal places in scientific notation.
friend std::ostream & operator<<(std::ostream &os, const DenseVectorBase< T > &v)
Same as above, but allows you to print using the usual stream syntax.
virtual T & el(const unsigned int i)=0
The libMesh namespace provides an interface to certain functionality in the library.
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...