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

此类定义了LIBMESH_DIM维的实数或复数空间中的向量。 更多...

#include <tensor_tools.h>

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

struct  rebind
 

Public 类型

typedef T value_type
 
typedef unsigned int index_type
 辅助 typedef 用于泛型索引编程。 更多...
 

Public 成员函数

 VectorValue ()
 空构造函数。 更多...
 
 VectorValue (const T &x, const T &y=0, const T &z=0)
 从 T 类型构造。默认情况下,设置较高维度的分量为0。 更多...
 
template<typename Scalar1 , typename Scalar2 , typename Scalar3 >
 VectorValue (typename boostcopy::enable_if_c< ScalarTraits< Scalar1 >::value, const Scalar1 >::type &x, typename boostcopy::enable_if_c< ScalarTraits< Scalar2 >::value, const Scalar2 >::type &y=0, typename boostcopy::enable_if_c< ScalarTraits< Scalar3 >::value, const Scalar3 >::type &z=0)
 从标量值构造。默认情况下,设置较高维度的分量为0。 更多...
 
template<typename Scalar >
 VectorValue (const Scalar &x, typename boostcopy::enable_if_c< ScalarTraits< Scalar >::value, const Scalar >::type *sfinae=nullptr)
 从标量值构造。默认情况下,设置较高维度的分量为0。 更多...
 
template<typename T2 >
 VectorValue (const VectorValue< T2 > &p)
 复制构造函数。 更多...
 
template<typename T2 >
 VectorValue (const TypeVector< T2 > &p)
 复制构造函数。 更多...
 
 VectorValue (const TypeVector< Real > &p_re, const TypeVector< Real > &p_im)
 构造函数,接受两个 TypeVector<Real> 作为参数,表示实部和虚部。 更多...
 
template<typename Scalar >
boostcopy::enable_if_c
< ScalarTraits< Scalar >
::value, VectorValue & >::type 
operator= (const Scalar &p)
 赋值运算符,用于将向量置为零。 更多...
 
template<typename T2 >
void assign (const TypeVector< T2 > &)
 在不创建临时对象的情况下将向量赋值给该向量。 更多...
 
const T & operator() (const unsigned int i) const
 返回向量中的第 i 个分量的常量引用。 更多...
 
T & operator() (const unsigned int i)
 返回向量中的第 i 个分量的可写引用。 更多...
 
const T & slice (const unsigned int i) const
 
T & slice (const unsigned int i)
 
template<typename T2 >
TypeVector< typename
CompareTypes< T, T2 >
::supertype > 
operator+ (const TypeVector< T2 > &) const
 向量相加。 更多...
 
template<typename T2 >
const TypeVector< T > & operator+= (const TypeVector< T2 > &)
 向量相加。 更多...
 
template<typename T2 >
TypeVector< typename
CompareTypes< T, T2 >
::supertype > 
operator- (const TypeVector< T2 > &) const
 从另一个向量中减去该向量。 更多...
 
TypeVector< T > operator- () const
 返回该向量的相反向量的副本。 更多...
 
template<typename T2 >
const TypeVector< T > & operator-= (const TypeVector< T2 > &)
 从该向量中减去另一个向量。 更多...
 
template<typename T2 >
void subtract (const TypeVector< T2 > &)
 从另一个向量中减去该向量,不创建临时对象。 更多...
 
template<typename T2 >
void subtract_scaled (const TypeVector< T2 > &, const T &)
 从该向量中减去另一个向量的缩放值,不创建临时对象。 更多...
 
template<typename Scalar >
boostcopy::enable_if_c
< ScalarTraits< Scalar >
::value, TypeVector< typename
CompareTypes< T, Scalar >
::supertype > >::type 
operator* (const Scalar &) const
 将该向量乘以标量值。 更多...
 
template<typename T2 >
CompareTypes< T, T2 >::supertype operator* (const TypeVector< T2 > &) const
 计算该向量与另一个向量的点积。 更多...
 
const TypeVector< T > & operator*= (const T &)
 将该向量乘以标量值。 更多...
 
template<typename Scalar >
boostcopy::enable_if_c
< ScalarTraits< Scalar >
::value, TypeVector< typename
CompareTypes< T, Scalar >
::supertype > >::type 
operator/ (const Scalar &) const
 将该向量的每个分量除以标量值。 更多...
 
const TypeVector< T > & operator/= (const T &)
 将该向量的每个分量除以标量值。 更多...
 
template<typename T2 >
CompareTypes< T, T2 >::supertype contract (const TypeVector< T2 > &) const
 返回 TypeVector::operator*() 的结果。 更多...
 
template<typename T2 >
TypeVector< typename
CompareTypes< T, T2 >
::supertype > 
cross (const TypeVector< T2 > &v) const
 计算该向量与另一个向量的叉积。 更多...
 
TypeVector< T > unit () const
 返回指向该向量方向的单位向量。 更多...
 
auto norm () const -> decltype(std::norm(T()))
 返回向量的模,即元素平方和的平方根。 更多...
 
auto norm_sq () const -> decltype(std::norm(T()))
 返回向量的模的平方,即元素模的平方和。 更多...
 
bool is_zero () const
 判断向量的所有值是否为零。 更多...
 
void zero ()
 将向量的所有分量设置为零。 更多...
 
