Skip to content

Commit

Permalink
multifab specific routines
Browse files Browse the repository at this point in the history
  • Loading branch information
ajnonaka committed Nov 25, 2024
1 parent 5c678a6 commit c1b8ae0
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions ExampleCodes/LinearSolvers/GMRES/Poisson/AMReX_GMRES_Poisson.H
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,7 @@ auto GMRESPOISSONT<MF>::makeVecRHS () const -> MF
template <typename MF>
auto GMRESPOISSONT<MF>::makeVecLHS () const -> MF
{
MF mf(m_ba, m_dm, 1, 1);
mf.setVal(0.);
return mf;
return MultiFab(m_ba, m_dm, 1, 1);
}

template <typename MF>
Expand All @@ -110,7 +108,7 @@ auto GMRESPOISSONT<MF>::norm2 (MF const& mf) const -> RT
template <typename MF>
void GMRESPOISSONT<MF>::scale (MF& mf, RT scale_factor)
{
Scale(mf, scale_factor, 0, nComp(mf), 0);
mf.mult(scale_factor);
}

template <typename MF>
Expand All @@ -122,25 +120,25 @@ auto GMRESPOISSONT<MF>::dotProduct (MF const& mf1, MF const& mf2) const -> RT
template <typename MF>
void GMRESPOISSONT<MF>::setToZero (MF& lhs)
{
setVal(lhs, RT(0.0));
lhs.setVal(0.);
}

template <typename MF>
void GMRESPOISSONT<MF>::assign (MF& lhs, MF const& rhs)
{
LocalCopy(lhs, rhs, 0, 0, nComp(lhs), IntVect(0));
MultiFab::Copy(lhs,rhs,0,0,1,0);
}

template <typename MF>
void GMRESPOISSONT<MF>::increment (MF& lhs, MF const& rhs, RT a)
{
Saxpy(lhs, a, rhs, 0, 0, nComp(lhs), IntVect(0));
MultiFab::Saxpy(lhs,a,rhs,0,0,1,0);
}

template <typename MF>
void GMRESPOISSONT<MF>::linComb (MF& lhs, RT a, MF const& rhs_a, RT b, MF const& rhs_b)
{
LinComb(lhs, a, rhs_a, 0, b, rhs_b, 0, 0, nComp(lhs), IntVect(0));
MultiFab::LinComb(lhs,a,rhs_a,0,b,rhs_b,0,0,1,0);
}

template <typename MF>
Expand Down

0 comments on commit c1b8ae0

Please sign in to comment.