22 #ifdef DEAL_II_HAVE_UNISTD_H
70 <<
"---------------------------------------------------------"
72 <<
"In one of the sub-threads of this program, an exception\n"
73 <<
"was thrown and not caught. Since exceptions do not\n"
74 <<
"propagate to the main thread, the library has caught it.\n"
75 <<
"The information carried by this exception is given below.\n"
77 <<
"---------------------------------------------------------"
79 std::cerr <<
"Exception message: " << std::endl
80 <<
" " << exc.what() << std::endl
81 <<
"Exception type: " << std::endl
82 <<
" " <<
typeid(exc).name() << std::endl;
83 std::cerr <<
"Aborting!" << std::endl
84 <<
"---------------------------------------------------------"
109 <<
"---------------------------------------------------------"
111 <<
"In one of the sub-threads of this program, an exception\n"
112 <<
"was thrown and not caught. Since exceptions do not\n"
113 <<
"propagate to the main thread, the library has caught it.\n"
115 <<
"---------------------------------------------------------"
117 std::cerr <<
"Type of exception is unknown, but not std::exception.\n"
118 <<
"No additional information is available.\n"
119 <<
"---------------------------------------------------------"
139 const pid_t this_id = syscall(SYS_gettid);
140 #elif defined(DEAL_II_HAVE_UNISTD_H) && defined(DEAL_II_HAVE_GETPID)
141 const pid_t this_id = getpid();
143 const unsigned int this_id = 0;
146 return static_cast<unsigned int>(this_id);
151 #ifdef DEAL_II_USE_MT_POSIX
154 # ifndef DEAL_II_USE_MT_POSIX_NO_BARRIERS
159 pthread_barrier_init(&
barrier,
nullptr, count);
176 ExcMessage(
"Your local POSIX installation does not support\n"
177 "POSIX barriers. You will not be able to use\n"
178 "this class, but the rest of the threading\n"
179 "functionality is available."));
187 # ifndef DEAL_II_USE_MT_POSIX_NO_BARRIERS
188 pthread_barrier_destroy(&
barrier);
203 # ifndef DEAL_II_USE_MT_POSIX_NO_BARRIERS
204 return pthread_barrier_wait(&
barrier);
226 std::vector<std::pair<unsigned int, unsigned int>>
228 const unsigned int end,
229 const unsigned int n_intervals)
233 const unsigned int n_elements =
end -
begin;
234 const unsigned int n_elements_per_interval = n_elements / n_intervals;
235 const unsigned int residual = n_elements % n_intervals;
237 std::vector<std::pair<unsigned int, unsigned int>> return_values(
240 return_values[0].first =
begin;
241 for (
unsigned int i = 0; i < n_intervals; ++i)
243 if (i != n_intervals - 1)
245 return_values[i].second =
246 (return_values[i].first + n_elements_per_interval);
252 ++return_values[i].second;
253 return_values[i + 1].first = return_values[i].second;
256 return_values[i].second =
end;
258 return return_values;