preCICE v3.2.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Attributes | List of all members
precice::cplscheme::tests::DummyCouplingScheme Class Referencefinal

Used to test CompositionalCouplingScheme. More...

#include <DummyCouplingScheme.hpp>

Inheritance diagram for precice::cplscheme::tests::DummyCouplingScheme:
[legend]
Collaboration diagram for precice::cplscheme::tests::DummyCouplingScheme:
[legend]

Public Member Functions

 DummyCouplingScheme (int numberIterations, int maxTimeWindows)
 Constructor.
 
void initialize () final override
 Destructor, empty.
 
void reinitialize () final override
 Reinitializes the coupling scheme, coupling data, and acceleration schemes.
 
bool isInitialized () const final override
 Not implemented.
 
bool sendsInitializedData () const final override
 Not implemented.
 
bool addComputedTime (double timeToAdd) final override
 Always assumes we reached the end of a time window.
 
ChangedMeshes firstSynchronization (const ChangedMeshes &changes) override
 
void firstExchange () override
 
ChangedMeshes secondSynchronization () override
 
void secondExchange () final override
 
void finalize () final override
 Finalizes the coupling and disconnects communication.
 
std::vector< std::stringgetCouplingPartners () const final override
 Returns list of all coupling partners.
 
std::string localParticipant () const final override
 Returns the name of the local participant.
 
bool willDataBeExchanged (double lastSolverTimeStepSize) const final override
 Not implemented.
 
bool hasDataBeenReceived () const final override
 Not implemented.
 
double getTime () const final override
 Not implemented.
 
double getTimeWindowStart () const final override
 
int getTimeWindows () const final override
 Not implemented.
 
bool hasTimeWindowSize () const final override
 Returns true, if time window size is prescribed by the cpl scheme.
 
double getTimeWindowSize () const final override
 Not implemented.
 
double getNextTimeStepMaxSize () const final override
 Not implemented.
 
bool isCouplingOngoing () const final override
 Not implemented.
 
bool isTimeWindowComplete () const final override
 Not implemented.
 
bool isActionRequired (Action action) const final override
 Not implemented.
 
bool isActionFulfilled (Action action) const final override
 Returns true, if the given action has already been performed by the accessor.
 
void markActionFulfilled (Action action) final override
 Not implemented.
 
int getCheckpointTimestepInterval () const
 Not implemented.
 
void requireAction (Action action) final override
 Not implemented.
 
std::string printCouplingState () const final override
 Empty.
 
bool isImplicitCouplingScheme () const override
 Returns true if the scheme or one subscheme is implicit.
 
bool hasConverged () const override
 Returns false if the scheme is implicit and hasn't converged.
 
bool requiresSubsteps () const final override
 Returns true if any send data of the scheme requires substeps.
 
ImplicitData implicitDataToReceive () const final override
 Returns a vector of implicit data to receive in the next advance.
 
- Public Member Functions inherited from precice::cplscheme::CouplingScheme
CouplingSchemeoperator= (CouplingScheme &&)=delete
 
virtual ~CouplingScheme ()=default
 

Private Attributes

logging::Logger _log {"cplscheme::tests::DummyCouplingScheme"}
 
int _numberIterations
 Number of iterations performed per time window. 1 --> explicit.
 
int _iterations = 0
 Performed iterations in the current time window.
 
int _maxTimeWindows
 Maximal number of time windows to be performed.
 
int _timeWindows = 0
 Performed number of time windows.
 
bool _isInitialized = false
 True, if initialize has been called.
 
bool _isOngoing = false
 True, if timesteps are left to be performed.
 
bool _hasConverged = false
 False, if iterations are left to be performed.
 

Additional Inherited Members

- Public Types inherited from precice::cplscheme::CouplingScheme
enum struct  Action { InitializeData , ReadCheckpoint , WriteCheckpoint }
 Actions that are required by CouplingSchemes. More...
 
using ChangedMeshes = std::vector<MeshID>
 
- Static Public Member Functions inherited from precice::cplscheme::CouplingScheme
static std::string toString (Action action)
 
- Static Public Attributes inherited from precice::cplscheme::CouplingScheme
static const double UNDEFINED_MAX_TIME = -1.0
 Does not define a time limit for the coupled simulation.
 
static const int UNDEFINED_TIME_WINDOWS = -1
 Does not define limit on time windows for the coupled simulation.
 
static const double UNDEFINED_TIME_WINDOW_SIZE = -1.0
 To be used, when the time window size is determined dynamically during the coupling.
 
