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

该类最终将定义一个在类型为T的LIBMESH_DIM维空间中的N阶张量。 更多...

#include <tensor_tools.h>

Public 类型

typedef tuple_of< N, unsigned int > index_type
 用于通用索引编程的辅助typedef 更多...
 

Public 成员函数

 TypeNTensor ()
 
 TypeNTensor (const T &)
 
 TypeNTensor (const TypeVector< T > &)
 
 TypeNTensor (const TypeTensor< T > &)
 
 TypeNTensor (const TypeNTensor< N, T > &)
 
TypeNTensoroperator= (const TypeNTensor< N, T > &)
 
 operator TypeVector< T > () const
 
 operator VectorValue< T > () const
 
 operator TypeTensor< T > () const
 
 operator TensorValue< T > () const
 
 ~TypeNTensor ()=default
 
const TypeNTensor< N-1, T > slice (const unsigned int) const
 
TypeNTensor< N-1, T > slice (const unsigned int)
 
template<typename Scalar >
boostcopy::enable_if_c
< ScalarTraits< Scalar >
::value, TypeNTensor & >::type 
operator= (const Scalar &libmesh_dbg_var(p))
 
template<typename T2 >
TypeNTensor< N, typename
CompareTypes< T, T2 >
::supertype > 
operator+ (const TypeNTensor< N, T2 > &) const
 
template<typename T2 >
const TypeNTensor< N, T > & operator+= (const TypeNTensor< N, T2 > &)
 
template<typename T2 >
TypeNTensor< N, typename
CompareTypes< T, T2 >
::supertype > 
operator- (const TypeNTensor< N, T2 > &) const
 
template<typename T2 >
const TypeNTensor< N, T > & operator-= (const TypeNTensor< N, T2 > &)
 
TypeNTensor< N, T > operator- () const
 
template<typename Scalar >
boostcopy::enable_if_c
< ScalarTraits< Scalar >
::value, TypeNTensor< N,
typename CompareTypes< T,
Scalar >::supertype > >::type 
operator* (const Scalar) const
 
template<typename Scalar >
const TypeNTensor< N, T > & operator*= (const Scalar)
 
template<typename Scalar >
boostcopy::enable_if_c
< ScalarTraits< Scalar >
::value, TypeNTensor< N,
typename CompareTypes< T,
Scalar >::supertype > >::type 
operator/ (const Scalar) const
 
const TypeNTensor< N, T > & operator/= (const T)
 
template<typename T2 >
CompareTypes< T, T2 >::supertype contract (const TypeNTensor< N, T2 > &) const
 将两个张量相乘,返回一个标量,即 $ \sum_{ij} A_{ij} B_{ij} $ 张量可能包含不同的数值类型。 也被称为张量的“双内积”或“双点积”。 更多...
 
auto norm_sq () const -> decltype(std::norm(T()))
 
void zero ()
 将张量的所有分量设置为0。 更多...
 
bool operator== (const TypeNTensor< N, T > &) const
 
bool operator< (const TypeNTensor< N, T > &) const
 
bool operator> (const TypeNTensor< N, T > &) const
 
void print (std::ostream &) const
 将该张量格式化打印到流中,默认为libMesh::out。 更多...
 
template<typename T2 >
void add_scaled (const TypeNTensor< N, T2 > &, const T &)
 将一个经过缩放的类型N张量添加到该类型N张量中,而不创建临时张量。 更多...
 

Public 属性

std::vector< T > _coords
 TypeNTensor的坐标 更多...
 

静态 Private 成员函数

static constexpr int int_pow (int b, int e)
 

友元

std::ostream & operator<< (std::ostream &os, const TypeNTensor< N, T > &t)
 执行格式化打印(如上所述),但支持以下语法: 更多...
 

详细描述

template<unsigned int N, typename T>
class libMesh::TypeNTensor< N, T >

该类最终将定义一个在类型为T的LIBMESH_DIM维空间中的N阶张量。

目前,它定义了一个占位符,允许在矢量值元素和二阶导数的情况下编译(但不提供正确的结果), 以便实现与张量阶数无关的代码。

