⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fmtnum.h

📁 crack modeling with xfem
💻 H
字号:
/* 2008 (c) Dorival M. Pedroso */#ifndef MPM_FMTNUM_H#define MPM_FMTNUM_H// STL#include <iostream>#include <iomanip>/** Formatting Numbers via STL streams. */struct FmtNum{	bool BoolAlpha;  ///< Format output as a boolean?	bool Integer;    ///< Format output as an integer?	bool Scientific; ///< Format output as a scientific number?	int  Width;      ///< Width of the output	int  Precision;  ///< Precision for floating point numbers};//                 bool  integ  scien   w   pFmtNum _a     = {  true, false, false,  0,  0 }; ///< BooleanFmtNum _3     = { false,  true, false,  3,  0 }; ///< IntegerFmtNum _4     = { false,  true, false,  4,  0 }; ///< IntegerFmtNum _6     = { false,  true, false,  6,  0 }; ///< IntegerFmtNum _8     = { false,  true, false,  8,  0 }; ///< IntegerFmtNum _3s    = { false, false,  true,  0,  3 }; ///< ScientificFmtNum _8s    = { false, false,  true,  0,  8 }; ///< ScientificFmtNum _4_2   = { false, false, false,  4,  2 }; ///< GeneralFmtNum _6_3   = { false, false, false,  6,  3 }; ///< GeneralFmtNum _12_6  = { false, false, false, 12,  6 }; ///< GeneralFmtNum _20_15 = { false, false, false, 20, 15 }; ///< General/** Format the output. */std::ostream & operator<< (std::ostream & os, FmtNum const & FN){	     if (FN.BoolAlpha)  { os<<" "<<std::setw(6)<<std::boolalpha; return os; }	else if (FN.Integer)    { os<<" "<<std::setw(FN.Width); return os; }	else if (FN.Scientific) { os<<" "<<std::setw(FN.Precision+9)<<std::scientific<<std::setprecision(FN.Precision); return os; } // add 9	else                    { os<<" "<<std::setw(FN.Width+1)<<std::fixed<<std::setprecision(FN.Precision); return os; } // add 1 (for sign)}#endif // MPM_FMTNUM_H/* 2008 (c) Dorival M. Pedroso */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -