File size: 4,973 Bytes
10f2621
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
/**
 * @defgroup Vmp Vmp class
 * @brief    A Virtual MPI communication layer object.
 */

/**
 *  @file       vmp.h
 *  @ingroup    Vmp
 *  @brief      Class Vmp: a Virtual MPI communication layer object.
 *  @author     Michael Holst
 *  @note       None
 *  @version    $Id: vmp.h,v 1.22 2010/08/12 05:40:23 fetk Exp $
 *  
 *  @attention
 *  @verbatim
 *
 * MALOC = < Minimal Abstraction Layer for Object-oriented C >
 * Copyright (C) 1994-- Michael Holst
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 * 
 *  @endverbatim
 */

#ifndef _VMP_H_
#define _VMP_H_

#include <maloc/maloc_base.h>

#include <maloc/vsys.h>
#include <maloc/vmpi.h>
#include <maloc/vcom.h>

/*
 * ***************************************************************************
 * Class Vmp: Parameters and datatypes
 * ***************************************************************************
 */

/**
 * @ingroup Vmp
 * @brief   Contains public data members for Vmp class
 * @author  Michael Holst
 * @note    None
 */
struct sVmp {
    int  mpi_rank;     /**< my process ID                                   */
    int  mpi_size;     /**< number of processess in this execution          */
};

/**
 * @ingroup Vmp
 * @brief   Declaration of the Vmp class as teh Vmp structure 
 * @author  Michael Holst
 */
typedef struct sVmp Vmp;

/*
 * ***************************************************************************
 * Class Vmp: Inlineable methods (vmp.c)
 * ***************************************************************************
 */

#if !defined(VINLINE_MALOC)
#else /* if defined(VINLINE_MALOC) */
#endif /* if !defined(VINLINE_MALOC) */


/**
 * @ingroup Vmp
 * @brief   The Vmp initializer. 
 * @author  Michael Holst
 * @note    Class Vmp: Non-inlineable method (vmp.c) 
 * @return  Success enumeration
 * @param   argc number of the command line arguments
 * @param   argv the command line arguments
 */
VEXTERNC int Vmp_init(int *argc, char ***argv);

/**
 * @ingroup Vmp
 * @brief   The Vmp finalizer. 
 * @author  Michael Holst
 * @note    Class Vmp: Non-inlineable method (vmp.c) 
 * @return  Success enumeration
 */
VEXTERNC int Vmp_finalize(void);

/**
 * @ingroup Vmp
 * @brief   The Vmp constructor. 
 * @author  Michael Holst
 * @note    Class Vmp: Non-inlineable method (vmp.c) 
 * @return  Success enumeration
 */
VEXTERNC Vmp* Vmp_ctor(void);

/**
 * @ingroup Vmp
 * @brief   The Vmp destructor. 
 * @author  Michael Holst
 * @note    Class Vmp: Non-inlineable method (vmp.c) 
 * @return  None
 * @param   thee Pointer to pointer of Vmp object
 */
VEXTERNC void Vmp_dtor(Vmp **thee);

/**
 * @ingroup Vmp
 * @brief   Return my processor ID.
 * @author  Michael Holst
 * @note    Class Vmp: Non-inlineable method (vmp.c) 
 * @return  Success enumeration
 * @param   thee Pointer to the Vmp object
 */
VEXTERNC int Vmp_rank(Vmp *thee);

/**
 * @ingroup Vmp
 * @brief   Return the number of processors involved.     
 * @author  Michael Holst
 * @note    Class Vmp: Non-inlineable method (vmp.c) 
 * @return  Success enumeration
 * @param   thee Pointer to the Vmp object
 */
VEXTERNC int Vmp_size(Vmp *thee);

/**
 * @ingroup Vmp
 * @brief   An MPI barrier.     
 * @author  Michael Holst
 * @note    Class Vmp: Non-inlineable method (vmp.c) 
 * @return  Success enumeration
 * @param   thee Pointer to the Vmp object
 */
VEXTERNC int Vmp_barr(Vmp *thee);

/**
 * @ingroup Vmp
 * @brief   An MPI blocking send.     
 * @author  Michael Holst
 * @note    Class Vmp: Non-inlineable method (vmp.c) 
 * @return  Success enumeration
 * @param   thee    Pointer to the Vmp object
 * @param   des     rank of receiving processor 
 * @param   buf     buffer containing message 
 * @param   bufsize number of items (of declared type) in buffer 
 */
VEXTERNC int Vmp_send(Vmp *thee, int des, char *buf, int bufsize);

/**
 * @ingroup Vmp
 * @brief   An MPI blocking receive.    
 * @author  Michael Holst
 * @note    Class Vmp: Non-inlineable method (vmp.c) 
 * @return  Success enumeration
 * @param   thee    Pointer to the Vmp object
 * @param   src     rank of receiving processor 
 * @param   buf     buffer containing message 
 * @param   bufsize number of items (of declared type) in buffer 
 */
VEXTERNC int Vmp_recv(Vmp *thee, int src, char *buf, int bufsize);

#endif /* _VMP_H_ */