Rheolef
7.1
an efficient C++ finite element environment
distributed.h
Go to the documentation of this file.
1
# ifndef _RHEO_DISTRIBUTED_H
2
# define _RHEO_DISTRIBUTED_H
3
#include "rheolef/compiler_mpi.h"
24
25
namespace
rheolef
{
26
27
struct
undefined_memory_model
{};
28
struct
sequential
{};
29
30
// compile-time predicate: is_sequential, is_distributed
31
template
<
class
M>
32
struct
is_sequential
{
33
static
const
bool
value
=
false
;
34
};
35
template
<
class
M>
36
struct
is_distributed
{
37
static
const
bool
value
=
false
;
38
};
39
template
<>
40
struct
is_sequential
<
sequential
> {
41
static
const
bool
value
=
true
;
42
};
43
template
<>
44
struct
is_distributed
<
sequential
> {
45
static
const
bool
value
=
false
;
46
};
47
48
// useful in expressions of type mixing fields and class-functions:
49
// promote memory_type to the field one
50
template
<
class
M1,
class
M2>
51
struct
promote_memory
{
52
typedef
undefined_memory_model
type
;
53
};
54
template
<>
55
struct
promote_memory
<
undefined_memory_model
,
sequential
> {
56
typedef
sequential
type
;
57
};
58
template
<>
59
struct
promote_memory
<
sequential
,
undefined_memory_model
> {
60
typedef
sequential
type
;
61
};
62
template
<>
63
struct
promote_memory
<
sequential
,
sequential
> {
64
typedef
sequential
type
;
65
};
66
67
}
// namespace rheolef
68
69
#ifndef _RHEOLEF_HAVE_MPI
70
// -----------------------------------------------------------------------
71
// distributed code & library should compile even without mpi
72
// -----------------------------------------------------------------------
73
# ifndef rheo_default_memory_model
74
# define rheo_default_memory_model sequential
75
# endif
76
namespace
rheolef
{
77
struct
communicator {
78
typedef
std::vector<int>::size_type
size_type
;
79
int
rank()
const
{
return
0; }
80
int
size()
const
{
return
1; }
81
};
82
}
// namespace rheolef
83
#else
84
// -----------------------------------------------------------------------
85
// distributed code here
86
// -----------------------------------------------------------------------
87
namespace
rheolef
{
88
struct
distributed
{};
89
90
template
<>
91
struct
is_sequential
<
distributed
> {
92
static
const
bool
value
=
false
;
93
};
94
template
<>
95
struct
is_distributed
<
distributed
> {
96
static
const
bool
value
=
true
;
97
};
98
template
<>
99
struct
promote_memory
<
undefined_memory_model
,
distributed
> {
100
typedef
distributed
type
;
101
};
102
template
<>
103
struct
promote_memory
<
distributed
,
undefined_memory_model
> {
104
typedef
distributed
type
;
105
};
106
template
<>
107
struct
promote_memory
<
distributed
,
distributed
> {
108
typedef
distributed
type
;
109
};
110
}
// namespace rheolef
111
112
# ifndef rheo_default_memory_model
113
# define rheo_default_memory_model distributed
114
# endif
115
#endif // _RHEOLEF_HAVE_MPI
116
117
#include "rheolef/environment.h"
118
119
#endif // _RHEO_DISTRIBUTED_H
rheolef::promote_memory< distributed, undefined_memory_model >::type
distributed type
Definition:
distributed.h:104
rheolef::sequential
Definition:
distributed.h:28
rheolef::promote_memory< sequential, sequential >::type
sequential type
Definition:
distributed.h:64
rheolef::promote_memory< distributed, distributed >::type
distributed type
Definition:
distributed.h:108
rheolef::size_type
size_t size_type
Definition:
basis_get.cc:76
rheolef::is_distributed
Definition:
distributed.h:36
rheolef::promote_memory< sequential, undefined_memory_model >::type
sequential type
Definition:
distributed.h:60
rheolef::is_sequential
Definition:
distributed.h:32
rheolef::distributed
Definition:
distributed.h:88
rheolef::promote_memory< undefined_memory_model, distributed >::type
distributed type
Definition:
distributed.h:100
rheolef::promote_memory< undefined_memory_model, sequential >::type
sequential type
Definition:
distributed.h:56
rheolef::undefined_memory_model
Definition:
distributed.h:27
rheolef
This file is part of Rheolef.
Definition:
compiler_eigen.h:37
rheolef::promote_memory::type
undefined_memory_model type
Definition:
distributed.h:52
rheolef::is_sequential::value
static const bool value
Definition:
distributed.h:33
size_type
field::size_type size_type
Definition:
branch.cc:425
rheolef::is_distributed::value
static const bool value
Definition:
distributed.h:37
rheolef::promote_memory
Definition:
distributed.h:51