preCICE v3.1.2
Loading...
Searching...
No Matches
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 (double startTime, int startTimeWindows) override final
 Destructor, empty.
 
bool isInitialized () const override final
 Not implemented.
 
bool sendsInitializedData () const override final
 Not implemented.
 
bool addComputedTime (double timeToAdd) override final
 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
 
void finalize () override final
 Finalizes the coupling and disconnects communication.
 
std::vector< std::stringgetCouplingPartners () const override final
 Returns list of all coupling partners.
 
std::string localParticipant () const override final
 Returns the name of the local participant.
 
bool willDataBeExchanged (double lastSolverTimeStepSize) const override final
 Not implemented.
 
bool hasDataBeenReceived () const override final
 Not implemented.
 
double getTime () const override final
 Not implemented.
 
double getTimeWindowStart () const override final
 
int getTimeWindows () const override final
 Not implemented.
 
bool hasTimeWindowSize () const override final
 Returns true, if time window size is prescribed by the cpl scheme.
 
double getTimeWindowSize () const override final
 Not implemented.
 
double getNextTimeStepMaxSize () const override final
 Not implemented.
 
bool isCouplingOngoing () const override final
 Not implemented.
 
bool isTimeWindowComplete () const override final
 Not implemented.
 
bool isActionRequired (Action action) const override final
 Not implemented.
 
bool isActionFulfilled (Action action) const override final
 Returns true, if the given action has already been performed by the accessor.
 
void markActionFulfilled (Action action) override final
 Not implemented.
 
int getCheckpointTimestepInterval () const
 Not implemented.
 
void requireAction (Action action) override final
 Not implemented.
 
std::string printCouplingState () const override final
 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 override final
 Returns true if any send data of the scheme requires substeps.
 
ImplicitData implicitDataToReceive () const override final
 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 ()
 

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 16 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 40 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 106 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 61 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 53 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 184 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 82 of file DummyCouplingScheme.hpp.

◆ getNextTimeStepMaxSize()

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

Not implemented.

Implements precice::cplscheme::CouplingScheme.

Definition at line 143 of file DummyCouplingScheme.hpp.

◆ getTime()

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

Not implemented.

Implements precice::cplscheme::CouplingScheme.

Definition at line 27 of file DummyCouplingScheme.cpp.

◆ getTimeWindows()

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

Not implemented.

Implements precice::cplscheme::CouplingScheme.

Definition at line 122 of file DummyCouplingScheme.hpp.

◆ getTimeWindowSize()

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

Not implemented.

Implements precice::cplscheme::CouplingScheme.

Definition at line 135 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 32 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 143 of file DummyCouplingScheme.cpp.

◆ hasDataBeenReceived()

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

Not implemented.

Implements precice::cplscheme::CouplingScheme.

Definition at line 106 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 127 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 218 of file DummyCouplingScheme.hpp.

◆ initialize()

void precice::cplscheme::tests::DummyCouplingScheme::initialize ( double startTime,
int startTimeWindows )
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 168 of file DummyCouplingScheme.hpp.

◆ isActionRequired()

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

Not implemented.

Implements precice::cplscheme::CouplingScheme.

Definition at line 120 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 112 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 206 of file DummyCouplingScheme.hpp.

◆ isInitialized()

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

Not implemented.

Implements precice::cplscheme::CouplingScheme.

Definition at line 44 of file DummyCouplingScheme.hpp.

◆ isTimeWindowComplete()

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

Not implemented.

Implements precice::cplscheme::CouplingScheme.

Definition at line 157 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 88 of file DummyCouplingScheme.hpp.

◆ markActionFulfilled()

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

Not implemented.

Implements precice::cplscheme::CouplingScheme.

Definition at line 176 of file DummyCouplingScheme.hpp.

◆ printCouplingState()

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

Empty.

Implements precice::cplscheme::CouplingScheme.

Definition at line 201 of file DummyCouplingScheme.hpp.

◆ requireAction()

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

Not implemented.

Implements precice::cplscheme::CouplingScheme.

Definition at line 193 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 213 of file DummyCouplingScheme.hpp.

◆ secondExchange()

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

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 74 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 67 of file DummyCouplingScheme.cpp.

◆ sendsInitializedData()

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

Not implemented.

Implements precice::cplscheme::CouplingScheme.

Definition at line 53 of file DummyCouplingScheme.hpp.

◆ willDataBeExchanged()

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

Not implemented.

Implements precice::cplscheme::CouplingScheme.

Definition at line 97 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 245 of file DummyCouplingScheme.hpp.

◆ _isInitialized

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

True, if initialize has been called.

Definition at line 239 of file DummyCouplingScheme.hpp.

◆ _isOngoing

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

True, if timesteps are left to be performed.

Definition at line 242 of file DummyCouplingScheme.hpp.

◆ _iterations

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

Performed iterations in the current time window.

Definition at line 230 of file DummyCouplingScheme.hpp.

◆ _log

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

Definition at line 224 of file DummyCouplingScheme.hpp.

◆ _maxTimeWindows

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

Maximal number of time windows to be performed.

Definition at line 233 of file DummyCouplingScheme.hpp.

◆ _numberIterations

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

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

Definition at line 227 of file DummyCouplingScheme.hpp.

◆ _timeWindows

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

Performed number of time windows.

Definition at line 236 of file DummyCouplingScheme.hpp.


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