bool relative_fuzzy_equals (const TypeVector< T > &rhs, Real tol=TOLERANCE) const
 判断两个向量是否在相对容差 tol 内相等。 更多...
 
bool absolute_fuzzy_equals (const TypeVector< T > &rhs, Real tol=TOLERANCE) const
 判断两个向量是否在绝对容差 tol 内相等。 更多...
 
bool operator== (const TypeVector< T > &rhs) const
 判断两个向量的每个分量是否相等。 更多...
 
bool operator!= (const TypeVector< T > &rhs) const
 判断两个向量是否不相等。 更多...
 
bool operator< (const TypeVector< T > &rhs) const
 判断该向量是否小于另一个向量。 更多...
 
template<>
bool operator< (const TypeVector< Complex > &rhs) const
 
bool operator<= (const TypeVector< T > &rhs) const
 判断该向量是否小于等于另一个向量。 更多...
 
template<>
bool operator<= (const TypeVector< Complex > &rhs) const
 
bool operator> (const TypeVector< T > &rhs) const
 判断该向量是否大于另一个向量。 更多...
 
template<>
bool operator> (const TypeVector< Complex > &rhs) const
 
bool operator>= (const TypeVector< T > &rhs) const
 判断该向量是否大于等于另一个向量。 更多...
 
template<>
bool operator>= (const TypeVector< Complex > &rhs) const
 
void print (std::ostream &os=libMesh::out) const
 格式化输出,默认输出到 libMesh::out 流。 更多...
 
void write_unformatted (std::ostream &out_stream, const bool newline=true) const
 无格式输出到流 out。只是将向量的元素用空格分隔打印出来。 默认情况下,还会打印一个换行符,但可以通过 newline 参数来控制这个行为。 更多...
 

Protected 属性

_coords [LIBMESH_DIM]
 TypeVector 的坐标。 更多...
 

详细描述

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

此类定义了LIBMESH_DIM维的实数或复数空间中的向量。

typedef RealVectorValue 总是定义了一个实数向量, 而 NumberVectorValue 根据库的配置定义了一个实数或复数向量。

作者
Benjamin S. Kirk
日期
2003
模板参数
T向量的数据类型。

在文件 tensor_tools.h35 行定义.

成员类型定义说明

template<typename T>
typedef unsigned int libMesh::TypeVector< T >::index_type
inherited

辅助 typedef 用于泛型索引编程。

在文件 type_vector.h211 行定义.

template<typename T>
typedef T libMesh::VectorValue< T >::value_type

在文件 vector_value.h49 行定义.

构造及析构函数说明

template<typename T >
libMesh::VectorValue< T >::VectorValue ( )
inline

空构造函数。

将向量设置为在 LIBMESH_DIM 维的 T 空间中的零向量。

在文件 vector_value.h160 行定义.

160  :
161  TypeVector<T> ()
162 {
163 }
template<typename T>
libMesh::VectorValue< T >::VectorValue ( const T &  x,
const T &  y = 0,
const T &  z = 0 
)
inline

从 T 类型构造。默认情况下,设置较高维度的分量为0。

参数
xx 维度的值。
yy 维度的值,默认为0。
zz 维度的值,默认为0。

在文件 vector_value.h168 行定义.

170  :
171  TypeVector<T> (x,y,z)
172 {
173 }
template<typename T >
template<typename Scalar1 , typename Scalar2 , typename Scalar3 >
libMesh::VectorValue< T >::VectorValue ( typename boostcopy::enable_if_c< ScalarTraits< Scalar1 >::value, const Scalar1 >::type &  x,
typename boostcopy::enable_if_c< ScalarTraits< Scalar2 >::value, const Scalar2 >::type &  y = 0,
typename boostcopy::enable_if_c< ScalarTraits< Scalar3 >::value, const Scalar3 >::type &  z = 0 
)
inline

从标量值构造。默认情况下,设置较高维度的分量为0。

模板参数
Scalar1第一个标量值的数据类型。
Scalar2第二个标量值的数据类型,默认为0。
Scalar3第三个标量值的数据类型,默认为0。
参数
x第一个标量值。
y第二个标量值,默认为0。
z第三个标量值,默认为0。

在文件 vector_value.h180 行定义.

188  :
189  TypeVector<T> (x,y,z)
190 {
191 }
template<typename T >
template<typename Scalar >
libMesh::VectorValue< T >::VectorValue ( const Scalar &  x,
typename boostcopy::enable_if_c< ScalarTraits< Scalar >::value, const Scalar >::type *  sfinae = nullptr 
)
inline

从标量值构造。默认情况下,设置较高维度的分量为0。

模板参数
Scalar标量值的数据类型。
参数
x标量值。
sfinae辅助参数,用于区分不同构造函数。

在文件 vector_value.h197 行定义.

200  :
201  TypeVector<T> (x)
202 {
203 }
template<typename T >
template<typename T2 >
libMesh::VectorValue< T >::VectorValue ( const VectorValue< T2 > &  p)
inline

复制构造函数。

模板参数
T2向量的数据类型。
参数
p要复制的向量。

在文件 vector_value.h208 行定义.

208  :
209  TypeVector<T> (p)
210 {
211 }
template<typename T >
template<typename T2 >
libMesh::VectorValue< T >::VectorValue ( const TypeVector< T2 > &  p)
inline

