preCICE v3.1.2
|
#include <TestContext.hpp>
Public Types | |
using | Participants = std::vector<ParticipantState> |
Public Member Functions | |
~TestContext () noexcept | |
std::string | config () const |
std::string | prefix (const std::string &filename) const |
bool | hasSize (int size) const |
Check whether this context has a given size. | |
bool | isNamed (const std::string &name) const |
Check whether this context has a given name. | |
bool | isRank (Rank rank) const |
Check whether this context has a given rank inside the Participant. | |
auto | comm () |
Returns a pointer to the MPI communicator of this context. | |
bool | isPrimary () const |
m2n::PtrM2N | connectPrimaryRanks (const std::string &acceptor, const std::string &requestor, const ConnectionOptions &options=ConnectionOptions{}) const |
std::string | describe () const |
Provides a user- and log-friendly description of the current context. | |
Construction | |
TestContext ()=default | |
Create a context representing an unnamed serial Participant. | |
template<class... T> | |
TestContext (Ranks ranks) | |
template<class... T> | |
TestContext (Ranks ranks, T... args) | |
template<class... T> | |
TestContext (T... args) | |
Public Attributes | |
std::string | name |
the name of the current participant | |
Rank | rank = 0 |
the rank of the current participant | |
int | size = 1 |
the size of the Communicator of the current participant | |
bool | invalid = false |
whether this context is valid or not | |
Private Member Functions | |
void | setContextFrom (const ParticipantState &p) |
Option Handling | |
void | handleOption (Participants &participants, ParticipantState participant) |
void | handleOption (Participants &participants, testing::Require requirement) |
template<class LastOption > | |
void | handleOptions (Participants &participants, LastOption &last) |
template<class NextOption , class... Rest> | |
void | handleOptions (Participants &participants, NextOption &next, Rest &... rest) |
Initialization | |
void | initialize (const Participants &participants) |
Main entrypoint. | |
void | initializeMPI (const Participants &participants) |
void | initializeIntraComm () |
Initialize the intra-participant communication connection if requested. | |
void | initializePetsc () |
Initialize PETSc if required. | |
void | initializeEvents () |
Initialize Events if required. | |
Private Attributes | |
bool | _petsc = false |
whether to initialize PETSc | |
bool | _events = false |
whether to initialize events | |
bool | _simple = false |
whether this Context was created with a Ranks constructor | |
bool | _initIntraComm = false |
whether to initialize an intra-participant connection | |
utils::Parallel::CommStatePtr | _contextComm |
the MPI communicator of the context | |
std::vector< std::string > | _names |
contains the name of every known Participant | |
Type representing the context of a test.
This type is responsible for
Definition at line 152 of file TestContext.hpp.
Definition at line 154 of file TestContext.hpp.
|
default |
Create a context representing an unnamed serial Participant.
|
inline |
Create a context representing an unnamed Participant running on a given count of Ranks
"Serial"_on(3_ranks).setupIntraComm()
Definition at line 183 of file TestContext.hpp.
|
inline |
Create a context representing an unnamed Participant running on a given count of Ranks and some requirements
"Serial"_on(3_ranks).setupIntraComm()
Definition at line 200 of file TestContext.hpp.
|
inline |
Create a context representing one or more participants
Definition at line 215 of file TestContext.hpp.
|
noexcept |
Cleans-up all initialized parts and synchronizes all ranks
Definition at line 33 of file TestContext.cpp.
|
inline |
Returns a pointer to the MPI communicator of this context.
Definition at line 257 of file TestContext.hpp.
std::string precice::testing::TestContext::config | ( | ) | const |
Returns the canonical config name of this test.
The location of integration tests are tied the test name and test suites. This computes the canonical filename of this test's configuration file based on the repository root, the current test suites and name.
Definition at line 60 of file TestContext.cpp.
m2n::PtrM2N precice::testing::TestContext::connectPrimaryRanks | ( | const std::string & | acceptor, |
const std::string & | requestor, | ||
const ConnectionOptions & | options = ConnectionOptions{} ) const |
Creates a M2N and establishes a primary connection between participants
[in] | acceptor | the accepting participant |
[in] | requestor | the requesting participant |
[in] | options | a set of options concerning the created connection |
Definition at line 216 of file TestContext.cpp.
std::string precice::testing::TestContext::describe | ( | ) | const |
Provides a user- and log-friendly description of the current context.
Definition at line 252 of file TestContext.cpp.
|
private |
|
private |
|
inlineprivate |
|
inlineprivate |
bool precice::testing::TestContext::hasSize | ( | int | size | ) | const |
Check whether this context has a given size.
Definition at line 65 of file TestContext.cpp.
|
private |
Main entrypoint.
Definition at line 126 of file TestContext.cpp.
|
private |
Initialize Events if required.
Definition at line 192 of file TestContext.cpp.
|
private |
Initialize the intra-participant communication connection if requested.
Definition at line 167 of file TestContext.cpp.
|
private |
Check, restrict and split the MPI communicator Marks unneeded contexts as invalid
Definition at line 136 of file TestContext.cpp.
|
private |
Initialize PETSc if required.
Definition at line 209 of file TestContext.cpp.
bool precice::testing::TestContext::isNamed | ( | const std::string & | name | ) | const |
Check whether this context has a given name.
Definition at line 70 of file TestContext.cpp.
bool precice::testing::TestContext::isPrimary | ( | ) | const |
Check whether this context is the primary rank of a participant
isRank(0)
Definition at line 86 of file TestContext.cpp.
bool precice::testing::TestContext::isRank | ( | Rank | rank | ) | const |
Check whether this context has a given rank inside the Participant.
Definition at line 78 of file TestContext.cpp.
std::string precice::testing::TestContext::prefix | ( | const std::string & | filename | ) | const |
Prefixes the given filename with the test directory.
The filename will be located in the same directory as the current test file.
Definition at line 52 of file TestContext.cpp.
|
private |
set the context from a Participants and the current com Both uniquely identify a context.
Definition at line 117 of file TestContext.cpp.
|
private |
the MPI communicator of the context
Definition at line 295 of file TestContext.hpp.
|
private |
whether to initialize events
Definition at line 286 of file TestContext.hpp.
|
private |
whether to initialize an intra-participant connection
Definition at line 292 of file TestContext.hpp.
|
private |
contains the name of every known Participant
Definition at line 298 of file TestContext.hpp.
|
private |
whether to initialize PETSc
Definition at line 283 of file TestContext.hpp.
|
private |
whether this Context was created with a Ranks constructor
Definition at line 289 of file TestContext.hpp.
bool precice::testing::TestContext::invalid = false |
whether this context is valid or not
Definition at line 166 of file TestContext.hpp.
std::string precice::testing::TestContext::name |
the name of the current participant
Definition at line 157 of file TestContext.hpp.
Rank precice::testing::TestContext::rank = 0 |
the rank of the current participant
Definition at line 160 of file TestContext.hpp.
int precice::testing::TestContext::size = 1 |
the size of the Communicator of the current participant
Definition at line 163 of file TestContext.hpp.