Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-xt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ag-ohlberger
dune-community
dune-xt
Commits
69b99c59
Commit
69b99c59
authored
10 years ago
by
Felix Schindler
Browse files
Options
Downloads
Patches
Plain Diff
[common.exceptions]
* give mpi info in parallel runs * overwrite DUNE_THROW
parent
97d061ec
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/stuff/common/exceptions.hh
+16
-7
16 additions, 7 deletions
dune/stuff/common/exceptions.hh
with
16 additions
and
7 deletions
dune/stuff/common/exceptions.hh
+
16
−
7
View file @
69b99c59
...
@@ -7,8 +7,7 @@
...
@@ -7,8 +7,7 @@
#define DUNE_STUFF_COMMON_EXCEPTIONS_HH
#define DUNE_STUFF_COMMON_EXCEPTIONS_HH
#include
<dune/common/exceptions.hh>
#include
<dune/common/exceptions.hh>
#include
<dune/common/parallel/mpihelper.hh>
#include
<dune/stuff/common/color.hh>
/**
/**
* \brief Macro to throw a colorfull exception.
* \brief Macro to throw a colorfull exception.
...
@@ -28,22 +27,32 @@ if (a.size() != b.size())
...
@@ -28,22 +27,32 @@ if (a.size() != b.size())
*/
*/
#define DUNE_THROW_COLORFULLY(E, m) \
#define DUNE_THROW_COLORFULLY(E, m) \
do { \
do { \
const std::string red = "\033[31m"; \
const std::string clear = "\033[0m"; \
E th__ex; \
E th__ex; \
std::ostringstream th__msg; \
std::ostringstream th__msg; \
th__msg << m; \
th__msg << m; \
std::ostringstream th__out; \
std::ostringstream th__out; \
th__out << Dune::Stuff::Common::Colors::red << #E << "\033[0m\n"; \
th__out << red << #E << clear; \
th__out << Dune::Stuff::Common::Colors::red << "[\033[0m"; \
if (Dune::MPIHelper::getCollectiveCommunication().size() > 0) \
th__out << " (on rank " << Dune::MPIHelper::getCollectiveCommunication().rank() << ")"; \
th__out << "\n"; \
th__out << red << "[" << clear; \
th__out << __func__; \
th__out << __func__; \
th__out <<
Dune::Stuff::Common::Colors::red << "|\033[0m";
\
th__out <<
red << "|" << clear;
\
th__out << __FILE__ <<
Dune::Stuff::Common::Colors::red << ":" << __LINE__ << "]\033[0m";
\
th__out << __FILE__ <<
red << ":" << __LINE__ << "]" << clear;
\
if (!th__msg.str().empty()) \
if (!th__msg.str().empty()) \
th__out << "\n" <<
Dune::Stuff::Common::Colors::red << "=>\033[0m " << th__msg.str();
\
th__out << "\n" <<
red << "=>" << clear << " " << th__msg.str();
\
th__ex.message(th__out.str()); \
th__ex.message(th__out.str()); \
throw th__ex; \
throw th__ex; \
} while (0)
} while (0)
// DUNE_THROW_COLORFULLY
// DUNE_THROW_COLORFULLY
#ifdef DUNE_THROW
#undef DUNE_THROW
#define DUNE_THROW DUNE_THROW_COLORFULLY
#endif // DUNE_THROW
namespace
Dune
{
namespace
Dune
{
namespace
Stuff
{
namespace
Stuff
{
namespace
Exceptions
{
namespace
Exceptions
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment