Compare commits

...
Author SHA1 Message Date
Stowell, Mark L. 8abe2babe4 Correcting warning message 2025-10-22 10:22:23 -07:00
Stowell, Mark L. b27b71bb64 Adding warning suggested by @tzanio 2025-10-22 09:51:06 -07:00
Stowell, Mark L. 262277bee9 Merge remote-tracking branch 'origin/master' into elem-inner-prod-dev
# Conflicts:
#	fem/bilinearform.cpp
#	fem/bilinearform.hpp
2025-10-22 09:47:16 -07:00
Stowell, Mark L a2106ac10e Adding BilinearForm::ElementWiseInnerProduct 2021-05-14 14:24:01 -07:00
2 changed files with 34 additions and 0 deletions
+26
View File
@@ -273,6 +273,32 @@ void BilinearForm::AddBdrFaceIntegrator(BilinearFormIntegrator *bfi,
boundary_face_integs_marker.Append(&bdr_marker);
}
void BilinearForm::ElementWiseInnerProduct(const GridFunction &x,
const GridFunction &y,
Vector &v)
{
MFEM_ASSERT(v.Size() == fes->GetNE(),
"Incorrect size for result vector");
v = 0.0;
Vector loc_x, loc_y;
DenseMatrix elmat;
Array<int> vdofs;
for (int i = 0; i < fes->GetNE(); i++)
{
fes->GetElementVDofs(i, vdofs);
x.GetSubVector(vdofs, loc_x);
y.GetSubVector(vdofs, loc_y);
ComputeElementMatrix(i, elmat);
v[i] = elmat.InnerProduct(loc_x, loc_y);
}
}
void BilinearForm::ComputeElementMatrix(int i, DenseMatrix &elmat) const
{
if (element_matrices)
+8
View File
@@ -334,6 +334,14 @@ public:
real_t InnerProduct(const Vector &x, const Vector &y) const
{ return mat->InnerProduct (x, y); }
/// @brief Compute \f$ v_e = y_e^T M_e x_e\f$
///
/// @note Recomputes element matrices with each invocation unless
/// the AssemblyLevel is ELEMENT. This can be computationally
/// expensive.
void ElementWiseInnerProduct(const GridFunction &x, const GridFunction &y,
Vector &v);
/** @brief Returns a pointer to (approximation) of the matrix inverse:
$ M^{-1} $ (currently returns NULL) */
MatrixInverse *Inverse() const override;