Skip to content

Commit

Permalink
Add check for complex-valued assignment in real-valued GridFunction o…
Browse files Browse the repository at this point in the history
…bject
  • Loading branch information
sebastiangrimberg committed Mar 4, 2024
1 parent 1ec7cb0 commit 702eb30
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions palace/fem/gridfunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ GridFunction &GridFunction::operator=(std::complex<double> s)
{
Imag() = s.imag();
}
else
{
MFEM_ASSERT(
s.imag() == 0.0,
"Cannot assign complex scalar to a non-complex-valued GridFunction object!");
}
return *this;
}

Expand Down

0 comments on commit 702eb30

Please sign in to comment.