/** * FIXME: This is a default implementation - derived classes should * reimplement it for efficiency. */ void ErrorEstimator::estimate_errors(const EquationSystems & equation_systems, ErrorMap & errors_per_cell, const std::map<const System *, const NumericVector<Number> *> * solution_vectors, bool estimate_parent_error) { SystemNorm old_error_norm = this->error_norm; // Find the requested error values from each system for (unsigned int s = 0; s != equation_systems.n_systems(); ++s) { const System & sys = equation_systems.get_system(s); unsigned int n_vars = sys.n_vars(); for (unsigned int v = 0; v != n_vars; ++v) { // Only fill in ErrorVectors the user asks for if (errors_per_cell.find(std::make_pair(&sys, v)) == errors_per_cell.end()) continue; // Calculate error in only one variable std::vector<Real> weights(n_vars, 0.0); weights[v] = 1.0; this->error_norm = SystemNorm(std::vector<FEMNormType>(n_vars, old_error_norm.type(v)), weights); const NumericVector<Number> * solution_vector = nullptr; if (solution_vectors && solution_vectors->find(&sys) != solution_vectors->end()) solution_vector = solution_vectors->find(&sys)->second; this->estimate_error (sys, *errors_per_cell[std::make_pair(&sys, v)], solution_vector, estimate_parent_error); } } // Restore our old state before returning this->error_norm = old_error_norm; }
void RegExp::check( ErrorMap& map ) { map.start(); check( map, true, true ); map.end(); }