Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
amdis-core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
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
amdis
amdis-core
Commits
ee995fd5
Commit
ee995fd5
authored
5 years ago
by
Praetorius, Simon
Browse files
Options
Downloads
Patches
Plain Diff
Revert "added vtksequencewriter"
This reverts commit
62155381
.
parent
721fda7d
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
src/amdis/Output.hpp
+55
-36
55 additions, 36 deletions
src/amdis/Output.hpp
with
55 additions
and
36 deletions
src/amdis/Output.hpp
+
55
−
36
View file @
ee995fd5
...
...
@@ -14,14 +14,11 @@
#include
<stdexcept>
#endif
#ifdef HAVE_MPI
#include
<mpi.h>
#endif
/// Use the formatting librart fmtlib::fmt
#include
<fmt/core.h>
#include
<fmt/ostream.h>
#include
<amdis/Environment.hpp>
#include
<amdis/common/TypeTraits.hpp>
/**
...
...
@@ -41,6 +38,11 @@
#endif
#endif
/// Level bound for output of additional information. See \ref info() and \ref info_()
#ifndef AMDIS_INFO_LEVEL
#define AMDIS_INFO_LEVEL 1
#endif
#define AMDIS_UNUSED(var) __attribute__((unused)) var
#define AMDIS_FUNCNAME(nn) AMDIS_UNUSED(const char *funcName); funcName = nn;
...
...
@@ -59,23 +61,27 @@ namespace AMDiS
namespace
Impl
{
template
<
class
OStream
,
class
...
Args
>
OStream
&
msg
(
OStream
&
out
,
Args
&&
...
args
)
OStream
&
msg_all
(
OStream
&
out
,
std
::
string
const
&
str
,
Args
&&
...
args
)
{
if
(
Environment
::
mpiSize
()
>
1
)
fmt
::
print
(
out
,
"["
+
std
::
to_string
(
Environment
::
mpiRank
())
+
"] "
+
str
,
FWD
(
args
)...);
else
fmt
::
print
(
out
,
str
,
FWD
(
args
)...);
return
out
;
}
template
<
class
OStream
,
class
...
Args
>
OStream
&
msg
(
OStream
&
out
,
std
::
string
const
&
str
,
Args
&&
...
args
)
{
#ifdef AMDIS_HAS_MPI
int
rank
=
-
1
;
int
num_ranks
=
-
1
;
MPI_Comm_rank
(
MPI_COMM_WORLD
,
&
rank
);
MPI_Comm_size
(
MPI_COMM_WORLD
,
&
num_ranks
);
if
(
num_ranks
>
1
&&
rank
==
0
)
{
out
<<
"[0] "
;
fmt
::
print
(
out
,
FWD
(
args
)...);
}
else
if
(
num_ranks
==
1
)
{
fmt
::
print
(
out
,
FWD
(
args
)...);
}
#ifdef AMDIS_MSG_ALL_RANKS
return
msg_all
(
out
,
str
,
FWD
(
args
)...);
#else
fmt
::
print
(
out
,
FWD
(
args
)...);
#endif
if
(
Environment
::
mpiSize
()
>
1
&&
Environment
::
mpiRank
()
==
0
)
fmt
::
print
(
out
,
"[0] "
+
str
,
FWD
(
args
)...);
else
if
(
Environment
::
mpiSize
()
==
1
)
fmt
::
print
(
out
,
str
,
FWD
(
args
)...);
return
out
;
#endif
}
}
// end namespace Impl
...
...
@@ -89,9 +95,17 @@ namespace AMDiS
* ```
**/
template
<
class
...
Args
>
void
msg
(
Args
&&
...
args
)
void
msg
(
std
::
string
const
&
str
,
Args
&&
...
args
)
{
Impl
::
msg
(
std
::
cout
,
str
+
"
\n
"
,
FWD
(
args
)...);
}
/// prints a message, if Environment::infoLevel() >= noInfoLevel
template
<
class
...
Args
>
void
info
(
int
noInfoLevel
,
std
::
string
const
&
str
,
Args
&&
...
args
)
{
Impl
::
msg
(
std
::
cout
,
FWD
(
args
)...)
<<
std
::
endl
;
if
(
int
(
AMDIS_INFO_LEVEL
)
>=
noInfoLevel
)
Impl
::
msg
(
std
::
cout
,
str
+
"
\n
"
,
FWD
(
args
)...);
}
...
...
@@ -103,11 +117,20 @@ namespace AMDiS
* ```
**/
template
<
class
...
Args
>
void
msg_
(
Args
&&
...
args
)
void
msg_
(
std
::
string
const
&
str
,
Args
&&
...
args
)
{
Impl
::
msg
(
std
::
cout
,
FWD
(
args
)...);
Impl
::
msg
(
std
::
cout
,
str
,
FWD
(
args
)...);
}
/// prints a message, if Environment::infoLevel() >= noInfoLevel
template
<
class
...
Args
>
void
info_
(
int
noInfoLevel
,
std
::
string
const
&
str
,
Args
&&
...
args
)
{
if
(
int
(
AMDIS_INFO_LEVEL
)
>=
noInfoLevel
)
Impl
::
msg
(
std
::
cout
,
str
,
FWD
(
args
)...);
}
/// \brief print a message and exit
/**
...
...
@@ -116,17 +139,13 @@ namespace AMDiS
* type \ref std::runtime_Error is thrown.
**/
template
<
class
...
Args
>
void
error_exit
(
Args
&&
...
args
)
void
error_exit
(
std
::
string
const
&
str
,
Args
&&
...
args
)
{
#ifdef AMDIS_NO_THROW
Impl
::
msg
(
std
::
cerr
<<
"ERROR: "
,
FWD
(
args
)...)
<<
std
::
endl
;
#ifndef NDEBUG
assert
(
false
);
#else
std
::
exit
(
EXIT_FAILURE
);
#endif
Impl
::
msg_all
(
std
::
cerr
,
"ERROR: "
+
str
+
"
\n
"
,
FWD
(
args
)...);
std
::
abort
();
#else
throw
std
::
runtime_error
(
std
::
string
(
"ERROR: "
)
+
fmt
::
format
(
FWD
(
args
)...));
throw
std
::
runtime_error
(
std
::
string
(
"ERROR: "
)
+
fmt
::
format
(
str
,
FWD
(
args
)...));
#endif
}
...
...
@@ -141,16 +160,16 @@ namespace AMDiS
* \p condition argument.
**/
template
<
class
...
Args
>
void
test_exit
(
bool
condition
,
Args
&&
...
args
)
void
test_exit
(
bool
condition
,
std
::
string
const
&
str
,
Args
&&
...
args
)
{
if
(
!
condition
)
{
error_exit
(
FWD
(
args
)...);
}
if
(
!
condition
)
{
error_exit
(
str
,
FWD
(
args
)...);
}
}
template
<
class
...
Args
>
void
warning
(
Args
&&
...
args
)
void
warning
(
std
::
string
const
&
str
,
Args
&&
...
args
)
{
Impl
::
msg
(
std
::
cout
<<
"WARNING: "
,
FWD
(
args
)...)
<<
std
::
endl
;
Impl
::
msg
(
std
::
cout
,
"WARNING: "
+
str
+
"
\n
"
,
FWD
(
args
)...);
}
...
...
@@ -161,9 +180,9 @@ namespace AMDiS
* string "WARNING".
**/
template
<
class
...
Args
>
void
test_warning
(
bool
condition
,
Args
&&
...
args
)
void
test_warning
(
bool
condition
,
std
::
string
const
&
str
,
Args
&&
...
args
)
{
if
(
!
condition
)
{
warning
(
FWD
(
args
)...);
}
if
(
!
condition
)
{
warning
(
str
,
FWD
(
args
)...);
}
}
...
...
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