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 final;
77 const T & operator() (const
unsigned int i) const;
82 T & operator() (const
unsigned int i);
84 virtual T
el(const
unsigned int i) const override final
85 {
return (*
this)(i); }
87 virtual T &
el(
const unsigned int i)
override final 88 {
return (*
this)(i); }
90 virtual unsigned int size() const override final
93 virtual bool empty() const override final
105 const unsigned int n);
163 const unsigned int ioff,
164 const unsigned int n) :
165 _parent_vector(new_parent)
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
DenseSubVector(DenseVector< T > &new_parent, const unsigned int ioff=0, const unsigned int n=0)
Constructor.
unsigned int i_off() const
virtual unsigned int size() const override final
The libMesh namespace provides an interface to certain functionality in the library.
DenseVector< T > & parent()
virtual bool empty() const override final
unsigned int _n
The length of this subvector.
Defines a dense subvector for use in finite element computations.
void reposition(const unsigned int ioff, const unsigned int n)
Changes the location of the subvector in the parent vector.
virtual T el(const unsigned int i) const override final
const T & operator()(const unsigned int i) const
virtual void zero() override final
Set every element in the vector to 0.
virtual ~DenseSubVector()=default
DenseVector< T > & _parent_vector
The parent vector that contains this subvector.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
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...
Defines an abstract dense vector base class for use in Finite Element-type computations.
Defines a dense vector for use in Finite Element-type computations.
virtual T & el(const unsigned int i) override final
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
unsigned int _i_off
The offset into the parent vector.
DenseSubVector & operator=(const DenseSubVector &)=default