1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
27 #include "dictionary.H"
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 Foam::debug::debugSwitch
33 Foam::messageStream::level
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 Foam::messageStream::messageStream
51 maxErrors_(maxErrors),
56 Foam::messageStream::messageStream(const dictionary& dict)
58 title_(dict.lookup("title")),
65 Foam::OSstream& Foam::messageStream::operator()
67 const char* functionName,
68 const char* sourceFileName,
69 const int sourceFileLineNumber
72 OSstream& os = operator OSstream&();
75 << " From function " << functionName << endl
76 << " in file " << sourceFileName
77 << " at line " << sourceFileLineNumber << endl
84 Foam::OSstream& Foam::messageStream::operator()
86 const string& functionName,
87 const char* sourceFileName,
88 const int sourceFileLineNumber
100 Foam::OSstream& Foam::messageStream::operator()
102 const char* functionName,
103 const char* sourceFileName,
104 const int sourceFileLineNumber,
105 const string& ioFileName,
106 const label ioStartLineNumber,
107 const label ioEndLineNumber
110 OSstream& os = operator OSstream&();
113 << " From function " << functionName << endl
114 << " in file " << sourceFileName
115 << " at line " << sourceFileLineNumber << endl
116 << " Reading " << ioFileName;
118 if (ioStartLineNumber >= 0 && ioEndLineNumber >= 0)
120 os << " from line " << ioStartLineNumber
121 << " to line " << ioEndLineNumber;
123 else if (ioStartLineNumber >= 0)
125 os << " at line " << ioStartLineNumber;
134 Foam::OSstream& Foam::messageStream::operator()
136 const char* functionName,
137 const char* sourceFileName,
138 const int sourceFileLineNumber,
139 const IOstream& ioStream
146 sourceFileLineNumber,
148 ioStream.lineNumber(),
154 Foam::OSstream& Foam::messageStream::operator()
156 const char* functionName,
157 const char* sourceFileName,
158 const int sourceFileLineNumber,
159 const dictionary& dict
166 sourceFileLineNumber,
168 dict.startLineNumber(),
174 Foam::messageStream::operator Foam::OSstream&()
178 bool collect = (severity_ == INFO || severity_ == WARNING);
181 if (!Pstream::master() && collect)
189 if (Pstream::parRun() && !collect)
191 Pout<< title().c_str();
195 Sout<< title().c_str();
203 if (errorCount_ >= maxErrors_)
205 FatalErrorIn("messageStream::operator OSstream&()")
207 << abort(FatalError);
211 if (Pstream::parRun() && !collect)
226 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
227 // Global messageStream definitions
229 Foam::messageStream Foam::SeriousError
231 "--> FOAM Serious Error : ",
232 messageStream::SERIOUS,
236 Foam::messageStream Foam::Warning
238 "--> FOAM Warning : ",
239 messageStream::WARNING
242 Foam::messageStream Foam::Info("", messageStream::INFO);
245 // ************************************************************************* //