36 #ifndef GETFEM_CONTEXT_H__
37 #define GETFEM_CONTEXT_H__
83 enum context_state { CONTEXT_NORMAL, CONTEXT_CHANGED, CONTEXT_INVALID };
84 mutable context_state state;
85 mutable std::atomic_bool touched;
86 mutable std::vector<const context_dependencies *> dependencies;
87 mutable std::vector<const context_dependencies *> dependent;
88 typedef std::vector<const context_dependencies *>::iterator iterator_list;
89 getfem::lock_factory locks_;
93 void invalid_context()
const;
94 bool go_check()
const;
102 void change_context()
const
104 if (state == CONTEXT_NORMAL)
107 getfem::local_guard lock = locks_.get_lock();
108 state = CONTEXT_CHANGED;
115 cd.sup_dependent_(*
this);
119 void clear_dependencies();
122 bool is_context_valid()
const {
return (state != CONTEXT_INVALID); }
123 bool is_context_changed()
const {
return (state == CONTEXT_CHANGED); }
126 {
if (state == CONTEXT_NORMAL)
return false;
return go_check(); }
130 context_dependencies(
const context_dependencies& cd);
131 context_dependencies& operator=(
const context_dependencies& cd);
Deal with interdependencies of objects.
bool context_check() const
return true if update_from_context was called
virtual void update_from_context() const =0
this function has to be defined and should update the object when the context is modified.
defines and typedefs for namespace getfem
Tools for multithreaded, OpenMP and Boost based parallelization.
GEneric Tool for Finite Element Methods.