Skip to content

Commit

Permalink
Fix const error in workspace vector copy constructor and copy assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastiangrimberg committed Feb 27, 2024
1 parent c7242ac commit 8e4148a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions extern/patch/mfem/patch_workspace_vectors.diff
Original file line number Diff line number Diff line change
Expand Up @@ -1068,10 +1068,10 @@ index 000000000..b5c0ebae8
+ WorkspaceVector(WorkspaceVector &&other);
+
+ /// No copy constructor.
+ WorkspaceVector(WorkspaceVector &other) = delete;
+ WorkspaceVector(const WorkspaceVector &other) = delete;
+
+ /// Copy assignment: copy contents of vector, not metadata.
+ WorkspaceVector& operator=(WorkspaceVector &other)
+ WorkspaceVector& operator=(const WorkspaceVector &other)
+ {
+ Vector::operator=(other);
+ return *this;
Expand Down
4 changes: 2 additions & 2 deletions palace/linalg/chebyshev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ void ChebyshevSmoother<OperType>::Mult(const VecType &x, VecType &y) const
}
else
{
r.VecType::operator=(x);
r = x;
y = 0.0;
}

Expand Down Expand Up @@ -289,7 +289,7 @@ void ChebyshevSmoother1stKind<OperType>::Mult(const VecType &x, VecType &y) cons
}
else
{
r.VecType::operator=(x);
r = x;
y = 0.0;
}

Expand Down
10 changes: 5 additions & 5 deletions palace/linalg/iterative.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ void CgSolver<OperType>::Mult(const VecType &b, VecType &x) const
}
else
{
r.VecType::operator=(b);
r = b;
x = 0.0;
}
if (B)
Expand All @@ -389,7 +389,7 @@ void CgSolver<OperType>::Mult(const VecType &b, VecType &x) const
}
else
{
z.VecType::operator=(r);
z = r;
}
beta = linalg::Dot(comm, z, r);
CheckDot(beta, "PCG preconditioner is not positive definite: (Br, r) = ");
Expand Down Expand Up @@ -424,7 +424,7 @@ void CgSolver<OperType>::Mult(const VecType &b, VecType &x) const
}
if (!it)
{
p.VecType::operator=(z);
p = z;
}
else
{
Expand All @@ -446,7 +446,7 @@ void CgSolver<OperType>::Mult(const VecType &b, VecType &x) const
}
else
{
z.VecType::operator=(r);
z = r;
}
beta = linalg::Dot(comm, z, r);
CheckDot(beta, "PCG preconditioner is not positive definite: (Br, r) = ");
Expand Down Expand Up @@ -644,7 +644,7 @@ void GmresSolver<OperType>::Mult(const VecType &b, VecType &x) const
}
else // B && pc_side == PrecSide::RIGHT
{
r.VecType::operator=(0.0);
r = 0.0;
for (int k = 0; k <= j; k++)
{
r.Add(s[k], V[k]);
Expand Down
4 changes: 2 additions & 2 deletions palace/utils/workspace.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ class ComplexWorkspaceVector : public ComplexVector
}

// No copy constructor.
ComplexWorkspaceVector(ComplexWorkspaceVector &other) = delete;
ComplexWorkspaceVector(const ComplexWorkspaceVector &other) = delete;

// Copy assignment: copy contents of vector, not metadata.
ComplexWorkspaceVector &operator=(ComplexWorkspaceVector &other)
ComplexWorkspaceVector &operator=(const ComplexWorkspaceVector &other)
{
ComplexVector::operator=(other);
return *this;
Expand Down

0 comments on commit 8e4148a

Please sign in to comment.