static const int UNDEFINED_MAX_ITERATIONS = -1
 To be used, when the number of max iterations is not defined (for explicit coupling).
 
static const int UNDEFINED_MIN_ITERATIONS = -1
 To be used, when the number of min iterations is not defined (for explicit coupling).
 
static const int INFINITE_MAX_ITERATIONS = -2
 To be used, when the number of max iterations is infinite (for implicit coupling).
 

Detailed Description

Used to test CompositionalCouplingScheme.

Definition at line 14 of file DummyCouplingScheme.hpp.

Constructor & Destructor Documentation

◆ DummyCouplingScheme()

precice::cplscheme::tests::DummyCouplingScheme::DummyCouplingScheme ( int numberIterations,
int maxTimeWindows )

Constructor.

Parameters
[in]numberIterationsIf 1, models an explicit coupling scheme, otherwise an implicit one.
[in]maxTimeWindowsNumber of time windows this DummyCouplingScheme has to perform.

Definition at line 8 of file DummyCouplingScheme.cpp.

Member Function Documentation

◆ addComputedTime()

bool precice::cplscheme::tests::DummyCouplingScheme::addComputedTime ( double timeToAdd)
finaloverridevirtual

Always assumes we reached the end of a time window.

Implements precice::cplscheme::CouplingScheme.

Definition at line 38 of file DummyCouplingScheme.cpp.

Here is the call graph for this function:

◆ finalize()

void precice::cplscheme::tests::DummyCouplingScheme::finalize ( )
finaloverridevirtual

Finalizes the coupling and disconnects communication.

Implements precice::cplscheme::CouplingScheme.

Definition at line 104 of file DummyCouplingScheme.cpp.

◆ firstExchange()

void precice::cplscheme::tests::DummyCouplingScheme::firstExchange ( )
overridevirtual

Exchanges the first set of data.

Precondition
firstSynchronization() was called

Implements precice::cplscheme::CouplingScheme.

Definition at line 59 of file DummyCouplingScheme.cpp.

◆ firstSynchronization()

CouplingScheme::ChangedMeshes precice::cplscheme::tests::DummyCouplingScheme::firstSynchronization ( const ChangedMeshes & changes)
overridevirtual

Synchronizes mesh changes with remote participants.

At this point, both participants may have changed the meshes. Thus, we need to send local changes and receive remote changes.

Parameters
[in]changesMeshIDs of locally changed meshes
Returns
MeshIDs of remotely changed meshes.

Implements precice::cplscheme::CouplingScheme.

Definition at line 51 of file DummyCouplingScheme.cpp.

Here is the call graph for this function:

◆ getCheckpointTimestepInterval()

int precice::cplscheme::tests::DummyCouplingScheme::getCheckpointTimestepInterval ( ) const
inline

Not implemented.

Definition at line 182 of file DummyCouplingScheme.hpp.

◆ getCouplingPartners()

std::vector< std::string > precice::cplscheme::tests::DummyCouplingScheme::getCouplingPartners ( ) const
inlinefinaloverridevirtual

Returns list of all coupling partners.

Implements precice::cplscheme::CouplingScheme.

Definition at line 80 of file DummyCouplingScheme.hpp.

◆ getNextTimeStepMaxSize()

double precice::cplscheme::tests::DummyCouplingScheme::getNextTimeStepMaxSize ( ) const
inlinefinaloverridevirtual

Not implemented.

Implements precice::cplscheme::CouplingScheme.

Definition at line 141 of file DummyCouplingScheme.hpp.

◆ getTime()

double precice::cplscheme::tests::DummyCouplingScheme::getTime ( ) const
finaloverridevirtual

Not implemented.

Implements precice::cplscheme::CouplingScheme.

Definition at line 25 of file DummyCouplingScheme.cpp.

◆ getTimeWindows()

int precice::cplscheme::tests::DummyCouplingScheme::getTimeWindows ( ) const
inlinefinaloverridevirtual

Not implemented.

Implements precice::cplscheme::CouplingScheme.

Definition at line 120 of file DummyCouplingScheme.hpp.

◆ getTimeWindowSize()

double precice::cplscheme::tests::DummyCouplingScheme::getTimeWindowSize ( ) const
inlinefinaloverridevirtual

Not implemented.

Implements precice::cplscheme::CouplingScheme.

Definition at line 133 of file DummyCouplingScheme.hpp.

◆ getTimeWindowStart()

double precice::cplscheme::tests::DummyCouplingScheme::getTimeWindowStart ( ) const
finaloverridevirtual

