refactor(solver): renamed setupOperator -> setOperatorEssentialTrueDofs to better reflect method job

This commit is contained in:
2025-04-21 09:05:34 -04:00
parent 30a6cb074f
commit 513e90b7a0
3 changed files with 5 additions and 7 deletions

View File

@@ -178,13 +178,13 @@ void PolySolver::solve() const {
// --- Set the initial guess for the solution ---
setInitialGuess();
setupOperator();
setOperatorEssentialTrueDofs();
// It's safer to get the offsets directly from the operator after finalization
const mfem::Array<int>& block_offsets = m_polytropOperator->GetBlockOffsets(); // Assuming a getter exists or accessing member if public/friend
mfem::BlockVector state_vector(block_offsets);
state_vector.GetBlock(0) = static_cast<mfem::Vector>(*m_theta);
state_vector.GetBlock(1) = static_cast<mfem::Vector>(*m_phi);
state_vector.GetBlock(0) = static_cast<mfem::Vector>(*m_theta); // NOLINT(*-slicing)
state_vector.GetBlock(1) = static_cast<mfem::Vector>(*m_phi); // NOLINT(*-slicing)
mfem::Vector zero_rhs(block_offsets.Last());
zero_rhs = 0.0;
@@ -304,7 +304,7 @@ void PolySolver::saveAndViewSolution(const mfem::BlockVector& state_vector) cons
}
}
void PolySolver::setupOperator() const {
void PolySolver::setOperatorEssentialTrueDofs() const {
SSE::MFEMArrayPairSet ess_tdof_pair_set = getEssentialTrueDof();
m_polytropOperator->SetEssentialTrueDofs(ess_tdof_pair_set);

View File

@@ -84,7 +84,7 @@ private: // Private methods
void setInitialGuess() const;
void saveAndViewSolution(const mfem::BlockVector& state_vector) const;
solverBundle setupNewtonSolver() const;
void setupOperator() const;
void setOperatorEssentialTrueDofs() const;
void LoadSolverUserParams(double &newtonRelTol, double &newtonAbsTol, int &newtonMaxIter, int &newtonPrintLevel,
double &gmresRelTol, double &gmresAbsTol, int &gmresMaxIter, int &gmresPrintLevel) const;

View File

@@ -286,8 +286,6 @@ void PolytropeOperator::SetEssentialTrueDofs(const SSE::MFEMArrayPair& theta_ess
if (m_f) {
m_f->SetEssentialTrueDofs(theta_ess_tdofs.first);
// This should be zeroing out the row; however, I am getting a segfault
} else {
MFEM_ABORT("m_f is null in PolytropeOperator::SetEssentialTrueDofs");
}