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"
54 const unsigned int ioff = 0,
55 const unsigned int n = 0);
74 virtual void zero() override final;
79 const T & operator() (const
unsigned int i) const;
84 T & operator() (const
unsigned int i);
89 virtual T
el(const
unsigned int i) const override final
90 {
return (*
this)(i); }
92 virtual T &
el(
const unsigned int i)
override final
93 {
return (*
this)(i); }
98 virtual unsigned int size() const override final
104 virtual bool empty() const override final
105 {
return (
_n == 0); }
119 const unsigned int n);
169 const unsigned int ioff,
170 const unsigned int n) :
171 _parent_vector(new_parent)
181 const unsigned int n)
187 libmesh_assert_less_equal ((this->i_off() + this->size()), _parent_vector.size());
196 for (
auto i : index_range(*
this))
197 _parent_vector (i + this->i_off()) = 0.;
206 libmesh_assert_less (i, this->size());
207 libmesh_assert_less (i + this->i_off(), _parent_vector.size());
209 return _parent_vector (i + this->i_off());
217 libmesh_assert_less (i, this->size());
218 libmesh_assert_less (i + this->i_off(), _parent_vector.size());
220 return _parent_vector (i + this->i_off());
227 libmesh_assert (this->size());
230 for (
auto i : make_range(1u, this->size()))
233 my_min = (my_min < current? my_min : current);
244 libmesh_assert (this->size());
247 for (
auto i : make_range(1u, this->size()))
250 my_max = (my_max > current? my_max : current);
262 for (
auto i : index_range(*
this))
264 my_norm +=
std::abs(_parent_vector (i + this->i_off()));
276 for (
auto i : index_range(*
this))
280 return sqrt(my_norm);
293 for (
auto i : make_range(1u, this->size()))
296 my_norm = (my_norm > current? my_norm : current);
298 return sqrt(my_norm);
304 #endif // LIBMESH_DENSE_SUBVECTOR_H
DenseSubVector(DenseVector< T > &new_parent, const unsigned int ioff=0, const unsigned int n=0)
构造函数。创建一个向量 parent 的稠密子向量。 子向量的维度为 ,并且子向量的 元素位于父向量的 位置。
virtual bool empty() const overridefinal
const T & operator()(const unsigned int i) const
ADRealEigenVector< T, D, asd > sqrt(const ADRealEigenVector< T, D, asd > &)
计算自动微分实数向量的平方根。
virtual T el(const unsigned int i) const overridefinal
重写基类函数,返回索引为 i 的元素的常量引用和可写引用。
DenseVector< T > & parent()
定义了一个用于有限元计算的稠密子向量。 在将元素载荷向量累加到全局向量之前存储这些载荷向量时特别有用,尤其是在存在方程组的情况下。 所有重写的虚拟函数在 dense_vector_base.h 中有文档说明。
ADRealEigenVector< T, D, asd > abs(const ADRealEigenVector< T, D, asd > &)
计算自动微分实数向量的绝对值。
void reposition(const unsigned int ioff, const unsigned int n)
更改子向量在父向量中的位置和长度。
unsigned int i_off() const
virtual unsigned int size() const overridefinal
virtual T & el(const unsigned int i) overridefinal
virtual ~DenseSubVector()=default
DenseVector< T > & _parent_vector
包含该子向量的父向量。
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
定义用于有限元计算的抽象稠密向量基类。 可以从这个类派生出特定的稠密向量,例如 DenseSubVectors。
定义用于有限元计算的稠密向量类。该类基本上是为了补充 DenseMatrix 类而设计的。 它相对于 std::vector 具有额外的功能,使其在有限元中特别有用,特别是对于方程组。 所有重写的虚拟函...
unsigned int _i_off
在父向量中的偏移。
virtual void zero() overridefinal
重写基类的 zero 函数,将子向量中的所有元素置零。
DenseSubVector & operator=(const DenseSubVector &)=default