perf(allocations): reduced overall allocations by 95%, increaseed jacobian applicatin by 2x

This commit uses global pre allocated work space to dramatically reduce memory usage and allocation time
This commit is contained in:
2026-09-10 06:50:56 -04:00
parent b3c04d507a
commit 75cc638739
66 changed files with 207183 additions and 99552 deletions

View File

@@ -1068,6 +1068,29 @@ namespace mean_field::operators {
return m_generatedVolumeDisplacement;
}
void PreparedStellarEquilibriumOperator::BuildVolumeDisplacementDirection(
const mfem::Vector &surfaceDeformationDirection,
mfem::Vector &volumeDisplacementDirection
) const {
VerifyPrepared();
MFEM_VERIFY(
surfaceDeformationDirection.Size() == m_domainDeformation.parameterCount(),
"PreparedStellarEquilibriumOperator received a surface-deformation direction with the wrong size."
);
validate_finite_vector(
surfaceDeformationDirection,
"PreparedStellarEquilibriumOperator received a non-finite surface-deformation direction."
);
MFEM_VERIFY(
volumeDisplacementDirection.Size() == m_domainDeformation.volumeDisplacementSize(),
"PreparedStellarEquilibriumOperator received a volume-displacement workspace with the wrong size."
);
m_domainDeformation.applyJacobian(
m_surfaceDeformationParameters, surfaceDeformationDirection, volumeDisplacementDirection
);
}
const mfem::Vector &PreparedStellarEquilibriumOperator::GetFullMechanicalResidual() const {
VerifyPrepared();
return m_fullMechanicalResidual;