Rheolef  7.2
an efficient C++ finite element environment
environment.h
Go to the documentation of this file.
1 # ifndef _RHEO_ENVIRONMENT_H
2 # define _RHEO_ENVIRONMENT_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: 29 september 2015
25 
26 namespace rheolef {
77 } // namespace rheolef
78 
79 #include "rheolef/communicator.h"
80 
81 #pragma GCC diagnostic push
82 #pragma GCC diagnostic ignored "-Weffc++"
83 #pragma GCC diagnostic ignored "-Wparentheses"
84 #pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
85 #include <boost/optional.hpp>
86 #pragma GCC diagnostic pop
87 
88 namespace rheolef {
89 
90 // [verbatim_environment_option]
92  static const int no_thread = 100;
93 // [verbatim_environment_option]
94 #ifdef _RHEOLEF_HAVE_MPI
95 // [verbatim_environment_option_cont]
96  static const int default_thread = MPI_THREAD_MULTIPLE;
97 // [verbatim_environment_option_cont]
98 #else // _RHEOLEF_HAVE_MPI
99  static const int default_thread = 0;
100 #endif // _RHEOLEF_HAVE_MPI
101 // [verbatim_environment_option_cont2]
104 };
105 // [verbatim_environment_option_cont2]
106 
107 #ifndef _RHEOLEF_HAVE_MPI
108 
109 // [verbatim_environment]
110 class environment {
111 public:
112  environment (int& argc, char**& argv, const environment_option_type& opt = environment_option_type());
113  ~environment();
114 // [verbatim_environment]
115 protected:
116  unsigned int _oldcw;
117 // [verbatim_environment_cont]
118 };
119 // [verbatim_environment_cont]
120 #else
121 class environment {
122 public:
123  explicit environment (int& argc, char**& argv, const environment_option_type& opt = environment_option_type());
124  ~environment();
125  static bool initialized();
126  static bool finalized();
127  static void abort(int errcode);
128  static int max_tag();
129  static int collectives_tag();
130  static boost::optional<int> host_rank();
131  static boost::optional<int> io_rank();
132  static std::string processor_name();
133 private:
134  bool _rheolef_has_init;
135  unsigned int _oldcw;
136  static const int _num_reserved_tags = 1;
137 };
138 #endif // _RHEOLEF_HAVE_MPI
139 } // namespace rheolef
140 #endif // _RHEO_ENVIRONMENT_H
see the environment page for the full documentation
Definition: environment.h:121
static std::string processor_name()
Definition: environment.cc:134
static bool initialized()
Definition: environment.cc:54
static boost::optional< int > io_rank()
Definition: environment.cc:123
environment(int &argc, char **&argv, const environment_option_type &opt=environment_option_type())
Definition: environment.cc:64
static boost::optional< int > host_rank()
Definition: environment.cc:112
static void abort(int errcode)
Definition: environment.cc:96
static int max_tag()
Definition: environment.cc:100
static bool finalized()
Definition: environment.cc:59
static int collectives_tag()
Definition: environment.cc:108
This file is part of Rheolef.
static const int default_thread
Definition: environment.h:96