复制构造函数。

模板参数
T2向量的数据类型。
参数
p要复制的向量。

在文件 vector_value.h218 行定义.

218  :
219  TypeVector<T> (p)
220 {
221 }
template<typename T>
libMesh::VectorValue< T >::VectorValue ( const TypeVector< Real > &  p_re,
const TypeVector< Real > &  p_im 
)
inline

构造函数,接受两个 TypeVector<Real> 作为参数,表示实部和虚部。

参数
p_re实部向量。
p_im虚部向量。

在文件 vector_value.h226 行定义.

227  :
228  TypeVector<T> (Complex (p_re(0), p_im(0)),
229  Complex (p_re(1), p_im(1)),
230  Complex (p_re(2), p_im(2)))
231 {
232 }
std::complex< Real > Complex

成员函数说明

template<typename T>
bool libMesh::TypeVector< T >::absolute_fuzzy_equals ( const TypeVector< T > &  rhs,
Real  tol = TOLERANCE 
) const
inlineinherited

判断两个向量是否在绝对容差 tol 内相等。

参数
rhs另一个向量。
tol绝对容差。
返回
如果两个向量在绝对容差 tol 内相等,则返回 true。

在文件 type_vector.h1105 行定义.

参考 std::abs().

1106 {
1107 #if LIBMESH_DIM == 1
1108  return (std::abs(_coords[0] - rhs._coords[0])
1109  <= tol);
1110 #endif
1111 
1112 #if LIBMESH_DIM == 2
1113  return (std::abs(_coords[0] - rhs._coords[0]) +
1114  std::abs(_coords[1] - rhs._coords[1])
1115  <= tol);
1116 #endif
1117 
1118 #if LIBMESH_DIM == 3
1119  return (std::abs(_coords[0] - rhs._coords[0]) +
1120  std::abs(_coords[1] - rhs._coords[1]) +
1121  std::abs(_coords[2] - rhs._coords[2])
1122  <= tol);
1123 #endif
1124 }
T _coords[LIBMESH_DIM]
TypeVector 的坐标。
Definition: type_vector.h:565
ADRealEigenVector< T, D, asd > abs(const ADRealEigenVector< T, D, asd > &)
计算自动微分实数向量的绝对值。
Definition: type_vector.h:112
template<typename T >
template<typename T2 >
void libMesh::TypeVector< T >::assign ( const TypeVector< T2 > &  p)
inlineinherited

在不创建临时对象的情况下将向量赋值给该向量。

模板参数
T2要从中赋值元素的向量的类型。
参数
v要赋值的向量。

在文件 type_vector.h682 行定义.

683 {
684  for (unsigned int i=0; i<LIBMESH_DIM; i++)
685  _coords[i] = p._coords[i];
686 }
T _coords[LIBMESH_DIM]
TypeVector 的坐标。
Definition: type_vector.h:565
template<typename T >
template<typename T2 >
CompareTypes< T, T2 >::supertype libMesh::TypeVector< T >::contract ( const TypeVector< T2 > &  p) const
inlineinherited

返回 TypeVector::operator*() 的结果。

模板参数
T2另一个向量的元素类型。
参数
v另一个向量。
返回
两个向量的点积结果。

在文件 type_vector.h1022 行定义.

1023 {
1024  return (*this)*(p);
1025 }
template<typename T >
template<typename T2 >
TypeVector< typename CompareTypes< T, T2 >::supertype > libMesh::TypeVector< T >::cross ( const TypeVector< T2 > &  v) const
inherited

计算该向量与另一个向量的叉积。

模板参数
T2另一个向量的元素类型。
参数
v另一个向量。
返回
两个向量的叉积结果。

在文件 type_vector.h1032 行定义.

参考 libMesh::libmesh_ignore().

1033 {
1034  typedef typename CompareTypes<T, T2>::supertype TS;
1035  libmesh_assert_equal_to (LIBMESH_DIM, 3);
1036 
1037  // | i j k |
1038  // |(*this)(0) (*this)(1) (*this)(2)|
1039  // | p(0) p(1) p(2) |
1040 
1041 #if LIBMESH_DIM == 3
1042  return TypeVector<TS>( _coords[1]*p._coords[2] - _coords[2]*p._coords[1],
1043  -_coords[0]*p._coords[2] + _coords[2]*p._coords[0],
1044  _coords[0]*p._coords[1] - _coords[1]*p._coords[0]);
1045 #else
1046  libmesh_ignore(p);
1047  return TypeVector<TS>(0);
1048 #endif
1049 }
T _coords[LIBMESH_DIM]
TypeVector 的坐标。
Definition: type_vector.h:565
void libmesh_ignore(const Args &...)
template<typename T >
bool libMesh::TypeVector< T >::is_zero ( ) const
inlineinherited

判断向量的所有值是否为零。

返回
如果向量中所有值都为零,则返回 true。

在文件 type_vector.h1095 行定义.

1096 {
1097  for (const auto & val : _coords)
1098  if (val != T(0))
1099  return false;
1100  return true;
1101 }
T _coords[LIBMESH_DIM]
TypeVector 的坐标。
Definition: type_vector.h:565
template<typename T>
auto libMesh::TypeVector< T >::norm ( ) const -> decltype(std::norm(T()))
inlineinherited