作者
Roy Stogner
日期
2012

在文件 tensor_tools.h38 行定义.

成员类型定义说明

template<unsigned int N, typename T>
typedef tuple_of<N, unsigned int> libMesh::TypeNTensor< N, T >::index_type

用于通用索引编程的辅助typedef

在文件 type_n_tensor.h52 行定义.

构造及析构函数说明

template<unsigned int N, typename T>
libMesh::TypeNTensor< N, T >::TypeNTensor ( )
inline

在文件 type_n_tensor.h55 行定义.

55 : _coords(std::vector<T>(int_pow(LIBMESH_DIM, N))) {}
static constexpr int int_pow(int b, int e)
std::vector< T > _coords
TypeNTensor的坐标
template<unsigned int N, typename T>
libMesh::TypeNTensor< N, T >::TypeNTensor ( const T &  )
inline

在文件 type_n_tensor.h58 行定义.

58 : _coords(std::vector<T>(int_pow(LIBMESH_DIM, N))) {}
static constexpr int int_pow(int b, int e)
std::vector< T > _coords
TypeNTensor的坐标
template<unsigned int N, typename T>
libMesh::TypeNTensor< N, T >::TypeNTensor ( const TypeVector< T > &  )
inline

在文件 type_n_tensor.h61 行定义.

61 : _coords(std::vector<T>(int_pow(LIBMESH_DIM, N))) {}
static constexpr int int_pow(int b, int e)
std::vector< T > _coords
TypeNTensor的坐标
template<unsigned int N, typename T>
libMesh::TypeNTensor< N, T >::TypeNTensor ( const TypeTensor< T > &  )
inline

在文件 type_n_tensor.h64 行定义.

64 : _coords(std::vector<T>(int_pow(LIBMESH_DIM, N))) {}
static constexpr int int_pow(int b, int e)
std::vector< T > _coords
TypeNTensor的坐标
template<unsigned int N, typename T>
libMesh::TypeNTensor< N, T >::TypeNTensor ( const TypeNTensor< N, T > &  )
inline

在文件 type_n_tensor.h67 行定义.

67 : _coords(std::vector<T>(int_pow(LIBMESH_DIM, N))) {}
static constexpr int int_pow(int b, int e)
std::vector< T > _coords
TypeNTensor的坐标
template<unsigned int N, typename T>
libMesh::TypeNTensor< N, T >::~TypeNTensor ( )
default

成员函数说明

template<unsigned int N, typename T >
template<typename T2 >
void libMesh::TypeNTensor< N, T >::add_scaled ( const TypeNTensor< N, T2 > &  p,
const T &  factor 
)
inline

将一个经过缩放的类型N张量添加到该类型N张量中,而不创建临时张量。

在文件 type_n_tensor.h286 行定义.

287 {
288  unsigned int size = int_pow(LIBMESH_DIM, N);
289  for (unsigned int i = 0; i < size ; i++)
290  _coords[i] += factor*p._coords[i];
291 }
static constexpr int int_pow(int b, int e)
std::vector< T > _coords
TypeNTensor的坐标
template<unsigned int N, typename T>
template<typename T2 >
CompareTypes<T,T2>::supertype libMesh::TypeNTensor< N, T >::contract ( const TypeNTensor< N, T2 > &  ) const
inline

将两个张量相乘,返回一个标量,即 $ \sum_{ij} A_{ij} B_{ij} $ 张量可能包含不同的数值类型。 也被称为张量的“双内积”或“双点积”。

返回
标量值的结果,该张量保持不变。

在文件 type_n_tensor.h197 行定义.

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

198  {
199  libmesh_not_implemented();
200  return 0;
201  }
template<unsigned int N, typename T>
static constexpr int libMesh::TypeNTensor< N, T >::int_pow ( int  b,
int  e 
)
inlinestaticprivate

在文件 type_n_tensor.h276 行定义.

277  {
278  return (e == 0) ? 1 : b * int_pow(b, e - 1);
279  }
static constexpr int int_pow(int b, int e)
template<unsigned int N, typename T>
auto libMesh::TypeNTensor< N, T >::norm_sq ( ) const -> decltype(std::norm(T()))
inline
返回
张量的Frobenius范数的平方,即各个分量的平方和。

在文件 type_n_tensor.h206 行定义.

207  {
208  libmesh_not_implemented();
209  return 0.;
210  }
template<unsigned int N, typename T>
libMesh::TypeNTensor< N, T >::operator TensorValue< T > ( ) const
inline

在文件 type_n_tensor.h78 行定义.

78 { libmesh_not_implemented(); return 0; }
template<unsigned int N, typename T>
libMesh::TypeNTensor< N, T >::operator TypeTensor< T > ( ) const
inline

在文件 type_n_tensor.h77 行定义.

77 { libmesh_not_implemented(); return 0; }
template<unsigned int N, typename T>
libMesh::TypeNTensor< N, T >::operator TypeVector< T > ( ) const
inline

在文件 type_n_tensor.h73 行定义.

73 { libmesh_not_implemented(); return 0; }
template<unsigned int N, typename T>
libMesh::TypeNTensor< N, T >::operator VectorValue< T > ( ) const
inline

在文件 type_n_tensor.h74 行定义.

74 { libmesh_not_implemented(); return 0; }
template<unsigned int N, typename T>
template<typename Scalar >
boostcopy::enable_if_c< ScalarTraits<Scalar>::value, TypeNTensor<N,typename CompareTypes<T, Scalar>::supertype> >::type libMesh::TypeNTensor< N, T >::operator* ( const Scalar  ) const
inline

在文件 type_n_tensor.h155 行定义.

156  {
157  libmesh_not_implemented();
158  return TypeNTensor<N,typename CompareTypes<T, Scalar>::supertype>();
159  }
template<unsigned int N, typename T>
template<typename Scalar >
const TypeNTensor<N,T>& libMesh::TypeNTensor< N, T >::operator*= ( const Scalar  )
inline

在文件 type_n_tensor.h163 行定义.

164  {
165  libmesh_not_implemented();
166  return *this;
167  }
template<unsigned int N, typename T>
template<typename T2 >
TypeNTensor<N,typename CompareTypes<T, T2>::supertype> libMesh::TypeNTensor< N, T >::operator+ ( const TypeNTensor< N, T2 > &  ) const
inline

在文件 type_n_tensor.h112 行定义.

113  {
114  libmesh_not_implemented();
115  return TypeNTensor<N,typename CompareTypes<T,T2>::supertype>();
116  }
template<unsigned int N, typename T>
template<typename T2 >
const TypeNTensor<N,T>& libMesh::TypeNTensor< N, T >::operator+= ( const TypeNTensor< N, T2 > &  )
inline

在文件 type_n_tensor.h120 行定义.

121  {
122  libmesh_not_implemented();
123  return *this;
124  }
template<unsigned int N, typename T>
template<typename T2 >
TypeNTensor<N,typename CompareTypes<T, T2>::supertype> libMesh::TypeNTensor< N, T >::operator- ( const TypeNTensor< N, T2 > &  ) const
inline

在文件 type_n_tensor.h129 行定义.

130  {
131  libmesh_not_implemented();
132  return TypeNTensor<N,typename CompareTypes<T,T2>::supertype>();
133  }
template<unsigned int N, typename T>
TypeNTensor<N,T> libMesh::TypeNTensor< N, T >::operator- ( ) const
inline

在文件 type_n_tensor.h144 行定义.

145  {
146  libmesh_not_implemented();
147  return *this;
148  }
template<unsigned int N, typename T>
template<typename T2 >
const TypeNTensor<N,T>& libMesh::TypeNTensor< N, T >::operator-= ( const TypeNTensor< N, T2 > &  )
inline

在文件 type_n_tensor.h137 行定义.

138  {
139  libmesh_not_implemented();
140  return *this;
141  }
template<unsigned int N, typename T>
template<typename Scalar >
boostcopy::enable_if_c< ScalarTraits<Scalar>::value, TypeNTensor<N,typename CompareTypes<T, Scalar>::supertype> >::type libMesh::TypeNTensor< N, T >::operator/ ( const Scalar  ) const
inline

