Files
SERiF/src/poly/utils/public/utilities.h

44 lines
1.5 KiB
C
Raw Normal View History

#pragma once
#include "mfem.hpp"
namespace serif::utilities {
[[nodiscard]] mfem::SparseMatrix build_reduced_matrix(
const mfem::SparseMatrix& matrix,
const mfem::Array<int>& trialEssentialDofs,
const mfem::Array<int>& testEssentialDofs
);
/**
* @brief Generate a vector of 1s and 0s where 1 elemetns cooresponds to queried dofs. Useful for degugging
* @param allDofs array, counding from 0, of all dofs in the system
* @param highlightDofs the dofs that you want to identify
* @return
*
* *Example Usage:*
* One could use this to identify, for example, which dofs are being identified as the central dofs
* @code
* ...
* mfem::Array<int> phiDofs, thetaDofs;
* phiDofs.SetSize(m_fePhi->GetNDofs());
* thetaDofs.SetSize(m_feTheta->GetNDofs());
* const mfem::Vector phiHighlightVector = serif::utilities::build_dof_identification_vector(phiDofs, phiCenterDofs);
* const mfem::Vector thetaHighlightVector = serif::utilities::build_dof_identification_vector(thetaDofs, thetaCenterDofs);
* Probe::glVisView(
* const_cast<mfem::Vector&>(phiHighlightVector),
* *m_fePhi,
* "Phi Center Dofs"
* );
* Probe::glVisView(
* const_cast<mfem::Vector&>(thetaHighlightVector),
* *m_feTheta,
* "Theta Center Dofs"
* );
* @endcode
*/
mfem::Vector build_dof_identification_vector(
const mfem::Array<int>& allDofs,
const::mfem::Array<int>& highlightDofs
);
}