preCICE v3.2.0
|
#include <TestContext.hpp>
Public Types | |
using | Participants = std::vector<ParticipantState> |
Public Member Functions | |
TestContext (TestSetup setup) | |
~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 &connector, const ConnectionOptions &options=ConnectionOptions{}) const |
std::string | describe () const |
Provides a user- and log-friendly description of the current context. | |
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) |
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. | |
void | initializeGinkgo () |
Initialize Ginkgo if required. | |
Private Attributes | |
TestSetup | _setup |
bool | _initIntraComm = false |
whether this context needs to initialize the intracomm | |
utils::Parallel::CommStatePtr | _contextComm |
the MPI communicator of the context | |
std::set< 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 193 of file TestContext.hpp.
Definition at line 195 of file TestContext.hpp.
precice::testing::TestContext::TestContext | ( | TestSetup | setup | ) |
Creates a context for a rank in the given TestSetup
Unneeded ranks are marked as invalid. Provides a TestContext named context
which can be used in the test.
Definition at line 73 of file TestContext.cpp.
|
noexcept |
Cleans-up all initialized parts and synchronizes all ranks
Definition at line 82 of file TestContext.cpp.
|
inline |
Returns a pointer to the MPI communicator of this context.
Definition at line 253 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 109 of file TestContext.cpp.
m2n::PtrM2N precice::testing::TestContext::connectPrimaryRanks | ( | const std::string & | acceptor, |
const std::string & | connector, | ||
const ConnectionOptions & | options = ConnectionOptions{} ) const |
Creates a M2N and establishes a primary connection between participants
[in] | acceptor | the accepting participant |
[in] | connector | the requesting participant |
[in] | options | a set of options concerning the created connection |
Definition at line 251 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 288 of file TestContext.cpp.
bool precice::testing::TestContext::hasSize | ( | int | size | ) | const |
Check whether this context has a given size.
Definition at line 114 of file TestContext.cpp.
|
private |
Main entrypoint.
Definition at line 149 of file TestContext.cpp.
|
private |
Initialize Events if required.
Definition at line 216 of file TestContext.cpp.
|
private |
Initialize Ginkgo if required.
Definition at line 240 of file TestContext.cpp.
|
private |
Initialize the intra-participant communication connection if requested.
Definition at line 191 of file TestContext.cpp.
|
private |
Check, restrict and split the MPI communicator Marks unneeded contexts as invalid
Definition at line 160 of file TestContext.cpp.
|
private |
Initialize PETSc if required.
Definition at line 233 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 119 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 135 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 127 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 101 of file TestContext.cpp.
|
private |
set the context from a Participants and the current com Both uniquely identify a context.
Definition at line 140 of file TestContext.cpp.
|
private |
the MPI communicator of the context
Definition at line 284 of file TestContext.hpp.
|
private |
whether this context needs to initialize the intracomm
Definition at line 281 of file TestContext.hpp.
|
private |
contains the name of every known Participant
Definition at line 287 of file TestContext.hpp.
|
private |
Definition at line 278 of file TestContext.hpp.
bool precice::testing::TestContext::invalid = false |
whether this context is valid or not
Definition at line 207 of file TestContext.hpp.
std::string precice::testing::TestContext::name |
the name of the current participant
Definition at line 198 of file TestContext.hpp.
Rank precice::testing::TestContext::rank = 0 |
the rank of the current participant
Definition at line 201 of file TestContext.hpp.
int precice::testing::TestContext::size = 1 |
the size of the Communicator of the current participant
Definition at line 204 of file TestContext.hpp.