Rheolef  7.1
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/distributed.h"
80 #include <boost/optional.hpp>
81 
82 namespace rheolef {
83 
84 // [verbatim_environment_option]
86  static const int no_thread = 100;
87 // [verbatim_environment_option]
88 #ifdef _RHEOLEF_HAVE_MPI
89 // [verbatim_environment_option_cont]
90  static const int default_thread = MPI_THREAD_SINGLE;
91 // [verbatim_environment_option_cont]
92 #else // _RHEOLEF_HAVE_MPI
93  static const int default_thread = 0;
94 #endif // _RHEOLEF_HAVE_MPI
95 // [verbatim_environment_option_cont2]
98 };
99 // [verbatim_environment_option_cont2]
100 
101 #ifndef _RHEOLEF_HAVE_MPI
102 
103 // [verbatim_environment]
104 class environment {
105 public:
106  environment (int& argc, char**& argv, const environment_option_type& opt = environment_option_type());
107  ~environment();
108 // [verbatim_environment]
109 protected:
110  unsigned int _oldcw;
111 // [verbatim_environment_cont]
112 };
113 // [verbatim_environment_cont]
114 #else
115 class environment {
116 public:
117  explicit environment (int& argc, char**& argv, const environment_option_type& opt = environment_option_type());
118  ~environment();
119  static bool initialized();
120  static bool finalized();
121  static void abort(int errcode);
122  static int max_tag();
123  static int collectives_tag();
124  static boost::optional<int> host_rank();
125  static boost::optional<int> io_rank();
126  static std::string processor_name();
127 private:
128  bool _rheolef_has_init;
129  unsigned int _oldcw;
130  static const int _num_reserved_tags = 1;
131 };
132 #endif // _RHEOLEF_HAVE_MPI
133 } // namespace rheolef
134 #endif // _RHEO_ENVIRONMENT_H
rheolef::environment::host_rank
static boost::optional< int > host_rank()
Definition: environment.cc:112
rheolef::environment::processor_name
static std::string processor_name()
Definition: environment.cc:134
rheolef::environment::abort
static void abort(int errcode)
Definition: environment.cc:96
rheolef::environment::collectives_tag
static int collectives_tag()
Definition: environment.cc:108
rheolef::environment::environment
environment(int &argc, char **&argv, const environment_option_type &opt=environment_option_type())
Definition: environment.cc:64
rheolef::environment_option_type::environment_option_type
environment_option_type()
Definition: environment.h:96
rheolef::environment::io_rank
static boost::optional< int > io_rank()
Definition: environment.cc:123
rheolef::environment
see the environment page for the full documentation
Definition: environment.h:115
rheolef::environment_option_type::no_thread
static const int no_thread
Definition: environment.h:86
rheolef
This file is part of Rheolef.
Definition: compiler_eigen.h:37
rheolef::environment_option_type
Definition: environment.h:85
rheolef::environment::~environment
~environment()
Definition: environment.cc:89
rheolef::environment::initialized
static bool initialized()
Definition: environment.cc:54
rheolef::environment_option_type::default_thread
static const int default_thread
Definition: environment.h:90
rheolef::environment::finalized
static bool finalized()
Definition: environment.cc:59
rheolef::environment_option_type::thread_level
int thread_level
Definition: environment.h:97
rheolef::environment::max_tag
static int max_tag()
Definition: environment.cc:100