preCICE v3.1.2
Loading...
Searching...
No Matches
Macros
ValidationMacros.hpp File Reference
#include "utils/stacktrace.hpp"
Include dependency graph for ValidationMacros.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define PRECICE_VALIDATE_MESH_NAME_IMPL(name)
 
#define PRECICE_REQUIRE_MESH_USE_IMPL(name)
 
#define PRECICE_REQUIRE_MESH_PROVIDE_IMPL(name)
 
#define PRECICE_REQUIRE_MESH_MODIFY_IMPL(name)
 
#define PRECICE_VALIDATE_MESH_NAME(name)
 
#define PRECICE_REQUIRE_MESH_USE(name)
 
#define PRECICE_REQUIRE_MESH_PROVIDE(name)
 
#define PRECICE_REQUIRE_MESH_MODIFY(name)
 
#define PRECICE_VALIDATE_DATA_NAME_IMPL(mesh, data)
 
#define PRECICE_REQUIRE_DATA_READ_IMPL(mesh, data)
 
#define PRECICE_REQUIRE_DATA_WRITE_IMPL(mesh, data)
 
#define PRECICE_VALIDATE_DATA_NAME(mesh, data)
 
#define PRECICE_REQUIRE_DATA_READ(mesh, data)
 
#define PRECICE_REQUIRE_DATA_WRITE(mesh, data)
 
#define PRECICE_VALIDATE_DATA(data, size)    PRECICE_CHECK(std::all_of(data, data + size, [](double val) { return std::isfinite(val); }), "One of the given data values is either plus or minus infinity or NaN.");
 
#define PRECICE_EXPERIMENTAL_API()
 

Detailed Description

This file contains verification macros to harden the Participant against misuse and misconfiguration.

Attention
Only include this file from ParticipantImpl.cpp

Definition in file ValidationMacros.hpp.

Macro Definition Documentation

◆ PRECICE_EXPERIMENTAL_API

#define PRECICE_EXPERIMENTAL_API ( )
Value:
PRECICE_CHECK(_allowsExperimental, "You called the API function \"{}\", which is part of the experimental API. " \
"You may unlock the full API by specifying <precice-configuration experimental=\"true\" ... > in the configuration. " \
"Please be aware that experimental features may change in any future version (even minor or bugfix).", \
__func__)
#define PRECICE_CHECK(check,...)
Definition LogMacros.hpp:35

Definition at line 162 of file ValidationMacros.hpp.

◆ PRECICE_REQUIRE_DATA_READ

#define PRECICE_REQUIRE_DATA_READ ( mesh,
data )
Value:
do { \
PRECICE_REQUIRE_DATA_READ_IMPL(mesh, data) \
} while (false)

Validates a given dataID and checks for read access This macros creates the "id" in a local scope and provides it to the called implementation.

Definition at line 134 of file ValidationMacros.hpp.

◆ PRECICE_REQUIRE_DATA_READ_IMPL

#define PRECICE_REQUIRE_DATA_READ_IMPL ( mesh,
data )
Value:
PRECICE_CHECK((_accessor->isDataRead(mesh, data)), \
"This participant does not use Data \"{0}\", but attempted to read it. " \
"Please extend the configuration of participant \"{1}\" by defining <read-data mesh=\"{2}\" name=\"{0}\" />.", \
data, _accessorName, mesh);
#define PRECICE_VALIDATE_DATA_NAME_IMPL(mesh, data)

Implementation of PRECICE_REQUIRE_DATA_READ()

Attention
Do not use this macro directly!

Definition at line 105 of file ValidationMacros.hpp.

◆ PRECICE_REQUIRE_DATA_WRITE

#define PRECICE_REQUIRE_DATA_WRITE ( mesh,
data )
Value:
do { \
PRECICE_REQUIRE_DATA_WRITE_IMPL(mesh, data) \
} while (false)

Validates a given dataID and checks for write access This macros creates the "id" in a local scope and provides it to the called implementation.

Definition at line 142 of file ValidationMacros.hpp.

◆ PRECICE_REQUIRE_DATA_WRITE_IMPL

#define PRECICE_REQUIRE_DATA_WRITE_IMPL ( mesh,
data )
Value:
PRECICE_CHECK((_accessor->isDataWrite(mesh, data)), \
"This participant does not use Data \"{0}\", but attempted to write it. " \
"Please extend the configuration of participant \"{1}\" by defining <write-data mesh=\"{2}\" name=\"{0}\" />.", \
data, _accessorName, mesh);

Implementation of PRECICE_REQUIRE_DATA_WRITE()

Attention
Do not use this macro directly!

Definition at line 116 of file ValidationMacros.hpp.

◆ PRECICE_REQUIRE_MESH_MODIFY

#define PRECICE_REQUIRE_MESH_MODIFY ( name)
Value:
do { \
PRECICE_REQUIRE_MESH_MODIFY_IMPL(name) \
} while (false)
std::string name

Validates a given meshID, checks if the mesh is provided by the current participant and unlocked This macros creates the "id" in a local scope and provides it to the called implementation.

Definition at line 84 of file ValidationMacros.hpp.

