本文整理汇总了C++中Ostream::precision方法的典型用法代码示例。如果您正苦于以下问题:C++ Ostream::precision方法的具体用法?C++ Ostream::precision怎么用?C++ Ostream::precision使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ostream
的用法示例。
在下文中一共展示了Ostream::precision方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: set
void cnoidalFirstProperties::set( Ostream& os)
{
scalar m = solve();
// Write the beginning of the sub-dictionary
writeBeginning( os );
// Write the already given parameters
writeGiven( os, "waveType" );
if (dict_.found( "Tsoft" ))
{
writeGiven( os, "Tsoft");
}
writeGiven( os, "depth");
writeGiven( os, "period");
writeGiven( os, "height");
if (m < 0.0)
{
Info << "\nPARAMETERS NOT SET\nNo cnoidal wave solution"
<< " exists for given input\n" << endl;
}
else
{
double K = gsl_sf_ellint_Kcomp( Foam::sqrt(m), GSL_PREC_DOUBLE );
double E = gsl_sf_ellint_Ecomp( Foam::sqrt(m), GSL_PREC_DOUBLE );
double A = 2.0/m - 1.0 - 3.0/m*E/K;
double L =
Foam::sqrt(16.0*m * Foam::pow(K, 2.0)*Foam::pow(d_, 3.0)/(3.0*H_));
double c = Foam::sqrt( G_*d_*(1 + A*H_/d_));
double omega = 2*PI_/T_;
if (write_)
{
writeDerived(os, "omega", omega);
writeDerived(os, "length", L);
writeDerived(os, "celerity", c);
// Locally change the write precision for m to avoid it being
// written as 1 instead of 0.9999999999 which makes elliptic
// integrals to infinity.
unsigned int pre = os.precision( 14 );
writeDerived(os, "m", m);
os.precision( pre );
}
}
writeGiven( os, "direction" );
// Write the relaxation zone
writeRelaxationZone( os );
// Write the closing bracket
writeEnding( os );
}