Reference documentation for deal.II version 8.5.1
event.cc
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2010 - 2014 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE at
12 // the top level of the deal.II distribution.
13 //
14 // ---------------------------------------------------------------------
15 
16 
17 #include <deal.II/base/event.h>
18 
19 DEAL_II_NAMESPACE_OPEN
20 
21 //TODO: Thread safety
22 
23 namespace Algorithms
24 {
25  std::vector<std::string> Event::names;
26 
27  Event
28  Event::assign(const char *name)
29  {
30  unsigned int index = names.size();
31  names.push_back(name);
32 
33  Event result;
34  // The constructor generated an
35  // object with all flags equal
36  // zero. Now we set the new one.
37  result.flags[index] = true;
38 
39  return result;
40  }
41 
42 
44  :
45  all_true(false),
46  flags(names.size(), false)
47  {}
48 
49 
50  void
52  {
53  all_true = false;
54  std::fill(flags.begin(), flags.end(), false);
55  }
56 
57 
58  void
60  {
61  all_true = true;
62  }
63 
64  namespace Events
65  {
66  const Event initial = Event::assign("Initial");
67  const Event remesh = Event::assign("Remesh");
68  const Event bad_derivative = Event::assign("Bad Derivative");
69  const Event new_time = Event::assign("New Time");
70  const Event new_timestep_size = Event::assign("New Time Step Size");
71  }
72 }
73 
74 DEAL_II_NAMESPACE_CLOSE
const Event remesh
Definition: event.cc:67
std::vector< bool > flags
Definition: event.h:122
const Event bad_derivative
Definition: event.cc:68
static Event assign(const char *name)
Definition: event.cc:28
const Event new_timestep_size
Definition: event.cc:70
void all()
Definition: event.cc:59
const Event initial
Definition: event.cc:66
void clear()
Definition: event.cc:51
const Event new_time
Definition: event.cc:69
static std::vector< std::string > names
Definition: event.h:128