Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a new bug introduced in #2858 #2901

Merged
merged 1 commit into from
Aug 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix a new bug introduced in #2858
  • Loading branch information
WeiqunZhang committed Aug 3, 2022
commit 7ede2a285482680382990eb8b417c3580cd31b87
18 changes: 16 additions & 2 deletions Src/Base/AMReX_Any.H
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,25 @@ public:

//! Returns a reference to the contained object.
template <typename MF>
MF& get () { return dynamic_cast<innards<MF>&>(*m_ptr).m_mf; }
MF& get () {
if (auto p0 = dynamic_cast<innards<MF>*>(m_ptr.get())) {
return p0->m_mf;
} else {
return dynamic_cast<innards<MF&>&>(*m_ptr).m_mf;
}
}

//! Returns a const reference to the contained object.
template <typename MF>
MF const& get () const { return dynamic_cast<innards<MF> const&>(*m_ptr).m_mf; }
MF const& get () const {
if (auto p0 = dynamic_cast<innards<MF>*>(m_ptr.get())) {
return p0->m_mf;
} else if (auto p1 = dynamic_cast<innards<MF&>*>(m_ptr.get())) {
return p1->m_mf;
} else {
return dynamic_cast<innards<MF const&> const&>(*m_ptr).m_mf;
}
}

template <typename MF>
bool is () const { return m_ptr->Type() == typeid(MF); }
Expand Down
2 changes: 1 addition & 1 deletion Src/LinearSolvers/MLMG/AMReX_MLMG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1152,7 +1152,7 @@ MLMG::compResidual (const Vector<MultiFab*>& a_res, const Vector<MultiFab*>& a_s
{
if (cf_strategy == CFStrategy::ghostnodes || a_sol[alev]->nGrowVect() == ng_sol)
{
sol[alev] = linop.AnyMakeAlias(a_sol[alev]);
sol[alev] = linop.AnyMakeAlias(*a_sol[alev]);
sol_is_alias[alev] = true;
}
else
Expand Down