Returns the time window start time of the current time window For compositional schemes, this returns the earliest start of an active time window

Implements precice::cplscheme::CouplingScheme.

Definition at line 30 of file DummyCouplingScheme.cpp.

◆ hasConverged()

bool precice::cplscheme::tests::DummyCouplingScheme::hasConverged ( ) const
overridevirtual

Returns false if the scheme is implicit and hasn't converged.

Implements precice::cplscheme::CouplingScheme.

Definition at line 141 of file DummyCouplingScheme.cpp.

◆ hasDataBeenReceived()

bool precice::cplscheme::tests::DummyCouplingScheme::hasDataBeenReceived ( ) const
inlinefinaloverridevirtual

Not implemented.

Implements precice::cplscheme::CouplingScheme.

Definition at line 104 of file DummyCouplingScheme.hpp.

◆ hasTimeWindowSize()

bool precice::cplscheme::tests::DummyCouplingScheme::hasTimeWindowSize ( ) const
inlinefinaloverridevirtual

Returns true, if time window size is prescribed by the cpl scheme.

Implements precice::cplscheme::CouplingScheme.

Definition at line 125 of file DummyCouplingScheme.hpp.

◆ implicitDataToReceive()

ImplicitData precice::cplscheme::tests::DummyCouplingScheme::implicitDataToReceive ( ) const
inlinefinaloverridevirtual

Returns a vector of implicit data to receive in the next advance.

Implements precice::cplscheme::CouplingScheme.

Definition at line 216 of file DummyCouplingScheme.hpp.

◆ initialize()

void precice::cplscheme::tests::DummyCouplingScheme::initialize ( )
finaloverridevirtual

Destructor, empty.

Implements precice::cplscheme::CouplingScheme.

Definition at line 16 of file DummyCouplingScheme.cpp.

◆ isActionFulfilled()

bool precice::cplscheme::tests::DummyCouplingScheme::isActionFulfilled ( Action action) const
inlinefinaloverridevirtual

Returns true, if the given action has already been performed by the accessor.

Implements precice::cplscheme::CouplingScheme.

Definition at line 166 of file DummyCouplingScheme.hpp.

◆ isActionRequired()

bool precice::cplscheme::tests::DummyCouplingScheme::isActionRequired ( Action action) const
finaloverridevirtual

Not implemented.

Implements precice::cplscheme::CouplingScheme.

Definition at line 118 of file DummyCouplingScheme.cpp.

Here is the call graph for this function:

◆ isCouplingOngoing()

bool precice::cplscheme::tests::DummyCouplingScheme::isCouplingOngoing ( ) const
finaloverridevirtual

Not implemented.

Implements precice::cplscheme::CouplingScheme.

Definition at line 110 of file DummyCouplingScheme.cpp.

◆ isImplicitCouplingScheme()

bool precice::cplscheme::tests::DummyCouplingScheme::isImplicitCouplingScheme ( ) const
inlineoverridevirtual

Returns true if the scheme or one subscheme is implicit.

Implements precice::cplscheme::CouplingScheme.

Definition at line 204 of file DummyCouplingScheme.hpp.

◆ isInitialized()

bool precice::cplscheme::tests::DummyCouplingScheme::isInitialized ( ) const
inlinefinaloverridevirtual

Not implemented.

Implements precice::cplscheme::CouplingScheme.

Definition at line 42 of file DummyCouplingScheme.hpp.

◆ isTimeWindowComplete()

bool precice::cplscheme::tests::DummyCouplingScheme::isTimeWindowComplete ( ) const
inlinefinaloverridevirtual

Not implemented.

Implements precice::cplscheme::CouplingScheme.

Definition at line 155 of file DummyCouplingScheme.hpp.

◆ localParticipant()

std::string precice::cplscheme::tests::DummyCouplingScheme::localParticipant ( ) const
inlinefinaloverridevirtual

Returns the name of the local participant.

Implements precice::cplscheme::CouplingScheme.

Definition at line 86 of file DummyCouplingScheme.hpp.

◆ markActionFulfilled()

void precice::cplscheme::tests::DummyCouplingScheme::markActionFulfilled ( Action action)
inlinefinaloverridevirtual

Not implemented.

Implements precice::cplscheme::CouplingScheme.

Definition at line 174 of file DummyCouplingScheme.hpp.

◆ printCouplingState()

std::string precice::cplscheme::tests::DummyCouplingScheme::printCouplingState ( ) const
inlinefinaloverridevirtual

Empty.

Implements precice::cplscheme::CouplingScheme.