在文件 type_n_tensor.h174 行定义.

175  {
176  libmesh_not_implemented();
177  return *this;
178  }
template<unsigned int N, typename T>
const TypeNTensor<N,T>& libMesh::TypeNTensor< N, T >::operator/= ( const T  )
inline

在文件 type_n_tensor.h181 行定义.

182  {
183  libmesh_not_implemented();
184  return *this;
185  }
template<unsigned int N, typename T>
bool libMesh::TypeNTensor< N, T >::operator< ( const TypeNTensor< N, T > &  ) const
inline
返回
如果这个张量“小于”另一个张量,则返回true。

用于排序。

在文件 type_n_tensor.h231 行定义.

232  {
233  libmesh_not_implemented();
234  return false;
235  }
template<unsigned int N, typename T>
TypeNTensor& libMesh::TypeNTensor< N, T >::operator= ( const TypeNTensor< N, T > &  )
inline

在文件 type_n_tensor.h70 行定义.

70 { libmesh_not_implemented(); return *this; }
template<unsigned int N, typename T>
template<typename Scalar >
boostcopy::enable_if_c< ScalarTraits<Scalar>::value, TypeNTensor &>::type libMesh::TypeNTensor< N, T >::operator= ( const Scalar &  libmesh_dbg_varp)
inline

在文件 type_n_tensor.h106 行定义.

参考 libMesh::TypeNTensor< N, T >::zero().

107  { libmesh_assert_equal_to (p, Scalar(0)); this->zero(); return *this; }
void zero()
将张量的所有分量设置为0。
template<unsigned int N, typename T>
bool libMesh::TypeNTensor< N, T >::operator== ( const TypeNTensor< N, T > &  ) const
inline
返回
如果两个张量相等,则返回true,否则返回false。

在文件 type_n_tensor.h220 行定义.

221  {
222  libmesh_not_implemented();
223  return true;
224  }
template<unsigned int N, typename T>
bool libMesh::TypeNTensor< N, T >::operator> ( const TypeNTensor< N, T > &  ) const
inline
返回
如果这个张量“大于”另一个张量,则返回true。

在文件 type_n_tensor.h240 行定义.

241  {
242  libmesh_not_implemented();
243  return false;
244  }
template<unsigned int N, typename T>
void libMesh::TypeNTensor< N, T >::print ( std::ostream &  ) const
inline

将该张量格式化打印到流中,默认为libMesh::out。

在文件 type_n_tensor.h249 行定义.

249 {}
template<unsigned int N, typename T>
const TypeNTensor<N-1,T> libMesh::TypeNTensor< N, T >::slice ( const unsigned  int) const
inline
返回
张量的第i个切片的代理。

在文件 type_n_tensor.h86 行定义.

87  {
88  libmesh_not_implemented();
89  return TypeNTensor<N-1,T>();
90  }
template<unsigned int N, typename T>
TypeNTensor<N-1,T> libMesh::TypeNTensor< N, T >::slice ( const unsigned  int)
inline
返回
张量的第i个切片的可写代理。

在文件 type_n_tensor.h95 行定义.

96  {
97  libmesh_not_implemented();
98  return TypeNTensor<N-1,T>();
99  }
template<unsigned int N, typename T>
void libMesh::TypeNTensor< N, T >::zero ( )
inline

将张量的所有分量设置为0。

在文件 type_n_tensor.h215 行定义.

参考自 libMesh::TypeNTensor< N, T >::operator=().

215 { libmesh_not_implemented(); }

友元及相关函数文档

template<unsigned int N, typename T>
std::ostream& operator<< ( std::ostream &  os,
const TypeNTensor< N, T > &  t 
)
friend

执行格式化打印(如上所述),但支持以下语法:

std::cout << t << std::endl;

在文件 type_n_tensor.h257 行定义.

259  {
260  t.print(os);
261  return os;
262  }

类成员变量说明

template<unsigned int N, typename T>
std::vector<T> libMesh::TypeNTensor< N, T >::_coords

TypeNTensor的坐标

在文件 type_n_tensor.h273 行定义.


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