Rheolef  7.2
an efficient C++ finite element environment
 
Loading...
Searching...
No Matches
communicator.h
Go to the documentation of this file.
1# ifndef _RHEO_COMMUNICATOR_H
2# define _RHEO_COMMUNICATOR_H
3//
4// This file is part of Rheolef.
5//
6// Copyright (C) 2000-2009 Pierre Saramito <Pierre.Saramito@imag.fr>
7//
8// Rheolef is free software; you can redistribute it and/or modify
9// it under the terms of the GNU General Public License as published by
10// the Free Software Foundation; either version 2 of the License, or
11// (at your option) any later version.
12//
13// Rheolef is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16// GNU General Public License for more details.
17//
18// You should have received a copy of the GNU General Public License
19// along with Rheolef; if not, write to the Free Software
20// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21//
22// =========================================================================
23// AUTHOR: Pierre.Saramito@imag.fr
24// DATE: 27 november 1998
25
26namespace rheolef {
56} // namespace rheolef
57#include "rheolef/compiler_mpi.h"
58
59namespace rheolef {
60
62 struct sequential {};
63
64 // compile-time predicate: is_sequential, is_distributed
65 template<class M>
67 static const bool value = false;
68 };
69 template<class M>
71 static const bool value = false;
72 };
73 template<>
75 static const bool value = true;
76 };
77 template<>
79 static const bool value = false;
80 };
81
82 // useful in expressions of type mixing fields and class-functions:
83 // promote memory_type to the field one
84 template<class M1, class M2>
88 template<>
92 template<>
96 template<>
100
101} // namespace rheolef
102
103#ifndef _RHEOLEF_HAVE_MPI
104// -----------------------------------------------------------------------
105// distributed code & library should compile even without mpi
106// -----------------------------------------------------------------------
107# ifndef rheo_default_memory_model
108# define rheo_default_memory_model sequential
109# endif
110namespace rheolef {
111// [verbatim_communicator]
112struct communicator {
113 typedef std::vector<int>::size_type size_type;
114 int size() const;
115 int rank() const;
116};
117// [verbatim_communicator]
118inline int communicator size() const { return 1; }
119inline int communicator rank() const { return 0; }
120} // namespace rheolef
121#else
122// -----------------------------------------------------------------------
123// distributed code here
124// -----------------------------------------------------------------------
125namespace rheolef {
126 using mpi::communicator;
127
128 struct distributed {};
129
130 template<>
132 static const bool value = false;
133 };
134 template<>
136 static const bool value = true;
137 };
138 template<>
142 template<>
146 template<>
150} // namespace rheolef
151
152# ifndef rheo_default_memory_model
153# define rheo_default_memory_model distributed
154# endif
155#endif // _RHEOLEF_HAVE_MPI
156
157#endif // _RHEO_COMMUNICATOR_H
field::size_type size_type
Definition branch.cc:430
see the communicator page for the full documentation
This file is part of Rheolef.
static const bool value
static const bool value
undefined_memory_model type