Merge pull request #1599 from andlaus/fast_banner

flow: print the startup banner immediately
This commit is contained in:
Atgeirr Flø Rasmussen 2018-10-24 15:12:38 +02:00 committed by GitHub
commit 08e26f523d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 27 deletions

View File

@ -134,13 +134,17 @@ int main(int argc, char** argv)
deckFilename = PreVanguard::canonicalDeckPath(deckFilename).string();
}
catch (const std::exception& e) {
Ewoms::Parameters::printUsage<PreTypeTag>(PreProblem::helpPreamble(argc, const_cast<const char**>(argv)),
e.what());
std::cerr << "Exception received: " << e.what() << ". Try '--help' for a usage description.\n";
return 1;
}
if (outputCout)
Opm::FlowMainEbos<PreTypeTag>::printBanner();
// Create Deck and EclipseState.
try {
std::cout << "Reading deck file '" << deckFilename << "'\n";
std::cout.flush();
Opm::Parser parser;
typedef std::pair<std::string, Opm::InputError::Action> ParseModePair;
typedef std::vector<ParseModePair> ParseModePairs;

View File

@ -19,7 +19,6 @@
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OPM_FLOW_MAIN_EBOS_HEADER_INCLUDED
#define OPM_FLOW_MAIN_EBOS_HEADER_INCLUDED
@ -193,6 +192,24 @@ namespace Opm
return status;
}
static void printBanner()
{
const int lineLen = 70;
const std::string version = moduleVersionName();
const std::string banner = "This is flow "+version;
const int bannerPreLen = (lineLen - 2 - banner.size())/2;
const int bannerPostLen = bannerPreLen + (lineLen - 2 - banner.size())%2;
std::cout << "**********************************************************************\n";
std::cout << "* *\n";
std::cout << "*" << std::string(bannerPreLen, ' ') << banner << std::string(bannerPostLen, ' ') << "*\n";
std::cout << "* *\n";
std::cout << "* Flow is a simulator for fully implicit three-phase black-oil flow, *\n";
std::cout << "* including solvent and polymer capabilities. *\n";
std::cout << "* For more information, see https://opm-project.org *\n";
std::cout << "* *\n";
std::cout << "**********************************************************************\n\n";
}
/// This is the main function of Flow. It runs a complete simulation with the
/// given grid and simulator classes, based on the user-specified command-line
/// input.
@ -207,7 +224,6 @@ namespace Opm
setupParallelism();
setupOutput();
printStartupMessage();
setupEbosSimulator();
setupLogging();
printPRTHeader();
@ -266,28 +282,6 @@ namespace Opm
ThreadManager::init();
}
// Print startup message if on output rank.
void printStartupMessage()
{
if (output_cout_) {
const int lineLen = 70;
const std::string version = moduleVersionName();
const std::string banner = "This is flow "+version;
const int bannerPreLen = (lineLen - 2 - banner.size())/2;
const int bannerPostLen = bannerPreLen + (lineLen - 2 - banner.size())%2;
std::cout << "**********************************************************************\n";
std::cout << "* *\n";
std::cout << "*" << std::string(bannerPreLen, ' ') << banner << std::string(bannerPostLen, ' ') << "*\n";
std::cout << "* *\n";
std::cout << "* Flow is a simulator for fully implicit three-phase black-oil flow, *\n";
std::cout << "* including solvent and polymer capabilities. *\n";
std::cout << "* For more information, see https://opm-project.org *\n";
std::cout << "* *\n";
std::cout << "**********************************************************************\n\n";
}
}
// Extract the minimum priority and determines if log files ought to be created.
// Writes to:
// output_to_files_

View File

@ -921,7 +921,7 @@ protected:
milun_decomposition( A, iluIteration, milu, *ILU, *reorderer, *inverseReorderer );
}
}
catch ( Dune::MatrixBlockError error )
catch ( const Dune::MatrixBlockError& error )
{
message = error.what();
std::cerr<<"Exception occured on process " << rank << " during " <<