libmesh解析
本工作只是尝试解析原libmesh的代码,供学习使用
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 
Public 类型 | Public 成员函数 | 静态 Public 成员函数 | Protected 类型 | Protected 成员函数 | Protected 属性 | 静态 Protected 属性 | Private 属性 | 友元 | 所有成员列表
libMesh::EigenSparseVector< T > 模板类 参考

This class provides a nice interface to the Eigen C++-based data structures for serial vectors. 更多...

#include <eigen_sparse_matrix.h>

类 libMesh::EigenSparseVector< T > 继承关系图:
[图例]

Public 类型

typedef EigenSV DataType
 Convenient typedefs. 更多...
 

Public 成员函数

 EigenSparseVector (const Parallel::Communicator &comm_in, const ParallelType=AUTOMATIC)
 Dummy-Constructor. 更多...
 
 EigenSparseVector (const Parallel::Communicator &comm_in, const numeric_index_type n, const ParallelType=AUTOMATIC)
 Constructor. 更多...
 
 EigenSparseVector (const Parallel::Communicator &comm_in, const numeric_index_type n, const numeric_index_type n_local, const ParallelType=AUTOMATIC)
 Constructor. 更多...
 
 EigenSparseVector (const Parallel::Communicator &comm_in, const numeric_index_type N, const numeric_index_type n_local, const std::vector< numeric_index_type > &ghost, const ParallelType=AUTOMATIC)
 Constructor. 更多...
 
EigenSparseVector< T > & operator= (const EigenSparseVector< T > &v)
 Copy assignment operator. 更多...
 
 EigenSparseVector (EigenSparseVector &&)=default
 The 5 special functions can be defaulted for this class, as it does not manage any memory itself. 更多...
 
 EigenSparseVector (const EigenSparseVector &)=default
 
EigenSparseVectoroperator= (EigenSparseVector &&)=default
 
virtual ~EigenSparseVector ()=default
 
virtual void close () override
 调用 NumericVector 的内部组装函数,确保值在处理器之间一致。 更多...
 
virtual void clear () override
 将 NumericVector<T> 恢复到原始状态。 更多...
 
virtual void zero () override
 将所有条目设置为零。等同于 v = 0,但更明显且更快。 更多...
 
virtual std::unique_ptr
< NumericVector< T > > 
zero_clone () const override
 返回一个智能指针,指向具有相同类型、大小和分区的此向量的副本,但所有条目都为零。 更多...
 
virtual std::unique_ptr
< NumericVector< T > > 
clone () const override
 返回一个包装了此向量副本的智能指针。 更多...
 
virtual void init (const numeric_index_type N, const numeric_index_type n_local, const bool fast=false, const ParallelType ptype=AUTOMATIC) override
 更改向量的维度为 n 。如果可能的话 ,该向量的保留内存保持不变。 如果 n==0 ,所有内存都将被释放。因此,如果要调整向量的大小并释放不需要的内存, 必须首先调用 init(0) ,然后调用 init(n) 。这种行为类似于 STL 容器。 更多...
 
virtual void init (const numeric_index_type N, const bool fast=false, const ParallelType ptype=AUTOMATIC) override
 调用 init() ,其中 n_local = N。 更多...
 
virtual void init (const numeric_index_type N, const numeric_index_type n_local, const std::vector< numeric_index_type > &ghost, const bool fast=false, const ParallelType=AUTOMATIC) override
 创建一个包含本地索引以及在 ghost 参数中指定的索引的向量。 更多...
 
virtual void init (const NumericVector< T > &other, const bool fast=false) override
 创建一个具有与 other 相同维度和存储类型的向量,包括 ghost dofs。 更多...
 
virtual NumericVector< T > & operator= (const T s) override
 设置向量的所有条目为值 s。 更多...
 
virtual NumericVector< T > & operator= (const NumericVector< T > &v) override
 一个复制赋值运算符 更多...
 
virtual NumericVector< T > & operator= (const std::vector< T > &v) override
 设置 (*this)(i) = v(i) 对于向量的每个条目。 更多...
 
virtual Real min () const override
 获取向量中的最小值,或者在复数情况下获取最小的实部。 更多...
 
virtual Real max () const override
 获取向量中的最大值,或者在复数情况下获取最大的实部。 更多...
 
virtual T sum () const override
 获取向量中所有值的总和。 更多...
 
virtual Real l1_norm () const override
 获取向量的 $ \ell_1 $-范数,即条目的绝对值之和。 更多...
 
virtual Real l2_norm () const override
 获取向量的 $ \ell_2 $-范数,即条目平方和的平方根。 更多...
 
virtual Real linfty_norm () const override
 获取向量的 $ \ell_{\infty} $-范数,即向量的最大绝对值。 更多...
 
virtual numeric_index_type size () const override
 获取向量的大小。 更多...
 
virtual numeric_index_type local_size () const override
 获取向量的本地大小,即 index_stop - index_start。 更多...
 
virtual numeric_index_type first_local_index () const override
 获取实际存储在该处理器上的第一个向量元素的索引。 更多...
 
virtual numeric_index_type last_local_index () const override
 获取实际存储在该处理器上的最后一个向量元素的索引+1。 更多...
 
virtual T operator() (const numeric_index_type i) const override
 获取向量的第 i 个条目的副本。 更多...
 
virtual NumericVector< T > & operator+= (const NumericVector< T > &v) override
 将向量加上 v$ \vec{u} \leftarrow \vec{u} + \vec{v} $。等价于 u.add(1, v)。 更多...
 
virtual NumericVector< T > & operator-= (const NumericVector< T > &v) override
 v 从 *this 减去, $ \vec{u} \leftarrow \vec{u} - \vec{v} $。等价于 u.add(-1, v)。 更多...
 
virtual NumericVector< T > & operator*= (const NumericVector< T > &v_in) override
 计算此向量条目与另一个向量的条目之间的分量乘法, $ u_i \leftarrow u_i v_i \, \forall i$更多...
 
virtual NumericVector< T > & operator/= (const NumericVector< T > &v_in) override
 计算此向量条目与另一个向量的分量除法, $ u_i \leftarrow \frac{u_i}{v_i} \, \forall i$更多...
 
virtual void reciprocal () override
 计算每个向量条目的分量倒数, $ u_i \leftarrow \frac{1}{u_i} \, \forall i$更多...
 
virtual void conjugate () override
 反转向量中每个条目的虚部。 更多...
 
virtual void set (const numeric_index_type i, const T value) override
 设置 v(i) = value 。 请注意,此方法的库实现是线程安全的, 例如,将在写入向量之前锁定 _numeric_vector_mutex更多...
 
virtual void add (const numeric_index_type i, const T value) override
 value 添加到由 i 指定的向量条目。 请注意,此方法的库实现是线程安全的, 例如,将在写入向量之前锁定 _numeric_vector_mutex更多...
 
virtual void add (const T s) override
 s 添加到向量的每个条目, $ u_i \leftarrow u_i + s $ 更多...
 
virtual void add (const NumericVector< T > &v) override
 v 添加到 *this, $ \vec{u} \leftarrow \vec{u} + \vec{v} $。 等效于调用 operator+=() 更多...
 
virtual void add (const T a, const NumericVector< T > &v) override
 带有标量倍数的向量相加, $ \vec{u} \leftarrow \vec{u} + a\vec{v} $。 等效于调用 operator+=() 更多...
 
virtual void add_vector (const NumericVector< T > &v, const SparseMatrix< T > &A) override
 计算 $ \vec{u} \leftarrow \vec{u} + A \vec{v} $, 即将 SparseMatrix ANumericVector v 的乘积添加到 this。 更多...
 
virtual void add_vector_transpose (const NumericVector< T > &v, const SparseMatrix< T > &A) override
 计算 $ \vec{u} \leftarrow \vec{u} + A^T \vec{v} $, 即将矩阵 A 的转置与 NumericVector v 的乘积添加到 this。 更多...
 
virtual void scale (const T factor) override
 缩放向量的每个元素。 更多...
 
virtual void abs () override
 设置 $ u_i \leftarrow |u_i| $,对向量中的每个条目进行绝对值操作。 更多...
 
virtual T dot (const NumericVector< T > &v) const override
 计算 $ \vec{u} \cdot \vec{v} $,即 (*this) 与向量 v 的点积。 更多...
 
virtual void localize (std::vector< T > &v_local) const override
 创建全局向量的副本并存储在本地向量 v_local 中。 更多...
 
virtual void localize (NumericVector< T > &v_local) const override
 创建全局向量的副本并存储在本地向量 v_local 中,而不是 std::vector。 更多...
 
virtual void localize (NumericVector< T > &v_local, const std::vector< numeric_index_type > &send_list) const override
 创建本地向量 v_local ,其中仅包含与此处理器相关的信息,由 send_list 定义。 更多...
 
virtual void localize (std::vector< T > &v_local, const std::vector< numeric_index_type > &indices) const override
 用全局索引中给定的值填充本地 std::vector "v_local"。 更多...
 
virtual void localize (const numeric_index_type first_local_idx, const numeric_index_type last_local_idx, const std::vector< numeric_index_type > &send_list) override
 使用由 send_list 指定的值从相邻处理器中选择的值更新本地向量。 更多...
 
virtual void localize_to_one (std::vector< T > &v_local, const processor_id_type proc_id=0) const override
 在处理器 proc_id 上创建全局向量的本地副本。 默认情况下,数据发送到处理器 0。此方法对于从一个处理器输出数据非常有用。 更多...
 
virtual void pointwise_mult (const NumericVector< T > &vec1, const NumericVector< T > &vec2) override
 比较该向量与另一个向量的全局相对差异。 更多...
 
virtual void pointwise_divide (const NumericVector< T > &vec1, const NumericVector< T > &vec2) override
 计算该向量与另一个向量的逐点除法。 更多...
 
virtual void swap (NumericVector< T > &v) override
 交换该向量的内容与向量 v 的内容。子类应提供足够的间接性以使此操作成为 O(1) 的头部交换操作。 更多...
 
virtual std::size_t max_allowed_id () const override
 返回 NumericVector 可以包含的最大条目数(在所有处理器上)。 更多...
 
DataTypevec ()
 References to the underlying Eigen data types. 更多...
 
const DataTypevec () const
 
virtual bool initialized () const
 检查向量是否已经初始化。 更多...
 
ParallelType type () const
 获取向量的类型。 更多...
 
ParallelType & type ()
 获取向量的类型。 更多...
 
virtual bool closed () const
 检查向量是否已经关闭并准备好进行计算。 更多...
 
virtual Real subset_l1_norm (const std::set< numeric_index_type > &indices) const
 获取指定条目的向量的 $ \ell_1 $-范数,即指定条目的绝对值之和。 更多...
 
virtual Real subset_l2_norm (const std::set< numeric_index_type > &indices) const
 获取指定条目的向量的 $ \ell_2 $-范数,即指定条目平方和的平方根。 更多...
 
virtual Real subset_linfty_norm (const std::set< numeric_index_type > &indices) const
 获取指定条目的向量的最大绝对值,即指定条目的 $ \ell_{\infty} $-范数。 更多...
 
Real l2_norm_diff (const NumericVector< T > &other_vec) const
 获取 $ \ell_2 $-范数的向量差值 $ \vec{u} - \vec{v} $, 其中 $ \vec{u} $this。 更多...
 
virtual T el (const numeric_index_type i) const
 获取向量的第 i 个条目。 更多...
 
virtual void get (const std::vector< numeric_index_type > &index, T *values) const
 一次访问多个组件。 values 将 *不会* 重新分配空间;它应该已经具有足够的空间。 默认实现对每个索引调用 operator() ,但某些实现可能在此处提供更快的方法。 更多...
 
void get (const std::vector< numeric_index_type > &index, std::vector< T > &values) const
 一次访问多个组件。 values 将被调整大小,如果需要,将被填充。 默认实现对每个索引调用 operator() ,但某些实现可能在此处提供更快的方法。 更多...
 
NumericVector< T > & operator*= (const T a)
 将向量缩放为 a$ \vec{u} \leftarrow a\vec{u} $。等价于 u.scale(a)。 更多...
 
