Collective Variables Module - Developer Documentation
Loading...
Searching...
No Matches
colvarproxy_replicas.h
1// -*- c++ -*-
2
3// This file is part of the Collective Variables module (Colvars).
4// The original version of Colvars and its updates are located at:
5// https://github.com/Colvars/colvars
6// Please update all Colvars source files before making any changes.
7// If you wish to distribute your changes, please submit them to the
8// Colvars repository at GitHub.
9
10#ifndef COLVARPROXY_REPLICAS_H
11#define COLVARPROXY_REPLICAS_H
12
13
14#ifdef COLVARS_MPI
15#include <mpi.h>
16typedef MPI_Comm replicas_mpi_comm_t;
17#else
18typedef void * replicas_mpi_comm_t;
19#endif
20
21
24
25public:
26
29
31 virtual ~colvarproxy_replicas();
32
34 virtual void set_replicas_mpi_communicator(replicas_mpi_comm_t comm);
35
37 virtual int check_replicas_enabled();
38
40 virtual int replica_index();
41
43 virtual int num_replicas();
44
46 virtual void replica_comm_barrier();
47
49 virtual int replica_comm_recv(char* msg_data, int buf_len, int src_rep);
50
52 virtual int replica_comm_send(char* msg_data, int msg_len, int dest_rep);
53
54protected:
55
57 replicas_mpi_comm_t replicas_mpi_comm;
58
61
64};
65
66#endif
Methods for multiple-replica communication.
Definition: colvarproxy_replicas.h:23
virtual void replica_comm_barrier()
Synchronize replica with others.
Definition: colvarproxy_replicas.cpp:65
virtual void set_replicas_mpi_communicator(replicas_mpi_comm_t comm)
Set the multiple replicas communicator.
Definition: colvarproxy_replicas.cpp:26
colvarproxy_replicas()
Constructor.
Definition: colvarproxy_replicas.cpp:15
int replicas_mpi_rank
Index (rank) of this replica in the MPI implementation.
Definition: colvarproxy_replicas.h:60
virtual int replica_comm_recv(char *msg_data, int buf_len, int src_rep)
Receive data from other replica.
Definition: colvarproxy_replicas.cpp:73
virtual ~colvarproxy_replicas()
Destructor.
Definition: colvarproxy_replicas.cpp:23
replicas_mpi_comm_t replicas_mpi_comm
MPI communicator containint 1 root proc from each world.
Definition: colvarproxy_replicas.h:57
virtual int replica_comm_send(char *msg_data, int msg_len, int dest_rep)
Send data to other replica.
Definition: colvarproxy_replicas.cpp:93
virtual int num_replicas()
Total number of replicas.
Definition: colvarproxy_replicas.cpp:59
virtual int check_replicas_enabled()
Indicate if multi-replica support is available and active.
Definition: colvarproxy_replicas.cpp:40
virtual int replica_index()
Index of this replica.
Definition: colvarproxy_replicas.cpp:53
int replicas_mpi_num
Number of replicas in the MPI implementation.
Definition: colvarproxy_replicas.h:63