void FEMSystem::init_context(DiffContext &c) { // Parent::init_context(c); // may be a good idea in derived classes // Although we do this in DiffSystem::build_context() and // FEMSystem::build_context() as well, we do it here just to be // extra sure that the deltat pointer gets set. Since the // intended behavior is for classes derived from FEMSystem to // call Parent::init_context() in their own init_context() // overloads, we can ensure that those classes get the correct // deltat pointers even if they have different build_context() // overloads. c.set_deltat_pointer ( &deltat ); FEMContext &context = libmesh_cast_ref<FEMContext&>(c); // Make sure we're prepared to do mass integration for (unsigned int var = 0; var != this->n_vars(); ++var) if (this->get_physics()->is_time_evolving(var)) { context.element_fe_var[var]->get_JxW(); context.element_fe_var[var]->get_phi(); } }
UniquePtr<DiffContext> DifferentiableSystem::build_context () { DiffContext* context = new DiffContext(*this); context->set_deltat_pointer( &this->deltat ); return UniquePtr<DiffContext>(context); }