Go to the documentation of this file.
20 #ifndef LIBMESH_DENSE_SUBVECTOR_H
21 #define LIBMESH_DENSE_SUBVECTOR_H
24 #include "libmesh/libmesh_common.h"
25 #include "libmesh/dense_vector.h"
26 #include "libmesh/int_range.h"
53 const unsigned int ioff=0,
54 const unsigned int n=0);
71 virtual void zero()
override;
77 const T &
operator() (
const unsigned int i)
const;
84 virtual T
el(
const unsigned int i)
const override
85 {
return (*
this)(i); }
87 virtual T &
el(
const unsigned int i)
override
88 {
return (*
this)(i); }
90 virtual unsigned int size()
const override
93 virtual bool empty()
const override
105 const unsigned int n);
163 const unsigned int ioff,
164 const unsigned int n) :
165 _parent_vector(new_parent)
167 reposition (ioff, n);
175 const unsigned int n)
181 libmesh_assert_less_equal ((this->i_off() + this->size()), _parent_vector.size());
191 _parent_vector (i + this->i_off()) = 0.;
200 libmesh_assert_less (i, this->size());
201 libmesh_assert_less (i + this->i_off(), _parent_vector.size());
203 return _parent_vector (i + this->i_off());
211 libmesh_assert_less (i, this->size());
212 libmesh_assert_less (i + this->i_off(), _parent_vector.size());
214 return _parent_vector (i + this->i_off());
227 my_min = (my_min < current? my_min : current);
244 my_max = (my_max > current? my_max : current);
258 my_norm +=
std::abs(_parent_vector (i + this->i_off()));
274 return sqrt(my_norm);
290 my_norm = (my_norm > current? my_norm : current);
292 return sqrt(my_norm);
298 #endif // LIBMESH_DENSE_SUBVECTOR_H
virtual T el(const unsigned int i) const override
DenseVector< T > & _parent_vector
The parent vector that contains this subvector.
DenseSubVector & operator=(const DenseSubVector &)=default
virtual bool empty() const override
unsigned int i_off() const
IntRange< std::size_t > index_range(const std::vector< T > &vec)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
The libMesh namespace provides an interface to certain functionality in the library.
MetaPhysicL::DualNumber< T, D > sqrt(const MetaPhysicL::DualNumber< T, D > &in)
Defines an abstract dense vector base class for use in Finite Element-type computations.
The IntRange templated class is intended to make it easy to loop over integers which are indices of a...
const T & operator()(const unsigned int i) const
MetaPhysicL::DualNumber< T, D > abs(const MetaPhysicL::DualNumber< T, D > &in)
virtual unsigned int size() const override
virtual ~DenseSubVector()=default
virtual void zero() override
Set every element in the vector to 0.
Defines a dense subvector for use in finite element computations.
DenseVector< T > & parent()
DenseSubVector(DenseVector< T > &new_parent, const unsigned int ioff=0, const unsigned int n=0)
Constructor.
void reposition(const unsigned int ioff, const unsigned int n)
Changes the location of the subvector in the parent vector.
unsigned int _n
The length of this subvector.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual T & el(const unsigned int i) override
Defines a dense vector for use in Finite Element-type computations.
unsigned int _i_off
The offset into the parent vector.