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

此类定义了LIBMESH_DIM维度的实数或复数空间中的张量。typedef RealTensorValue总是定义为实数值的张量, 而NumberTensorValue则根据库的配置定义为实数或复数值的张量。 更多...

#include <tensor_tools.h>

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

struct  rebind
 

Public 类型

typedef T value_type
 

Public 成员函数

 TensorValue ()
 无参构造函数。 在LIBMESH_DIM维度的T空间中创建零张量。 更多...
 
 TensorValue (const T &xx, const T &xy=0, const T &xz=0, const T &yx=0, const T &yy=0, const T &yz=0, const T &zx=0, const T &zy=0, const T &zz=0)
 Constructor-from-T。默认情况下,将更高维度的条目设置为0。 更多...
 
template<typename Scalar >
 TensorValue (const Scalar &xx, const Scalar &xy=0, const Scalar &xz=0, const Scalar &yx=0, const Scalar &yy=0, const Scalar &yz=0, const Scalar &zx=0, const Scalar &zy=0, typename boostcopy::enable_if_c< ScalarTraits< Scalar >::value, const Scalar >::type &zz=0)
 Constructor-from-scalars。默认情况下,将更高维度的条目设置为0。 更多...
 
template<typename T2 >
 TensorValue (const TypeVector< T2 > &vx)
 构造函数。对于LIBMESH_DIM=1,需要1行向量。 更多...
 
template<typename T2 >
 TensorValue (const TypeVector< T2 > &vx, const TypeVector< T2 > &vy)
 构造函数。对于LIBMESH_DIM=2,需要2行向量。 更多...
 
template<typename T2 >
 TensorValue (const TypeVector< T2 > &vx, const TypeVector< T2 > &vy, const TypeVector< T2 > &vz)
 构造函数。对于LIBMESH_DIM=3,需要3行向量。 更多...
 
template<typename T2 >
 TensorValue (const TensorValue< T2 > &p)
 复制构造函数。 更多...
 
template<typename T2 >
 TensorValue (const TypeTensor< T2 > &p)
 复制构造函数。 更多...
 
 TensorValue (const TypeTensor< Real > &p_re, const TypeTensor< Real > &p_im)
 构造函数,接受两个TypeTensor<Real>作为参数,表示实部和虚部。 更多...
 
template<typename Scalar >
boostcopy::enable_if_c
< ScalarTraits< Scalar >
::value, TensorValue & >::type 
operator= (const Scalar &libmesh_dbg_var(p))
 赋值给标量的运算符。仅用于将张量清零。 更多...
 

静态 Public 成员函数

static TensorValue< Realintrinsic_rotation_matrix (Real phi, Real theta, Real psi)
 生成与提供的欧拉角关联的内禀旋转矩阵。内禀旋转会保持域中的物体不动,同时旋转坐标轴。 我们遵循http://mathworld.wolfram.com/EulerAngles.html中描述的约定 (方程6-14给出了复合变换矩阵的条目)。旋转在z、x'和z''轴上按顺序执行。旋 转序列的每个步骤中的正角度给出了在旋转轴周围以逆时针方向旋转实体的外观,尽管事实上 旋转的是坐标轴本身。为了给出物体逆时针旋转的外观,我们实际上将角度传递到方法中的负角度。 所有角度应以度为单位提供。 更多...
 
static TensorValue< Realinverse_intrinsic_rotation_matrix (Real phi, Real theta, Real psi)
 反转与提供给intrinsic_rotation_matrix的相同角度的旋转,即返回到原始起始点。 所有角度应以度为单位提供。 更多...
 
static TensorValue< Realextrinsic_rotation_matrix (Real angle1_deg, Real angle2_deg, Real angle3_deg)
 生成与提供的欧拉角关联的外禀旋转矩阵。外禀旋转旋转域中的物体,并保持坐标轴不变。 我们遵循https://en.wikipedia.org/wiki/Euler_angles#Rotation_matrix中描述的约定, 我们使用“适当的欧拉角”列和Z1 X2 Z3行中描述的矩阵,该矩阵指示按顺序绕z、x和z轴执行旋转。 正角度表示相对于相应轴的逆时针旋转。注意,角度应以度为单位提供。 更多...
 
static TensorValue< Realinverse_extrinsic_rotation_matrix (Real angle1_deg, Real angle2_deg, Real angle3_deg)
 反转与提供给extrinsic_rotation_matrix的相同角度的旋转,即返回到原始起始点。 更多...
 

Protected 类型

typedef std::tuple< unsigned
int, unsigned int > 
index_type
 Helper typedef 用于泛型索引编程。 更多...
 

Protected 成员函数

const T & operator() (const unsigned int i, const unsigned int j) const
 返回 (i,j) 元素的常量引用。 更多...
 
T & operator() (const unsigned int i, const unsigned int j)
 返回 (i,j) 元素的可写引用。 更多...
 
ConstTypeTensorColumn< T > slice (const unsigned int i) const
 返回 Tensor 的第 i 列的代理。 更多...
 
TypeTensorColumn< T > slice (const unsigned int i)
 返回 Tensor 的第 i 列的可写代理。 更多...
 
TypeVector< T > row (const unsigned int r) const
 返回 Tensor 的一行作为 TypeVector 的副本。 更多...
 
template<typename T2 >
TypeTensor< typename
CompareTypes< T, T2 >
::supertype > 
operator+ (const TypeTensor< T2 > &) const
 将另一个 Tensor 加到该 Tensor 上。 更多...
 
template<typename T2 >
const TypeTensor< T > & operator+= (const TypeTensor< T2 > &)
 在该 Tensor 上加上另一个 Tensor。 更多...
 
template<typename T2 >
void add (const TypeTensor< T2 > &)
 在不创建临时 Tensor 的情况下将另一个 Tensor 加到该 Tensor 上。 更多...
 
template<typename T2 >
void add_scaled (const TypeTensor< T2 > &, const T &scale)
 在不创建临时 Tensor 的情况下将一个缩放的 Tensor 加到该 Tensor 上。 更多...
 
template<typename T2 >
TypeTensor< typename
CompareTypes< T, T2 >
::supertype > 
operator- (const TypeTensor< T2 > &) const
 从该 Tensor 减去另一个 Tensor。 更多...
 
TypeTensor< T > operator- () const
 返回该 Tensor 的负值的副本。 更多...
 
template<typename T2 >
const TypeTensor< T > & operator-= (const TypeTensor< T2 > &)
 从该 Tensor 减去另一个 Tensor。 更多...
 
template<typename T2 >
void subtract (const TypeTensor< T2 > &)
 在不创建临时 Tensor 的情况下从该 Tensor 减去另一个 Tensor。 更多...
 
template<typename T2 >
void subtract_scaled (const TypeTensor< T2 > &, const T &)
 在不创建临时 Tensor 的情况下从该 Tensor 减去一个缩放的 Tensor。 更多...
 
template<typename Scalar >
auto operator* (const Scalar &scalar) const -> typename boostcopy::enable_if_c< ScalarTraits< Scalar >::value, TypeTensor< decltype(T()*scalar)>>::type
 将该 Tensor 与标量值相乘。 更多...
 
template<typename T2 >
TypeTensor< typename
CompareTypes< T, T2 >
::supertype > 
operator* (const TypeTensor< T2 > &) const
 将两个 Tensor 相乘,即矩阵-矩阵乘积。 这些 Tensor 可能包含不同的数值类型。 更多...
 
template<typename T2 >
TypeVector< typename
CompareTypes< T, T2 >
::supertype > 
operator* (const TypeVector< T2 > &) const
 将该 Tensor 右乘以一个向量,即矩阵-向量乘积。 这个 Tensor 和向量可以包含不同的数值类型。 更多...
 
template<typename Scalar , typename boostcopy::enable_if_c< ScalarTraits< Scalar >::value, int >::type = 0>
const TypeTensor< T > & operator*= (const Scalar &factor)
 在地方上将该 Tensor 乘以标量值。 更多...
 
template<typename T2 >
const TypeTensor< T > & operator*= (const TypeTensor< T2 > &)
 在地方上将该 Tensor 与另一个 Tensor 相乘。 更多...
 
template<typename Scalar >
boostcopy::enable_if_c
< ScalarTraits< Scalar >
::value, TypeTensor< typename
CompareTypes< T, Scalar >
::supertype > >::type 
operator/ (const Scalar &) const
 将该 Tensor 的每个元素除以标量值。 更多...
 
