Skip to content

Commit 728b9c1

Browse files
committed
Doxygen Base part 03
1 parent 20ce506 commit 728b9c1

6 files changed

Lines changed: 829 additions & 236 deletions

File tree

Src/Base/AMReX_BLassert.H

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,25 @@
55

66
#include <AMReX.H>
77

8+
/**
9+
* \file AMReX_BLassert.H
10+
* \brief Assertion macros used across AMReX for runtime consistency checks.
11+
*
12+
* In debug builds (or when `AMREX_USE_ASSERTION` is defined) the macros expand
13+
* to runtime checks that call `amrex::Assert` if they fail. In release builds
14+
* without assertion support, the non-\*_ALWAYS variants become no-ops.
15+
*
16+
* - `AMREX_ASSERT(expr)` evaluates \p expr and aborts on failure, emitting the
17+
* expression, file, and line number.
18+
* - `AMREX_ASSERT_WITH_MESSAGE(expr,msg)` behaves the same but also forwards
19+
* the user-provided \p msg to `amrex::Assert`, allowing custom diagnostics.
20+
* - The `_ALWAYS_` variants (`AMREX_ALWAYS_ASSERT`, etc.) remain active even in
21+
* non-debug builds.
22+
* - `AMREX_GPU_ASSERT` provides the same semantics inside GPU code paths when
23+
* `AMREX_USE_GPU` is defined and either `AMREX_DEBUG` or `AMREX_USE_ASSERTION`
24+
* is enabled; otherwise it is a no-op.
25+
*/
26+
827
#ifdef AMREX_ASSERT
928
#undef AMREX_ASSERT
1029
#endif
@@ -15,25 +34,6 @@
1534

1635
#if !defined(AMREX_DEBUG) && !defined(AMREX_USE_ASSERTION)
1736

18-
/*
19-
The macro AMREX_ASSERT(EX) is a debugging macro, used to test the
20-
internal consistency of AMReX, that may also be useful in user
21-
code. The argument EX is a C++ expression that you expect to
22-
always evaluate to true.
23-
24-
When code is compiled with the DEBUG macro set to TRUE, the
25-
AMREX_ASSERT(EX) macro expands to a boolean test of the expression EX.
26-
If that expression evaluates to true, nothing happens, but if the
27-
expression evaluates to false, a message is output detailing the
28-
file and line number of the AMREX_ASSERT(EX) statement, as well as the
29-
literal expression EX itself, and then exits via abort() using
30-
amrex::Assert(). The idea is that if the assertion fails, something
31-
has gone terribly wrong somewhere.
32-
33-
If the DEBUG macro is not set to TRUE, the AMREX_ASSERT(EX) call becomes
34-
a null statement in the code, which will be eliminated by the code
35-
optimizer.
36-
*/
3737
#define AMREX_ASSERT_WITH_MESSAGE(EX,MSG) ((void)0)
3838
#define AMREX_ASSERT(EX) ((void)0)
3939
#define BL_ASSERT(EX) ((void)0)
@@ -56,4 +56,4 @@
5656
#define AMREX_GPU_ASSERT(EX) (EX)?((void)0):amrex::Assert( # EX , __FILE__, __LINE__)
5757
#endif
5858

59-
#endif /*BL_BL_ASSERT_H*/
59+
#endif /* AMREX_BLASSERT_H_ */

Src/Base/AMReX_BackgroundThread.H

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,48 @@
1010
#include <queue>
1111
#include <thread>
1212

13+
/**
14+
* \file AMReX_BackgroundThread.H
15+
* \brief Simple job queue serviced by a dedicated background std::thread.
16+
*/
17+
1318
namespace amrex {
1419

20+
/**
21+
* \class amrex::BackgroundThread
22+
* \brief Utility class running deferred work on a single background thread.
23+
* \ingroup amrex_utilities
24+
*/
1525
class BackgroundThread
1626
{
1727
public:
28+
/**
29+
* \brief Launch the worker thread and initialize synchronization primitives.
30+
*/
1831
BackgroundThread ();
32+
/**
33+
* \brief Stop the worker thread and drain any queued work.
34+
*/
1935
~BackgroundThread ();
2036
BackgroundThread (BackgroundThread const&) = delete;
2137
BackgroundThread (BackgroundThread &&) = delete;
2238
BackgroundThread& operator= (BackgroundThread const&) = delete;
2339
BackgroundThread& operator= (BackgroundThread &&) = delete;
2440

41+
/**
42+
* \brief Enqueue a job that will run asynchronously on the worker thread.
43+
* \param a_f Functor representing the work to execute.
44+
*/
2545
void Submit (std::function<void()>&& a_f);
46+
/**
47+
* \overload
48+
*/
2649
void Submit (std::function<void()> const& a_f);
2750

28-
void Finish (); // Not required. Call this if you want all jobs to finish.
51+
/**
52+
* \brief Block the caller until all queued jobs have completed.
53+
*/
54+
void Finish ();
2955

3056
private:
3157
void do_job ();

0 commit comments

Comments
 (0)