Definition at line 199 of file DummyCouplingScheme.hpp.

◆ reinitialize()

void precice::cplscheme::tests::DummyCouplingScheme::reinitialize ( )
inlinefinaloverridevirtual

Reinitializes the coupling scheme, coupling data, and acceleration schemes.

Implements precice::cplscheme::CouplingScheme.

Definition at line 37 of file DummyCouplingScheme.hpp.

◆ requireAction()

void precice::cplscheme::tests::DummyCouplingScheme::requireAction ( Action action)
inlinefinaloverridevirtual

Not implemented.

Implements precice::cplscheme::CouplingScheme.

Definition at line 191 of file DummyCouplingScheme.hpp.

◆ requiresSubsteps()

bool precice::cplscheme::tests::DummyCouplingScheme::requiresSubsteps ( ) const
inlinefinaloverridevirtual

Returns true if any send data of the scheme requires substeps.

Implements precice::cplscheme::CouplingScheme.

Definition at line 211 of file DummyCouplingScheme.hpp.

◆ secondExchange()

void precice::cplscheme::tests::DummyCouplingScheme::secondExchange ( )
finaloverridevirtual

Exchanges the second set of data.

This concludes the step of the coupling scheme

Precondition
secondSynchronization() was called

Implements precice::cplscheme::CouplingScheme.

Definition at line 72 of file DummyCouplingScheme.cpp.

Here is the call graph for this function:

◆ secondSynchronization()

CouplingScheme::ChangedMeshes precice::cplscheme::tests::DummyCouplingScheme::secondSynchronization ( )
overridevirtual

Receive mesh changes from remote participants in the second step.

At this point, the remote participant may have changed the meshes if it is using a serial coupling scheme. In contrast, the local participant has already communicated local changes to the remote participant during firstSynchronization(). Hence we only need to receive remote changes here.

Note
local changes are covered by firstSynchronization()
Returns
MeshIDs of remotely changed meshes.
Precondition
firstExchange() was called

Implements precice::cplscheme::CouplingScheme.

Definition at line 65 of file DummyCouplingScheme.cpp.

◆ sendsInitializedData()

bool precice::cplscheme::tests::DummyCouplingScheme::sendsInitializedData ( ) const
inlinefinaloverridevirtual

Not implemented.

Implements precice::cplscheme::CouplingScheme.

Definition at line 51 of file DummyCouplingScheme.hpp.

◆ willDataBeExchanged()

bool precice::cplscheme::tests::DummyCouplingScheme::willDataBeExchanged ( double lastSolverTimeStepSize) const
inlinefinaloverridevirtual

Not implemented.

Implements precice::cplscheme::CouplingScheme.

Definition at line 95 of file DummyCouplingScheme.hpp.

Member Data Documentation

◆ _hasConverged

bool precice::cplscheme::tests::DummyCouplingScheme::_hasConverged = false
private

False, if iterations are left to be performed.

Definition at line 243 of file DummyCouplingScheme.hpp.

◆ _isInitialized

bool precice::cplscheme::tests::DummyCouplingScheme::_isInitialized = false
private

True, if initialize has been called.

Definition at line 237 of file DummyCouplingScheme.hpp.

◆ _isOngoing

bool precice::cplscheme::tests::DummyCouplingScheme::_isOngoing = false
private

True, if timesteps are left to be performed.

Definition at line 240 of file DummyCouplingScheme.hpp.

◆ _iterations

int precice::cplscheme::tests::DummyCouplingScheme::_iterations = 0
private

Performed iterations in the current time window.

Definition at line 228 of file DummyCouplingScheme.hpp.

◆ _log

logging::Logger precice::cplscheme::tests::DummyCouplingScheme::_log {"cplscheme::tests::DummyCouplingScheme"}
mutableprivate

Definition at line 222 of file DummyCouplingScheme.hpp.

◆ _maxTimeWindows

int precice::cplscheme::tests::DummyCouplingScheme::_maxTimeWindows
private

Maximal number of time windows to be performed.

Definition at line 231 of file DummyCouplingScheme.hpp.

◆ _numberIterations

int precice::cplscheme::tests::DummyCouplingScheme::_numberIterations
private

Number of iterations performed per time window. 1 --> explicit.

Definition at line 225 of file DummyCouplingScheme.hpp.

◆ _timeWindows

int precice::cplscheme::tests::DummyCouplingScheme::_timeWindows = 0
private

Performed number of time windows.

Definition at line 234 of file DummyCouplingScheme.hpp.


The documentation for this class was generated from the following files: