| 1 |
// @HEADER |
| 2 |
// ***************************************************************************** |
| 3 |
// ShyLU: Scalable Hybrid LU Preconditioner and Solver |
| 4 |
// |
| 5 |
// Copyright 2011 NTESS and the ShyLU contributors. |
| 6 |
// SPDX-License-Identifier: BSD-3-Clause |
| 7 |
// ***************************************************************************** |
| 8 |
// @HEADER |
| 9 |
|
| 10 |
#ifndef _FROSCH_OUTPUT_HPP |
| 11 |
#define _FROSCH_OUTPUT_HPP |
| 12 |
|
| 13 |
#include <ShyLU_DDFROSch_config.h> |
| 14 |
|
| 15 |
// Width of indent before FROSch output |
| 16 |
#ifndef FROSCH_OUTPUT_INDENT |
| 17 |
#define FROSCH_OUTPUT_INDENT 5 |
| 18 |
#endif |
| 19 |
|
| 20 |
#ifndef FROSCH_ASSERT |
| 21 |
#define FROSCH_ASSERT(COND,MSG) \ |
| 22 |
{ \ |
| 23 |
const bool throw_exception = !(COND); \ |
| 24 |
if(throw_exception) { \ |
| 25 |
Teuchos::TestForException_incrThrowNumber(); \ |
| 26 |
const int throwNumber = Teuchos::TestForException_getThrowNumber(); \ |
| 27 |
std::ostringstream omsg; \ |
| 28 |
omsg \ |
| 29 |
<< std::setw(FROSCH_OUTPUT_INDENT) << " " << __FILE__ << ":" << __LINE__ << ":\n\n" \ |
| 30 |
<< "Throw number = " << throwNumber \ |
| 31 |
<< "\n\n" \ |
| 32 |
<< std::setw(FROSCH_OUTPUT_INDENT) << " " << "Throw test that evaluated to true: "#COND \ |
| 33 |
<< "\n\n" \ |
| 34 |
<< std::setw(FROSCH_OUTPUT_INDENT) << " " << "[ERROR] " << MSG; \ |
| 35 |
const std::string &omsgstr = omsg.str(); \ |
| 36 |
TEUCHOS_STORE_STACKTRACE(); \ |
| 37 |
Teuchos::TestForException_break(omsgstr, throwNumber); \ |
| 38 |
throw std::logic_error(omsgstr); \ |
| 39 |
} \ |
| 40 |
} |
| 41 |
#endif |
| 42 |
|
| 43 |
#ifndef FROSCH_WARNING |
| 44 |
#define FROSCH_WARNING(CLASS,VERBOSE,OUTPUT) if (VERBOSE) std::cerr << std::setw(FROSCH_OUTPUT_INDENT) << " " << "[WARNING] " << CLASS << ": " << OUTPUT << std::endl; |
| 45 |
#endif |
| 46 |
|
| 47 |
#ifndef FROSCH_NOTIFICATION |
| 48 |
#define FROSCH_NOTIFICATION(CLASS,VERBOSE,OUTPUT) if (VERBOSE) std::cout << std::setw(FROSCH_OUTPUT_INDENT) << " " << "[NOTIFICATION] " << CLASS << ": " << OUTPUT << std::endl; |
| 49 |
#endif |
| 50 |
|
| 51 |
#ifndef FROSCH_TEST_OUTPUT |
| 52 |
#define FROSCH_TEST_OUTPUT(COMM,VERBOSE,OUTPUT) COMM->barrier(); COMM->barrier(); COMM->barrier(); if (VERBOSE) std::cout << std::setw(FROSCH_OUTPUT_INDENT) << " " << OUTPUT << std::endl; |
| 53 |
#endif |
| 54 |
|
| 55 |
#endif |