返回向量的模,即元素平方和的平方根。

返回
向量的模。

在文件 type_vector.h1055 行定义.

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

1056 {
1057  return std::sqrt(this->norm_sq());
1058 }
ADRealEigenVector< T, D, asd > sqrt(const ADRealEigenVector< T, D, asd > &)
计算自动微分实数向量的平方根。
Definition: type_vector.h:88
auto norm_sq() const -> decltype(std::norm(T()))
返回向量的模的平方,即元素模的平方和。
Definition: type_vector.h:1074
template<typename T>
auto libMesh::TypeVector< T >::norm_sq ( ) const -> decltype(std::norm(T()))
inlineinherited

返回向量的模的平方,即元素模的平方和。

返回
向量的模的平方。

在文件 type_vector.h1074 行定义.

参考 libMesh::TensorTools::norm_sq().

1075 {
1076 #if LIBMESH_DIM == 1
1077  return (TensorTools::norm_sq(_coords[0]));
1078 #endif
1079 
1080 #if LIBMESH_DIM == 2
1081  return (TensorTools::norm_sq(_coords[0]) +
1083 #endif
1084 
1085 #if LIBMESH_DIM == 3
1086  return (TensorTools::norm_sq(_coords[0]) +
1089 #endif
1090 }
T _coords[LIBMESH_DIM]
TypeVector 的坐标。
Definition: type_vector.h:565
T norm_sq(std::complex< T > a)
Definition: tensor_tools.h:74
template<typename T>
bool libMesh::TypeVector< T >::operator!= ( const TypeVector< T > &  rhs) const
inlineinherited

判断两个向量是否不相等。

参数
rhs另一个向量。
返回
如果两个向量不相等,则返回 true。

在文件 type_vector.h1177 行定义.

1178 {
1179  return (!(*this == rhs));
1180 }
template<typename T >
const T & libMesh::TypeVector< T >::operator() ( const unsigned int  i) const
inlineinherited

返回向量中的第 i 个分量的常量引用。

参数
i分量的索引。
返回
向量中的第 i 个分量的常量引用。

在文件 type_vector.h692 行定义.

693 {
694  libmesh_assert_less (i, LIBMESH_DIM);
695 
696  return _coords[i];
697 }
T _coords[LIBMESH_DIM]
TypeVector 的坐标。
Definition: type_vector.h:565
template<typename T >
T & libMesh::TypeVector< T >::operator() ( const unsigned int  i)
inlineinherited

返回向量中的第 i 个分量的可写引用。

参数
i分量的索引。
返回
向量中的第 i 个分量的可写引用。

在文件 type_vector.h703 行定义.

704 {
705  libmesh_assert_less (i, LIBMESH_DIM);
706 
707  return _coords[i];
708 }
T _coords[LIBMESH_DIM]
TypeVector 的坐标。
Definition: type_vector.h:565
template<typename T >
template<typename Scalar >
boostcopy::enable_if_c< ScalarTraits< Scalar >::value, TypeVector< typename CompareTypes< T, Scalar >::supertype > >::type libMesh::TypeVector< T >::operator* ( const Scalar &  factor) const
inlineinherited

将该向量乘以标量值。

模板参数
Scalar标量值的类型。
参数
s要乘以的标量值。
返回
结果的副本,该向量保持不变。

在文件 type_vector.h889 行定义.

890 {
891  typedef typename CompareTypes<T, Scalar>::supertype SuperType;
892 
893 #if LIBMESH_DIM == 1
894  return TypeVector<SuperType>(_coords[0]*factor);
895 #endif
896 
897 #if LIBMESH_DIM == 2
898  return TypeVector<SuperType>(_coords[0]*factor,
899  _coords[1]*factor);
900 #endif
901 
902 #if LIBMESH_DIM == 3
903  return TypeVector<SuperType>(_coords[0]*factor,
904  _coords[1]*factor,
905  _coords[2]*factor);
906 #endif
907 }
T _coords[LIBMESH_DIM]
TypeVector 的坐标。
Definition: type_vector.h:565
template<typename T >
template<typename T2 >
CompareTypes< T, T2 >::supertype libMesh::TypeVector< T >::operator* ( const TypeVector< T2 > &  p) const
inlineinherited

计算该向量与另一个向量的点积。

模板参数
T2另一个向量的元素类型。
参数
v另一个向量。
返回
两个向量的点积结果。
注解
在复数情况下,不进行复共轭操作。
这两个向量可以包含不同的数值类型。

在文件 type_vector.h1000 行定义.

1001 {
1002 #if LIBMESH_DIM == 1
1003  return _coords[0]*p._coords[0];
1004 #endif
1005 
1006 #if LIBMESH_DIM == 2
1007  return (_coords[0]*p._coords[0] +
1008  _coords[1]*p._coords[1]);
1009 #endif
1010 
1011 #if LIBMESH_DIM == 3
1012  return (_coords[0]*p(0) +
1013  _coords[1]*p(1) +
1014  _coords[2]*p(2));
1015 #endif
1016 }
T _coords[LIBMESH_DIM]
TypeVector 的坐标。
Definition: type_vector.h:565
template<typename T>
const TypeVector< T > & libMesh::TypeVector< T >::operator*= ( const T &  factor)
inlineinherited

将该向量乘以标量值。

模板参数
Scalar标量值的类型。
参数
s要乘以的标量值。
返回
指向 *this 的引用。

在文件 type_vector.h926 行定义.

927 {
928 #if LIBMESH_DIM == 1
929  _coords[0] *= factor;
930 #endif
931 
932 #if LIBMESH_DIM == 2
933  _coords[0] *= factor;
934  _coords[1] *= factor;
935 #endif
936 
937 #if LIBMESH_DIM == 3
938  _coords[0] *= factor;
939  _coords[1] *= factor;
940  _coords[2] *= factor;
941 #endif
942 
943  return *this;
944 }
T _coords[LIBMESH_DIM]
TypeVector 的坐标。
Definition: type_vector.h:565
template<typename T >
template<typename T2 >
TypeVector< typename CompareTypes< T, T2 >::supertype > libMesh::TypeVector< T >::operator+ ( const TypeVector< T2 > &  p) const
inlineinherited

向量相加。

模板参数
T2另一个向量的元素类型。
参数
v要相加的另一个向量。
返回
结果的副本,该向量保持不变。

在文件 type_vector.h716 行定义.

717 {
718  typedef typename CompareTypes<T, T2>::supertype TS;
719 #if LIBMESH_DIM == 1
720  return TypeVector<TS> (_coords[0] + p._coords[0]);
721 #endif
722 
723 #if LIBMESH_DIM == 2
724  return TypeVector<TS> (_coords[0] + p._coords[0],
725  _coords[1] + p._coords[1]);
726 #endif
727 
728 #if LIBMESH_DIM == 3
729  return TypeVector<TS> (_coords[0] + p._coords[0],
730  _coords[1] + p._coords[1],
731  _coords[2] + p._coords[2]);
732 #endif
733 
734 }
T _coords[LIBMESH_DIM]
TypeVector 的坐标。
Definition: type_vector.h:565
template<typename T >
template<typename T2 >
const TypeVector< T > & libMesh::TypeVector< T >::operator+= ( const TypeVector< T2 > &  p)
inlineinherited

向量相加。

模板参数
T2另一个向量的元素类型。
参数
v要相加的另一个向量。
返回
指向 *this 的引用。

在文件 type_vector.h741 行定义.

742 {
743  this->add (p);
744 
745  return *this;
746 }
template<typename T >
template<typename T2 >
TypeVector< typename CompareTypes< T, T2 >::supertype > libMesh::TypeVector< T >::operator- ( const TypeVector< T2 > &  p) const
inlineinherited

从另一个向量中减去该向量。

模板参数
T2另一个向量的元素类型。
参数
v要从中减去的向量。
返回
结果的副本,该向量保持不变。

在文件 type_vector.h802 行定义.

803 {
804  typedef typename CompareTypes<T, T2>::supertype TS;
805 
806 #if LIBMESH_DIM == 1
807  return TypeVector<TS>(_coords[0] - p._coords[0]);
808 #endif
809 
810 #if LIBMESH_DIM == 2
811  return TypeVector<TS>(_coords[0] - p._coords[0],
812  _coords[1] - p._coords[1]);
813 #endif
814 
815 #if LIBMESH_DIM == 3
816  return TypeVector<TS>(_coords[0] - p._coords[0],
817  _coords[1] - p._coords[1],
818  _coords[2] - p._coords[2]);
819 #endif
820 
821 }
T _coords[LIBMESH_DIM]
TypeVector 的坐标。
Definition: type_vector.h:565
template<typename T >
TypeVector< T > libMesh::TypeVector< T >::operator- ( ) const
inlineinherited

返回该向量的相反向量的副本。

返回
相反向量的副本。

在文件 type_vector.h861 行定义.

862 {
863 
864 #if LIBMESH_DIM == 1
865  return TypeVector(-_coords[0]);
866 #endif
867 
868 #if LIBMESH_DIM == 2
869  return TypeVector(-_coords[0],
870  -_coords[1]);
871 #endif
872 
873 #if LIBMESH_DIM == 3
874  return TypeVector(-_coords[0],
875  -_coords[1],
876  -_coords[2]);
877 #endif
878 
879 }
T _coords[LIBMESH_DIM]
TypeVector 的坐标。
Definition: type_vector.h:565
TypeVector()
空构造函数。将向量初始化为 LIBMESH_DIM 维中的零向量。
Definition: type_vector.h:577
template<typename T >
template<typename T2 >
const TypeVector< T > & libMesh::TypeVector< T >::operator-= ( const TypeVector< T2 > &  p)
inlineinherited

从该向量中减去另一个向量。

模板参数
T2另一个向量的元素类型。
参数
v要从中减去的向量。
返回
指向 *this 的引用。

在文件 type_vector.h828 行定义.

829 {
830  this->subtract (p);
831 
832  return *this;
833 }
void subtract(const TypeVector< T2 > &)
从另一个向量中减去该向量,不创建临时对象。
Definition: type_vector.h:840
template<typename T >
template<typename Scalar >
boostcopy::enable_if_c< ScalarTraits< Scalar >::value, TypeVector< typename CompareTypes< T, Scalar >::supertype > >::type libMesh::TypeVector< T >::operator/ ( const Scalar &  factor) const
inlineinherited

将该向量的每个分量除以标量值。

模板参数
Scalar标量值的类型。
参数
s要除以的标量值。
返回
结果的副本,该向量保持不变。

在文件 type_vector.h954 行定义.

955 {
956  libmesh_assert_not_equal_to (factor, static_cast<T>(0.));
957 
958  typedef typename CompareTypes<T, Scalar>::supertype TS;
959 
960 #if LIBMESH_DIM == 1
961  return TypeVector<TS>(_coords[0]/factor);
962 #endif
963 
964 #if LIBMESH_DIM == 2
965  return TypeVector<TS>(_coords[0]/factor,
966  _coords[1]/factor);
967 #endif
968 
969 #if LIBMESH_DIM == 3
970  return TypeVector<TS>(_coords[0]/factor,
971  _coords[1]/factor,
972  _coords[2]/factor);
973 #endif
974 
975 }
T _coords[LIBMESH_DIM]
TypeVector 的坐标。
Definition: type_vector.h:565
template<typename T>
const TypeVector< T > & libMesh::TypeVector< T >::operator/= ( const T &  factor)
inlineinherited

将该向量的每个分量除以标量值。

模板参数
Scalar标量值的类型。
参数
s要除以的标量值。
返回
指向 *this 的引用。

在文件 type_vector.h983 行定义.

984 {
985  libmesh_assert_not_equal_to (factor, static_cast<T>(0.));
986 
987  for (unsigned int i=0; i<LIBMESH_DIM; i++)
988  _coords[i] /= factor;
989 
990  return *this;
991 }
T _coords[LIBMESH_DIM]
TypeVector 的坐标。
Definition: type_vector.h:565
template<>
bool libMesh::TypeVector< Complex >::operator< ( const TypeVector< Complex > &  rhs) const
inherited

在文件 type_vector.C148 行定义.

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

149 {
150  for (unsigned int i=0; i<LIBMESH_DIM; i++)
151  {
152  if ((*this)(i).real() < rhs(i).real())
153  return true;
154  if ((*this)(i).real() > rhs(i).real())
155  return false;
156  if ((*this)(i).imag() < rhs(i).imag())
157  return true;
158  if ((*this)(i).imag() > rhs(i).imag())
159  return false;
160  }
161  return false;
162 }
boost::multiprecision::float128 real(const boost::multiprecision::float128 in)
boost::multiprecision::float128 imag(const boost::multiprecision::float128)
template<typename T>
bool libMesh::TypeVector< T >::operator< ( const TypeVector< T > &  rhs) const
inherited

判断该向量是否小于另一个向量。

参数
rhs另一个向量。
返回
如果该向量小于另一个向量,则返回 true。

用于排序。还用于选择某些任意基函数的方向。

在文件 type_vector.C90 行定义.

91 {
92  for (unsigned int i=0; i<LIBMESH_DIM; i++)
93  {
94  if ((*this)(i) < rhs(i))
95  return true;
96  if ((*this)(i) > rhs(i))
97  return false;
98  }
99  return false;
100 }
template<>
bool libMesh::TypeVector< Complex >::operator<= ( const TypeVector< Complex > &  rhs) const
inherited

在文件 type_vector.C167 行定义.

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

168 {
169  for (unsigned int i=0; i<LIBMESH_DIM; i++)
170  {
171  if ((*this)(i).real() < rhs(i).real())
172  return true;
173  if ((*this)(i).real() > rhs(i).real())
174  return false;
175  if ((*this)(i).imag() < rhs(i).imag())
176  return true;
177  if ((*this)(i).imag() > rhs(i).imag())
178  return false;
179  }
180  return true;
181 }
boost::multiprecision::float128 real(const boost::multiprecision::float128 in)
boost::multiprecision::float128 imag(const boost::multiprecision::float128)
template<typename T>
bool libMesh::TypeVector< T >::operator<= ( const TypeVector< T > &  rhs) const
inherited

判断该向量是否小于等于另一个向量。

参数
rhs另一个向量。
返回
如果该向量小于等于另一个向量,则返回 true。

用于排序。还用于选择某些任意约束方程的方向。

在文件 type_vector.C104 行定义.

105 {
106  for (unsigned int i=0; i<LIBMESH_DIM; i++)
107  {
108  if ((*this)(i) < rhs(i))
109  return true;
110  if ((*this)(i) > rhs(i))
111  return false;
112  }
113  return true;
114 }
template<typename T>
template<typename Scalar >
boostcopy::enable_if_c< ScalarTraits<Scalar>::value, VectorValue &>::type libMesh::VectorValue< T >::operator= ( const Scalar &  p)
inline

赋值运算符,用于将向量置为零。

模板参数
Scalar标量值的数据类型。
参数
p要赋值的标量值。
返回
返回修改后的向量。

在文件 vector_value.h141 行定义.

142  { libmesh_assert_equal_to (p, Scalar(0)); this->zero(); return *this; }
void zero()
将向量的所有分量设置为零。
Definition: type_vector.h:1064
template<typename T>
bool libMesh::TypeVector< T >::operator== ( const TypeVector< T > &  rhs) const
inlineinherited

判断两个向量的每个分量是否相等。

参数
rhs另一个向量。
返回
如果两个向量的每个分量都相等,则返回 true。
注解
对于浮点类型 T,可能更适合使用 absolute_fuzzy_equals() 函数。

在文件 type_vector.h1155 行定义.

1156 {
1157 #if LIBMESH_DIM == 1
1158  return (_coords[0] == rhs._coords[0]);
1159 #endif
1160 
1161 #if LIBMESH_DIM == 2
1162  return (_coords[0] == rhs._coords[0] &&
1163  _coords[1] == rhs._coords[1]);
1164 #endif
1165 
1166 #if LIBMESH_DIM == 3
1167  return (_coords[0] == rhs._coords[0] &&
1168  _coords[1] == rhs._coords[1] &&
1169  _coords[2] == rhs._coords[2]);
1170 #endif
1171 }
T _coords[LIBMESH_DIM]
TypeVector 的坐标。
Definition: type_vector.h:565
template<>
bool libMesh::TypeVector< Complex >::operator> ( const TypeVector< Complex > &  rhs) const
inherited

在文件 type_vector.C186 行定义.

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

187 {
188  for (unsigned int i=0; i<LIBMESH_DIM; i++)
189  {
190  if ((*this)(i).real() > rhs(i).real())
191  return true;
192  if ((*this)(i).real() < rhs(i).real())
193  return false;
194  if ((*this)(i).imag() > rhs(i).imag())
195  return true;
196  if ((*this)(i).imag() < rhs(i).imag())
197  return false;
198  }
199  return false;
200 }
boost::multiprecision::float128 real(const boost::multiprecision::float128 in)
boost::multiprecision::float128 imag(const boost::multiprecision::float128)
template<typename T>
bool libMesh::TypeVector< T >::operator> ( const TypeVector< T > &  rhs) const
inherited

判断该向量是否大于另一个向量。

参数
rhs另一个向量。
返回
如果该向量大于另一个向量,则返回 true。

用于排序。还用于选择某些任意基函数的方向。

在文件 type_vector.C119 行定义.

120 {
121  for (unsigned int i=0; i<LIBMESH_DIM; i++)
122  {
123  if ((*this)(i) > rhs(i))
124  return true;
125  if ((*this)(i) < rhs(i))
126  return false;
127  }
128  return false;
129 }
template<>
bool libMesh::TypeVector< Complex >::operator>= ( const TypeVector< Complex > &  rhs) const
inherited

在文件 type_vector.C205 行定义.

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

206 {
207  for (unsigned int i=0; i<LIBMESH_DIM; i++)
208  {
209  if ((*this)(i).real() > rhs(i).real())
210  return true;
211  if ((*this)(i).real() < rhs(i).real())
212  return false;
213  if ((*this)(i).imag() > rhs(i).imag())
214  return true;
215  if ((*this)(i).imag() < rhs(i).imag())
216  return false;
217  }
218  return true;
219 }
boost::multiprecision::float128 real(const boost::multiprecision::float128 in)
boost::multiprecision::float128 imag(const boost::multiprecision::float128)
template<typename T>
bool libMesh::TypeVector< T >::operator>= ( const TypeVector< T > &  rhs) const
inherited

判断该向量是否大于等于另一个向量。

参数
rhs另一个向量。
返回
如果该向量大于等于另一个向量,则返回 true。

用于排序。还用于选择某些任意约束方程的方向。

在文件 type_vector.C133 行定义.

134 {
135  for (unsigned int i=0; i<LIBMESH_DIM; i++)
136  {
137  if ((*this)(i) > rhs(i))
138  return true;
139  if ((*this)(i) < rhs(i))
140  return false;
141  }
142  return true;
143 }
template<typename T >
void libMesh::TypeVector< T >::print ( std::ostream &  os = libMesh::out) const
inherited

格式化输出,默认输出到 libMesh::out 流。

参数
[out]os输出流,默认为 libMesh::out。

在文件 type_vector.C47 行定义.

48 {
49 #if LIBMESH_DIM == 1
50 
51  os << "x=" << (*this)(0);
52 
53 #endif
54 #if LIBMESH_DIM == 2
55 
56  os << "(x,y)=("
57  << std::setw(8) << (*this)(0) << ", "
58  << std::setw(8) << (*this)(1) << ")";
59 
60 #endif
61 #if LIBMESH_DIM == 3
62 
63  os << "(x,y,z)=("
64  << std::setw(8) << (*this)(0) << ", "
65  << std::setw(8) << (*this)(1) << ", "
66  << std::setw(8) << (*this)(2) << ")";
67 #endif
68 }
template<typename T>
bool libMesh::TypeVector< T >::relative_fuzzy_equals ( const TypeVector< T > &  rhs,
Real  tol = TOLERANCE 
) const
inlineinherited

判断两个向量是否在相对容差 tol 内相等。

参数
rhs另一个向量。
tol相对容差。
返回
如果两个向量在相对容差 tol 内相等,则返回 true。

在文件 type_vector.h1130 行定义.

参考 std::abs().

1131 {
1132 #if LIBMESH_DIM == 1
1133  return this->absolute_fuzzy_equals(rhs, tol *
1134  (std::abs(_coords[0]) + std::abs(rhs._coords[0])));
1135 #endif
1136 
1137 #if LIBMESH_DIM == 2
1138  return this->absolute_fuzzy_equals(rhs, tol *
1139  (std::abs(_coords[0]) + std::abs(rhs._coords[0]) +
1140  std::abs(_coords[1]) + std::abs(rhs._coords[1])));
1141 #endif
1142 
1143 #if LIBMESH_DIM == 3
1144  return this->absolute_fuzzy_equals(rhs, tol *
1145  (std::abs(_coords[0]) + std::abs(rhs._coords[0]) +
1146  std::abs(_coords[1]) + std::abs(rhs._coords[1]) +
1147  std::abs(_coords[2]) + std::abs(rhs._coords[2])));
1148 #endif
1149 }
T _coords[LIBMESH_DIM]
TypeVector 的坐标。
Definition: type_vector.h:565
ADRealEigenVector< T, D, asd > abs(const ADRealEigenVector< T, D, asd > &)
计算自动微分实数向量的绝对值。
Definition: type_vector.h:112
bool absolute_fuzzy_equals(const TypeVector< T > &rhs, Real tol=TOLERANCE) const
判断两个向量是否在绝对容差 tol 内相等。
Definition: type_vector.h:1105
template<typename T>
const T& libMesh::TypeVector< T >::slice ( const unsigned int  i) const
inlineinherited

在文件 type_vector.h262 行定义.

262 { return (*this)(i); }
template<typename T>
T& libMesh::TypeVector< T >::slice ( const unsigned int  i)
inlineinherited

在文件 type_vector.h271 行定义.

271 { return (*this)(i); }
template<typename T >
template<typename T2 >
void libMesh::TypeVector< T >::subtract ( const TypeVector< T2 > &  p)
inlineinherited

从另一个向量中减去该向量,不创建临时对象。

模板参数
T2另一个向量的元素类型。
参数
v要从中减去的向量。

在文件 type_vector.h840 行定义.

841 {
842  for (unsigned int i=0; i<LIBMESH_DIM; i++)
843  _coords[i] -= p._coords[i];
844 }
T _coords[LIBMESH_DIM]
TypeVector 的坐标。
Definition: type_vector.h:565
template<typename T>
template<typename T2 >
void libMesh::TypeVector< T >::subtract_scaled ( const TypeVector< T2 > &  p,
const T &  factor 
)
inlineinherited

从该向量中减去另一个向量的缩放值,不创建临时对象。

模板参数
T2另一个向量的元素类型。
参数
v要从中减去的向量。
scale缩放值。

在文件 type_vector.h851 行定义.

852 {
853  for (unsigned int i=0; i<LIBMESH_DIM; i++)
854  _coords[i] -= factor*p(i);
855 }
T _coords[LIBMESH_DIM]
TypeVector 的坐标。
Definition: type_vector.h:565
template<typename T >
TypeVector< T > libMesh::TypeVector< T >::unit ( ) const
inlineinherited

返回指向该向量方向的单位向量。

返回
单位向量。

在文件 type_vector.h1246 行定义.

参考 std::norm().

1247 {
1248 
1249  auto && length = norm();
1250 
1251  libmesh_assert_not_equal_to (length, static_cast<Real>(0.));
1252 
1253 #if LIBMESH_DIM == 1
1254  return TypeVector<T>(_coords[0]/length);
1255 #endif
1256 
1257 #if LIBMESH_DIM == 2
1258  return TypeVector<T>(_coords[0]/length,
1259  _coords[1]/length);
1260 #endif
1261 
1262 #if LIBMESH_DIM == 3
1263  return TypeVector<T>(_coords[0]/length,
1264  _coords[1]/length,
1265  _coords[2]/length);
1266 #endif
1267 
1268 }
T _coords[LIBMESH_DIM]
TypeVector 的坐标。
Definition: type_vector.h:565
auto norm() const -> decltype(std::norm(T()))
返回向量的模,即元素平方和的平方根。
Definition: type_vector.h:1055
template<typename T >
void libMesh::TypeVector< T >::write_unformatted ( std::ostream &  out_stream,
const bool  newline = true 
) const
inherited

无格式输出到流 out。只是将向量的元素用空格分隔打印出来。 默认情况下,还会打印一个换行符,但可以通过 newline 参数来控制这个行为。

参数
[out]out_stream输出流。
newline是否打印换行符,默认为 true。

在文件 type_vector.C75 行定义.

77 {
78  os << std::setiosflags(std::ios::showpoint)
79  << (*this)(0) << " "
80  << (*this)(1) << " "
81  << (*this)(2) << " ";
82 
83  if (newline)
84  os << '\n';
85 }
template<typename T >
void libMesh::TypeVector< T >::zero ( )
inlineinherited

将向量的所有分量设置为零。

在文件 type_vector.h1064 行定义.

参考自 libMesh::VectorValue< Real >::operator=() , 以及 libMesh::TypeVector< Real >::operator=().

1065 {
1066  for (unsigned int i=0; i<LIBMESH_DIM; i++)
1067  _coords[i] = 0.;
1068 }
T _coords[LIBMESH_DIM]
TypeVector 的坐标。
Definition: type_vector.h:565

类成员变量说明

template<typename T>
T libMesh::TypeVector< T >::_coords[LIBMESH_DIM]
protectedinherited

TypeVector 的坐标。

在文件 type_vector.h565 行定义.

参考自 libMesh::TypeTensor< T >::row().


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