NumericVector< T > & operator/= (const T a)
 将向量缩放为 1/a$ \vec{u} \leftarrow \frac{1}{a}\vec{u} $。等价于 u.scale(1. 更多...
 
virtual void add_vector (const T *v, const std::vector< numeric_index_type > &dof_indices)
 计算 $ \vec{u} \leftarrow \vec{u} + \vec{v} $,其中 v 是一个指针, 每个 dof_indices[i] 指定了要添加的值 v[i] 的位置。 这应该在子类中进行重写以提高效率。请注意,此方法的库实现是线程安全的。 更多...
 
void add_vector (const std::vector< T > &v, const std::vector< numeric_index_type > &dof_indices)
 计算 $ \vec{u} \leftarrow \vec{u} + \vec{v} $,其中 v 是一个 std::vector, 每个 dof_indices[i] 指定了要添加的值 v[i] 的位置 默认实现对每个索引调用 operator() ,但某些实现可能在此处提供更快的方法。 请注意,此方法的库实现是线程安全的。 更多...
 
void add_vector (const NumericVector< T > &v, const std::vector< numeric_index_type > &dof_indices)
 计算 $ \vec{u} \leftarrow \vec{u} + \vec{v} $,其中 v 是一个 NumericVector, 每个 dof_indices[i] 指定了要添加的值 v(i) 的位置。此方法是线程安全的。 更多...
 
void add_vector (const DenseVector< T > &v, const std::vector< numeric_index_type > &dof_indices)
 计算 $ \vec{u} \leftarrow \vec{u} + \vec{v} $,其中 v 是一个 DenseVector, 每个 dof_indices[i] 指定了要添加的值 v(i) 的位置。此方法是线程安全的。 更多...
 
void add_vector (const NumericVector< T > &v, const ShellMatrix< T > &A)
 计算 $ \vec{u} \leftarrow \vec{u} + A \vec{v} $, 即将 ShellMatrix ANumericVector v 的乘积添加到 this。 更多...
 
virtual void insert (const T *v, const std::vector< numeric_index_type > &dof_indices)
 v 的条目插入到 *this 中,位置由 dof_indices 指定。请注意,此方法的库实现是线程安全的。 更多...
 
void insert (const NumericVector< T > &v, const std::vector< numeric_index_type > &dof_indices)
 v 的条目插入到 *this 中,位置由 v 指定。 只要使用 NumericVector 的库实现,此方法是线程安全的。 更多...
 
void insert (const DenseVector< T > &v, const std::vector< numeric_index_type > &dof_indices)
 v 的条目插入到 *this 中,位置由 v 指定。 只要使用 NumericVector 的库实现,此方法是线程安全的。 更多...
 
void insert (const DenseSubVector< T > &v, const std::vector< numeric_index_type > &dof_indices)
 v 的条目插入到 *this 中,位置由 v 指定。 只要使用 NumericVector 的库实现,此方法是线程安全的。 更多...
 
virtual int compare (const NumericVector< T > &other_vector, const Real threshold=TOLERANCE) const
 比较 thisother_vector 的等效性,(在给定的 threshold 内) 如果等效则返回 -1 ,或者返回第一个索引,其中 abs(a[i]-b[i]) 超过阈值。 更多...
 
virtual int local_relative_compare (const NumericVector< T > &other_vector, const Real threshold=TOLERANCE) const
 比较该向量与另一个向量的局部相对差异。 更多...
 
virtual void print (std::ostream &os=libMesh::out) const
 打印本地向量的内容,默认输出到 libMesh::out 流。 更多...
 
template<>
void print (std::ostream &os) const
 
virtual void print_global (std::ostream &os=libMesh::out) const
 打印全局向量的内容,默认输出到 libMesh::out 流。 更多...
 
template<>
void print_global (std::ostream &os) const
 
virtual void print_matlab (const std::string &="") const
 以Matlab的稀疏矩阵格式打印向量内容。可选择将向量打印到名为 name 的文件中。 如果未指定 name,则内容将被打印到屏幕上。 更多...
 
virtual void create_subvector (NumericVector< T > &subvector, const std::vector< numeric_index_type > &rows) const
 使用 rows 中的索引从该向量中填充 subvector。类似于 SparseMatrix 类的 create_submatrix() 函数, 当前仅对 PetscVectors 实现了此功能。 更多...
 
bool readable () const
 检查该向量是否能够用于全局操作。 更多...
 
bool compatible (const NumericVector< T > &v) const
 检查该向量和向量 v 是否能够一起用于全局操作。 更多...
 

静态 Public 成员函数

static std::unique_ptr
< NumericVector< T > > 
build (const Parallel::Communicator &comm, const SolverPackage solver_package=libMesh::default_solver_package())
 构建一个 NumericVector 对象。 更多...
 
static std::string get_info ()
 Gets a string containing the reference information. 更多...
 
static void print_info (std::ostream &out_stream=libMesh::out)
 Prints the reference information, by default to libMesh::out. 更多...
 
static unsigned int n_objects ()
 Prints the number of outstanding (created, but not yet destroyed) objects. 更多...
 
static void enable_print_counter_info ()
 Methods to enable/disable the reference counter output from print_info() 更多...
 
static void disable_print_counter_info ()
 

Protected 类型

typedef std::map< std::string,
std::pair< unsigned int,
unsigned int > > 
Counts
 Data structure to log the information. 更多...
 

Protected 成员函数

void increment_constructor_count (const std::string &name) noexcept
 Increments the construction counter. 更多...
 
void increment_destructor_count (const std::string &name) noexcept
 Increments the destruction counter. 更多...
 

Protected 属性

bool _is_closed
 用于跟踪向量的值在在一些或全部处理器上进行插入或添加值操作后是否在所有处理器上保持一致的标志。 更多...
 
bool _is_initialized
 在调用 init() 后设置为 true。 更多...
 
ParallelType _type
 向量的类型。 更多...
 
std::mutex _numeric_vector_mutex
 用于执行线程安全操作的互斥锁。 更多...
 

静态 Protected 属性

static Counts _counts
 Actually holds the data. 更多...
 
static Threads::atomic
< unsigned int > 
_n_objects
 The number of objects. 更多...
 
static Threads::spin_mutex _mutex
 Mutual exclusion object to enable thread-safe reference counting. 更多...
 
static bool _enable_print_counter = true
 Flag to control whether reference count information is printed when print_info is called. 更多...
 

Private 属性

DataType _vec
 Actual Eigen::SparseVector<> we are wrapping. 更多...
 

友元

class EigenSparseMatrix< T >
 Make other Eigen datatypes friends. 更多...
 
class EigenSparseLinearSolver< T >
 

详细描述

template<typename T>
class libMesh::EigenSparseVector< T >

This class provides a nice interface to the Eigen C++-based data structures for serial vectors.

All overridden virtual functions are documented in numeric_vector.h.

作者
Benjamin S. Kirk
日期
2002

在文件 eigen_sparse_matrix.h42 行定义.

成员类型定义说明

typedef std::map<std::string, std::pair<unsigned int, unsigned int> > libMesh::ReferenceCounter::Counts
protectedinherited

Data structure to log the information.

The log is identified by the class name.

在文件 reference_counter.h119 行定义.

template<typename T>
typedef EigenSV libMesh::EigenSparseVector< T >::DataType

Convenient typedefs.

在文件 eigen_sparse_vector.h113 行定义.

构造及析构函数说明

template<typename T >
libMesh::EigenSparseVector< T >::EigenSparseVector ( const Parallel::Communicator &  comm_in,
const ParallelType  ptype = AUTOMATIC 
)
inlineexplicit

Dummy-Constructor.

Dimension=0

在文件 eigen_sparse_vector.h266 行定义.

参考 libMesh::NumericVector< T >::_type.

268  : NumericVector<T>(comm_in, ptype)
269 {
270  this->_type = ptype;
271 }
ParallelType _type
向量的类型。
template<typename T >
libMesh::EigenSparseVector< T >::EigenSparseVector ( const Parallel::Communicator &  comm_in,
const numeric_index_type  n,
const ParallelType  ptype = AUTOMATIC 
)
inlineexplicit

Constructor.

Set dimension to n and initialize all elements with zero.

在文件 eigen_sparse_vector.h277 行定义.

参考 libMesh::EigenSparseVector< T >::init().

280  : NumericVector<T>(comm_in, ptype)
281 {
282  this->init(n, n, false, ptype);
283 }
virtual void init(const numeric_index_type N, const numeric_index_type n_local, const bool fast=false, const ParallelType ptype=AUTOMATIC) override
更改向量的维度为 n 。如果可能的话 ,该向量的保留内存保持不变。 如果 n==0 ,所有内存都将被释放。因此,如果要调整向量的大小并释放不需要的内存, 必须首先调用 init(0) ,然后调用 ini...
template<typename T >
libMesh::EigenSparseVector< T >::EigenSparseVector ( const Parallel::Communicator &  comm_in,
const numeric_index_type  n,
const numeric_index_type  n_local,
const ParallelType  ptype = AUTOMATIC 
)
inline

Constructor.

Set local dimension to n_local, the global dimension to n, and initialize all elements with zero.

在文件 eigen_sparse_vector.h289 行定义.

参考 libMesh::EigenSparseVector< T >::init().

293  : NumericVector<T>(comm_in, ptype)
294 {
295  this->init(n, n_local, false, ptype);
296 }
virtual void init(const numeric_index_type N, const numeric_index_type n_local, const bool fast=false, const ParallelType ptype=AUTOMATIC) override
更改向量的维度为 n 。如果可能的话 ,该向量的保留内存保持不变。 如果 n==0 ,所有内存都将被释放。因此,如果要调整向量的大小并释放不需要的内存, 必须首先调用 init(0) ,然后调用 ini...
template<typename T >
libMesh::EigenSparseVector< T >::EigenSparseVector ( const Parallel::Communicator &  comm_in,
const numeric_index_type  N,
const numeric_index_type  n_local,
const std::vector< numeric_index_type > &  ghost,
const ParallelType  ptype = AUTOMATIC 
)
inline

Constructor.

Set local dimension to n_local, the global dimension to n, but additionally reserve memory for the indices specified by the ghost argument.

在文件 eigen_sparse_vector.h302 行定义.

参考 libMesh::EigenSparseVector< T >::init().

307  : NumericVector<T>(comm_in, ptype)
308 {
309  this->init(N, n_local, ghost, false, ptype);
310 }
virtual void init(const numeric_index_type N, const numeric_index_type n_local, const bool fast=false, const ParallelType ptype=AUTOMATIC) override
更改向量的维度为 n 。如果可能的话 ,该向量的保留内存保持不变。 如果 n==0 ,所有内存都将被释放。因此,如果要调整向量的大小并释放不需要的内存, 必须首先调用 init(0) ,然后调用 ini...
template<typename T>
libMesh::EigenSparseVector< T >::EigenSparseVector ( EigenSparseVector< T > &&  )
default

The 5 special functions can be defaulted for this class, as it does not manage any memory itself.

template<typename T>
libMesh::EigenSparseVector< T >::EigenSparseVector ( const EigenSparseVector< T > &  )
default
template<typename T>
virtual libMesh::EigenSparseVector< T >::~EigenSparseVector ( )
virtualdefault

成员函数说明

template<typename T >
void libMesh::EigenSparseVector< T >::abs ( )
overridevirtual

设置 $ u_i \leftarrow |u_i| $,对向量中的每个条目进行绝对值操作。

实现了 libMesh::NumericVector< T >.

在文件 eigen_sparse_vector.C240 行定义.

参考 std::abs() , 以及 libMesh::initialized().

241 {
242  libmesh_assert (this->initialized());
243 
244  const numeric_index_type n = this->size();
245 
246  for (numeric_index_type i=0; i!=n; ++i)
247  this->set(i,std::abs((*this)(i)));
248 }
virtual bool initialized() const
检查向量是否已经初始化。
ADRealEigenVector< T, D, asd > abs(const ADRealEigenVector< T, D, asd > &)
计算自动微分实数向量的绝对值。
Definition: type_vector.h:112
dof_id_type numeric_index_type
Definition: id_types.h:99
virtual numeric_index_type size() const override
获取向量的大小。
virtual void set(const numeric_index_type i, const T value) override
设置 v(i) = value 。 请注意,此方法的库实现是线程安全的, 例如,将在写入向量之前锁定 _numeric_vector_mutex 。
template<typename T >
void libMesh::EigenSparseVector< T >::add ( const numeric_index_type  i,
const T  value 
)
inlineoverridevirtual

value 添加到由 i 指定的向量条目。 请注意,此方法的库实现是线程安全的, 例如,将在写入向量之前锁定 _numeric_vector_mutex

参数
i要添加到的条目的索引。
value要添加的值。

实现了 libMesh::NumericVector< T >.

在文件 eigen_sparse_vector.h498 行定义.

参考 libMesh::initialized().

499 {
500  libmesh_assert (this->initialized());
501  libmesh_assert_less (i, this->size());
502 
503  std::scoped_lock lock(this->_numeric_vector_mutex);
504  _vec[static_cast<eigen_idx_type>(i)] += value;
505 
506  this->_is_closed = false;
507 }
std::mutex _numeric_vector_mutex
用于执行线程安全操作的互斥锁。
DataType _vec
Actual Eigen::SparseVector&lt;&gt; we are wrapping.
int32_t eigen_idx_type
virtual bool initialized() const
检查向量是否已经初始化。
virtual numeric_index_type size() const override
获取向量的大小。
bool _is_closed
用于跟踪向量的值在在一些或全部处理器上进行插入或添加值操作后是否在所有处理器上保持一致的标志。
template<typename T >
void libMesh::EigenSparseVector< T >::add ( const T  s)
overridevirtual

s 添加到向量的每个条目, $ u_i \leftarrow u_i + s $

参数
s要添加的值。

实现了 libMesh::NumericVector< T >.

在文件 eigen_sparse_vector.C165 行定义.

166 {
167  _vec += EigenSV::Constant(this->size(), v);
168 }
DataType _vec
Actual Eigen::SparseVector&lt;&gt; we are wrapping.
virtual numeric_index_type size() const override
获取向量的大小。
template<typename T >
void libMesh::EigenSparseVector< T >::add ( const NumericVector< T > &  v)
overridevirtual

v 添加到 *this, $ \vec{u} \leftarrow \vec{u} + \vec{v} $。 等效于调用 operator+=()

参数
v另一个数值向量。

实现了 libMesh::NumericVector< T >.

在文件 eigen_sparse_vector.C174 行定义.

参考 libMesh::EigenSparseVector< T >::_vec , 以及 libMesh::initialized().

175 {
176  libmesh_assert (this->initialized());
177 
178  const EigenSparseVector<T> & v = cast_ref<const EigenSparseVector<T> &>(v_in);
179 
180  _vec += v._vec;
181 }
DataType _vec
Actual Eigen::SparseVector&lt;&gt; we are wrapping.
virtual bool initialized() const
检查向量是否已经初始化。
template<typename T >
void libMesh::EigenSparseVector< T >::add ( const T  a,
const NumericVector< T > &  v 
)
overridevirtual

带有标量倍数的向量相加, $ \vec{u} \leftarrow \vec{u} + a\vec{v} $。 等效于调用 operator+=()

参数
a缩放因子。
v另一个数值向量。

实现了 libMesh::NumericVector< T >.

在文件 eigen_sparse_vector.C186 行定义.

参考 libMesh::EigenSparseVector< T >::_vec , 以及 libMesh::initialized().

187 {
188  libmesh_assert (this->initialized());
189 
190  const EigenSparseVector<T> & v = cast_ref<const EigenSparseVector<T> &>(v_in);
191 
192  _vec += v._vec*a;
193 }
DataType _vec
Actual Eigen::SparseVector&lt;&gt; we are wrapping.
virtual bool initialized() const
检查向量是否已经初始化。
template<typename T >
void libMesh::EigenSparseVector< T >::add_vector ( const NumericVector< T > &  v,
const SparseMatrix< T > &  A 
)
overridevirtual

计算 $ \vec{u} \leftarrow \vec{u} + A \vec{v} $, 即将 SparseMatrix ANumericVector v 的乘积添加到 this。

参数
v另一个数值向量。
A稀疏矩阵。

实现了 libMesh::NumericVector< T >.

在文件 eigen_sparse_vector.C198 行定义.

参考 libMesh::EigenSparseVector< T >::_vec.

200 {
201  // Make sure the data passed in are really in Eigen types
202  const EigenSparseVector<T> * e_vec = cast_ptr<const EigenSparseVector<T> *>(&vec_in);
203  const EigenSparseMatrix<T> * mat = cast_ptr<const EigenSparseMatrix<T> *>(&mat_in);
204 
205  libmesh_assert(e_vec);
206  libmesh_assert(mat);
207 
208  _vec += mat->_mat*e_vec->_vec;
209 }
DataType _vec
Actual Eigen::SparseVector&lt;&gt; we are wrapping.
friend class EigenSparseMatrix< T >
Make other Eigen datatypes friends.
template<typename T >
void libMesh::NumericVector< T >::add_vector ( const T *  v,
const std::vector< numeric_index_type > &  dof_indices 
)
virtualinherited

计算 $ \vec{u} \leftarrow \vec{u} + \vec{v} $,其中 v 是一个指针, 每个 dof_indices[i] 指定了要添加的值 v[i] 的位置。 这应该在子类中进行重写以提高效率。请注意,此方法的库实现是线程安全的。

参数
v一个指向值的指针。
dof_indices每个要添加值的位置的索引集合。

libMesh::PetscVector< T > , 以及 libMesh::EpetraVector< T > 重载.

在文件 numeric_vector.C379 行定义.

参考自 libMesh::SparseMatrix< T >::vector_mult_add().

381 {
382  libmesh_assert(v);
383 
384  for (auto i : index_range(dof_indices))
385  this->add (dof_indices[i], v[i]);
386 }
virtual void add(const numeric_index_type i, const T value)=0
将 value 添加到由 i 指定的向量条目。 请注意,此方法的库实现是线程安全的, 例如,将在写入向量之前锁定 _numeric_vector_mutex 。
template<typename T >
void libMesh::NumericVector< T >::add_vector ( const std::vector< T > &  v,
const std::vector< numeric_index_type > &  dof_indices 
)
inlineinherited

计算 $ \vec{u} \leftarrow \vec{u} + \vec{v} $,其中 v 是一个 std::vector, 每个 dof_indices[i] 指定了要添加的值 v[i] 的位置 默认实现对每个索引调用 operator() ,但某些实现可能在此处提供更快的方法。 请注意,此方法的库实现是线程安全的。

参数
v包含要添加的值的 std::vector。
dof_indices每个要添加值的位置的索引集合。

在文件 numeric_vector.h1041 行定义.

1043 {
1044  libmesh_assert(v.size() == dof_indices.size());
1045  if (!v.empty())
1046  this->add_vector(v.data(), dof_indices);
1047 }
virtual void add_vector(const T *v, const std::vector< numeric_index_type > &dof_indices)
计算 ,其中 v 是一个指针, 每个 dof_indices[i] 指定了要添加的值 v[i] 的位置。 这应该在子类中进行重写以提高效率。请注意,此方法的库实现是线程安全的。 ...
template<typename T >
void libMesh::NumericVector< T >::add_vector ( const NumericVector< T > &  v,
const std::vector< numeric_index_type > &  dof_indices 
)
inherited

计算 $ \vec{u} \leftarrow \vec{u} + \vec{v} $,其中 v 是一个 NumericVector, 每个 dof_indices[i] 指定了要添加的值 v(i) 的位置。此方法是线程安全的。

参数
v另一个数值向量。
dof_indices每个要添加值的位置的索引集合。

在文件 numeric_vector.C391 行定义.

参考 libMesh::NumericVector< T >::readable() , 以及 libMesh::NumericVector< T >::size().

393 {
394  libmesh_assert(v.readable());
395 
396  const std::size_t n = dof_indices.size();
397  libmesh_assert_equal_to(v.size(), n);
398  for (numeric_index_type i=0; i != n; i++)
399  this->add (dof_indices[i], v(i));
400 }
dof_id_type numeric_index_type
Definition: id_types.h:99
virtual void add(const numeric_index_type i, const T value)=0
将 value 添加到由 i 指定的向量条目。 请注意,此方法的库实现是线程安全的, 例如,将在写入向量之前锁定 _numeric_vector_mutex 。
template<typename T >
void libMesh::NumericVector< T >::add_vector ( const DenseVector< T > &  v,
const std::vector< numeric_index_type > &  dof_indices 
)
inlineinherited

计算 $ \vec{u} \leftarrow \vec{u} + \vec{v} $,其中 v 是一个 DenseVector, 每个 dof_indices[i] 指定了要添加的值 v(i) 的位置。此方法是线程安全的。

参数
v另一个数值向量。
dof_indices每个要添加值的位置的索引集合。

在文件 numeric_vector.h1053 行定义.

参考 libMesh::DenseVector< T >::empty() , 以及 libMesh::DenseVector< T >::size().

1055 {
1056  libmesh_assert(v.size() == dof_indices.size());
1057  if (!v.empty())
1058  this->add_vector(&v(0), dof_indices);
1059 }
virtual void add_vector(const T *v, const std::vector< numeric_index_type > &dof_indices)
计算 ,其中 v 是一个指针, 每个 dof_indices[i] 指定了要添加的值 v[i] 的位置。 这应该在子类中进行重写以提高效率。请注意,此方法的库实现是线程安全的。 ...
template<typename T >
void libMesh::NumericVector< T >::add_vector ( const NumericVector< T > &  v,
const ShellMatrix< T > &  A 
)
inherited

计算 $ \vec{u} \leftarrow \vec{u} + A \vec{v} $, 即将 ShellMatrix ANumericVector v 的乘积添加到 this。

参数
v另一个数值向量。
AShell 矩阵。

在文件 numeric_vector.C405 行定义.

参考 libMesh::ShellMatrix< T >::vector_mult_add().

407 {
408  libmesh_assert(this->compatible(v));
409 
410  a.vector_mult_add(*this,v);
411 }
bool compatible(const NumericVector< T > &v) const
检查该向量和向量 v 是否能够一起用于全局操作。
template<typename T >
void libMesh::EigenSparseVector< T >::add_vector_transpose ( const NumericVector< T > &  v,
const SparseMatrix< T > &  A 
)
overridevirtual

计算 $ \vec{u} \leftarrow \vec{u} + A^T \vec{v} $, 即将矩阵 A 的转置与 NumericVector v 的乘积添加到 this。

参数
v另一个数值向量。
A稀疏矩阵。

实现了 libMesh::NumericVector< T >.

在文件 eigen_sparse_vector.C214 行定义.

参考 libMesh::EigenSparseVector< T >::_vec.

216 {
217  // Make sure the data passed in are really in Eigen types
218  const EigenSparseVector<T> * e_vec = cast_ptr<const EigenSparseVector<T> *>(&vec_in);
219  const EigenSparseMatrix<T> * mat = cast_ptr<const EigenSparseMatrix<T> *>(&mat_in);
220 
221  libmesh_assert(e_vec);
222  libmesh_assert(mat);
223 
224  _vec += mat->_mat.transpose()*e_vec->_vec;
225 }
DataType _vec
Actual Eigen::SparseVector&lt;&gt; we are wrapping.
friend class EigenSparseMatrix< T >
Make other Eigen datatypes friends.
template<typename T >
std::unique_ptr< NumericVector< T > > libMesh::NumericVector< T >::build ( const Parallel::Communicator &  comm,
const SolverPackage  solver_package = libMesh::default_solver_package() 
)
staticinherited

构建一个 NumericVector 对象。

参数
comm通信器对象,表示通信方式。
solver_package线性求解器包的类型。
返回
指向构建的 NumericVector 对象的 unique_ptr。

在文件 numeric_vector.C50 行定义.

参考 libMesh::EIGEN_SOLVERS, libMesh::LASPACK_SOLVERS , 以及 libMesh::TRILINOS_SOLVERS.

参考自 libMesh::DiagonalMatrix< T >::DiagonalMatrix(), libMesh::DofMap::enforce_adjoint_constraints_exactly(), libMesh::DofMap::enforce_constraints_exactly(), libMesh::DofMap::enforce_constraints_on_residual() , 以及 libMesh::DofMap::process_mesh_constraint_rows().

51 {
52  // Build the appropriate vector
53  switch (solver_package)
54  {
55 
56 #ifdef LIBMESH_HAVE_LASPACK
57  case LASPACK_SOLVERS:
58  return std::make_unique<LaspackVector<T>>(comm, AUTOMATIC);
59 #endif
60 
61 #ifdef LIBMESH_HAVE_PETSC
62  case PETSC_SOLVERS:
63  return std::make_unique<PetscVector<T>>(comm, AUTOMATIC);
64 #endif
65 
66 #ifdef LIBMESH_TRILINOS_HAVE_EPETRA
67  case TRILINOS_SOLVERS:
68  return std::make_unique<EpetraVector<T>>(comm, AUTOMATIC);
69 #endif
70 
71 #ifdef LIBMESH_HAVE_EIGEN
72  case EIGEN_SOLVERS:
73  return std::make_unique<EigenSparseVector<T>>(comm, AUTOMATIC);
74 #endif
75 
76  default:
77  return std::make_unique<DistributedVector<T>>(comm, AUTOMATIC);
78  }
79 }
EIGEN_SOLVERS
Definition: libmesh.C:249
TRILINOS_SOLVERS
Definition: libmesh.C:247
LASPACK_SOLVERS
Definition: libmesh.C:251
template<typename T >
void libMesh::EigenSparseVector< T >::clear ( )
inlineoverridevirtual

将 NumericVector<T> 恢复到原始状态。

重载 libMesh::NumericVector< T > .

在文件 eigen_sparse_vector.h393 行定义.

参考 libMesh::libMeshPrivateData::_is_initialized.

394 {
395  _vec.resize(0);
396 
397  this->_is_initialized = false;
398  this->_is_closed = false;
399 }
DataType _vec
Actual Eigen::SparseVector&lt;&gt; we are wrapping.
bool _is_initialized
在调用 init() 后设置为 true。
bool _is_closed
用于跟踪向量的值在在一些或全部处理器上进行插入或添加值操作后是否在所有处理器上保持一致的标志。
template<typename T >
std::unique_ptr< NumericVector< T > > libMesh::EigenSparseVector< T >::clone ( ) const
inlineoverridevirtual

返回一个包装了此向量副本的智能指针。

注解
派生类必须重写此方法。
返回
指向新向量副本的 unique_ptr。

实现了 libMesh::NumericVector< T >.

在文件 eigen_sparse_vector.h427 行定义.

参考 libMesh::NumericVector< T >::init().

428 {
429  NumericVector<T> * cloned_vector = new EigenSparseVector<T>(this->comm());
430  cloned_vector->init(*this, true);
431  *cloned_vector = *this;
432  return std::unique_ptr<NumericVector<T>>(cloned_vector);
433 }
template<typename T >
void libMesh::EigenSparseVector< T >::close ( )
inlineoverridevirtual

调用 NumericVector 的内部组装函数,确保值在处理器之间一致。

实现了 libMesh::NumericVector< T >.

在文件 eigen_sparse_vector.h382 行定义.

参考 libMesh::initialized().

383 {
384  libmesh_assert (this->initialized());
385 
386  this->_is_closed = true;
387 }
virtual bool initialized() const
检查向量是否已经初始化。
bool _is_closed
用于跟踪向量的值在在一些或全部处理器上进行插入或添加值操作后是否在所有处理器上保持一致的标志。
template<typename T>
virtual bool libMesh::NumericVector< T >::closed ( ) const
inlinevirtualinherited

检查向量是否已经关闭并准备好进行计算。

返回
如果向量已经关闭并准备好进行计算,则返回 true;否则返回 false。

在文件 numeric_vector.h180 行定义.

参考 libMesh::NumericVector< T >::_is_closed.

参考自 libMesh::DofMap::enforce_adjoint_constraints_exactly(), libMesh::DofMap::enforce_constraints_exactly(), libMesh::PetscVector< T >::localize(), libMesh::DofMap::max_constraint_error(), libMesh::EigenSparseVector< T >::operator=(), libMesh::LaspackVector< T >::operator=() , 以及 libMesh::PetscVector< T >::operator=().

180 { return _is_closed; }
bool _is_closed
用于跟踪向量的值在在一些或全部处理器上进行插入或添加值操作后是否在所有处理器上保持一致的标志。
template<typename T >
int libMesh::NumericVector< T >::compare ( const NumericVector< T > &  other_vector,
const Real  threshold = TOLERANCE 
) const
virtualinherited

比较 thisother_vector 的等效性,(在给定的 threshold 内) 如果等效则返回 -1 ,或者返回第一个索引,其中 abs(a[i]-b[i]) 超过阈值。

注解
"等效" 表示两个向量非常相似或几乎相同,其差异小于或等于给定的阈值。 这个阈值通常用于考虑浮点数精度问题,因为在计算机中,浮点数运算可能会导致微小的数值差异。 当两个向量被认为等效时,它们的差异小于或等于阈值。 具体来说,这是通过计算两个向量的每个元素之间的差异并将其与阈值进行比较来确定的。 如果两个向量的差异小于阈值,就可以说它们是等效的。 否则,如果差异大于阈值,就可以说它们不等效。
参数
other_vector另一个数值向量。
threshold阈值。
返回
如果向量等效则返回 -1 ,否则返回第一个不等效的索引。

在文件 numeric_vector.C109 行定义.

参考 std::abs().

111 {
112  libmesh_assert(this->compatible(other_vector));
113 
114  int first_different_i = std::numeric_limits<int>::max();
116 
117  while (first_different_i==std::numeric_limits<int>::max()
118  && i<last_local_index())
119  {
120  if (std::abs((*this)(i) - other_vector(i)) > threshold)
121  first_different_i = i;
122  else
123  i++;
124  }
125 
126  // Find the correct first differing index in parallel
127  this->comm().min(first_different_i);
128 
129  if (first_different_i == std::numeric_limits<int>::max())
130  return -1;
131 
132  return first_different_i;
133 }
ADRealEigenVector< T, D, asd > abs(const ADRealEigenVector< T, D, asd > &)
计算自动微分实数向量的绝对值。
Definition: type_vector.h:112
dof_id_type numeric_index_type
Definition: id_types.h:99
virtual numeric_index_type first_local_index() const =0
获取实际存储在该处理器上的第一个向量元素的索引。
virtual numeric_index_type last_local_index() const =0
获取实际存储在该处理器上的最后一个向量元素的索引+1。
bool compatible(const NumericVector< T > &v) const
检查该向量和向量 v 是否能够一起用于全局操作。
template<typename T >
bool libMesh::NumericVector< T >::compatible ( const NumericVector< T > &  v) const
inherited

检查该向量和向量 v 是否能够一起用于全局操作。

参数
v要比较的另一个向量。
返回
如果这两个向量可以一起用于全局操作,则返回 true,否则返回 false。

在文件 numeric_vector.C423 行定义.

参考 libMesh::NumericVector< T >::first_local_index(), libMesh::NumericVector< T >::last_local_index(), libMesh::NumericVector< T >::local_size(), libMesh::NumericVector< T >::readable() , 以及 libMesh::NumericVector< T >::size().

424 {
425  return this->readable() && v.readable() &&
426  this->size() == v.size() &&
427  this->local_size() == v.local_size() &&
428  this->first_local_index() == v.first_local_index() &&
429  this->last_local_index() == v.last_local_index();
430 }
virtual numeric_index_type size() const =0
获取向量的大小。
bool readable() const
检查该向量是否能够用于全局操作。
virtual numeric_index_type first_local_index() const =0
获取实际存储在该处理器上的第一个向量元素的索引。
virtual numeric_index_type local_size() const =0
获取向量的本地大小,即 index_stop - index_start。
virtual numeric_index_type last_local_index() const =0
获取实际存储在该处理器上的最后一个向量元素的索引+1。
template<typename T >
void libMesh::EigenSparseVector< T >::conjugate ( )
overridevirtual

反转向量中每个条目的虚部。

实现了 libMesh::NumericVector< T >.

在文件 eigen_sparse_vector.C157 行定义.

158 {
159  _vec = _vec.conjugate();
160 }
DataType _vec
Actual Eigen::SparseVector&lt;&gt; we are wrapping.
template<typename T>
virtual void libMesh::NumericVector< T >::create_subvector ( NumericVector< T > &  subvector,
const std::vector< numeric_index_type > &  rows 
) const
inlinevirtualinherited

使用 rows 中的索引从该向量中填充 subvector。类似于 SparseMatrix 类的 create_submatrix() 函数, 当前仅对 PetscVectors 实现了此功能。

参数
subvector要填充的子向量。
rows包含用于选择要填充到子向量的索引的向量。

libMesh::PetscVector< T > , 以及 libMesh::EpetraVector< T > 重载.

在文件 numeric_vector.h871 行定义.

873  {
874  libmesh_not_implemented();
875  }
void libMesh::ReferenceCounter::disable_print_counter_info ( )
staticinherited

在文件 reference_counter.C100 行定义.

参考 libMesh::ReferenceCounter::_enable_print_counter.

101 {
102  _enable_print_counter = false;
103  return;
104 }
static bool _enable_print_counter
Flag to control whether reference count information is printed when print_info is called...
template<typename T >
T libMesh::EigenSparseVector< T >::dot ( const NumericVector< T > &  v) const
overridevirtual

计算 $ \vec{u} \cdot \vec{v} $,即 (*this) 与向量 v 的点积。

在复数值情况下,使用 v 的复共轭。

参数
v另一个数值向量。
返回
点积的结果。

实现了 libMesh::NumericVector< T >.

在文件 eigen_sparse_vector.C253 行定义.

参考 libMesh::EigenSparseVector< T >::_vec , 以及 libMesh::initialized().

254 {
255  libmesh_assert (this->initialized());
256 
257  // Make sure the NumericVector passed in is really a EigenSparseVector
258  const EigenSparseVector<T> * v = cast_ptr<const EigenSparseVector<T> *>(&v_in);
259  libmesh_assert(v);
260 
261  return _vec.dot(v->_vec);
262 }
DataType _vec
Actual Eigen::SparseVector&lt;&gt; we are wrapping.
virtual bool initialized() const
检查向量是否已经初始化。
template<typename T>
virtual T libMesh::NumericVector< T >::el ( const numeric_index_type  i) const
inlinevirtualinherited

获取向量的第 i 个条目。

参数
i要获取的条目的索引。
返回
第 i 个条目的值。

在文件 numeric_vector.h416 行定义.

416 { return (*this)(i); }
void libMesh::ReferenceCounter::enable_print_counter_info ( )
staticinherited

Methods to enable/disable the reference counter output from print_info()

在文件 reference_counter.C94 行定义.

参考 libMesh::ReferenceCounter::_enable_print_counter.

95 {
96  _enable_print_counter = true;
97  return;
98 }
static bool _enable_print_counter
Flag to control whether reference count information is printed when print_info is called...
template<typename T >
numeric_index_type libMesh::EigenSparseVector< T >::first_local_index ( ) const
inlineoverridevirtual

获取实际存储在该处理器上的第一个向量元素的索引。

注解
此索引的最小值为 0。
返回
第一个本地索引。

实现了 libMesh::NumericVector< T >.

在文件 eigen_sparse_vector.h461 行定义.

参考 libMesh::initialized().

462 {
463  libmesh_assert (this->initialized());
464 
465  return 0;
466 }
virtual bool initialized() const
检查向量是否已经初始化。
template<typename T >
void libMesh::NumericVector< T >::get ( const std::vector< numeric_index_type > &  index,
T *  values 
) const
inlinevirtualinherited

一次访问多个组件。 values 将 *不会* 重新分配空间;它应该已经具有足够的空间。 默认实现对每个索引调用 operator() ,但某些实现可能在此处提供更快的方法。

参数
index要获取的索引集合。
values存储获取值的数组。

libMesh::PetscVector< T > 重载.

在文件 numeric_vector.h1012 行定义.

参考自 libMesh::DofMap::enforce_adjoint_constraints_exactly(), libMesh::DofMap::enforce_constraints_exactly(), libMesh::DofMap::enforce_constraints_on_residual() , 以及 libMesh::DofMap::max_constraint_error().

1014 {
1015  const std::size_t num = index.size();
1016  for (std::size_t i=0; i<num; i++)
1017  {
1018  values[i] = (*this)(index[i]);
1019  }
1020 }
template<typename T >
void libMesh::NumericVector< T >::get ( const std::vector< numeric_index_type > &  index,
std::vector< T > &  values 
) const
inlineinherited

一次访问多个组件。 values 将被调整大小,如果需要,将被填充。 默认实现对每个索引调用 operator() ,但某些实现可能在此处提供更快的方法。

参数
index要获取的索引集合。
values存储获取值的向量。

在文件 numeric_vector.h1026 行定义.

1028 {
1029  const std::size_t num = index.size();
1030  values.resize(num);
1031  if (!num)
1032  return;
1033 
1034  this->get(index, values.data());
1035 }
std::string libMesh::ReferenceCounter::get_info ( )
staticinherited

Gets a string containing the reference information.

在文件 reference_counter.C47 行定义.

参考 libMesh::ReferenceCounter::_counts.

参考自 libMesh::ReferenceCounter::print_info().

48 {
49 #if defined(LIBMESH_ENABLE_REFERENCE_COUNTING) && defined(DEBUG)
50 
51  std::ostringstream oss;
52 
53  oss << '\n'
54  << " ---------------------------------------------------------------------------- \n"
55  << "| Reference count information |\n"
56  << " ---------------------------------------------------------------------------- \n";
57 
58  for (const auto & [name, cd] : _counts)
59  oss << "| " << name << " reference count information:\n"
60  << "| Creations: " << cd.first << '\n'
61  << "| Destructions: " << cd.second << '\n';
62 
63  oss << " ---------------------------------------------------------------------------- \n";
64 
65  return oss.str();
66 
67 #else
68 
69  return "";
70 
71 #endif
72 }
static Counts _counts
Actually holds the data.
void libMesh::ReferenceCounter::increment_constructor_count ( const std::string &  name)
inlineprotectednoexceptinherited

Increments the construction counter.

Should be called in the constructor of any derived class that will be reference counted.

在文件 reference_counter.h183 行定义.

参考 libMesh::err.

参考自 libMesh::ReferenceCountedObject< SparseMatrix< T > >::ReferenceCountedObject().

184 {
185  libmesh_try
186  {
187  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
188  std::pair<unsigned int, unsigned int> & p = _counts[name];
189  p.first++;
190  }
191  libmesh_catch (...)
192  {
193  auto stream = libMesh::err.get();
194  stream->exceptions(stream->goodbit); // stream must not throw
195  libMesh::err << "Encountered unrecoverable error while calling "
196  << "ReferenceCounter::increment_constructor_count() "
197  << "for a(n) " << name << " object." << std::endl;
198  std::terminate();
199  }
200 }
OStreamProxy err
static Counts _counts
Actually holds the data.
void libMesh::ReferenceCounter::increment_destructor_count ( const std::string &  name)
inlineprotectednoexceptinherited

Increments the destruction counter.

Should be called in the destructor of any derived class that will be reference counted.

在文件 reference_counter.h207 行定义.

参考 libMesh::err.

参考自 libMesh::ReferenceCountedObject< SparseMatrix< T > >::~ReferenceCountedObject().

208 {
209  libmesh_try
210  {
211  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
212  std::pair<unsigned int, unsigned int> & p = _counts[name];
213  p.second++;
214  }
215  libmesh_catch (...)
216  {
217  auto stream = libMesh::err.get();
218  stream->exceptions(stream->goodbit); // stream must not throw
219  libMesh::err << "Encountered unrecoverable error while calling "
220  << "ReferenceCounter::increment_destructor_count() "
221  << "for a(n) " << name << " object." << std::endl;
222  std::terminate();
223  }
224 }
OStreamProxy err
static Counts _counts
Actually holds the data.
template<typename T >
void libMesh::EigenSparseVector< T >::init ( const numeric_index_type  n,
const numeric_index_type  n_local,
const bool  fast = false,
const ParallelType  ptype = AUTOMATIC 
)
inlineoverridevirtual

更改向量的维度为 n 。如果可能的话 ,该向量的保留内存保持不变。 如果 n==0 ,所有内存都将被释放。因此,如果要调整向量的大小并释放不需要的内存, 必须首先调用 init(0) ,然后调用 init(n) 。这种行为类似于 STL 容器。

参数
n新的全局维度。
n_local新的本地维度。
fast如果为 false,则向量将被填充为零。
ptype平行类型,表示数值向量的类型。

实现了 libMesh::NumericVector< T >.

在文件 eigen_sparse_vector.h316 行定义.

参考 libMesh::libMeshPrivateData::_is_initialized, libMesh::initialized() , 以及 libMesh::zero.

参考自 libMesh::EigenSparseVector< T >::EigenSparseVector().

320 {
321  // Eigen vectors only for serial cases,
322  // but can provide a "parallel" vector on one processor.
323  libmesh_error_msg_if(n != n_local, "Error: EigenSparseVectors can only be used in serial!");
324 
325  this->_type = SERIAL;
326 
327  // Clear initialized vectors
328  if (this->initialized())
329  this->clear();
330 
331  _vec.resize(n);
332 
333  this->_is_initialized = true;
334  this->_is_closed = true;
335 
336  // Optionally zero out all components
337  if (fast == false)
338  this->zero ();
339 
340  return;
341 }
DataType _vec
Actual Eigen::SparseVector&lt;&gt; we are wrapping.
bool _is_initialized
在调用 init() 后设置为 true。
virtual bool initialized() const
检查向量是否已经初始化。
virtual void clear() override
将 NumericVector&lt;T&gt; 恢复到原始状态。
ParallelType _type
向量的类型。
virtual void zero() override
将所有条目设置为零。等同于 v = 0,但更明显且更快。
bool _is_closed
用于跟踪向量的值在在一些或全部处理器上进行插入或添加值操作后是否在所有处理器上保持一致的标志。
template<typename T >
void libMesh::EigenSparseVector< T >::init ( const numeric_index_type  n,
const bool  fast = false,
const ParallelType  ptype = AUTOMATIC 
)
inlineoverridevirtual

调用 init() ,其中 n_local = N。

参数
n新的全局维度。
fast如果为 false,则向量将被填充为零。
ptype平行类型,表示数值向量的类型。

实现了 libMesh::NumericVector< T >.

在文件 eigen_sparse_vector.h347 行定义.

350 {
351  this->init(n,n,fast,ptype);
352 }
virtual void init(const numeric_index_type N, const numeric_index_type n_local, const bool fast=false, const ParallelType ptype=AUTOMATIC) override
更改向量的维度为 n 。如果可能的话 ,该向量的保留内存保持不变。 如果 n==0 ,所有内存都将被释放。因此,如果要调整向量的大小并释放不需要的内存, 必须首先调用 init(0) ,然后调用 ini...
template<typename T>
virtual void libMesh::EigenSparseVector< T >::init ( const numeric_index_type  n,
const numeric_index_type  n_local,
const std::vector< numeric_index_type > &  ghost,
const bool  fast = false,
const ParallelType  ptype = AUTOMATIC 
)
overridevirtual

创建一个包含本地索引以及在 ghost 参数中指定的索引的向量。

参数
n新的全局维度。
n_local新的本地维度。
ghost指定的索引。
fast如果为 false,则向量将被填充为零。
ptype平行类型,表示数值向量的类型。

实现了 libMesh::NumericVector< T >.

template<class T >
void libMesh::EigenSparseVector< T >::init ( const NumericVector< T > &  other,
const bool  fast = false 
)
overridevirtual

创建一个具有与 other 相同维度和存储类型的向量,包括 ghost dofs。

参数
other另一个数值向量。
fast如果为 false,则向量将被填充为零。

实现了 libMesh::NumericVector< T >.

在文件 eigen_sparse_vector.h372 行定义.

参考 libMesh::NumericVector< T >::local_size(), libMesh::NumericVector< T >::size() , 以及 libMesh::NumericVector< T >::type().

374 {
375  this->init(other.size(),other.local_size(),fast,other.type());
376 }
virtual void init(const numeric_index_type N, const numeric_index_type n_local, const bool fast=false, const ParallelType ptype=AUTOMATIC) override
更改向量的维度为 n 。如果可能的话 ,该向量的保留内存保持不变。 如果 n==0 ,所有内存都将被释放。因此,如果要调整向量的大小并释放不需要的内存, 必须首先调用 init(0) ,然后调用 ini...
template<typename T>
virtual bool libMesh::NumericVector< T >::initialized ( ) const
inlinevirtualinherited

检查向量是否已经初始化。

返回
如果向量已经初始化,则返回 true;否则返回 false。

在文件 numeric_vector.h159 行定义.

参考 libMesh::NumericVector< T >::_is_initialized.

参考自 libMesh::PetscVector< T >::create_subvector() , 以及 libMesh::PetscVector< T >::init().

159 { return _is_initialized; }
bool _is_initialized
在调用 init() 后设置为 true。
template<typename T >
void libMesh::NumericVector< T >::insert ( const T *  v,
const std::vector< numeric_index_type > &  dof_indices 
)
virtualinherited

v 的条目插入到 *this 中,位置由 dof_indices 指定。请注意,此方法的库实现是线程安全的。

参数
v一个指向值的指针。
dof_indices每个要插入值的位置的索引集合。

libMesh::PetscVector< T > , 以及 libMesh::EpetraVector< T > 重载.

在文件 numeric_vector.C84 行定义.

86 {
87  libmesh_assert (v);
88 
89  for (auto i : index_range(dof_indices))
90  this->set (dof_indices[i], v[i]);
91 }
virtual void set(const numeric_index_type i, const T value)=0
设置 v(i) = value 。 请注意,此方法的库实现是线程安全的, 例如,将在写入向量之前锁定 _numeric_vector_mutex 。
template<typename T >
void libMesh::NumericVector< T >::insert ( const NumericVector< T > &  v,
const std::vector< numeric_index_type > &  dof_indices 
)
inherited

v 的条目插入到 *this 中,位置由 v 指定。 只要使用 NumericVector 的库实现,此方法是线程安全的。

参数
v一个数值向量。
dof_indices每个要插入值的位置的索引集合。

在文件 numeric_vector.C96 行定义.

参考 libMesh::NumericVector< T >::readable() , 以及 libMesh::NumericVector< T >::size().

98 {
99  libmesh_assert_equal_to (V.size(), dof_indices.size());
100  libmesh_assert (V.readable());
101 
102  for (auto i : index_range(dof_indices))
103  this->set (dof_indices[i], V(i));
104 }
virtual void set(const numeric_index_type i, const T value)=0
设置 v(i) = value 。 请注意,此方法的库实现是线程安全的, 例如,将在写入向量之前锁定 _numeric_vector_mutex 。
template<typename T >
void libMesh::NumericVector< T >::insert ( const DenseVector< T > &  v,
const std::vector< numeric_index_type > &  dof_indices 
)
inlineinherited

v 的条目插入到 *this 中,位置由 v 指定。 只要使用 NumericVector 的库实现,此方法是线程安全的。

参数
v一个 DenseVector。
dof_indices每个要插入值的位置的索引集合。

在文件 numeric_vector.h1077 行定义.

参考 libMesh::DenseVector< T >::empty() , 以及 libMesh::DenseVector< T >::size().

1079 {
1080  libmesh_assert(v.size() == dof_indices.size());
1081  if (!v.empty())
1082  this->insert(&v(0), dof_indices);
1083 }
virtual void insert(const T *v, const std::vector< numeric_index_type > &dof_indices)
将 v 的条目插入到 *this 中,位置由 dof_indices 指定。请注意,此方法的库实现是线程安全的。
template<typename T >
void libMesh::NumericVector< T >::insert ( const DenseSubVector< T > &  v,
const std::vector< numeric_index_type > &  dof_indices 
)
inlineinherited

v 的条目插入到 *this 中,位置由 v 指定。 只要使用 NumericVector 的库实现,此方法是线程安全的。

参数
v一个 DenseSubVector。
dof_indices每个要插入值的位置的索引集合。

在文件 numeric_vector.h1089 行定义.

参考 libMesh::DenseSubVector< T >::empty() , 以及 libMesh::DenseSubVector< T >::size().

1091 {
1092  libmesh_assert(v.size() == dof_indices.size());
1093  if (!v.empty())
1094  this->insert(&v(0), dof_indices);
1095 }
virtual void insert(const T *v, const std::vector< numeric_index_type > &dof_indices)
将 v 的条目插入到 *this 中,位置由 dof_indices 指定。请注意,此方法的库实现是线程安全的。
template<typename T >
Real libMesh::EigenSparseVector< T >::l1_norm ( ) const
overridevirtual

获取向量的 $ \ell_1 $-范数,即条目的绝对值之和。

返回
向量的 $ \ell_1 $-范数。

实现了 libMesh::NumericVector< T >.

在文件 eigen_sparse_vector.C48 行定义.

参考 libMesh::closed() , 以及 libMesh::initialized().

49 {
50  libmesh_assert (this->closed());
51  libmesh_assert (this->initialized());
52 
53  return _vec.lpNorm<1>();
54 }
virtual bool closed() const
检查向量是否已经关闭并准备好进行计算。
DataType _vec
Actual Eigen::SparseVector&lt;&gt; we are wrapping.
virtual bool initialized() const
检查向量是否已经初始化。
template<typename T >
Real libMesh::EigenSparseVector< T >::l2_norm ( ) const
overridevirtual

获取向量的 $ \ell_2 $-范数,即条目平方和的平方根。

返回
向量的 $ \ell_2 $-范数。

实现了 libMesh::NumericVector< T >.

在文件 eigen_sparse_vector.C59 行定义.

参考 libMesh::closed() , 以及 libMesh::initialized().

60 {
61  libmesh_assert (this->closed());
62  libmesh_assert (this->initialized());
63 
64  return _vec.lpNorm<2>();
65 }
virtual bool closed() const
检查向量是否已经关闭并准备好进行计算。
DataType _vec
Actual Eigen::SparseVector&lt;&gt; we are wrapping.
virtual bool initialized() const
检查向量是否已经初始化。
template<class T >
Real libMesh::NumericVector< T >::l2_norm_diff ( const NumericVector< T > &  other_vec) const
inherited

获取 $ \ell_2 $-范数的向量差值 $ \vec{u} - \vec{v} $, 其中 $ \vec{u} $this。

参数
other_vec另一个数值向量。
返回
$ \ell_2 $-范数的向量差值。

在文件 numeric_vector.C363 行定义.

参考 std::norm(), libMesh::TensorTools::norm_sq(), libMesh::Real , 以及 std::sqrt().

364 {
365  libmesh_assert(this->compatible(v));
366 
367  Real norm = 0;
368  for (const auto i : make_range(this->first_local_index(), this->last_local_index()))
369  norm += TensorTools::norm_sq((*this)(i) - v(i));
370 
371  this->comm().sum(norm);
372 
373  return std::sqrt(norm);
374 }
ADRealEigenVector< T, D, asd > sqrt(const ADRealEigenVector< T, D, asd > &)
计算自动微分实数向量的平方根。
Definition: type_vector.h:88
T norm_sq(std::complex< T > a)
Definition: tensor_tools.h:74
virtual numeric_index_type first_local_index() const =0
获取实际存储在该处理器上的第一个向量元素的索引。
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
ADRealEigenVector< T, D, asd > norm(const ADRealEigenVector< T, D, asd > &)
计算自动微分实数向量的范数。
Definition: type_vector.h:64
virtual numeric_index_type last_local_index() const =0
获取实际存储在该处理器上的最后一个向量元素的索引+1。
bool compatible(const NumericVector< T > &v) const
检查该向量和向量 v 是否能够一起用于全局操作。
template<typename T >
numeric_index_type libMesh::EigenSparseVector< T >::last_local_index ( ) const
inlineoverridevirtual

获取实际存储在该处理器上的最后一个向量元素的索引+1。

注解
此索引的最大值为 size()
返回
最后一个本地索引+1。

实现了 libMesh::NumericVector< T >.

在文件 eigen_sparse_vector.h472 行定义.

参考 libMesh::initialized().

473 {
474  libmesh_assert (this->initialized());
475 
476  return this->size();
477 }
virtual bool initialized() const
检查向量是否已经初始化。
virtual numeric_index_type size() const override
获取向量的大小。
template<typename T >
Real libMesh::EigenSparseVector< T >::linfty_norm ( ) const
overridevirtual

获取向量的 $ \ell_{\infty} $-范数,即向量的最大绝对值。

返回
向量的 $ \ell_{\infty} $-范数。

实现了 libMesh::NumericVector< T >.

在文件 eigen_sparse_vector.C70 行定义.

参考 libMesh::closed() , 以及 libMesh::initialized().

71 {
72  libmesh_assert (this->closed());
73  libmesh_assert (this->initialized());
74 
75  return _vec.lpNorm<Eigen::Infinity>();
76 }
virtual bool closed() const
检查向量是否已经关闭并准备好进行计算。
DataType _vec
Actual Eigen::SparseVector&lt;&gt; we are wrapping.
virtual bool initialized() const
检查向量是否已经初始化。
template<typename T >
int libMesh::NumericVector< T >::local_relative_compare ( const NumericVector< T > &  other_vector,
const Real  threshold = TOLERANCE 
) const
virtualinherited

比较该向量与另一个向量的局部相对差异。

如果两个向量在给定的局部相对阈值 abs(a[i]-b[i])/max(a[i],b[i]) 下等效,则返回-1,否则返回首个不等效的索引。

参数
other_vector要比较的另一个向量。
threshold允许的局部相对差异阈值(可选,默认值为 TOLERANCE)。
返回
-1 表示等效,否则返回不等效的索引。

在文件 numeric_vector.C137 行定义.

参考 std::abs().

139 {
140  libmesh_assert(this->compatible(other_vector));
141 
142  int first_different_i = std::numeric_limits<int>::max();
144 
145  do
146  {
147  if (std::abs((*this)(i) - other_vector(i)) > threshold *
148  std::max(std::abs((*this)(i)), std::abs(other_vector(i))))
149  first_different_i = i;
150  else
151  i++;
152  }
153  while (first_different_i==std::numeric_limits<int>::max()
154  && i<last_local_index());
155 
156  // Find the correct first differing index in parallel
157  this->comm().min(first_different_i);
158 
159  if (first_different_i == std::numeric_limits<int>::max())
160  return -1;
161 
162  return first_different_i;
163 }
ADRealEigenVector< T, D, asd > abs(const ADRealEigenVector< T, D, asd > &)
计算自动微分实数向量的绝对值。
Definition: type_vector.h:112
dof_id_type numeric_index_type
Definition: id_types.h:99
virtual numeric_index_type first_local_index() const =0
获取实际存储在该处理器上的第一个向量元素的索引。
virtual numeric_index_type last_local_index() const =0
获取实际存储在该处理器上的最后一个向量元素的索引+1。
bool compatible(const NumericVector< T > &v) const
检查该向量和向量 v 是否能够一起用于全局操作。
template<typename T >
numeric_index_type libMesh::EigenSparseVector< T >::local_size ( ) const
inlineoverridevirtual

获取向量的本地大小,即 index_stop - index_start。

返回
向量的本地大小。

实现了 libMesh::NumericVector< T >.

在文件 eigen_sparse_vector.h450 行定义.

参考 libMesh::initialized().

451 {
452  libmesh_assert (this->initialized());
453 
454  return this->size();
455 }
virtual bool initialized() const
检查向量是否已经初始化。
virtual numeric_index_type size() const override
获取向量的大小。
template<typename T >
void libMesh::EigenSparseVector< T >::localize ( std::vector< T > &  v_local) const
overridevirtual

创建全局向量的副本并存储在本地向量 v_local 中。

参数
v_local用于存储本地向量的 std::vector。

实现了 libMesh::NumericVector< T >.

在文件 eigen_sparse_vector.C392 行定义.

394 {
395  v_local.resize(this->size());
396 
397  for (auto i : index_range(v_local))
398  v_local[i] = (*this)(i);
399 }
virtual numeric_index_type size() const override
获取向量的大小。
template<typename T >
void libMesh::EigenSparseVector< T >::localize ( NumericVector< T > &  v_local) const
overridevirtual

创建全局向量的副本并存储在本地向量 v_local 中,而不是 std::vector。

参数
v_local用于存储本地向量的 NumericVector<T>。

实现了 libMesh::NumericVector< T >.

在文件 eigen_sparse_vector.C334 行定义.

335 {
336  // Make sure the NumericVector passed in is really a EigenSparseVector
337  EigenSparseVector<T> * v_local =
338  cast_ptr<EigenSparseVector<T> *>(&v_local_in);
339 
340  libmesh_assert(v_local);
341 
342  *v_local = *this;
343 }
template<typename T>
virtual void libMesh::EigenSparseVector< T >::localize ( NumericVector< T > &  v_local,
const std::vector< numeric_index_type > &  send_list 
) const
overridevirtual

创建本地向量 v_local ,其中仅包含与此处理器相关的信息,由 send_list 定义。

参数
v_local用于存储本地向量的 NumericVector<T>。
send_list指定要包含在本地向量中的值的索引列表。

实现了 libMesh::NumericVector< T >.

template<typename T >
void libMesh::EigenSparseVector< T >::localize ( std::vector< T > &  v_local,
const std::vector< numeric_index_type > &  indices 
) const
overridevirtual

用全局索引中给定的值填充本地 std::vector "v_local"。

参数
v_local用于存储本地向量的 std::vector。
indices要填充到 v_local 中的全局索引列表。

Fill in the local std::vector "v_local" with the global indices given in "indices".

注解
每个处理器上的索引可能不同, 并且相同的索引可以本地化到多个处理器。 生成的v_local可以比原来的v_local短,并且条目将按照索引指定的顺序排列。

Example:

*   On 4 procs *this = {a, b, c, d, e, f, g, h, i} is a parallel vector.
*   On each proc, the indices arrays are set up as:
*   proc0, indices = {1,2,4,5}
*   proc1, indices = {2,5,6,8}
*   proc2, indices = {2,3,6,7}
*   proc3, indices = {0,1,2,3}
*
*   After calling this version of localize, the v_local vectors are:
*   proc0, v_local = {b,c,e,f}
*   proc1, v_local = {c,f,g,i}
*   proc2, v_local = {c,d,g,h}
*   proc3, v_local = {a,b,c,d}
* 

这个函数在并行I/0例程中很有用,当你有一个解值的并行向量,你想写一个子集。

实现了 libMesh::NumericVector< T >.

在文件 eigen_sparse_vector.C364 行定义.

366 {
367  // EigenSparseVectors are serial, so we can just copy values
368  v_local.resize(indices.size());
369 
370  for (auto i : index_range(v_local))
371  v_local[i] = (*this)(indices[i]);
372 }
template<typename T>
virtual void libMesh::EigenSparseVector< T >::localize ( const numeric_index_type  first_local_idx,
const numeric_index_type  last_local_idx,
const std::vector< numeric_index_type > &  send_list 
)
overridevirtual

使用由 send_list 指定的值从相邻处理器中选择的值更新本地向量。

参数
first_local_idx本地向量的第一个索引。
last_local_idx本地向量的最后一个索引。
send_list用于更新本地向量的值的索引列表。

实现了 libMesh::NumericVector< T >.

template<typename T>
void libMesh::EigenSparseVector< T >::localize_to_one ( std::vector< T > &  v_local,
const processor_id_type  proc_id = 0 
) const
overridevirtual

在处理器 proc_id 上创建全局向量的本地副本。 默认情况下,数据发送到处理器 0。此方法对于从一个处理器输出数据非常有用。

参数
v_local用于存储本地向量的 std::vector。
proc_id目标处理器的 ID。

实现了 libMesh::NumericVector< T >.

在文件 eigen_sparse_vector.C404 行定义.

406 {
407  libmesh_assert_equal_to (pid, 0);
408 
409  this->localize (v_local);
410 }
virtual void localize(std::vector< T > &v_local) const override
创建全局向量的副本并存储在本地向量 v_local 中。
template<typename T >
Real libMesh::EigenSparseVector< T >::max ( ) const
overridevirtual

获取向量中的最大值,或者在复数情况下获取最大的实部。

返回
向量的最大值。

实现了 libMesh::NumericVector< T >.

在文件 eigen_sparse_vector.C430 行定义.

参考 libMesh::initialized(), libMesh::libmesh_real() , 以及 libMesh::Real.

431 {
432  libmesh_assert (this->initialized());
433  if (!this->size())
434  return -std::numeric_limits<Real>::max();
435 
436 #ifdef LIBMESH_USE_COMPLEX_NUMBERS
437  Real the_max = libmesh_real((*this)(0));
438 
439  const numeric_index_type n = this->size();
440 
441  for (numeric_index_type i=1; i<n; i++)
442  the_max = std::max (the_max, libmesh_real((*this)(i)));
443 
444  return the_max;
445 #else
446  return libmesh_real(_vec.maxCoeff());
447 #endif
448 }
T libmesh_real(T a)
DataType _vec
Actual Eigen::SparseVector&lt;&gt; we are wrapping.
virtual bool initialized() const
检查向量是否已经初始化。
dof_id_type numeric_index_type
Definition: id_types.h:99
virtual numeric_index_type size() const override
获取向量的大小。
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
template<typename T >
std::size_t libMesh::EigenSparseVector< T >::max_allowed_id ( ) const
inlineoverridevirtual

返回 NumericVector 可以包含的最大条目数(在所有处理器上)。

尽管我们定义了 numeric_index_type,通常要求 NumericVector 底层实现的索引具有大小等于 sizeof(numeric_index_type) 的大小, 但这两种类型仍可能具有不同的符号,这会影响可以存储在 NumericVector 中的最大值数量。

实现了 libMesh::NumericVector< T >.

在文件 eigen_sparse_vector.h541 行定义.

542 {
543  // We use the Eigen::Matrix type which appears to be templated on
544  // int for its sizes, see e.g. https://eigen.tuxfamily.org/dox/classEigen_1_1Matrix.html
545  return std::numeric_limits<int>::max();
546 }
template<typename T >
Real libMesh::EigenSparseVector< T >::min ( ) const
overridevirtual

获取向量中的最小值,或者在复数情况下获取最小的实部。

返回
向量的最小值。

实现了 libMesh::NumericVector< T >.

在文件 eigen_sparse_vector.C453 行定义.

参考 libMesh::initialized(), libMesh::libmesh_real() , 以及 libMesh::Real.

454 {
455  libmesh_assert (this->initialized());
456  if (!this->size())
457  return std::numeric_limits<Real>::max();
458 
459 #ifdef LIBMESH_USE_COMPLEX_NUMBERS
460  Real the_min = libmesh_real((*this)(0));
461 
462  const numeric_index_type n = this->size();
463 
464  for (numeric_index_type i=1; i<n; i++)
465  the_min = std::min (the_min, libmesh_real((*this)(i)));
466 
467  return the_min;
468 #else
469  return libmesh_real(_vec.minCoeff());
470 #endif
471 }
T libmesh_real(T a)
DataType _vec
Actual Eigen::SparseVector&lt;&gt; we are wrapping.
virtual bool initialized() const
检查向量是否已经初始化。
dof_id_type numeric_index_type
Definition: id_types.h:99
virtual numeric_index_type size() const override
获取向量的大小。
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static unsigned int libMesh::ReferenceCounter::n_objects ( )
inlinestaticinherited

Prints the number of outstanding (created, but not yet destroyed) objects.

在文件 reference_counter.h85 行定义.

参考 libMesh::ReferenceCounter::_n_objects.

参考自 libMesh::LibMeshInit::~LibMeshInit().

86  { return _n_objects; }
static Threads::atomic< unsigned int > _n_objects
The number of objects.
template<typename T >
T libMesh::EigenSparseVector< T >::operator() ( const numeric_index_type  i) const
inlineoverridevirtual

获取向量的第 i 个条目的副本。

参数
i要获取的条目的索引。
返回
第 i 个条目的副本。

实现了 libMesh::NumericVector< T >.

在文件 eigen_sparse_vector.h513 行定义.

参考 libMesh::initialized().

514 {
515  libmesh_assert (this->initialized());
516  libmesh_assert ( ((i >= this->first_local_index()) &&
517  (i < this->last_local_index())) );
518 
519  return _vec[static_cast<eigen_idx_type>(i)];
520 }
DataType _vec
Actual Eigen::SparseVector&lt;&gt; we are wrapping.
virtual numeric_index_type last_local_index() const override
获取实际存储在该处理器上的最后一个向量元素的索引+1。
int32_t eigen_idx_type
virtual bool initialized() const
检查向量是否已经初始化。
virtual numeric_index_type first_local_index() const override
获取实际存储在该处理器上的第一个向量元素的索引。
template<typename T >
NumericVector< T > & libMesh::EigenSparseVector< T >::operator*= ( const NumericVector< T > &  v)
overridevirtual

计算此向量条目与另一个向量的条目之间的分量乘法, $ u_i \leftarrow u_i v_i \, \forall i$

参数
v另一个数值向量。
返回
对 *this 的引用。

实现了 libMesh::NumericVector< T >.

在文件 eigen_sparse_vector.C110 行定义.

参考 libMesh::closed() , 以及 libMesh::NumericVector< T >::size().

111 {
112  libmesh_assert (this->closed());
113  libmesh_assert_equal_to(size(), v_in.size());
114 
115  const EigenSparseVector<T> & v = cast_ref<const EigenSparseVector<T> &>(v_in);
116 
117  _vec = _vec.cwiseProduct(v._vec);
118 
119  return *this;
120 }
virtual bool closed() const
检查向量是否已经关闭并准备好进行计算。
DataType _vec
Actual Eigen::SparseVector&lt;&gt; we are wrapping.
virtual numeric_index_type size() const override
获取向量的大小。
template<typename T>
NumericVector<T>& libMesh::NumericVector< T >::operator*= ( const T  a)
inlineinherited

将向量缩放为 a$ \vec{u} \leftarrow a\vec{u} $。等价于 u.scale(a)。

参数
a缩放因子。
返回
对 *this 的引用。

在文件 numeric_vector.h463 行定义.

参考 libMesh::NumericVector< T >::scale().

463 { this->scale(a); return *this; }
virtual void scale(const T factor)=0
缩放向量的每个元素。
template<typename T >
NumericVector< T > & libMesh::EigenSparseVector< T >::operator+= ( const NumericVector< T > &  v)
overridevirtual

将向量加上 v$ \vec{u} \leftarrow \vec{u} + \vec{v} $。等价于 u.add(1, v)。

参数
v另一个数值向量。
返回
对 *this 的引用。

实现了 libMesh::NumericVector< T >.

在文件 eigen_sparse_vector.C81 行定义.

参考 libMesh::EigenSparseVector< T >::_vec , 以及 libMesh::closed().

82 {
83  libmesh_assert (this->closed());
84 
85  const EigenSparseVector<T> & v = cast_ref<const EigenSparseVector<T> &>(v_in);
86 
87  _vec += v._vec;
88 
89  return *this;
90 }
virtual bool closed() const
检查向量是否已经关闭并准备好进行计算。
DataType _vec
Actual Eigen::SparseVector&lt;&gt; we are wrapping.
template<typename T >
NumericVector< T > & libMesh::EigenSparseVector< T >::operator-= ( const NumericVector< T > &  v)
overridevirtual

v 从 *this 减去, $ \vec{u} \leftarrow \vec{u} - \vec{v} $。等价于 u.add(-1, v)。

参数
v另一个数值向量。
返回
对 *this 的引用。

实现了 libMesh::NumericVector< T >.

在文件 eigen_sparse_vector.C96 行定义.

参考 libMesh::EigenSparseVector< T >::_vec , 以及 libMesh::closed().

97 {
98  libmesh_assert (this->closed());
99 
100  const EigenSparseVector<T> & v = cast_ref<const EigenSparseVector<T> &>(v_in);
101 
102  _vec -= v._vec;
103 
104  return *this;
105 }
virtual bool closed() const
检查向量是否已经关闭并准备好进行计算。
DataType _vec
Actual Eigen::SparseVector&lt;&gt; we are wrapping.
template<typename T >
NumericVector< T > & libMesh::EigenSparseVector< T >::operator/= ( const NumericVector< T > &  v)
overridevirtual

计算此向量条目与另一个向量的分量除法, $ u_i \leftarrow \frac{u_i}{v_i} \, \forall i$

参数
v另一个数值向量。
返回
对 *this 的引用。

实现了 libMesh::NumericVector< T >.

在文件 eigen_sparse_vector.C125 行定义.

参考 libMesh::closed() , 以及 libMesh::NumericVector< T >::size().

126 {
127  libmesh_assert (this->closed());
128  libmesh_assert_equal_to(size(), v_in.size());
129 
130  const EigenSparseVector<T> & v = cast_ref<const EigenSparseVector<T> &>(v_in);
131 
132  _vec = _vec.cwiseQuotient(v._vec);
133 
134  return *this;
135 }
virtual bool closed() const
检查向量是否已经关闭并准备好进行计算。
DataType _vec
Actual Eigen::SparseVector&lt;&gt; we are wrapping.
virtual numeric_index_type size() const override
获取向量的大小。
template<typename T>
NumericVector<T>& libMesh::NumericVector< T >::operator/= ( const T  a)
inlineinherited

将向量缩放为 1/a$ \vec{u} \leftarrow \frac{1}{a}\vec{u} $。等价于 u.scale(1.

/a)。

参数
a缩放因子。
返回
对 *this 的引用。

在文件 numeric_vector.h481 行定义.

参考 libMesh::NumericVector< T >::scale().

481 { this->scale(1./a); return *this; }
virtual void scale(const T factor)=0
缩放向量的每个元素。
template<typename T >
EigenSparseVector< T > & libMesh::EigenSparseVector< T >::operator= ( const EigenSparseVector< T > &  v)

Copy assignment operator.

Does some state checks before copying the underlying Eigen data type.

返回
A reference to *this as the derived type.

在文件 eigen_sparse_vector.C299 行定义.

参考 libMesh::EigenSparseVector< T >::_vec, libMesh::NumericVector< T >::closed(), libMesh::initialized() , 以及 libMesh::EigenSparseVector< T >::size().

300 {
301  libmesh_assert (this->initialized());
302  libmesh_assert (v.closed());
303  libmesh_assert_equal_to (this->size(), v.size());
304 
305  _vec = v._vec;
306 
307  this->_is_closed = true;
308 
309  return *this;
310 }
DataType _vec
Actual Eigen::SparseVector&lt;&gt; we are wrapping.
virtual bool initialized() const
检查向量是否已经初始化。
virtual numeric_index_type size() const override
获取向量的大小。
bool _is_closed
用于跟踪向量的值在在一些或全部处理器上进行插入或添加值操作后是否在所有处理器上保持一致的标志。
template<typename T>
EigenSparseVector& libMesh::EigenSparseVector< T >::operator= ( EigenSparseVector< T > &&  )
default
template<typename T >
NumericVector< T > & libMesh::EigenSparseVector< T >::operator= ( const T  s)
overridevirtual

设置向量的所有条目为值 s。

参数
s设置的值。
返回
对 *this 的引用。

实现了 libMesh::NumericVector< T >.

在文件 eigen_sparse_vector.C268 行定义.

参考 libMesh::closed() , 以及 libMesh::initialized().

269 {
270  libmesh_assert (this->initialized());
271  libmesh_assert (this->closed());
272 
273  _vec.fill(s);
274 
275  return *this;
276 }
virtual bool closed() const
检查向量是否已经关闭并准备好进行计算。
DataType _vec
Actual Eigen::SparseVector&lt;&gt; we are wrapping.
virtual bool initialized() const
检查向量是否已经初始化。
template<typename T >
NumericVector< T > & libMesh::EigenSparseVector< T >::operator= ( const NumericVector< T > &  v)
overridevirtual

一个复制赋值运算符

参数
v要复制的 NumericVector 对象。
返回
作为基础类型的 *this 的引用。

实现了 libMesh::NumericVector< T >.

在文件 eigen_sparse_vector.C282 行定义.

283 {
284  // Make sure the NumericVector passed in is really a EigenSparseVector
285  const EigenSparseVector<T> * v =
286  cast_ptr<const EigenSparseVector<T> *>(&v_in);
287 
288  libmesh_assert(v);
289 
290  *this = *v;
291 
292  return *this;
293 }
template<typename T >
NumericVector< T > & libMesh::EigenSparseVector< T >::operator= ( const std::vector< T > &  v)
overridevirtual

设置 (*this)(i) = v(i) 对于向量的每个条目。

参数
v另一个向量。
返回
对 *this 的引用。

Case 1: The vector is the same size of The global vector. Only add the local components.

实现了 libMesh::NumericVector< T >.

在文件 eigen_sparse_vector.C316 行定义.

317 {
322  if (this->size() == v.size())
323  for (auto i : index_range(v))
324  this->set (i, v[i]);
325 
326  else
327  libmesh_error_msg("this->size() = " << this->size() << " must be equal to v.size() = " << v.size());
328 
329  return *this;
330 }
virtual numeric_index_type size() const override
获取向量的大小。
virtual void set(const numeric_index_type i, const T value) override
设置 v(i) = value 。 请注意,此方法的库实现是线程安全的, 例如,将在写入向量之前锁定 _numeric_vector_mutex 。
template<typename T >
void libMesh::EigenSparseVector< T >::pointwise_divide ( const NumericVector< T > &  vec1,
const NumericVector< T > &  vec2 
)
overridevirtual

计算该向量与另一个向量的逐点除法。

执行逐点(分量间)除法操作 $ u_i \leftarrow \frac{v_{1,i}}{v_{2,i}} $, 并将结果存储在该向量中。

参数
vec1被除数的输入向量。
vec2除数的输入向量。

实现了 libMesh::NumericVector< T >.

在文件 eigen_sparse_vector.C422 行定义.

424 {
425  libmesh_not_implemented();
426 }
template<typename T >
void libMesh::EigenSparseVector< T >::pointwise_mult ( const NumericVector< T > &  vec1,
const NumericVector< T > &  vec2 
)
overridevirtual

比较该向量与另一个向量的全局相对差异。

如果两个向量在给定的全局相对阈值 threshold 下等效,则返回-1,否则返回首个不等效的索引, 其中相对差异定义为 $ \frac{|a[i]-b[i]|}{\max_j(a[j],b[j])} $

参数
other_vector要比较的另一个向量。
threshold允许的全局相对差异阈值(可选,默认值为 TOLERANCE)。
返回
-1 表示等效,否则返回不等效的索引。 计算该向量与另一个向量的逐点乘积。

执行逐点(分量间)乘积操作 $ u_i \leftarrow u_i v_i $,并将结果存储在该向量中。

参数
vec1第一个输入向量。
vec2第二个输入向量。

实现了 libMesh::NumericVector< T >.

在文件 eigen_sparse_vector.C415 行定义.

417 {
418  libmesh_not_implemented();
419 }
template<typename T >
void libMesh::NumericVector< T >::print ( std::ostream &  os = libMesh::out) const
inlinevirtualinherited

打印本地向量的内容,默认输出到 libMesh::out 流。

参数
os输出流,用于指定输出位置(可选,默认为 libMesh::out)。

在文件 numeric_vector.h1121 行定义.

参考 libMesh::initialized().

1122 {
1123  libmesh_assert (this->initialized());
1124  os << "Size\tglobal = " << this->size()
1125  << "\t\tlocal = " << this->local_size() << std::endl;
1126 
1127  os << "#\tValue" << std::endl;
1128  for (auto i : index_range(*this))
1129  os << i << "\t" << (*this)(i) << std::endl;
1130 }
virtual numeric_index_type size() const =0
获取向量的大小。
virtual bool initialized() const
检查向量是否已经初始化。
virtual numeric_index_type local_size() const =0
获取向量的本地大小,即 index_stop - index_start。
template<>
void libMesh::NumericVector< Complex >::print ( std::ostream &  os) const
inlineinherited

在文件 numeric_vector.h1103 行定义.

参考 std::imag(), libMesh::initialized() , 以及 std::real().

1104 {
1105  libmesh_assert (this->initialized());
1106  os << "Size\tglobal = " << this->size()
1107  << "\t\tlocal = " << this->local_size() << std::endl;
1108 
1109  // std::complex<>::operator<<() is defined, but use this form
1110  os << "#\tReal part\t\tImaginary part" << std::endl;
1111  for (auto i : index_range(*this))
1112  os << i << "\t"
1113  << (*this)(i).real() << "\t\t"
1114  << (*this)(i).imag() << std::endl;
1115 }
boost::multiprecision::float128 real(const boost::multiprecision::float128 in)
virtual numeric_index_type size() const =0
获取向量的大小。
virtual bool initialized() const
检查向量是否已经初始化。
virtual numeric_index_type local_size() const =0
获取向量的本地大小,即 index_stop - index_start。
boost::multiprecision::float128 imag(const boost::multiprecision::float128)
template<typename T >
void libMesh::NumericVector< T >::print_global ( std::ostream &  os = libMesh::out) const
inlinevirtualinherited

打印全局向量的内容,默认输出到 libMesh::out 流。

参数
os输出流,用于指定输出位置(可选,默认为 libMesh::out)。

在文件 numeric_vector.h1158 行定义.

参考 libMesh::initialized().

1159 {
1160  libmesh_assert (this->initialized());
1161 
1162  std::vector<T> v(this->size());
1163  this->localize(v);
1164 
1165  // 现在我们只需要输出的一个副本
1166  if (this->processor_id())
1167  return;
1168 
1169  os << "Size\tglobal = " << this->size() << std::endl;
1170  os << "#\tValue" << std::endl;
1171  for (auto i : make_range(v.size()))
1172  os << i << "\t" << v[i] << std::endl;
1173 }
virtual numeric_index_type size() const =0
获取向量的大小。
virtual bool initialized() const
检查向量是否已经初始化。
virtual void localize(std::vector< T > &v_local) const =0
创建全局向量的副本并存储在本地向量 v_local 中。
template<>
void libMesh::NumericVector< Complex >::print_global ( std::ostream &  os) const
inlineinherited

在文件 numeric_vector.h1136 行定义.

参考 libMesh::initialized().

1137 {
1138  libmesh_assert (this->initialized());
1139 
1140  std::vector<Complex> v(this->size());
1141  this->localize(v);
1142 
1143  // 现在我们只需要输出的一个副本
1144  if (this->processor_id())
1145  return;
1146 
1147  os << "Size\tglobal = " << this->size() << std::endl;
1148  os << "#\tReal part\t\tImaginary part" << std::endl;
1149  for (auto i : make_range(v.size()))
1150  os << i << "\t"
1151  << v[i].real() << "\t\t"
1152  << v[i].imag() << std::endl;
1153 }
virtual numeric_index_type size() const =0
获取向量的大小。
virtual bool initialized() const
检查向量是否已经初始化。
virtual void localize(std::vector< T > &v_local) const =0
创建全局向量的副本并存储在本地向量 v_local 中。
void libMesh::ReferenceCounter::print_info ( std::ostream &  out_stream = libMesh::out)
staticinherited

Prints the reference information, by default to libMesh::out.

在文件 reference_counter.C81 行定义.

参考 libMesh::ReferenceCounter::_enable_print_counter , 以及 libMesh::ReferenceCounter::get_info().

参考自 libMesh::LibMeshInit::~LibMeshInit().

82 {
84  out_stream << ReferenceCounter::get_info();
85 }
static std::string get_info()
Gets a string containing the reference information.
static bool _enable_print_counter
Flag to control whether reference count information is printed when print_info is called...
template<typename T>
virtual void libMesh::NumericVector< T >::print_matlab ( const std::string &  = "") const
inlinevirtualinherited

以Matlab的稀疏矩阵格式打印向量内容。可选择将向量打印到名为 name 的文件中。 如果未指定 name,则内容将被打印到屏幕上。

参数
name用于指定输出文件名的可选参数(默认为空)。

libMesh::PetscVector< T > 重载.

在文件 numeric_vector.h859 行定义.

860  {
861  libmesh_not_implemented();
862  }
template<typename T >
bool libMesh::NumericVector< T >::readable ( ) const
inherited

检查该向量是否能够用于全局操作。

返回
如果向量可以用于全局操作,则返回 true,否则返回 false。

在文件 numeric_vector.C416 行定义.

参考 libMesh::closed() , 以及 libMesh::initialized().

参考自 libMesh::NumericVector< T >::add_vector(), libMesh::NumericVector< T >::compatible() , 以及 libMesh::NumericVector< T >::insert().

417 {
418  return this->initialized() && this->closed();
419 }
virtual bool closed() const
检查向量是否已经关闭并准备好进行计算。
virtual bool initialized() const
检查向量是否已经初始化。
template<typename T >
void libMesh::EigenSparseVector< T >::reciprocal ( )
overridevirtual

计算每个向量条目的分量倒数, $ u_i \leftarrow \frac{1}{u_i} \, \forall i$

实现了 libMesh::NumericVector< T >.

在文件 eigen_sparse_vector.C141 行定义.

142 {
143 #ifndef NDEBUG
144  const numeric_index_type n = this->size();
145 
146  for (numeric_index_type i=0; i<n; i++)
147  // Don't divide by zero!
148  libmesh_assert_not_equal_to ((*this)(i), T(0));
149 #endif
150 
151  _vec = _vec.cwiseInverse();
152 }
DataType _vec
Actual Eigen::SparseVector&lt;&gt; we are wrapping.
dof_id_type numeric_index_type
Definition: id_types.h:99
virtual numeric_index_type size() const override
获取向量的大小。
template<typename T >
void libMesh::EigenSparseVector< T >::scale ( const T  factor)
overridevirtual

缩放向量的每个元素。

参数
factor缩放因子。

实现了 libMesh::NumericVector< T >.

在文件 eigen_sparse_vector.C230 行定义.

参考 libMesh::initialized().

231 {
232  libmesh_assert (this->initialized());
233 
234  _vec *= factor;
235 }
DataType _vec
Actual Eigen::SparseVector&lt;&gt; we are wrapping.
virtual bool initialized() const
检查向量是否已经初始化。
template<typename T >
void libMesh::EigenSparseVector< T >::set ( const numeric_index_type  i,
const T  value 
)
inlineoverridevirtual

设置 v(i) = value 。 请注意,此方法的库实现是线程安全的, 例如,将在写入向量之前锁定 _numeric_vector_mutex

参数
i要设置的条目的索引。
value要设置的值。

实现了 libMesh::NumericVector< T >.

在文件 eigen_sparse_vector.h483 行定义.

参考 libMesh::initialized().

484 {
485  libmesh_assert (this->initialized());
486  libmesh_assert_less (i, this->size());
487 
488  std::scoped_lock lock(this->_numeric_vector_mutex);
489  _vec[static_cast<eigen_idx_type>(i)] = value;
490 
491  this->_is_closed = false;
492 }
std::mutex _numeric_vector_mutex
用于执行线程安全操作的互斥锁。
DataType _vec
Actual Eigen::SparseVector&lt;&gt; we are wrapping.
int32_t eigen_idx_type
virtual bool initialized() const
检查向量是否已经初始化。
virtual numeric_index_type size() const override
获取向量的大小。
bool _is_closed
用于跟踪向量的值在在一些或全部处理器上进行插入或添加值操作后是否在所有处理器上保持一致的标志。
template<typename T >
numeric_index_type libMesh::EigenSparseVector< T >::size ( ) const
inlineoverridevirtual

获取向量的大小。

返回
向量的大小。

实现了 libMesh::NumericVector< T >.

在文件 eigen_sparse_vector.h439 行定义.

参考 libMesh::initialized().

参考自 libMesh::EigenSparseVector< T >::operator=().

440 {
441  libmesh_assert (this->initialized());
442 
443  return static_cast<numeric_index_type>(_vec.size());
444 }
DataType _vec
Actual Eigen::SparseVector&lt;&gt; we are wrapping.
virtual bool initialized() const
检查向量是否已经初始化。
dof_id_type numeric_index_type
Definition: id_types.h:99
template<class T >
Real libMesh::NumericVector< T >::subset_l1_norm ( const std::set< numeric_index_type > &  indices) const
virtualinherited

获取指定条目的向量的 $ \ell_1 $-范数,即指定条目的绝对值之和。

参数
indices指定的索引集合。
返回
指定条目的向量的 $ \ell_1 $-范数。
注解
索引必须位于此处理器上。

在文件 numeric_vector.C306 行定义.

参考 std::abs(), std::norm() , 以及 libMesh::Real.

307 {
308  libmesh_assert (this->readable());
309 
310  const NumericVector<T> & v = *this;
311 
312  Real norm = 0;
313 
314  for (const auto & index : indices)
315  norm += std::abs(v(index));
316 
317  this->comm().sum(norm);
318 
319  return norm;
320 }
bool readable() const
检查该向量是否能够用于全局操作。
ADRealEigenVector< T, D, asd > abs(const ADRealEigenVector< T, D, asd > &)
计算自动微分实数向量的绝对值。
Definition: type_vector.h:112
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
ADRealEigenVector< T, D, asd > norm(const ADRealEigenVector< T, D, asd > &)
计算自动微分实数向量的范数。
Definition: type_vector.h:64
template<class T >
Real libMesh::NumericVector< T >::subset_l2_norm ( const std::set< numeric_index_type > &  indices) const
virtualinherited

获取指定条目的向量的 $ \ell_2 $-范数,即指定条目平方和的平方根。

参数
indices指定的索引集合。
返回
指定条目的向量的 $ \ell_2 $-范数。
注解
索引必须位于此处理器上。

在文件 numeric_vector.C323 行定义.

参考 std::norm(), libMesh::TensorTools::norm_sq(), libMesh::Real , 以及 std::sqrt().

324 {
325  libmesh_assert (this->readable());
326 
327  const NumericVector<T> & v = *this;
328 
329  Real norm = 0;
330 
331  for (const auto & index : indices)
332  norm += TensorTools::norm_sq(v(index));
333 
334  this->comm().sum(norm);
335 
336  return std::sqrt(norm);
337 }
bool readable() const
检查该向量是否能够用于全局操作。
ADRealEigenVector< T, D, asd > sqrt(const ADRealEigenVector< T, D, asd > &)
计算自动微分实数向量的平方根。
Definition: type_vector.h:88
T norm_sq(std::complex< T > a)
Definition: tensor_tools.h:74
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
ADRealEigenVector< T, D, asd > norm(const ADRealEigenVector< T, D, asd > &)
计算自动微分实数向量的范数。
Definition: type_vector.h:64
template<class T >
Real libMesh::NumericVector< T >::subset_linfty_norm ( const std::set< numeric_index_type > &  indices) const
virtualinherited

获取指定条目的向量的最大绝对值,即指定条目的 $ \ell_{\infty} $-范数。

参数
indices指定的索引集合。
返回
指定条目的向量的最大绝对值。
注解
索引必须位于此处理器上。

在文件 numeric_vector.C340 行定义.

参考 std::abs(), std::norm() , 以及 libMesh::Real.

341 {
342  libmesh_assert (this->readable());
343 
344  const NumericVector<T> & v = *this;
345 
346  Real norm = 0;
347 
348  for (const auto & index : indices)
349  {
350  Real value = std::abs(v(index));
351  if (value > norm)
352  norm = value;
353  }
354 
355  this->comm().max(norm);
356 
357  return norm;
358 }
bool readable() const
检查该向量是否能够用于全局操作。
ADRealEigenVector< T, D, asd > abs(const ADRealEigenVector< T, D, asd > &)
计算自动微分实数向量的绝对值。
Definition: type_vector.h:112
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
ADRealEigenVector< T, D, asd > norm(const ADRealEigenVector< T, D, asd > &)
计算自动微分实数向量的范数。
Definition: type_vector.h:64
template<typename T >
T libMesh::EigenSparseVector< T >::sum ( ) const
overridevirtual

获取向量中所有值的总和。

返回
向量中所有值的总和。

实现了 libMesh::NumericVector< T >.

在文件 eigen_sparse_vector.C37 行定义.

参考 libMesh::closed() , 以及 libMesh::initialized().

38 {
39  libmesh_assert (this->closed());
40  libmesh_assert (this->initialized());
41 
42  return _vec.sum();
43 }
virtual bool closed() const
检查向量是否已经关闭并准备好进行计算。
DataType _vec
Actual Eigen::SparseVector&lt;&gt; we are wrapping.
virtual bool initialized() const
检查向量是否已经初始化。
template<typename T >
void libMesh::EigenSparseVector< T >::swap ( NumericVector< T > &  v)
inlineoverridevirtual

交换该向量的内容与向量 v 的内容。子类应提供足够的间接性以使此操作成为 O(1) 的头部交换操作。

参数
v要交换内容的向量。

重载 libMesh::NumericVector< T > .

在文件 eigen_sparse_vector.h526 行定义.

参考 libMesh::libMeshPrivateData::_is_initialized , 以及 libMesh::EigenSparseVector< T >::swap().

参考自 libMesh::EigenSparseVector< T >::swap().

527 {
528  EigenSparseVector<T> & v = cast_ref<EigenSparseVector<T> &>(other);
529 
530  _vec.swap(v._vec);
531 
532  std::swap (this->_is_closed, v._is_closed);
533  std::swap (this->_is_initialized, v._is_initialized);
534  std::swap (this->_type, v._type);
535 }
DataType _vec
Actual Eigen::SparseVector&lt;&gt; we are wrapping.
bool _is_initialized
在调用 init() 后设置为 true。
ParallelType _type
向量的类型。
bool _is_closed
用于跟踪向量的值在在一些或全部处理器上进行插入或添加值操作后是否在所有处理器上保持一致的标志。
template<typename T>
ParallelType libMesh::NumericVector< T >::type ( ) const
inlineinherited
template<typename T>
ParallelType& libMesh::NumericVector< T >::type ( )
inlineinherited

获取向量的类型。

返回
向量的类型(SERIAL、PARALLEL、GHOSTED)。

在文件 numeric_vector.h173 行定义.

参考 libMesh::NumericVector< T >::_type.

173 { return _type; }
ParallelType _type
向量的类型。
template<typename T>
DataType& libMesh::EigenSparseVector< T >::vec ( )
inline

References to the underlying Eigen data types.

注解
This is generally not required in user-level code.

在文件 eigen_sparse_vector.h243 行定义.

参考 libMesh::EigenSparseVector< T >::_vec.

243 { return _vec; }
DataType _vec
Actual Eigen::SparseVector&lt;&gt; we are wrapping.
template<typename T>
const DataType& libMesh::EigenSparseVector< T >::vec ( ) const
inline

在文件 eigen_sparse_vector.h244 行定义.

参考 libMesh::EigenSparseVector< T >::_vec.

244 { return _vec; }
DataType _vec
Actual Eigen::SparseVector&lt;&gt; we are wrapping.
template<typename T >
void libMesh::EigenSparseVector< T >::zero ( )
inlineoverridevirtual

将所有条目设置为零。等同于 v = 0,但更明显且更快。

实现了 libMesh::NumericVector< T >.

在文件 eigen_sparse_vector.h404 行定义.

参考 libMesh::closed() , 以及 libMesh::initialized().

405 {
406  libmesh_assert (this->initialized());
407  libmesh_assert (this->closed());
408 
409  _vec.setZero();
410 }
virtual bool closed() const
检查向量是否已经关闭并准备好进行计算。
DataType _vec
Actual Eigen::SparseVector&lt;&gt; we are wrapping.
virtual bool initialized() const
检查向量是否已经初始化。
template<typename T >
std::unique_ptr< NumericVector< T > > libMesh::EigenSparseVector< T >::zero_clone ( ) const
inlineoverridevirtual

返回一个智能指针,指向具有相同类型、大小和分区的此向量的副本,但所有条目都为零。

注解
派生类必须重写此方法。
返回
指向新向量副本的 unique_ptr。

实现了 libMesh::NumericVector< T >.

在文件 eigen_sparse_vector.h416 行定义.

参考 libMesh::NumericVector< T >::init().

417 {
418  NumericVector<T> * cloned_vector = new EigenSparseVector<T>(this->comm());
419  cloned_vector->init(*this);
420  return std::unique_ptr<NumericVector<T>>(cloned_vector);
421 }

友元及相关函数文档

template<typename T>
friend class EigenSparseLinearSolver< T >
friend

在文件 eigen_sparse_vector.h257 行定义.

template<typename T>
friend class EigenSparseMatrix< T >
friend

Make other Eigen datatypes friends.

在文件 eigen_sparse_vector.h256 行定义.

类成员变量说明

ReferenceCounter::Counts libMesh::ReferenceCounter::_counts
staticprotectedinherited

Actually holds the data.

在文件 reference_counter.h124 行定义.

参考自 libMesh::ReferenceCounter::get_info().

bool libMesh::ReferenceCounter::_enable_print_counter = true
staticprotectedinherited

Flag to control whether reference count information is printed when print_info is called.

在文件 reference_counter.h143 行定义.

参考自 libMesh::ReferenceCounter::disable_print_counter_info(), libMesh::ReferenceCounter::enable_print_counter_info() , 以及 libMesh::ReferenceCounter::print_info().

template<typename T>
bool libMesh::NumericVector< T >::_is_closed
protectedinherited

用于跟踪向量的值在在一些或全部处理器上进行插入或添加值操作后是否在所有处理器上保持一致的标志。

在文件 numeric_vector.h913 行定义.

参考自 libMesh::NumericVector< T >::closed(), libMesh::EpetraVector< T >::EpetraVector(), libMesh::DistributedVector< T >::localize(), libMesh::DistributedVector< T >::operator=() , 以及 libMesh::PetscVector< T >::PetscVector().

template<typename T>
bool libMesh::NumericVector< T >::_is_initialized
protectedinherited
Threads::spin_mutex libMesh::ReferenceCounter::_mutex
staticprotectedinherited

Mutual exclusion object to enable thread-safe reference counting.

在文件 reference_counter.h137 行定义.

Threads::atomic< unsigned int > libMesh::ReferenceCounter::_n_objects
staticprotectedinherited

The number of objects.

Print the reference count information when the number returns to 0.

在文件 reference_counter.h132 行定义.

参考自 libMesh::ReferenceCounter::n_objects(), libMesh::ReferenceCounter::ReferenceCounter() , 以及 libMesh::ReferenceCounter::~ReferenceCounter().

template<typename T>
std::mutex libMesh::NumericVector< T >::_numeric_vector_mutex
protectedinherited

用于执行线程安全操作的互斥锁。

在文件 numeric_vector.h928 行定义.

template<typename T>
ParallelType libMesh::NumericVector< T >::_type
protectedinherited
template<typename T>
DataType libMesh::EigenSparseVector< T >::_vec
private

该类的文档由以下文件生成: