refactor(poly): updated header guards to pragma once

This commit is contained in:
2025-04-21 08:54:59 -04:00
parent 2192dca6d7
commit 431a47b9c7
6 changed files with 36 additions and 61 deletions

View File

@@ -1,5 +1,4 @@
#ifndef POLYSOLVER_H
#define POLYSOLVER_H
#pragma once
#include "mfem.hpp"
#include <memory>
@@ -21,8 +20,8 @@ namespace laneEmden {
// Struct to persist lifetime of the linear and nonlinear solvers
struct solverBundle {
mfem::GMRESSolver solver;
mfem::NewtonSolver newton;
mfem::GMRESSolver solver; // Must be first so it lives longer than the newton solver
mfem::NewtonSolver newton; // Must be second so that when it is destroyed the solver is still alive preventing a double delete
};
class PolySolver {
@@ -32,10 +31,10 @@ public: // Public methods
void solve() const;
double getN() { return m_polytropicIndex; }
double getOrder() { return m_feOrder; }
mfem::Mesh* getMesh() { return m_mesh.get(); }
mfem::GridFunction& getSolution() { return *m_theta; }
double getN() const { return m_polytropicIndex; }
double getOrder() const { return m_feOrder; }
mfem::Mesh* getMesh() const { return m_mesh.get(); }
mfem::GridFunction& getSolution() const { return *m_theta; }
private: // Private Attributes
Config& m_config = Config::getInstance();
@@ -70,6 +69,4 @@ private: // Private methods
void LoadSolverUserParams(double &newtonRelTol, double &newtonAbsTol, int &newtonMaxIter, int &newtonPrintLevel,
double &gmresRelTol, double &gmresAbsTol, int &gmresMaxIter, int &gmresPrintLevel) const;
};
#endif // POLYSOLVER_H
};