Added: Virtual method printStep for app-specific time step headers

This commit is contained in:
Knut Morten Okstad 2018-04-22 08:35:55 +02:00
parent 3167d115a1
commit 095c671396
4 changed files with 34 additions and 13 deletions

View File

@ -314,11 +314,16 @@ SIM::ConvStatus NewmarkSIM::solveStep (TimeStep& param, SIM::SolutionMode,
if (msgLevel >= 0)
{
utl::LogStream& cout = model.getProcessAdm().cout;
double digits = log10(param.time.t)-log10(param.time.dt);
size_t stdPrec = digits > 6.0 ? cout.precision(ceil(digits)) : 0;
cout <<"\n step="<< param.step <<" time="<< param.time.t << std::endl;
if (digits > 6.0) cout.precision(stdPrec);
double digits = log10(param.time.t) - log10(param.time.dt);
if (digits > 6.0)
{
utl::LogStream& cout = model.getProcessAdm().cout;
std::streamsize oldPrec = cout.precision(ceil(digits));
model.printStep(param.step,param.time);
cout.precision(oldPrec);
}
else
model.printStep(param.step,param.time);
}
if (subiter&FIRST && !model.updateDirichlet(param.time.t,&solution.front()))

View File

@ -203,15 +203,16 @@ ConvStatus NonLinSIM::solveStep (TimeStep& param, SolutionMode mode,
if (msgLevel >= 0)
{
utl::LogStream& cout = model.getProcessAdm().cout;
double digits = log10(param.time.t)-log10(param.time.dt);
std::streamsize oldPrec = digits > 6.0 ? cout.precision(ceil(digits)) : 0;
cout <<"\n step="<< param.step <<" time="<< param.time.t;
if (param.maxCFL > 0.0 || param.maxCFL < -0.5)
cout <<" CFL = "<< param.time.CFL << std::endl;
double digits = log10(param.time.t) - log10(param.time.dt);
if (digits > 6.0)
{
utl::LogStream& cout = model.getProcessAdm().cout;
std::streamsize oldPrec = cout.precision(ceil(digits));
model.printStep(param.step,param.time);
cout.precision(oldPrec);
}
else
cout << std::endl;
if (oldPrec > 0) cout << std::setprecision(oldPrec);
model.printStep(param.step,param.time);
}
param.iter = 0;

View File

@ -1055,6 +1055,12 @@ bool SIMbase::solveMatrixSystem (Vectors& solution, int printSol,
}
void SIMbase::printStep (int istep, const TimeDomain& time) const
{
adm.cout <<"\n step="<< istep <<" time="<< time.t << std::endl;
}
void SIMbase::printSolutionSummary (const Vector& solution, int printSol,
const char* compName,
std::streamsize outPrec)

View File

@ -385,6 +385,15 @@ public:
//! \param eNorm Matrix with element norms
virtual bool postProcessNorms(Vectors& gNorm, Matrix* eNorm) { return true; }
//! \brief Prints out load/time step identification.
//! \param[in] istep Load- or time step counter
//! \param[in] time Parameters for nonlinear/time-dependent simulations
//!
//! \details This method is used by multi-step simulators to print out
//! a heading when starting a new load/time increment. Override this method
//! if your simulator have some additional data to be printed.
virtual void printStep(int istep, const TimeDomain& time) const;
//! \brief Prints a summary of the calculated solution to std::cout.
//! \param[in] solution The solution vector
//! \param[in] printSol Print solution only if size is less than this value