diff --git a/src/poly/solver/private/polySolver.cpp b/src/poly/solver/private/polySolver.cpp index 2be3947..897bbda 100644 --- a/src/poly/solver/private/polySolver.cpp +++ b/src/poly/solver/private/polySolver.cpp @@ -9,6 +9,8 @@ #include "polyMFEMUtils.h" #include "polyCoeff.h" +#include "warning_control.h" + // TODO: Come back to this and think of a better way to get the mesh file const std::string SPHERICAL_MESH = std::string(getenv("MESON_SOURCE_ROOT")) + "/src/resources/mesh/sphere.msh"; @@ -111,10 +113,11 @@ void PolySolver::solve(){ // --- Extract the Solution --- mfem::Vector u_sol_view(U.GetData(), lambdaDofOffset); - #pragma GCC diagnostic push // MFEM is using deprecated functions, I cant do anything about it so I will ignore the warning - #pragma GCC diagnostic ignored "-Wdeprecated-declarations" - u->SetData(u_sol_view); - #pragma GCC diagnostic pop + + DEPRECATION_WARNING_OFF // DISABLE DEPRECATION WARNING + u->SetData(u_sol_view); + DEPRECATION_WARNING_ON // REENABLE DEPRECATION WARNING + double lambda = U[lambdaDofOffset]; std::cout << "λ = " << lambda << std::endl; diff --git a/src/poly/utils/private/polyMFEMUtils.cpp b/src/poly/utils/private/polyMFEMUtils.cpp index 6a3b569..55132a3 100644 --- a/src/poly/utils/private/polyMFEMUtils.cpp +++ b/src/poly/utils/private/polyMFEMUtils.cpp @@ -6,6 +6,8 @@ #include "polyMFEMUtils.h" +#include "warning_control.h" + namespace polyMFEMUtils { NonlinearPowerIntegrator::NonlinearPowerIntegrator( mfem::Coefficient &coeff, @@ -242,7 +244,11 @@ namespace polyMFEMUtils { y[i] = F[i]; } mfem::GridFunction u_gf(C.FESpace()); - u_gf.SetData(u); + + DEPRECATION_WARNING_OFF + u_gf.SetData(u); + DEPRECATION_WARNING_ON + y[lambdaDofOffset] = C.operator()(u_gf); // add -lambda * C to the residual @@ -275,8 +281,13 @@ namespace polyMFEMUtils { mfem::SparseMatrix *J_aug = new mfem::SparseMatrix(height, width); // Copy the original Jacobian into the augmented Jacobian for (int i = 0; i < Jnfl_sparse->Height(); i++) { - for (int j = 0; j < Jnfl_sparse->Width(); j++) { - J_aug->Set(i, j, Jnfl_sparse->Elem(i, j)); + const int *J_cols = Jnfl_sparse->GetRowColumns(i); + const double *J_vals = Jnfl_sparse->GetRowEntries(i); + + for (int jj = 0; jj < Jnfl_sparse->RowSize(i); jj++) { + int j = J_cols[jj]; + double val = J_vals[jj]; + J_aug->Set(i, j, val); } } diff --git a/src/poly/utils/public/polyMFEMUtils.h b/src/poly/utils/public/polyMFEMUtils.h index 8bddb01..8ef8b9f 100644 --- a/src/poly/utils/public/polyMFEMUtils.h +++ b/src/poly/utils/public/polyMFEMUtils.h @@ -5,6 +5,7 @@ #include + /** * @file polyMFEMUtils.h * @brief A collection of utilities for working with MFEM and solving the lane-emden equation.