fpmas 1.6
Macros
macros.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define FPMAS_C_STR(arg)   fpmas::to_string(arg).c_str()
 
#define MPI_DISTRIBUTED_ID_TYPE    fpmas::api::graph::DistributedId::mpiDistributedIdType
 
#define FPMAS_ON_PROC(COMM, RANK)   if(COMM.getRank() == RANK)
 
#define FPMAS_NODE_TASK(node, body)
 
#define FPMAS_DEFINE_GROUPS(...)
 
#define FPMAS_DEFINE_LAYERS(...)
 

Detailed Description

FPMAS macros.

Macro Definition Documentation

◆ FPMAS_C_STR

#define FPMAS_C_STR (   arg)    fpmas::to_string(arg).c_str()

Converts arg to a C-like null terminated string.

arg must be implicitly convertible to std::string

This can be used to easily log thinks using FPMAS_LOG* macros.

Example
DistributedId id {0, 4};
FPMAS_LOGI(RANK, "Tag", "%s", FPMAS_C_STR(id));
#define FPMAS_C_STR(arg)
Definition: macros.h:24
Parameters
argobject to convert as a C-like string

◆ MPI_DISTRIBUTED_ID_TYPE

#define MPI_DISTRIBUTED_ID_TYPE    fpmas::api::graph::DistributedId::mpiDistributedIdType

MPI type that can be used to transmit fpmas::api::graph::DistributedId instances.

◆ FPMAS_ON_PROC

#define FPMAS_ON_PROC (   COMM,
  RANK 
)    if(COMM.getRank() == RANK)

Elegant expression to specify a portion of code that should be executed only on the process with the given rank.

Parameters
COMMreference to an fpmas::api::communication::MpiCommunicator instance
RANKrank of the process on which the code should be executed

◆ FPMAS_NODE_TASK

#define FPMAS_NODE_TASK (   node,
  body 
)
Value:
<std::remove_pointer<decltype(node)>::type::data_type>(node, [&] () body)
Definition: scheduler.h:140

Utility macro to easily build tasks bound to a node.

Parameters
nodenode to bind to the task
bodyfunction body run by the task

◆ FPMAS_DEFINE_GROUPS

#define FPMAS_DEFINE_GROUPS (   ...)
Value:
__VA_ARGS__ };
int GroupId
Definition: model.h:78

Defines a set of groups as an anonymous enum. Each group name can then be used where an fpmas::api::model::GroupId is required.

Example

FPMAS_DEFINE_GROUPS(GroupA, GroupB);
int main(int argc, char** argv) {
...
model.buildGroup(GroupA);
...
fpmas::api::model::AgentGroup& group_a = model.getGroup(GroupA);
...
}
Definition: model.h:547
#define FPMAS_DEFINE_GROUPS(...)
Definition: macros.h:70

◆ FPMAS_DEFINE_LAYERS

#define FPMAS_DEFINE_LAYERS (   ...)
Value:
__VA_ARGS__ };
int LayerId
Definition: edge.h:13

Defines a set of layers as an anonymous enum. Each group name can then be used where an fpmas::api::graph::LayerId is required.

Example

FPMAS_DEFINE_LAYERS(LayerA, LayerB);
int main(int argc, char** argv) {
...
graph.link(node_1, node_2, LayerA);
...
auto neighbors = node_1->outNeighbors(LayerB);
...
}
#define FPMAS_DEFINE_LAYERS(...)
Definition: macros.h:91