libmesh解析
本工作只是尝试解析原libmesh的代码,供学习使用
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 
dense_vector_base.C
浏览该文件的文档.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2023 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 // C++ includes
19 #include <iostream>
20 #include <iomanip> // for std::setw
21 
22 
23 // Local Includes
24 #include "libmesh/dense_vector_base.h"
25 #include "libmesh/int_range.h"
26 
27 namespace libMesh
28 {
29 
30 template<typename T>
31 void DenseVectorBase<T>::print_scientific (std::ostream & os, unsigned precision) const
32 {
33  // save the initial format flags
34  std::ios_base::fmtflags os_flags = os.flags();
35 
36  // Print the vector entries.
37  for (auto i : make_range(this->size()))
38  os << std::setw(10)
39  << std::scientific
40  << std::setprecision(precision)
41  << this->el(i)
42  << std::endl;
43 
44  // reset the original format flags
45  os.flags(os_flags);
46 }
47 
48 
49 
50 template<typename T>
51 void DenseVectorBase<T>::print (std::ostream & os) const
52 {
53  for (auto i : make_range(this->size()))
54  os << std::setw(8)
55  << this->el(i)
56  << std::endl;
57 }
58 
59 
60 //--------------------------------------------------------------
61 // Explicit instantiations
62 template class LIBMESH_EXPORT DenseVectorBase<Real>;
63 
64 #ifdef LIBMESH_USE_COMPLEX_NUMBERS
65 template class LIBMESH_EXPORT DenseVectorBase<Complex>;
66 #endif
67 
68 } // namespace libMesh
void print_scientific(std::ostream &os, unsigned precision=8) const
以科学计数法在额外的小数位数下打印向量的条目。
void print(std::ostream &os) const
将向量漂亮地打印到 stdout。
定义用于有限元计算的抽象稠密向量基类。 可以从这个类派生出特定的稠密向量,例如 DenseSubVectors。
Definition: dof_map.h:63