ASAGI
1.0
a pArallel Server for Adaptive GeoInformation
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
allocator
mpialloc.h
Go to the documentation of this file.
1
38
#ifndef ALLOCATOR_MPIALLOC_H
39
#define ALLOCATOR_MPIALLOC_H
40
41
#ifdef ASAGI_NOMPI
42
#include "
default.h
"
43
#else // ASAGI_NOMPI
44
#include "
asagi.h
"
45
46
#include "
mpi/mpicomm.h
"
47
#endif // ASAGI_NOMPI
48
49
namespace
allocator
50
{
51
52
#ifdef ASAGI_NOMPI
53
54
typedef
Default MPIAlloc;
55
#else // ASAGI_NOMPI
56
60
class
MPIAlloc
61
{
62
public
:
66
template
<
typename
T>
67
static
asagi::Grid::Error
allocate
(
size_t
size, T* &ptr)
68
{
69
std::lock_guard<mpi::Lock> lock(
mpi::MPIComm::mpiLock
);
70
71
if
(MPI_Alloc_mem(size *
sizeof
(T), MPI_INFO_NULL, &ptr) != MPI_SUCCESS)
72
return
asagi::Grid::MPI_ERROR
;
73
74
return
asagi::Grid::SUCCESS
;
75
}
76
80
template
<
typename
T>
81
static
void
free
(T *ptr)
82
{
83
if
(ptr) {
84
std::lock_guard<mpi::Lock> lock(
mpi::MPIComm::mpiLock
);
85
MPI_Free_mem(ptr);
86
}
87
}
88
};
89
90
#endif // ASAGI_NOMPI
91
92
}
93
94
#endif // ALLOCATOR_MPIALLOC_H
asagi::Grid::Error
Error
Definition:
asagi.h:92
mpicomm.h
asagi::Grid::SUCCESS
Definition:
asagi.h:94
allocator::MPIAlloc::free
static void free(T *ptr)
Definition:
mpialloc.h:81
asagi::Grid::MPI_ERROR
Definition:
asagi.h:96
allocator::MPIAlloc::allocate
static asagi::Grid::Error allocate(size_t size, T *&ptr)
Definition:
mpialloc.h:67
allocator::MPIAlloc
Definition:
mpialloc.h:60
asagi.h
Include file for C and C++ API.
mpi::MPIComm::mpiLock
static Lock mpiLock
Definition:
mpicomm.h:180
default.h
Generated by
1.8.7