messageStream: Removed unused code and corrected communicator handling
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -41,15 +41,6 @@ Foam::IOerror::IOerror(const string& title)
|
||||
{}
|
||||
|
||||
|
||||
Foam::IOerror::IOerror(const dictionary& errDict)
|
||||
:
|
||||
error(errDict),
|
||||
ioFileName_(errDict.lookup("ioFileName")),
|
||||
ioStartLineNumber_(errDict.lookup<label>("ioStartLineNumber")),
|
||||
ioEndLineNumber_(errDict.lookup<label>("ioEndLineNumber"))
|
||||
{}
|
||||
|
||||
|
||||
Foam::IOerror::~IOerror() throw()
|
||||
{}
|
||||
|
||||
@ -65,6 +56,7 @@ Foam::OSstream& Foam::IOerror::operator()
|
||||
)
|
||||
{
|
||||
error::operator()(functionName, sourceFileName, sourceFileLineNumber);
|
||||
|
||||
ioFileName_ = ioFileName;
|
||||
ioStartLineNumber_ = ioStartLineNumber;
|
||||
ioEndLineNumber_ = ioEndLineNumber;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -54,43 +54,6 @@ Foam::error::error(const string& title)
|
||||
}
|
||||
|
||||
|
||||
Foam::error::error(const dictionary& errDict)
|
||||
:
|
||||
std::exception(),
|
||||
messageStream(errDict),
|
||||
functionName_(errDict.lookup("functionName")),
|
||||
sourceFileName_(errDict.lookup("sourceFileName")),
|
||||
sourceFileLineNumber_(errDict.lookup<label>("sourceFileLineNumber")),
|
||||
abort_(env("FOAM_ABORT")),
|
||||
throwExceptions_(false),
|
||||
messageStreamPtr_(new OStringStream())
|
||||
{
|
||||
if (!messageStreamPtr_->good())
|
||||
{
|
||||
Perr<< endl
|
||||
<< "error::error(const dictionary& errDict) : "
|
||||
"cannot open error stream"
|
||||
<< endl;
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::error::error(const error& err)
|
||||
:
|
||||
std::exception(),
|
||||
messageStream(err),
|
||||
functionName_(err.functionName_),
|
||||
sourceFileName_(err.sourceFileName_),
|
||||
sourceFileLineNumber_(err.sourceFileLineNumber_),
|
||||
abort_(err.abort_),
|
||||
throwExceptions_(err.throwExceptions_),
|
||||
messageStreamPtr_(new OStringStream(*err.messageStreamPtr_))
|
||||
{
|
||||
//*messageStreamPtr_ << err.message();
|
||||
}
|
||||
|
||||
|
||||
Foam::error::~error() throw()
|
||||
{
|
||||
delete messageStreamPtr_;
|
||||
@ -128,7 +91,7 @@ Foam::OSstream& Foam::error::operator()
|
||||
}
|
||||
|
||||
|
||||
Foam::error::operator Foam::OSstream&()
|
||||
Foam::OSstream& Foam::error::operator()()
|
||||
{
|
||||
if (!messageStreamPtr_->good())
|
||||
{
|
||||
|
||||
@ -90,12 +90,6 @@ public:
|
||||
//- Construct from title string
|
||||
error(const string& title);
|
||||
|
||||
//- Construct from dictionary
|
||||
error(const dictionary&);
|
||||
|
||||
//- Copy constructor
|
||||
error(const error&);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~error() throw();
|
||||
@ -148,20 +142,18 @@ public:
|
||||
const int sourceFileLineNumber = 0
|
||||
);
|
||||
|
||||
//- Convert to OSstream
|
||||
// Prints basic message and returns OSstream for further info.
|
||||
operator OSstream&();
|
||||
|
||||
//- Explicitly convert to OSstream for << operations
|
||||
OSstream& operator()()
|
||||
OSstream& operator()();
|
||||
|
||||
//- Convert to OSstream for << operations
|
||||
operator OSstream&()
|
||||
{
|
||||
return operator OSstream&();
|
||||
return this->operator()();
|
||||
}
|
||||
|
||||
//- Create and return a dictionary
|
||||
operator dictionary() const;
|
||||
|
||||
|
||||
//- Helper function to print a stack (if OpenFOAM IO not yet
|
||||
// initialised)
|
||||
static void safePrintStack(std::ostream&);
|
||||
@ -212,9 +204,6 @@ public:
|
||||
//- Construct from title string
|
||||
IOerror(const string& title);
|
||||
|
||||
//- Construct from dictionary
|
||||
IOerror(const dictionary&);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~IOerror() throw();
|
||||
@ -283,7 +272,6 @@ public:
|
||||
//- Create and return a dictionary
|
||||
operator dictionary() const;
|
||||
|
||||
|
||||
//- Exit : can be called for any error to exit program
|
||||
void exit(const int errNo = 1);
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -36,7 +36,7 @@ int Foam::messageStream::level(Foam::debug::debugSwitch("level", 2));
|
||||
Foam::messageStream::messageStream
|
||||
(
|
||||
const string& title,
|
||||
errorSeverity sev,
|
||||
const errorSeverity sev,
|
||||
const int maxErrors
|
||||
)
|
||||
:
|
||||
@ -47,35 +47,6 @@ Foam::messageStream::messageStream
|
||||
{}
|
||||
|
||||
|
||||
Foam::messageStream::messageStream(const dictionary& dict)
|
||||
:
|
||||
title_(dict.lookup("title")),
|
||||
severity_(FATAL),
|
||||
maxErrors_(0),
|
||||
errorCount_(0)
|
||||
{}
|
||||
|
||||
|
||||
Foam::OSstream& Foam::messageStream::masterStream(const label communicator)
|
||||
{
|
||||
if (UPstream::warnComm != -1 && communicator != UPstream::warnComm)
|
||||
{
|
||||
Pout<< "** messageStream with comm:" << communicator
|
||||
<< endl;
|
||||
error::printStack(Pout);
|
||||
}
|
||||
|
||||
if (communicator == UPstream::worldComm || UPstream::master(communicator))
|
||||
{
|
||||
return operator()();
|
||||
}
|
||||
else
|
||||
{
|
||||
return Snull;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::OSstream& Foam::messageStream::operator()
|
||||
(
|
||||
const char* functionName,
|
||||
@ -185,14 +156,35 @@ Foam::OSstream& Foam::messageStream::operator()
|
||||
}
|
||||
|
||||
|
||||
Foam::messageStream::operator Foam::OSstream&()
|
||||
Foam::OSstream& Foam::messageStream::operator()(label communicator)
|
||||
{
|
||||
if (communicator != -1)
|
||||
{
|
||||
if (UPstream::warnComm != -1 && communicator != UPstream::warnComm)
|
||||
{
|
||||
Pout<< "** messageStream with comm:" << communicator
|
||||
<< endl;
|
||||
error::printStack(Pout);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
communicator = UPstream::worldComm;
|
||||
}
|
||||
|
||||
if (level)
|
||||
{
|
||||
bool collect = (severity_ == INFO || severity_ == WARNING);
|
||||
const bool master = Pstream::master(communicator);
|
||||
|
||||
// Report the error
|
||||
if (!Pstream::master() && collect)
|
||||
const bool collect = severity_ == INFO || severity_ == WARNING;
|
||||
|
||||
const bool prefix =
|
||||
(Pstream::parRun() && !collect)
|
||||
|| communicator != UPstream::worldComm;
|
||||
|
||||
OSstream& os = prefix ? Pout : Sout;
|
||||
|
||||
if (!master && collect)
|
||||
{
|
||||
return Snull;
|
||||
}
|
||||
@ -200,14 +192,7 @@ Foam::messageStream::operator Foam::OSstream&()
|
||||
{
|
||||
if (title().size())
|
||||
{
|
||||
if (Pstream::parRun() && !collect)
|
||||
{
|
||||
Pout<< title().c_str();
|
||||
}
|
||||
else
|
||||
{
|
||||
Sout<< title().c_str();
|
||||
}
|
||||
os << title().c_str();
|
||||
}
|
||||
|
||||
if (maxErrors_)
|
||||
@ -222,14 +207,7 @@ Foam::messageStream::operator Foam::OSstream&()
|
||||
}
|
||||
}
|
||||
|
||||
if (Pstream::parRun() && !collect)
|
||||
{
|
||||
return Pout;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Sout;
|
||||
}
|
||||
return os;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -104,15 +104,11 @@ public:
|
||||
messageStream
|
||||
(
|
||||
const string& title,
|
||||
errorSeverity,
|
||||
const errorSeverity,
|
||||
const int maxErrors = 0
|
||||
);
|
||||
|
||||
|
||||
//- Construct from dictionary
|
||||
messageStream(const dictionary&);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the title of this error type
|
||||
@ -134,11 +130,6 @@ public:
|
||||
return maxErrors_;
|
||||
}
|
||||
|
||||
//- Convert to OSstream
|
||||
// Prints to Pout for the master stream
|
||||
OSstream& masterStream(const label communicator);
|
||||
|
||||
|
||||
//- Convert to OSstream
|
||||
// Prints basic message and returns OSstream for further info.
|
||||
OSstream& operator()
|
||||
@ -189,13 +180,13 @@ public:
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Convert to OSstream for << operations
|
||||
operator OSstream&();
|
||||
|
||||
//- Explicitly convert to OSstream for << operations
|
||||
OSstream& operator()()
|
||||
OSstream& operator()(const label communicator = -1);
|
||||
|
||||
//- Convert to OSstream for << operations
|
||||
operator OSstream&()
|
||||
{
|
||||
return operator OSstream&();
|
||||
return this->operator()();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -131,7 +131,7 @@ Foam::solverPerformance Foam::GAMGSolver::solve
|
||||
|
||||
if (debug >= 2)
|
||||
{
|
||||
solverPerf.print(Info.masterStream(matrix().mesh().comm()));
|
||||
solverPerf.print(Info(matrix().mesh().comm()));
|
||||
}
|
||||
} while
|
||||
(
|
||||
@ -654,7 +654,7 @@ void Foam::GAMGSolver::solveCoarsestLevel
|
||||
//
|
||||
// if (debug >= 2)
|
||||
// {
|
||||
// coarseSolverPerf.print(Info.masterStream(coarseComm));
|
||||
// coarseSolverPerf.print(Info(coarseComm));
|
||||
// }
|
||||
//
|
||||
// Pout<< "procAgglom: coarsestSource :" << coarsestSource << endl;
|
||||
@ -700,7 +700,7 @@ void Foam::GAMGSolver::solveCoarsestLevel
|
||||
|
||||
if (debug >= 2)
|
||||
{
|
||||
coarseSolverPerf.print(Info.masterStream(coarseComm));
|
||||
coarseSolverPerf.print(Info(coarseComm));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -132,7 +132,7 @@ Foam::solverPerformance Foam::smoothSolver::solve
|
||||
|
||||
if (lduMatrix::debug >= 2)
|
||||
{
|
||||
Info.masterStream(matrix().mesh().comm())
|
||||
Info(matrix().mesh().comm())
|
||||
<< " Normalisation factor = " << normFactor << endl;
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -61,7 +61,7 @@ Foam::SolverPerformance<Type> Foam::fvMatrix<Type>::solve
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info.masterStream(this->mesh().comm())
|
||||
Info(this->mesh().comm())
|
||||
<< "fvMatrix<Type>::solve(const dictionary& solverControls) : "
|
||||
"solving fvMatrix<Type>"
|
||||
<< endl;
|
||||
@ -108,7 +108,7 @@ Foam::SolverPerformance<Type> Foam::fvMatrix<Type>::solveSegregated
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info.masterStream(this->mesh().comm())
|
||||
Info(this->mesh().comm())
|
||||
<< "fvMatrix<Type>::solveSegregated"
|
||||
"(const dictionary& solverControls) : "
|
||||
"solving fvMatrix<Type>"
|
||||
@ -198,7 +198,7 @@ Foam::SolverPerformance<Type> Foam::fvMatrix<Type>::solveSegregated
|
||||
|
||||
if (SolverPerformance<Type>::debug)
|
||||
{
|
||||
solverPerf.print(Info.masterStream(this->mesh().comm()));
|
||||
solverPerf.print(Info(this->mesh().comm()));
|
||||
}
|
||||
|
||||
solverPerfVec.replace(cmpt, solverPerf);
|
||||
@ -224,7 +224,7 @@ Foam::SolverPerformance<Type> Foam::fvMatrix<Type>::solveCoupled
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info.masterStream(this->mesh().comm())
|
||||
Info(this->mesh().comm())
|
||||
<< "fvMatrix<Type>::solveCoupled"
|
||||
"(const dictionary& solverControls) : "
|
||||
"solving fvMatrix<Type>"
|
||||
@ -265,7 +265,7 @@ Foam::SolverPerformance<Type> Foam::fvMatrix<Type>::solveCoupled
|
||||
|
||||
if (SolverPerformance<Type>::debug)
|
||||
{
|
||||
solverPerf.print(Info.masterStream(this->mesh().comm()));
|
||||
solverPerf.print(Info(this->mesh().comm()));
|
||||
}
|
||||
|
||||
psi.correctBoundaryConditions();
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -62,7 +62,7 @@ Foam::fvMatrix<Foam::scalar>::solver
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info.masterStream(this->mesh().comm())
|
||||
Info(this->mesh().comm())
|
||||
<< "fvMatrix<scalar>::solver(const dictionary& solverControls) : "
|
||||
"solver for fvMatrix<scalar>"
|
||||
<< endl;
|
||||
@ -121,7 +121,7 @@ Foam::solverPerformance Foam::fvMatrix<Foam::scalar>::fvSolver::solve
|
||||
|
||||
if (solverPerformance::debug)
|
||||
{
|
||||
solverPerf.print(Info.masterStream(fvMat_.mesh().comm()));
|
||||
solverPerf.print(Info(fvMat_.mesh().comm()));
|
||||
}
|
||||
|
||||
fvMat_.diag() = saveDiag;
|
||||
@ -142,7 +142,7 @@ Foam::solverPerformance Foam::fvMatrix<Foam::scalar>::solveSegregated
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info.masterStream(this->mesh().comm())
|
||||
Info(this->mesh().comm())
|
||||
<< "fvMatrix<scalar>::solveSegregated"
|
||||
"(const dictionary& solverControls) : "
|
||||
"solving fvMatrix<scalar>"
|
||||
@ -171,7 +171,7 @@ Foam::solverPerformance Foam::fvMatrix<Foam::scalar>::solveSegregated
|
||||
|
||||
if (solverPerformance::debug)
|
||||
{
|
||||
solverPerf.print(Info.masterStream(mesh().comm()));
|
||||
solverPerf.print(Info(mesh().comm()));
|
||||
}
|
||||
|
||||
diag() = saveDiag;
|
||||
|
||||
Reference in New Issue
Block a user