37 #ifndef GETFEM_CONTEXT_H__
38 #define GETFEM_CONTEXT_H__
84 enum context_state { CONTEXT_NORMAL, CONTEXT_CHANGED, CONTEXT_INVALID };
85 mutable context_state state;
86 mutable std::atomic_bool touched;
87 mutable std::vector<const context_dependencies *> dependencies;
88 mutable std::vector<const context_dependencies *> dependent;
89 typedef std::vector<const context_dependencies *>::iterator iterator_list;
90 getfem::lock_factory locks_;
94 void invalid_context()
const;
95 bool go_check()
const;
101 virtual void update_from_context()
const = 0;
103 void change_context()
const
105 if (state == CONTEXT_NORMAL)
108 getfem::local_guard lock = locks_.get_lock();
109 state = CONTEXT_CHANGED;
116 cd.sup_dependent_(*
this);
120 void clear_dependencies();
123 bool is_context_valid()
const {
return (state != CONTEXT_INVALID); }
124 bool is_context_changed()
const {
return (state == CONTEXT_CHANGED); }
127 {
if (state == CONTEXT_NORMAL)
return false;
return go_check(); }
131 context_dependencies(
const context_dependencies& cd);
132 context_dependencies& operator=(
const context_dependencies& cd);