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;
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);
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.