Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F100491865
grid.hh
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Jan 31, 05:39
Size
876 B
Mime Type
text/x-c++
Expires
Sun, Feb 2, 05:39 (2 d)
Engine
blob
Format
Raw Data
Handle
23974705
Attached To
R7871 phys-743-exercises
grid.hh
View Options
#ifndef GRID_HH
#define GRID_HH
/* -------------------------------------------------------------------------- */
#include <vector>
#include <mpi.h>
/* -------------------------------------------------------------------------- */
class
Grid
{
public
:
Grid
(
int
m
=
0
,
int
n
=
0
);
~
Grid
()
{
for
(
auto
&
req
:
requests
)
{
MPI_Request_free
(
&
req
);
}
}
/// access the value [i][j] of the grid
inline
float
&
operator
()(
int
i
,
int
j
)
{
return
m_storage
[
i
*
m_n
+
j
];
}
inline
const
float
&
operator
()(
int
i
,
int
j
)
const
{
return
m_storage
[
i
*
m_n
+
j
];
}
void
resize
(
int
m
,
int
n
);
std
::
vector
<
MPI_Request
>
&
getRequests
()
{
return
requests
;
}
/// set the grid to 0
void
clear
();
int
m
()
const
;
int
n
()
const
;
private
:
int
m_m
,
m_n
;
std
::
vector
<
float
>
m_storage
;
std
::
vector
<
MPI_Request
>
requests
;
};
#endif
/* GRID_HH */
Event Timeline
Log In to Comment