37 #ifndef GETFEM_CONTEXT_H__ 38 #define GETFEM_CONTEXT_H__ 44 #ifdef GETFEM_HAVE_OPENMP 45 #include <boost/atomic.hpp> 46 typedef boost::atomic_bool atomic_bool;
48 typedef bool atomic_bool;
90 enum context_state { CONTEXT_NORMAL, CONTEXT_CHANGED, CONTEXT_INVALID };
91 mutable context_state state;
92 mutable atomic_bool touched;
93 mutable std::vector<const context_dependencies *> dependencies;
94 mutable std::vector<const context_dependencies *> dependent;
95 typedef std::vector<const context_dependencies *>::iterator iterator_list;
96 getfem::lock_factory locks_;
100 void invalid_context()
const;
101 bool go_check()
const;
107 virtual void update_from_context()
const = 0;
109 void change_context()
const 111 if (state == CONTEXT_NORMAL)
114 getfem::local_guard lock = locks_.get_lock();
115 state = CONTEXT_CHANGED;
122 cd.sup_dependent_(*
this);
126 void clear_dependencies();
129 bool is_context_valid()
const {
return (state != CONTEXT_INVALID); }
130 bool is_context_changed()
const {
return (state == CONTEXT_CHANGED); }
133 {
if (state == CONTEXT_NORMAL)
return false;
return go_check(); }
Tools for multithreaded, OpenMP and Boost based parallelization.
Deal with interdependencies of objects.
GEneric Tool for Finite Element Methods.
bool context_check() const
return true if update_from_context was called
defines and typedefs for namespace getfem