const TypeTensor< T > & operator/= (const T &)
 将该 Tensor 的每个元素除以标量值。 更多...
 
template<typename T2 >
CompareTypes< T, T2 >::supertype contract (const TypeTensor< T2 > &) const
 将两个 Tensor 相乘,返回一个标量,即 $ \sum_{ij} A_{ij} B_{ij} $。 这些 Tensor 可能包含不同的数值类型。 更多...
 
template<typename T2 >
TypeVector< typename
CompareTypes< T, T2 >
::supertype > 
left_multiply (const TypeVector< T2 > &p) const
 将该 Tensor 左乘以一个向量,即矩阵-向量乘积。 这个 Tensor 和向量可以包含不同的数值类型。 更多...
 
TypeTensor< T > transpose () const
 返回该 Tensor 的转置(对于复数不共轭)。 更多...
 
TypeTensor< T > inverse () const
 返回该 Tensor 的逆作为独立对象。 更多...
 
void solve (const TypeVector< T > &b, TypeVector< T > &x) const
 解方程组 $ A \cdot x = b $ 得到 $ x $,其中 $ A $ 为该 Tensor。 更多...
 
auto norm () const -> decltype(std::norm(T()))
 返回 Tensor 的 Frobenius 范数,即元素平方和的平方根。 更多...
 
auto norm_sq () const -> decltype(std::norm(T()))
 返回 Tensor 的 Frobenius 范数的平方,即元素模平方的和。 更多...
 
bool is_zero () const
 如果 Tensor 中的所有值都为零,则返回 true。 更多...
 
det () const
 返回 Tensor 的行列式。 由于这些是最多 3x3 的 Tensor,我们不像 DenseMatrix 那样做 LU 分解。 更多...
 
tr () const
 返回 Tensor 的迹。 更多...
 
void zero ()
 将 Tensor 的所有元素设置为零。 更多...
 
bool operator== (const TypeTensor< T > &rhs) const
 检查两个 Tensor 是否相等。 更多...
 
bool operator< (const TypeTensor< T > &rhs) const
 检查该 Tensor 是否小于另一个 Tensor。 用于排序时很有用。 更多...
 
template<>
bool operator< (const TypeTensor< Real > &rhs) const
 
template<>
bool operator< (const TypeTensor< Complex > &rhs) const
 
bool operator> (const TypeTensor< T > &rhs) const
 检查该 Tensor 是否大于另一个 Tensor。 更多...
 
template<>
bool operator> (const TypeTensor< Real > &rhs) const
 
template<>
bool operator> (const TypeTensor< 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
 无格式输出到流,默认为打印元素并以空格和换行符分隔。 更多...
 

Protected 属性

_coords [LIBMESH_DIM *LIBMESH_DIM]
 TypeTensor 的坐标 更多...
 

详细描述

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

此类定义了LIBMESH_DIM维度的实数或复数空间中的张量。typedef RealTensorValue总是定义为实数值的张量, 而NumberTensorValue则根据库的配置定义为实数或复数值的张量。

作者
Roy H. Stogner
日期
2004

在文件 tensor_tools.h37 行定义.

成员类型定义说明

template<typename T>
typedef std::tuple<unsigned int, unsigned int> libMesh::TypeTensor< T >::index_type
protectedinherited

Helper typedef 用于泛型索引编程。

在文件 type_tensor.h120 行定义.

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

在文件 tensor_value.h45 行定义.

构造及析构函数说明

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

无参构造函数。 在LIBMESH_DIM维度的T空间中创建零张量。

在文件 tensor_value.h231 行定义.

231  :
232  TypeTensor<T> ()
233 {
234 }
template<typename T >
libMesh::TensorValue< T >::TensorValue ( const T &  xx,
const T &  xy = 0,
const T &  xz = 0,
const T &  yx = 0,
const T &  yy = 0,
const T &  yz = 0,
const T &  zx = 0,
const T &  zy = 0,
const T &  zz = 0 
)
inlineexplicit

Constructor-from-T。默认情况下,将更高维度的条目设置为0。

参数
xxxx分量的值
xyxy分量的值,默认为0
xzxz分量的值,默认为0
yxyx分量的值,默认为0
yyyy分量的值,默认为0
yzyz分量的值,默认为0
zxzx分量的值,默认为0
zyzy分量的值,默认为0
zzzz分量的值,默认为0

在文件 tensor_value.h240 行定义.

248  :
249  TypeTensor<T> (xx,xy,xz,yx,yy,yz,zx,zy,zz)
250 {
251 }
template<typename T >
template<typename Scalar >
libMesh::TensorValue< T >::TensorValue ( const Scalar &  xx,
const Scalar &  xy = 0,
const Scalar &  xz = 0,
const Scalar &  yx = 0,
const Scalar &  yy = 0,
const Scalar &  yz = 0,
const Scalar &  zx = 0,
const Scalar &  zy = 0,
typename boostcopy::enable_if_c< ScalarTraits< Scalar >::value, const Scalar >::type &  zz = 0 
)
inlineexplicit

Constructor-from-scalars。默认情况下,将更高维度的条目设置为0。

参数
xxxx分量的值
xyxy分量的值,默认为0
xzxz分量的值,默认为0
yxyx分量的值,默认为0
yyyy分量的值,默认为0
yzyz分量的值,默认为0
zxzx分量的值,默认为0
zyzy分量的值,默认为0
zzzz分量的值,默认为0

在文件 tensor_value.h257 行定义.

267  :
268  TypeTensor<T> (xx,xy,xz,yx,yy,yz,zx,zy,zz)
269 {
270 }
template<typename T >
template<typename T2 >
libMesh::TensorValue< T >::TensorValue ( const TypeVector< T2 > &  vx)
inline

构造函数。对于LIBMESH_DIM=1,需要1行向量。

参数
vx包含vx分量的行向量

在文件 tensor_value.h287 行定义.

287  :
288  TypeTensor<T> (vx)
289 {
290 }
template<typename T >
template<typename T2 >
libMesh::TensorValue< T >::TensorValue ( const TypeVector< T2 > &  vx,
const TypeVector< T2 > &  vy 
)
inline

构造函数。对于LIBMESH_DIM=2,需要2行向量。

参数
vx包含vx分量的行向量
vy包含vy分量的行向量

在文件 tensor_value.h297 行定义.

298  :
299  TypeTensor<T> (vx, vy)
300 {
301 }
template<typename T >
template<typename T2 >
libMesh::TensorValue< T >::TensorValue ( const TypeVector< T2 > &  vx,
const TypeVector< T2 > &  vy,
const TypeVector< T2 > &  vz 
)
inline

构造函数。对于LIBMESH_DIM=3,需要3行向量。

参数
vx包含vx分量的行向量
vy包含vy分量的行向量
vz包含vz分量的行向量

在文件 tensor_value.h308 行定义.

310  :
311  TypeTensor<T> (vx, vy, vz)
312 {
313 }
template<typename T >
template<typename T2 >
libMesh::TensorValue< T >::TensorValue ( const TensorValue< T2 > &  p)
inline

复制构造函数。

参数
p要复制的张量

在文件 tensor_value.h277 行定义.

277  :
278  TypeTensor<T> (p)
279 {
280 }
template<typename T >
template<typename T2 >
libMesh::TensorValue< T >::TensorValue ( const TypeTensor< T2 > &  p)
inline

复制构造函数。

参数
p要复制的张量

在文件 tensor_value.h320 行定义.

320  :
321  TypeTensor<T> (p)
322 {
323 }
template<typename T >
libMesh::TensorValue< T >::TensorValue ( const TypeTensor< Real > &  p_re,
const TypeTensor< Real > &  p_im 
)
inline

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

参数
p_re实部张量
p_im虚部张量

在文件 tensor_value.h329 行定义.

330  :
331  TypeTensor<T> (Complex (p_re(0,0), p_im(0,0)),
332  Complex (p_re(0,1), p_im(0,1)),
333  Complex (p_re(0,2), p_im(0,2)),
334  Complex (p_re(1,0), p_im(1,0)),
335  Complex (p_re(1,1), p_im(1,1)),
336  Complex (p_re(1,2), p_im(1,2)),
337  Complex (p_re(2,0), p_im(2,0)),
338  Complex (p_re(2,1), p_im(2,1)),
339  Complex (p_re(2,2), p_im(2,2)))
340 {
341 }
std::complex< Real > Complex

成员函数说明

template<typename T >
template<typename T2 >
void libMesh::TypeTensor< T >::add ( const TypeTensor< T2 > &  p)
inlineprotectedinherited

在不创建临时 Tensor 的情况下将另一个 Tensor 加到该 Tensor 上。

模板参数
T2另一个 Tensor 的元素类型。
参数
p另一个 Tensor。

在文件 type_tensor.h930 行定义.

参考 libMesh::TypeTensor< T >::_coords.

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

931 {
932  for (unsigned int i=0; i<LIBMESH_DIM*LIBMESH_DIM; i++)
933  _coords[i] += p._coords[i];
934 }
T _coords[LIBMESH_DIM *LIBMESH_DIM]
TypeTensor 的坐标
Definition: type_tensor.h:500
template<typename T >
template<typename T2 >
void libMesh::TypeTensor< T >::add_scaled ( const TypeTensor< T2 > &  p,
const T &  scale 
)
inlineprotectedinherited

在不创建临时 Tensor 的情况下将一个缩放的 Tensor 加到该 Tensor 上。

模板参数
T2另一个 Tensor 的元素类型。
参数
p要加的 Tensor。
scale缩放因子。

在文件 type_tensor.h941 行定义.

参考 libMesh::TypeTensor< T >::_coords.

942 {
943  for (unsigned int i=0; i<LIBMESH_DIM*LIBMESH_DIM; i++)
944  _coords[i] += factor*p._coords[i];
945 
946 }
T _coords[LIBMESH_DIM *LIBMESH_DIM]
TypeTensor 的坐标
Definition: type_tensor.h:500
template<typename T >
template<typename T2 >
CompareTypes< T, T2 >::supertype libMesh::TypeTensor< T >::contract ( const TypeTensor< T2 > &  t) const
inlineprotectedinherited

将两个 Tensor 相乘,返回一个标量,即 $ \sum_{ij} A_{ij} B_{ij} $。 这些 Tensor 可能包含不同的数值类型。

Multiply 2 tensors together, i.e.

模板参数
T2另一个 Tensor 的元素类型。
参数
p另一个 Tensor。
返回
标量结果,该 Tensor 保持不变。

sum Aij*Bij. The tensors may be of different types.

在文件 type_tensor.h1358 行定义.

参考 libMesh::TypeTensor< T >::_coords.

参考自 libMesh::TensorTools::inner_product().

1359 {
1360  typename CompareTypes<T,T2>::supertype sum = 0.;
1361  for (unsigned int i=0; i<LIBMESH_DIM*LIBMESH_DIM; i++)
1362  sum += _coords[i]*t._coords[i];
1363  return sum;
1364 }
T _coords[LIBMESH_DIM *LIBMESH_DIM]
TypeTensor 的坐标
Definition: type_tensor.h:500
template<typename T >
T libMesh::TypeTensor< T >::det ( ) const
inlineprotectedinherited

返回 Tensor 的行列式。 由于这些是最多 3x3 的 Tensor,我们不像 DenseMatrix 那样做 LU 分解。

返回
Tensor 的行列式。

在文件 type_tensor.h1388 行定义.

参考 libMesh::TypeTensor< T >::_coords.

1389 {
1390 #if LIBMESH_DIM == 1
1391  return _coords[0];
1392 #endif
1393 
1394 #if LIBMESH_DIM == 2
1395  return (_coords[0] * _coords[3]
1396  - _coords[1] * _coords[2]);
1397 #endif
1398 
1399 #if LIBMESH_DIM == 3
1400  return (_coords[0] * _coords[4] * _coords[8]
1401  + _coords[1] * _coords[5] * _coords[6]
1402  + _coords[2] * _coords[3] * _coords[7]
1403  - _coords[0] * _coords[5] * _coords[7]
1404  - _coords[1] * _coords[3] * _coords[8]
1405  - _coords[2] * _coords[4] * _coords[6]);
1406 #endif
1407 }
T _coords[LIBMESH_DIM *LIBMESH_DIM]
TypeTensor 的坐标
Definition: type_tensor.h:500
template<typename T >
TensorValue< Real > libMesh::TensorValue< T >::extrinsic_rotation_matrix ( Real  angle1_deg,
Real  angle2_deg,
Real  angle3_deg 
)
static

生成与提供的欧拉角关联的外禀旋转矩阵。外禀旋转旋转域中的物体,并保持坐标轴不变。 我们遵循https://en.wikipedia.org/wiki/Euler_angles#Rotation_matrix中描述的约定, 我们使用“适当的欧拉角”列和Z1 X2 Z3行中描述的矩阵,该矩阵指示按顺序绕z、x和z轴执行旋转。 正角度表示相对于相应轴的逆时针旋转。注意,角度应以度为单位提供。

参数
angle1_deg绕z轴的旋转角度
angle2_deg绕x轴的旋转角度(angle1之后)
angle3_deg绕z轴的旋转角度(angle1和angle2之后)
返回
相关联的旋转矩阵

在文件 tensor_value.h388 行定义.

参考 libMesh::libmesh_ignore() , 以及 libMesh::pi.

参考自 libMesh::TensorValue< T >::inverse_extrinsic_rotation_matrix().

391 {
392 #if LIBMESH_DIM == 3
393  const auto angle1 = angle1_deg / 180. * pi;
394  const auto angle2 = angle2_deg / 180. * pi;
395  const auto angle3 = angle3_deg / 180. * pi;
396  const auto s1 = std::sin(angle1), c1 = std::cos(angle1);
397  const auto s2 = std::sin(angle2), c2 = std::cos(angle2);
398  const auto s3 = std::sin(angle3), c3 = std::cos(angle3);
399 
400  return TensorValue<Real>(c1 * c3 - c2 * s1 * s3,
401  -c1 * s3 - c2 * c3 * s1,
402  s1 * s2,
403  c3 * s1 + c1 * c2 * s3,
404  c1 * c2 * c3 - s1 * s3,
405  -c1 * s2,
406  s2 * s3,
407  c3 * s2,
408  c2);
409 #else
410  libmesh_ignore(angle1_deg, angle2_deg, angle3_deg);
411  libmesh_error_msg("TensorValue<T>::extrinsic_rotation_matrix() requires libMesh to be compiled "
412  "with LIBMESH_DIM==3");
413  // We'll never get here
414  return TensorValue<Real>();
415 #endif
416 }
void libmesh_ignore(const Args &...)
const Real pi
.
Definition: libmesh.h:242
template<typename T >
TensorValue< Real > libMesh::TensorValue< T >::intrinsic_rotation_matrix ( Real  phi,
Real  theta,
Real  psi 
)
static

生成与提供的欧拉角关联的内禀旋转矩阵。内禀旋转会保持域中的物体不动,同时旋转坐标轴。 我们遵循http://mathworld.wolfram.com/EulerAngles.html中描述的约定 (方程6-14给出了复合变换矩阵的条目)。旋转在z、x'和z''轴上按顺序执行。旋 转序列的每个步骤中的正角度给出了在旋转轴周围以逆时针方向旋转实体的外观,尽管事实上 旋转的是坐标轴本身。为了给出物体逆时针旋转的外观,我们实际上将角度传递到方法中的负角度。 所有角度应以度为单位提供。

参数
phi围绕原始z轴旋转坐标轴的负角度
theta围绕“当前”x轴(phi之后)旋转坐标轴的负角度,例如x'
psi围绕“当前”z轴(phi和theta之后)旋转坐标轴的负角度,例如z''
返回
相关联的旋转矩阵

在文件 tensor_value.h346 行定义.

参考 libMesh::libmesh_ignore(), libMesh::pi , 以及 libMesh::Real.

参考自 libMesh::TensorValue< T >::inverse_intrinsic_rotation_matrix().

347 {
348 #if LIBMESH_DIM == 3
349  // We apply a negative sign here or else we don't get the appearance of
350  // counter-clockwise/right-hand-rule rotation of the bodies with respect to the coordinate axes
351  // (but as explained in the method doxygen we are *actually* rotating the coordinate axes while
352  // leaving the bodies fixed)
353  const Real p = -phi / 180. * pi;
354  const Real t = -theta / 180. * pi;
355  const Real s = -psi / 180. * pi;
356  const Real sp = std::sin(p), cp = std::cos(p);
357  const Real st = std::sin(t), ct = std::cos(t);
358  const Real ss = std::sin(s), cs = std::cos(s);
359 
360  return TensorValue<Real>(cp * cs - sp * ct * ss,
361  sp * cs + cp * ct * ss,
362  st * ss,
363  -cp * ss - sp * ct * cs,
364  -sp * ss + cp * ct * cs,
365  st * cs,
366  sp * st,
367  -cp * st,
368  ct);
369 #else
370  libmesh_ignore(phi, theta, psi);
371  libmesh_error_msg("TensorValue<T>::intrinsic_rotation_matrix() requires libMesh to be compiled "
372  "with LIBMESH_DIM==3");
373  // We'll never get here
374  return TensorValue<Real>();
375 #endif
376 }
void libmesh_ignore(const Args &...)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const Real pi
.
Definition: libmesh.h:242
template<typename T >
TypeTensor< T > libMesh::TypeTensor< T >::inverse ( ) const
inlineprotectedinherited

返回该 Tensor 的逆作为独立对象。

返回
该 Tensor 的逆。

在文件 type_tensor.h1170 行定义.

参考 libMesh::TypeTensor< T >::_coords , 以及 libMesh::TypeTensor< T >::TypeTensor().

1171 {
1172 #if LIBMESH_DIM == 1
1173  if (_coords[0] == static_cast<T>(0.))
1174  libmesh_convergence_failure();
1175  return TypeTensor(1. / _coords[0]);
1176 #endif
1177 
1178 #if LIBMESH_DIM == 2
1179  // Get convenient reference to this.
1180  const TypeTensor<T> & A = *this;
1181 
1182  // Use temporary variables, avoid multiple accesses
1183  T a = A(0,0), b = A(0,1),
1184  c = A(1,0), d = A(1,1);
1185 
1186  // Make sure det = ad - bc is not zero
1187  T my_det = a*d - b*c;
1188 
1189  if (my_det == static_cast<T>(0.))
1190  libmesh_convergence_failure();
1191 
1192  return TypeTensor(d/my_det, -b/my_det, -c/my_det, a/my_det);
1193 #endif
1194 
1195 #if LIBMESH_DIM == 3
1196  // Get convenient reference to this.
1197  const TypeTensor<T> & A = *this;
1198 
1199  T a11 = A(0,0), a12 = A(0,1), a13 = A(0,2),
1200  a21 = A(1,0), a22 = A(1,1), a23 = A(1,2),
1201  a31 = A(2,0), a32 = A(2,1), a33 = A(2,2);
1202 
1203  T my_det = a11*(a33*a22-a32*a23) - a21*(a33*a12-a32*a13) + a31*(a23*a12-a22*a13);
1204 
1205  if (my_det == static_cast<T>(0.))
1206  libmesh_convergence_failure();
1207 
1208  // Inline comment characters are for lining up columns.
1209  return TypeTensor( (a33*a22-a32*a23)/my_det, -(a33*a12-a32*a13)/my_det, (a23*a12-a22*a13)/my_det,
1210  -(a33*a21-a31*a23)/my_det, (a33*a11-a31*a13)/my_det, -(a23*a11-a21*a13)/my_det,
1211  (a32*a21-a31*a22)/my_det, -(a32*a11-a31*a12)/my_det, (a22*a11-a21*a12)/my_det);
1212 #endif
1213 }
TypeTensor()
Empty constructor.
Definition: type_tensor.h:615
T _coords[LIBMESH_DIM *LIBMESH_DIM]
TypeTensor 的坐标
Definition: type_tensor.h:500
template<typename T >
TensorValue< Real > libMesh::TensorValue< T >::inverse_extrinsic_rotation_matrix ( Real  angle1_deg,
Real  angle2_deg,
Real  angle3_deg 
)
static

反转与提供给extrinsic_rotation_matrix的相同角度的旋转,即返回到原始起始点。

参数
angle1_deg绕z轴的旋转角度
angle2_deg绕x轴的旋转角度(angle1之后)
angle3_deg绕z轴的旋转角度(angle1和angle2之后)
返回
相关联的旋转矩阵

在文件 tensor_value.h420 行定义.

参考 libMesh::TensorValue< T >::extrinsic_rotation_matrix().

423 {
424  // The inverse of a rotation matrix is just the transpose
425  return TensorValue<T>::extrinsic_rotation_matrix(angle1_deg, angle2_deg, angle3_deg).transpose();
426 }
static TensorValue< Real > extrinsic_rotation_matrix(Real angle1_deg, Real angle2_deg, Real angle3_deg)
生成与提供的欧拉角关联的外禀旋转矩阵。外禀旋转旋转域中的物体,并保持坐标轴不变。 我们遵循https://en.wikipedia.org/wiki/Euler_angles#Rotation_matr...
Definition: tensor_value.h:388
template<typename T >
TensorValue< Real > libMesh::TensorValue< T >::inverse_intrinsic_rotation_matrix ( Real  phi,
Real  theta,
Real  psi 
)
static

反转与提供给intrinsic_rotation_matrix的相同角度的旋转,即返回到原始起始点。 所有角度应以度为单位提供。

参数
phi围绕原始z轴旋转坐标轴的负角度
theta围绕“当前”x轴(phi之后)旋转坐标轴的负角度,例如x'
psi围绕“当前”z轴(phi和theta之后)旋转坐标轴的负角度,例如z''
返回
相关联的旋转矩阵

在文件 tensor_value.h380 行定义.

参考 libMesh::TensorValue< T >::intrinsic_rotation_matrix().

381 {
382  // The inverse of a rotation matrix is just the transpose
383  return TensorValue<T>::intrinsic_rotation_matrix(phi, theta, psi).transpose();
384 }
static TensorValue< Real > intrinsic_rotation_matrix(Real phi, Real theta, Real psi)
生成与提供的欧拉角关联的内禀旋转矩阵。内禀旋转会保持域中的物体不动,同时旋转坐标轴。 我们遵循http://mathworld.wolfram.com/EulerAngles.html中描述的约定 (方程6-14给出了复合变换矩阵的条目)。旋转在z、x&#39;和z&#39;&#39;轴上按顺序执行。旋 转序列的每个步骤中的正角度给出了在旋转轴周围以逆时针方向旋转实体的外观,尽管事实上 旋转的是坐标轴本身。为了给出物体逆时针旋转的外观,我们实际上将角度传递到方法中的负角度。 所有角度应以度为单位提供。
Definition: tensor_value.h:346
template<typename T >
bool libMesh::TypeTensor< T >::is_zero ( ) const
inlineprotectedinherited

如果 Tensor 中的所有值都为零,则返回 true。

返回
如果 Tensor 中的所有值都为零,则为 true,否则为 false。

在文件 type_tensor.h1378 行定义.

参考 libMesh::TypeTensor< T >::_coords.

1379 {
1380  for (const auto & val : _coords)
1381  if (val != T(0))
1382  return false;
1383  return true;
1384 }
T _coords[LIBMESH_DIM *LIBMESH_DIM]
TypeTensor 的坐标
Definition: type_tensor.h:500
template<typename T >
template<typename T2 >
TypeVector< typename CompareTypes< T, T2 >::supertype > libMesh::TypeTensor< T >::left_multiply ( const TypeVector< T2 > &  p) const
inlineprotectedinherited

将该 Tensor 左乘以一个向量,即矩阵-向量乘积。 这个 Tensor 和向量可以包含不同的数值类型。

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

在文件 type_tensor.h1301 行定义.

参考自 libMesh::operator*().

1302 {
1303  TypeVector<typename CompareTypes<T,T2>::supertype> returnval;
1304  for (unsigned int i=0; i<LIBMESH_DIM; i++)
1305  for (unsigned int j=0; j<LIBMESH_DIM; j++)
1306  returnval(i) += p(j)*(*this)(j,i);
1307 
1308  return returnval;
1309 }
template<typename T >
auto libMesh::TypeTensor< T >::norm ( ) const -> decltype(std::norm(T()))
inlineprotectedinherited

返回 Tensor 的 Frobenius 范数,即元素平方和的平方根。

返回
Tensor 的 Frobenius 范数。

在文件 type_tensor.h1370 行定义.

参考 libMesh::TypeTensor< T >::norm_sq() , 以及 std::sqrt().

1371 {
1372  return std::sqrt(this->norm_sq());
1373 }
auto norm_sq() const -> decltype(std::norm(T()))
返回 Tensor 的 Frobenius 范数的平方,即元素模平方的和。
Definition: type_tensor.h:1438
ADRealEigenVector< T, D, asd > sqrt(const ADRealEigenVector< T, D, asd > &)
计算自动微分实数向量的平方根。
Definition: type_vector.h:88
template<typename T >
auto libMesh::TypeTensor< T >::norm_sq ( ) const -> decltype(std::norm(T()))
inlineprotectedinherited

返回 Tensor 的 Frobenius 范数的平方,即元素模平方的和。

返回
Tensor 的 Frobenius 范数的平方。

在文件 type_tensor.h1438 行定义.

参考 libMesh::TypeTensor< T >::_coords, libMesh::TensorTools::norm_sq() , 以及 libMesh::Real.

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

1439 {
1440  Real sum = 0.;
1441  for (unsigned int i=0; i<LIBMESH_DIM*LIBMESH_DIM; i++)
1442  sum += TensorTools::norm_sq(_coords[i]);
1443  return sum;
1444 }
T _coords[LIBMESH_DIM *LIBMESH_DIM]
TypeTensor 的坐标
Definition: type_tensor.h:500
T norm_sq(std::complex< T > a)
Definition: tensor_tools.h:74
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
template<typename T >
const T & libMesh::TypeTensor< T >::operator() ( const unsigned int  i,
const unsigned int  j 
) const
inlineprotectedinherited

返回 (i,j) 元素的常量引用。

参数
i行索引。
j列索引。
返回
(i,j) 元素的常量引用。

在文件 type_tensor.h811 行定义.

参考 libMesh::TypeTensor< T >::_coords.

813 {
814  libmesh_assert_less (i, 3);
815  libmesh_assert_less (j, 3);
816 
817 #if LIBMESH_DIM < 3
818  const static T my_zero = 0;
819  if (i >= LIBMESH_DIM || j >= LIBMESH_DIM)
820  return my_zero;
821 #endif
822 
823  return _coords[i*LIBMESH_DIM+j];
824 }
T _coords[LIBMESH_DIM *LIBMESH_DIM]
TypeTensor 的坐标
Definition: type_tensor.h:500
template<typename T >
T & libMesh::TypeTensor< T >::operator() ( const unsigned int  i,
const unsigned int  j 
)
inlineprotectedinherited

返回 (i,j) 元素的可写引用。

参数
i行索引。
j列索引。
返回
(i,j) 元素的可写引用。

在文件 type_tensor.h830 行定义.

参考 libMesh::TypeTensor< T >::_coords.

832 {
833 #if LIBMESH_DIM < 3
834 
835  libmesh_error_msg_if(i >= LIBMESH_DIM || j >= LIBMESH_DIM,
836  "ERROR: You are assigning to a tensor component that is out of range for the compiled LIBMESH_DIM!");
837 
838 #endif
839 
840  libmesh_assert_less (i, LIBMESH_DIM);
841  libmesh_assert_less (j, LIBMESH_DIM);
842 
843  return _coords[i*LIBMESH_DIM+j];
844 }
T _coords[LIBMESH_DIM *LIBMESH_DIM]
TypeTensor 的坐标
Definition: type_tensor.h:500
template<typename T >
template<typename Scalar >
auto libMesh::TypeTensor< T >::operator* ( const Scalar &  scalar) const -> typename boostcopy::enable_if_c< ScalarTraits<Scalar>::value, TypeTensor<decltype(T() * scalar)>>::type
inlineprotectedinherited

将该 Tensor 与标量值相乘。

模板参数
Scalar标量类型。
参数
scalar标量值。
返回
结果的副本,该 Tensor 保持不变。

在文件 type_tensor.h1055 行定义.

参考 libMesh::TypeTensor< T >::_coords.

1058 {
1059  typedef decltype((*this)(0, 0) * factor) TS;
1060 
1061 
1062 #if LIBMESH_DIM == 1
1063  return TypeTensor<TS>(_coords[0]*factor);
1064 #endif
1065 
1066 #if LIBMESH_DIM == 2
1067  return TypeTensor<TS>(_coords[0]*factor,
1068  _coords[1]*factor,
1069  _coords[2]*factor,
1070  _coords[3]*factor);
1071 #endif
1072 
1073 #if LIBMESH_DIM == 3
1074  return TypeTensor<TS>(_coords[0]*factor,
1075  _coords[1]*factor,
1076  _coords[2]*factor,
1077  _coords[3]*factor,
1078  _coords[4]*factor,
1079  _coords[5]*factor,
1080  _coords[6]*factor,
1081  _coords[7]*factor,
1082  _coords[8]*factor);
1083 #endif
1084 }
T _coords[LIBMESH_DIM *LIBMESH_DIM]
TypeTensor 的坐标
Definition: type_tensor.h:500
template<typename T >
template<typename T2 >
TypeTensor< typename CompareTypes< T, T2 >::supertype > libMesh::TypeTensor< T >::operator* ( const TypeTensor< T2 > &  p) const
inlineprotectedinherited

将两个 Tensor 相乘,即矩阵-矩阵乘积。 这些 Tensor 可能包含不同的数值类型。

模板参数
T2另一个 Tensor 的元素类型。
参数
p另一个 Tensor。
返回
结果的副本,该 Tensor 保持不变。

在文件 type_tensor.h1323 行定义.

1324 {
1325  TypeTensor<typename CompareTypes<T, T2>::supertype> returnval;
1326  for (unsigned int i=0; i<LIBMESH_DIM; i++)
1327  for (unsigned int j=0; j<LIBMESH_DIM; j++)
1328  for (unsigned int k=0; k<LIBMESH_DIM; k++)
1329  returnval(i,j) += (*this)(i,k)*p(k,j);
1330 
1331  return returnval;
1332 }
template<typename T >
template<typename T2 >
TypeVector< typename CompareTypes< T, T2 >::supertype > libMesh::TypeTensor< T >::operator* ( const TypeVector< T2 > &  p) const
inlineprotectedinherited

将该 Tensor 右乘以一个向量,即矩阵-向量乘积。 这个 Tensor 和向量可以包含不同的数值类型。

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

在文件 type_tensor.h1287 行定义.

1288 {
1289  TypeVector<typename CompareTypes<T,T2>::supertype> returnval;
1290  for (unsigned int i=0; i<LIBMESH_DIM; i++)
1291  for (unsigned int j=0; j<LIBMESH_DIM; j++)
1292  returnval(i) += (*this)(i,j)*p(j);
1293 
1294  return returnval;
1295 }
template<typename T>
template<typename Scalar , typename boostcopy::enable_if_c< ScalarTraits< Scalar >::value, int >::type = 0>
const TypeTensor<T>& libMesh::TypeTensor< T >::operator*= ( const Scalar &  factor)
inlineprotectedinherited

在地方上将该 Tensor 乘以标量值。

模板参数
Scalar标量类型。
参数
factor缩放因子。
返回
对 *this 的引用。

在文件 type_tensor.h304 行定义.

参考 libMesh::TypeTensor< T >::_coords.

305  {
306  for (unsigned int i = 0; i < LIBMESH_DIM * LIBMESH_DIM; i++)
307  _coords[i] *= factor;
308 
309  return *this;
310  }
T _coords[LIBMESH_DIM *LIBMESH_DIM]
TypeTensor 的坐标
Definition: type_tensor.h:500
template<typename T >
template<typename T2 >
const TypeTensor< T > & libMesh::TypeTensor< T >::operator*= ( const TypeTensor< T2 > &  p)
inlineprotectedinherited

在地方上将该 Tensor 与另一个 Tensor 相乘。

模板参数
T2另一个 Tensor 的元素类型。
参数
p另一个 Tensor。
返回
对 *this 的引用。

在文件 type_tensor.h1337 行定义.

1338 {
1339  TypeTensor<T> temp;
1340  for (unsigned int i=0; i<LIBMESH_DIM; i++)
1341  for (unsigned int j=0; j<LIBMESH_DIM; j++)
1342  for (unsigned int k=0; k<LIBMESH_DIM; k++)
1343  temp(i,j) += (*this)(i,k)*p(k,j);
1344 
1345  this->assign(temp);
1346  return *this;
1347 }
template<typename T >
template<typename T2 >
TypeTensor< typename CompareTypes< T, T2 >::supertype > libMesh::TypeTensor< T >::operator+ ( const TypeTensor< T2 > &  p) const
inlineprotectedinherited

将另一个 Tensor 加到该 Tensor 上。

模板参数
T2另一个 Tensor 的元素类型。
参数
p另一个 Tensor。
返回
结果的副本,该 Tensor 保持不变。

在文件 type_tensor.h884 行定义.

参考 libMesh::TypeTensor< T >::_coords.

885 {
886 
887 #if LIBMESH_DIM == 1
888  return TypeTensor<typename CompareTypes<T, T2>::supertype>(_coords[0] + p._coords[0]);
889 #endif
890 
891 #if LIBMESH_DIM == 2
892  return TypeTensor<typename CompareTypes<T, T2>::supertype>(_coords[0] + p._coords[0],
893  _coords[1] + p._coords[1],
894  0.,
895  _coords[2] + p._coords[2],
896  _coords[3] + p._coords[3]);
897 #endif
898 
899 #if LIBMESH_DIM == 3
900  return TypeTensor<typename CompareTypes<T, T2>::supertype>(_coords[0] + p._coords[0],
901  _coords[1] + p._coords[1],
902  _coords[2] + p._coords[2],
903  _coords[3] + p._coords[3],
904  _coords[4] + p._coords[4],
905  _coords[5] + p._coords[5],
906  _coords[6] + p._coords[6],
907  _coords[7] + p._coords[7],
908  _coords[8] + p._coords[8]);
909 #endif
910 
911 }
T _coords[LIBMESH_DIM *LIBMESH_DIM]
TypeTensor 的坐标
Definition: type_tensor.h:500
template<typename T >
template<typename T2 >
const TypeTensor< T > & libMesh::TypeTensor< T >::operator+= ( const TypeTensor< T2 > &  p)
inlineprotectedinherited

在该 Tensor 上加上另一个 Tensor。

模板参数
T2另一个 Tensor 的元素类型。
参数
p另一个 Tensor。
返回
对 *this 的引用。

在文件 type_tensor.h918 行定义.

参考 libMesh::TypeTensor< T >::add().

919 {
920  this->add (p);
921 
922  return *this;
923 }
void add(const TypeTensor< T2 > &)
在不创建临时 Tensor 的情况下将另一个 Tensor 加到该 Tensor 上。
Definition: type_tensor.h:930
template<typename T >
template<typename T2 >
TypeTensor< typename CompareTypes< T, T2 >::supertype > libMesh::TypeTensor< T >::operator- ( const TypeTensor< T2 > &  p) const
inlineprotectedinherited

从该 Tensor 减去另一个 Tensor。

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

在文件 type_tensor.h954 行定义.

参考 libMesh::TypeTensor< T >::_coords.

955 {
956 
957 #if LIBMESH_DIM == 1
958  return TypeTensor<typename CompareTypes<T, T2>::supertype>(_coords[0] - p._coords[0]);
959 #endif
960 
961 #if LIBMESH_DIM == 2
962  return TypeTensor<typename CompareTypes<T, T2>::supertype>(_coords[0] - p._coords[0],
963  _coords[1] - p._coords[1],
964  0.,
965  _coords[2] - p._coords[2],
966  _coords[3] - p._coords[3]);
967 #endif
968 
969 #if LIBMESH_DIM == 3
970  return TypeTensor<typename CompareTypes<T, T2>::supertype>(_coords[0] - p._coords[0],
971  _coords[1] - p._coords[1],
972  _coords[2] - p._coords[2],
973  _coords[3] - p._coords[3],
974  _coords[4] - p._coords[4],
975  _coords[5] - p._coords[5],
976  _coords[6] - p._coords[6],
977  _coords[7] - p._coords[7],
978  _coords[8] - p._coords[8]);
979 #endif
980 
981 }
T _coords[LIBMESH_DIM *LIBMESH_DIM]
TypeTensor 的坐标
Definition: type_tensor.h:500
template<typename T >
TypeTensor< T > libMesh::TypeTensor< T >::operator- ( ) const
inlineprotectedinherited

返回该 Tensor 的负值的副本。

返回
该 Tensor 的负值的副本。

在文件 type_tensor.h1021 行定义.

参考 libMesh::TypeTensor< T >::_coords , 以及 libMesh::TypeTensor< T >::TypeTensor().

1022 {
1023 
1024 #if LIBMESH_DIM == 1
1025  return TypeTensor(-_coords[0]);
1026 #endif
1027 
1028 #if LIBMESH_DIM == 2
1029  return TypeTensor(-_coords[0],
1030  -_coords[1],
1031  -_coords[2],
1032  -_coords[3]);
1033 #endif
1034 
1035 #if LIBMESH_DIM == 3
1036  return TypeTensor(-_coords[0],
1037  -_coords[1],
1038  -_coords[2],
1039  -_coords[3],
1040  -_coords[4],
1041  -_coords[5],
1042  -_coords[6],
1043  -_coords[7],
1044  -_coords[8]);
1045 #endif
1046 
1047 }
TypeTensor()
Empty constructor.
Definition: type_tensor.h:615
T _coords[LIBMESH_DIM *LIBMESH_DIM]
TypeTensor 的坐标
Definition: type_tensor.h:500
template<typename T >
template<typename T2 >
const TypeTensor< T > & libMesh::TypeTensor< T >::operator-= ( const TypeTensor< T2 > &  p)
inlineprotectedinherited

从该 Tensor 减去另一个 Tensor。

模板参数
T2另一个 Tensor 的元素类型。
参数
p要减去的 Tensor。
返回
对 *this 的引用。

在文件 type_tensor.h988 行定义.

参考 libMesh::TypeTensor< T >::subtract().

989 {
990  this->subtract (p);
991 
992  return *this;
993 }
void subtract(const TypeTensor< T2 > &)
在不创建临时 Tensor 的情况下从该 Tensor 减去另一个 Tensor。
Definition: type_tensor.h:1000
template<typename T >
template<typename Scalar >
boostcopy::enable_if_c< ScalarTraits< Scalar >::value, TypeTensor< typename CompareTypes< T, Scalar >::supertype > >::type libMesh::TypeTensor< T >::operator/ ( const Scalar &  factor) const
inlineprotectedinherited

将该 Tensor 的每个元素除以标量值。

模板参数
Scalar标量类型。
参数
divisor除数。
返回
结果的副本,该 Tensor 保持不变。

在文件 type_tensor.h1105 行定义.

参考 libMesh::TypeTensor< T >::_coords.

1106 {
1107  libmesh_assert_not_equal_to (factor, static_cast<T>(0.));
1108 
1109  typedef typename CompareTypes<T, Scalar>::supertype TS;
1110 
1111 #if LIBMESH_DIM == 1
1112  return TypeTensor<TS>(_coords[0]/factor);
1113 #endif
1114 
1115 #if LIBMESH_DIM == 2
1116  return TypeTensor<TS>(_coords[0]/factor,
1117  _coords[1]/factor,
1118  _coords[2]/factor,
1119  _coords[3]/factor);
1120 #endif
1121 
1122 #if LIBMESH_DIM == 3
1123  return TypeTensor<TS>(_coords[0]/factor,
1124  _coords[1]/factor,
1125  _coords[2]/factor,
1126  _coords[3]/factor,
1127  _coords[4]/factor,
1128  _coords[5]/factor,
1129  _coords[6]/factor,
1130  _coords[7]/factor,
1131  _coords[8]/factor);
1132 #endif
1133 
1134 }
T _coords[LIBMESH_DIM *LIBMESH_DIM]
TypeTensor 的坐标
Definition: type_tensor.h:500
template<typename T >
const TypeTensor< T > & libMesh::TypeTensor< T >::operator/= ( const T &  factor)
inlineprotectedinherited

将该 Tensor 的每个元素除以标量值。

参数
divisor除数。
返回
对 *this 的引用。

在文件 type_tensor.h1270 行定义.

参考 libMesh::TypeTensor< T >::_coords.

1271 {
1272  libmesh_assert_not_equal_to (factor, static_cast<T>(0.));
1273 
1274  for (unsigned int i=0; i<LIBMESH_DIM*LIBMESH_DIM; i++)
1275  _coords[i] /= factor;
1276 
1277  return *this;
1278 }
T _coords[LIBMESH_DIM *LIBMESH_DIM]
TypeTensor 的坐标
Definition: type_tensor.h:500
template<>
bool libMesh::TypeTensor< Real >::operator< ( const TypeTensor< Real > &  rhs) const
protectedinherited

在文件 type_tensor.C113 行定义.

114 {
115  for (unsigned int i=0; i<LIBMESH_DIM; i++)
116  for (unsigned int j=0; j<LIBMESH_DIM; j++)
117  {
118  if ((*this)(i,j) < rhs(i,j))
119  return true;
120  if ((*this)(i,j) > rhs(i,j))
121  return false;
122  }
123  return false;
124 }
template<>
bool libMesh::TypeTensor< Complex >::operator< ( const TypeTensor< Complex > &  rhs) const
protectedinherited

在文件 type_tensor.C146 行定义.

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

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

检查该 Tensor 是否小于另一个 Tensor。 用于排序时很有用。

参数
rhs要比较的另一个 Tensor。
返回
如果该 Tensor 小于另一个 Tensor,则为 true。
template<typename T>
template<typename Scalar >
boostcopy::enable_if_c< ScalarTraits<Scalar>::value, TensorValue &>::type libMesh::TensorValue< T >::operator= ( const Scalar &  libmesh_dbg_varp)
inline

赋值给标量的运算符。仅用于将张量清零。

参数
p要赋值为0的标量
返回
引用到当前张量

在文件 tensor_value.h166 行定义.

参考 libMesh::TypeTensor< T >::zero().

167  { libmesh_assert_equal_to (p, Scalar(0)); this->zero(); return *this; }
void zero()
将 Tensor 的所有元素设置为零。
Definition: type_tensor.h:1428
template<typename T >
bool libMesh::TypeTensor< T >::operator== ( const TypeTensor< T > &  rhs) const
inlineprotectedinherited

检查两个 Tensor 是否相等。

参数
rhs要比较的另一个 Tensor。
返回
如果两个 Tensor 相等,则为 true,否则为 false。

在文件 type_tensor.h1450 行定义.

参考 libMesh::TypeTensor< T >::_coords, std::abs() , 以及 libMesh::TOLERANCE.

1451 {
1452 #if LIBMESH_DIM == 1
1453  return (std::abs(_coords[0] - rhs._coords[0])
1454  < TOLERANCE);
1455 #endif
1456 
1457 #if LIBMESH_DIM == 2
1458  return ((std::abs(_coords[0] - rhs._coords[0]) +
1459  std::abs(_coords[1] - rhs._coords[1]) +
1460  std::abs(_coords[2] - rhs._coords[2]) +
1461  std::abs(_coords[3] - rhs._coords[3]))
1462  < 4.*TOLERANCE);
1463 #endif
1464 
1465 #if LIBMESH_DIM == 3
1466  return ((std::abs(_coords[0] - rhs._coords[0]) +
1467  std::abs(_coords[1] - rhs._coords[1]) +
1468  std::abs(_coords[2] - rhs._coords[2]) +
1469  std::abs(_coords[3] - rhs._coords[3]) +
1470  std::abs(_coords[4] - rhs._coords[4]) +
1471  std::abs(_coords[5] - rhs._coords[5]) +
1472  std::abs(_coords[6] - rhs._coords[6]) +
1473  std::abs(_coords[7] - rhs._coords[7]) +
1474  std::abs(_coords[8] - rhs._coords[8]))
1475  < 9.*TOLERANCE);
1476 #endif
1477 
1478 }
static constexpr Real TOLERANCE
T _coords[LIBMESH_DIM *LIBMESH_DIM]
TypeTensor 的坐标
Definition: type_tensor.h:500
ADRealEigenVector< T, D, asd > abs(const ADRealEigenVector< T, D, asd > &)
计算自动微分实数向量的绝对值。
Definition: type_vector.h:112
template<>
bool libMesh::TypeTensor< Real >::operator> ( const TypeTensor< Real > &  rhs) const
protectedinherited

在文件 type_tensor.C129 行定义.

130 {
131  for (unsigned int i=0; i<LIBMESH_DIM; i++)
132  for (unsigned int j=0; j<LIBMESH_DIM; j++)
133  {
134  if ((*this)(i,j) > rhs(i,j))
135  return true;
136  if ((*this)(i,j) < rhs(i,j))
137  return false;
138  }
139  return false;
140 }
template<>
bool libMesh::TypeTensor< Complex >::operator> ( const TypeTensor< Complex > &  rhs) const
protectedinherited

在文件 type_tensor.C166 行定义.

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

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

检查该 Tensor 是否大于另一个 Tensor。

参数
rhs要比较的另一个 Tensor。
返回
如果该 Tensor 大于另一个 Tensor,则为 true。
template<typename T >
void libMesh::TypeTensor< T >::print ( std::ostream &  os = libMesh::out) const
protectedinherited

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

参数
[out]os输出流。

在文件 type_tensor.C39 行定义.

40 {
41 #if LIBMESH_DIM == 1
42 
43  os << "x=" << (*this)(0,0) << std::endl;
44 
45 #endif
46 #if LIBMESH_DIM == 2
47 
48  os << "(xx,xy)=("
49  << std::setw(8) << (*this)(0,0) << ", "
50  << std::setw(8) << (*this)(0,1) << ")"
51  << std::endl;
52  os << "(yx,yy)=("
53  << std::setw(8) << (*this)(1,0) << ", "
54  << std::setw(8) << (*this)(1,1) << ")"
55  << std::endl;
56 
57 #endif
58 #if LIBMESH_DIM == 3
59 
60  os << "(xx,xy,xz)=("
61  << std::setw(8) << (*this)(0,0) << ", "
62  << std::setw(8) << (*this)(0,1) << ", "
63  << std::setw(8) << (*this)(0,2) << ")"
64  << std::endl;
65  os << "(yx,yy,yz)=("
66  << std::setw(8) << (*this)(1,0) << ", "
67  << std::setw(8) << (*this)(1,1) << ", "
68  << std::setw(8) << (*this)(1,2) << ")"
69  << std::endl;
70  os << "(zx,zy,zz)=("
71  << std::setw(8) << (*this)(2,0) << ", "
72  << std::setw(8) << (*this)(2,1) << ", "
73  << std::setw(8) << (*this)(2,2) << ")"
74  << std::endl;
75 #endif
76 }
template<typename T >
TypeVector< T > libMesh::TypeTensor< T >::row ( const unsigned int  r) const
inlineprotectedinherited

返回 Tensor 的一行作为 TypeVector 的副本。

参数
r行索引。
返回
Tensor 的一行作为 TypeVector 的副本。

在文件 type_tensor.h870 行定义.

参考 libMesh::TypeTensor< T >::_coords , 以及 libMesh::TypeVector< T >::_coords.

871 {
872  TypeVector<T> return_vector;
873 
874  for (unsigned int j=0; j<LIBMESH_DIM; j++)
875  return_vector._coords[j] = _coords[r*LIBMESH_DIM + j];
876 
877  return return_vector;
878 }
T _coords[LIBMESH_DIM *LIBMESH_DIM]
TypeTensor 的坐标
Definition: type_tensor.h:500
template<typename T >
ConstTypeTensorColumn< T > libMesh::TypeTensor< T >::slice ( const unsigned int  i) const
inlineprotectedinherited

返回 Tensor 的第 i 列的代理。

参数
i列索引。
返回
Tensor 第 i 列的常量代理。

在文件 type_tensor.h850 行定义.

851 {
852  libmesh_assert_less (i, LIBMESH_DIM);
853  return ConstTypeTensorColumn<T>(*this, i);
854 }
template<typename T >
TypeTensorColumn< T > libMesh::TypeTensor< T >::slice ( const unsigned int  i)
inlineprotectedinherited

返回 Tensor 的第 i 列的可写代理。

参数
i列索引。
返回
Tensor 第 i 列的可写代理。

在文件 type_tensor.h860 行定义.

861 {
862  libmesh_assert_less (i, LIBMESH_DIM);
863  return TypeTensorColumn<T>(*this, i);
864 }
template<typename T >
void libMesh::TypeTensor< T >::solve ( const TypeVector< T > &  b,
TypeVector< T > &  x 
) const
inlineprotectedinherited

解方程组 $ A \cdot x = b $ 得到 $ x $,其中 $ A $ 为该 Tensor。

参数
b右侧向量。
[out]x解向量。

在文件 type_tensor.h1219 行定义.

参考 libMesh::TypeTensor< T >::_coords.

1220 {
1221 #if LIBMESH_DIM == 1
1222  if (_coords[0] == static_cast<T>(0.))
1223  libmesh_convergence_failure();
1224  x(0) = b(0) / _coords[0];
1225 #endif
1226 
1227 #if LIBMESH_DIM == 2
1228  T my_det = _coords[0]*_coords[3] - _coords[1]*_coords[2];
1229 
1230  if (my_det == static_cast<T>(0.))
1231  libmesh_convergence_failure();
1232 
1233  T my_det_inv = 1./my_det;
1234 
1235  x(0) = my_det_inv*( _coords[3]*b(0) - _coords[1]*b(1));
1236  x(1) = my_det_inv*(-_coords[2]*b(0) + _coords[0]*b(1));
1237 #endif
1238 
1239 #if LIBMESH_DIM == 3
1240  T my_det =
1241  // a11*(a33 *a22 - a32 *a23)
1242  _coords[0]*(_coords[8]*_coords[4] - _coords[7]*_coords[5])
1243  // -a21*(a33 *a12 - a32 *a13)
1244  -_coords[3]*(_coords[8]*_coords[1] - _coords[7]*_coords[2]) +
1245  // +a31*(a23 *a12 - a22 *a13)
1246  +_coords[6]*(_coords[5]*_coords[1] - _coords[4]*_coords[2]);
1247 
1248  if (my_det == static_cast<T>(0.))
1249  libmesh_convergence_failure();
1250 
1251  T my_det_inv = 1./my_det;
1252  x(0) = my_det_inv*((_coords[8]*_coords[4] - _coords[7]*_coords[5])*b(0) -
1253  (_coords[8]*_coords[1] - _coords[7]*_coords[2])*b(1) +
1254  (_coords[5]*_coords[1] - _coords[4]*_coords[2])*b(2));
1255 
1256  x(1) = my_det_inv*((_coords[6]*_coords[5] - _coords[8]*_coords[3])*b(0) +
1257  (_coords[8]*_coords[0] - _coords[6]*_coords[2])*b(1) -
1258  (_coords[5]*_coords[0] - _coords[3]*_coords[2])*b(2));
1259 
1260  x(2) = my_det_inv*((_coords[7]*_coords[3] - _coords[6]*_coords[4])*b(0) -
1261  (_coords[7]*_coords[0] - _coords[6]*_coords[1])*b(1) +
1262  (_coords[4]*_coords[0] - _coords[3]*_coords[1])*b(2));
1263 #endif
1264 }
T _coords[LIBMESH_DIM *LIBMESH_DIM]
TypeTensor 的坐标
Definition: type_tensor.h:500
template<typename T >
template<typename T2 >
void libMesh::TypeTensor< T >::subtract ( const TypeTensor< T2 > &  p)
inlineprotectedinherited

在不创建临时 Tensor 的情况下从该 Tensor 减去另一个 Tensor。

模板参数
T2另一个 Tensor 的元素类型。
参数
p要减去的 Tensor。

在文件 type_tensor.h1000 行定义.

参考 libMesh::TypeTensor< T >::_coords.

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

1001 {
1002  for (unsigned int i=0; i<LIBMESH_DIM*LIBMESH_DIM; i++)
1003  _coords[i] -= p._coords[i];
1004 }
T _coords[LIBMESH_DIM *LIBMESH_DIM]
TypeTensor 的坐标
Definition: type_tensor.h:500
template<typename T >
template<typename T2 >
void libMesh::TypeTensor< T >::subtract_scaled ( const TypeTensor< T2 > &  p,
const T &  factor 
)
inlineprotectedinherited

在不创建临时 Tensor 的情况下从该 Tensor 减去一个缩放的 Tensor。

模板参数
T2另一个 Tensor 的元素类型。
参数
p要减去的 Tensor。
scale缩放因子。

在文件 type_tensor.h1011 行定义.

参考 libMesh::TypeTensor< T >::_coords.

1012 {
1013  for (unsigned int i=0; i<LIBMESH_DIM*LIBMESH_DIM; i++)
1014  _coords[i] -= factor*p._coords[i];
1015 }
T _coords[LIBMESH_DIM *LIBMESH_DIM]
TypeTensor 的坐标
Definition: type_tensor.h:500
template<typename T >
T libMesh::TypeTensor< T >::tr ( ) const
inlineprotectedinherited

返回 Tensor 的迹。

返回
Tensor 的迹。

在文件 type_tensor.h1411 行定义.

参考 libMesh::TypeTensor< T >::_coords.

1412 {
1413 #if LIBMESH_DIM == 1
1414  return _coords[0];
1415 #endif
1416 
1417 #if LIBMESH_DIM == 2
1418  return _coords[0] + _coords[3];
1419 #endif
1420 
1421 #if LIBMESH_DIM == 3
1422  return _coords[0] + _coords[4] + _coords[8];
1423 #endif
1424 }
T _coords[LIBMESH_DIM *LIBMESH_DIM]
TypeTensor 的坐标
Definition: type_tensor.h:500
template<typename T >
TypeTensor< T > libMesh::TypeTensor< T >::transpose ( ) const
inlineprotectedinherited

返回该 Tensor 的转置(对于复数不共轭)。

返回
该 Tensor 的转置。

在文件 type_tensor.h1140 行定义.

参考 libMesh::TypeTensor< T >::_coords , 以及 libMesh::TypeTensor< T >::TypeTensor().

1141 {
1142 #if LIBMESH_DIM == 1
1143  return TypeTensor(_coords[0]);
1144 #endif
1145 
1146 #if LIBMESH_DIM == 2
1147  return TypeTensor(_coords[0],
1148  _coords[2],
1149  _coords[1],
1150  _coords[3]);
1151 #endif
1152 
1153 #if LIBMESH_DIM == 3
1154  return TypeTensor(_coords[0],
1155  _coords[3],
1156  _coords[6],
1157  _coords[1],
1158  _coords[4],
1159  _coords[7],
1160  _coords[2],
1161  _coords[5],
1162  _coords[8]);
1163 #endif
1164 }
TypeTensor()
Empty constructor.
Definition: type_tensor.h:615
T _coords[LIBMESH_DIM *LIBMESH_DIM]
TypeTensor 的坐标
Definition: type_tensor.h:500
template<typename T >
void libMesh::TypeTensor< T >::write_unformatted ( std::ostream &  out_stream,
const bool  newline = true 
) const
protectedinherited

无格式输出到流,默认为打印元素并以空格和换行符分隔。

参数
[out]out_stream输出流。
newline是否输出换行符。

在文件 type_tensor.C83 行定义.

85 {
86  libmesh_assert (out_stream);
87 
88  out_stream << std::setiosflags(std::ios::showpoint)
89  << (*this)(0,0) << " "
90  << (*this)(0,1) << " "
91  << (*this)(0,2) << " ";
92  if (newline)
93  out_stream << '\n';
94 
95  out_stream << std::setiosflags(std::ios::showpoint)
96  << (*this)(1,0) << " "
97  << (*this)(1,1) << " "
98  << (*this)(1,2) << " ";
99  if (newline)
100  out_stream << '\n';
101 
102  out_stream << std::setiosflags(std::ios::showpoint)
103  << (*this)(2,0) << " "
104  << (*this)(2,1) << " "
105  << (*this)(2,2) << " ";
106  if (newline)
107  out_stream << '\n';
108 }
template<typename T >
void libMesh::TypeTensor< T >::zero ( )
inlineprotectedinherited

将 Tensor 的所有元素设置为零。

在文件 type_tensor.h1428 行定义.

参考 libMesh::TypeTensor< T >::_coords.

参考自 libMesh::TypeTensor< T >::operator=() , 以及 libMesh::TensorValue< T >::operator=().

1429 {
1430  for (unsigned int i=0; i<LIBMESH_DIM*LIBMESH_DIM; i++)
1431  _coords[i] = 0.;
1432 }
T _coords[LIBMESH_DIM *LIBMESH_DIM]
TypeTensor 的坐标
Definition: type_tensor.h:500

类成员变量说明

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

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