◆ PRECICE_REQUIRE_MESH_MODIFY_IMPL

#define PRECICE_REQUIRE_MESH_MODIFY_IMPL ( name)
Value:
PRECICE_CHECK(!_meshLock.check(name), \
"This participant attempted to modify the Mesh \"{}\" while locked. " \
"Mesh modification is only allowed before calling initialize().", \
name);
#define PRECICE_REQUIRE_MESH_PROVIDE_IMPL(name)

Implementation of PRECICE_REQUIRE_MESH_MODIFY()

Attention
Do not use this macro directly!

Definition at line 50 of file ValidationMacros.hpp.

◆ PRECICE_REQUIRE_MESH_PROVIDE

#define PRECICE_REQUIRE_MESH_PROVIDE ( name)
Value:
do { \
PRECICE_REQUIRE_MESH_PROVIDE_IMPL(name) \
} while (false)

Validates a given meshID and checks if the mesh is provided by the current participant This macros creates the "id" in a local scope and provides it to the called implementation.

Definition at line 76 of file ValidationMacros.hpp.

◆ PRECICE_REQUIRE_MESH_PROVIDE_IMPL

#define PRECICE_REQUIRE_MESH_PROVIDE_IMPL ( name)
Value:
PRECICE_CHECK(_accessor->isMeshProvided(name), \
"This participant does not provide Mesh \"{0}\", but attempted to modify it. " \
"Please add a provide-mesh tag as follows <provide-mesh name=\"{0}\" />.", \
name);
#define PRECICE_REQUIRE_MESH_USE_IMPL(name)

Implementation of PRECICE_REQUIRE_MESH_PROVIDE()

Attention
Do not use this macro directly!

Definition at line 39 of file ValidationMacros.hpp.

◆ PRECICE_REQUIRE_MESH_USE

#define PRECICE_REQUIRE_MESH_USE ( name)
Value:
do { \
PRECICE_REQUIRE_MESH_USE_IMPL(name) \
} while (false)

Validates a given meshID and checks if the mesh is used by the current participant This macros creates the "id" in a local scope and provides it to the called implementation.

Definition at line 68 of file ValidationMacros.hpp.

◆ PRECICE_REQUIRE_MESH_USE_IMPL

#define PRECICE_REQUIRE_MESH_USE_IMPL ( name)
Value:
PRECICE_CHECK(_accessor->isMeshUsed(name), \
"This participant does not use the mesh \"{0}\", but attempted to access it. " \
"Please define a <provide-mesh name=\"{0}\" /> or <receive-mesh name=\"{0}\" from=\"...\" /> " \
"tag in the configuration of participant \" {1}.", \
name, _accessorName);
#define PRECICE_VALIDATE_MESH_NAME_IMPL(name)

Implementation of PRECICE_REQUIRE_MESH_USE()

Attention
Do not use this macro directly!

Definition at line 27 of file ValidationMacros.hpp.

◆ PRECICE_VALIDATE_DATA

#define PRECICE_VALIDATE_DATA ( data,
size )    PRECICE_CHECK(std::all_of(data, data + size, [](double val) { return std::isfinite(val); }), "One of the given data values is either plus or minus infinity or NaN.");

Definition at line 157 of file ValidationMacros.hpp.

◆ PRECICE_VALIDATE_DATA_NAME

#define PRECICE_VALIDATE_DATA_NAME ( mesh,
data )
Value:
do { \
PRECICE_VALIDATE_DATA_NAME_IMPL(mesh, data) \
} while (false)

Validates a given dataID This macros creates the "id" in a local scope and provides it to the called implementation.

Definition at line 126 of file ValidationMacros.hpp.

◆ PRECICE_VALIDATE_DATA_NAME_IMPL

#define PRECICE_VALIDATE_DATA_NAME_IMPL ( mesh,
data )
Value:
PRECICE_CHECK(_accessor->hasData(mesh, data), \
"The given data \"{}\" is unknown to preCICE mesh \"{}\".{}", data, mesh, _accessor->hintForMeshData(mesh, data));

Implementation of PRECICE_VALIDATE_DATA_ID()

Attention
Do not use this macro directly!

Definition at line 97 of file ValidationMacros.hpp.

◆ PRECICE_VALIDATE_MESH_NAME

#define PRECICE_VALIDATE_MESH_NAME ( name)
Value:
do { \
PRECICE_VALIDATE_MESH_NAME_IMPL(name) \
} while (false)

Validates a given meshID This macros creates the "id" in a local scope and provides it to the called implementation.

Definition at line 60 of file ValidationMacros.hpp.

◆ PRECICE_VALIDATE_MESH_NAME_IMPL

#define PRECICE_VALIDATE_MESH_NAME_IMPL ( name)
Value:
PRECICE_CHECK(_accessor->hasMesh(name), \
"The mesh named \"{}\" is unknown to preCICE.{}", \
name, _accessor->hintForMesh(name));

Implementation of PRECICE_VALIDATE_MESH_ID()

Attention
Do not use this macro directly!

Definition at line 18 of file ValidationMacros.hpp.