void Adaptivity::updateErrorVectors() { // Resize all of the ErrorVectors in case the mesh has changed for (const auto & it : _indicator_field_to_error_vector) { ErrorVector & vec = *(it.second); vec.assign(_mesh.getMesh().max_elem_id(), 0); } // Fill the vectors with the local contributions UpdateErrorVectorsThread uevt(_subproblem, _indicator_field_to_error_vector); Threads::parallel_reduce(*_mesh.getActiveLocalElementRange(), uevt); // Now sum across all processors for (const auto & it : _indicator_field_to_error_vector) _subproblem.comm().sum((std::vector<float>&)*(it.second)); }
void Adaptivity::updateErrorVectors() { // Resize all of the ErrorVectors in case the mesh has changed for (std::map<std::string, ErrorVector *>::iterator it=_indicator_field_to_error_vector.begin(); it != _indicator_field_to_error_vector.end(); ++it) { ErrorVector & vec = *(it->second); vec.resize(_mesh.getMesh().max_elem_id()); for (unsigned int i=0; i<vec.size(); i++) vec[i] = 0.0; } // Fill the vectors with the local contributions UpdateErrorVectorsThread uevt(_subproblem, _indicator_field_to_error_vector); Threads::parallel_reduce(*_mesh.getActiveLocalElementRange(), uevt); // Now sum across all processors for (std::map<std::string, ErrorVector *>::iterator it=_indicator_field_to_error_vector.begin(); it != _indicator_field_to_error_vector.end(); ++it) _subproblem.comm().sum((std::vector<float>&)*(it->second)); }