Skip to content

Commit a235157

Browse files
committed
AdjointRefinementEE bugfix
Don't try to restore any vectors that we didn't walk in with.
1 parent 43187c6 commit a235157

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

Diff for: src/error_estimation/adjoint_refinement_estimator.C

+12-4
Original file line numberDiff line numberDiff line change
@@ -401,10 +401,18 @@ void AdjointRefinementEstimator::estimate_error (const System& _system,
401401
// The (string) name of this vector
402402
const std::string& var_name = vec->first;
403403

404-
system.get_vector(var_name) = *coarse_vectors[var_name];
405-
406-
coarse_vectors[var_name]->clear();
407-
delete coarse_vectors[var_name];
404+
// If it's a vector we already had (and not a newly created
405+
// vector like an adjoint rhs), we need to restore it.
406+
std::map<std::string, NumericVector<Number> *>::iterator it =
407+
coarse_vectors.find(var_name);
408+
if (it != coarse_vectors.end())
409+
{
410+
NumericVector<Number> *coarsevec = it->second;
411+
system.get_vector(var_name) = *coarsevec;
412+
413+
coarsevec->clear();
414+
delete coarsevec;
415+
}
408416
}
409417

410418
// Restore old partitioner and renumbering settings

0 commit comments

Comments
 (0)