Skip to content
Snippets Groups Projects
Commit c5205498 authored by oliver.sander_at_tu-dresden.de's avatar oliver.sander_at_tu-dresden.de
Browse files

Also implement the boundarydofs method for dune-functions bases

With this patch, the method works both for old-style dune-fufem bases
and for dune-functions bases directly.  The distinction is done
using some minor SFINAE trickery.
parent eca595f6
No related branches found
No related tags found
1 merge request!42Also implement the boundarydofs method for dune-functions bases
Pipeline #12900 passed
......@@ -15,11 +15,58 @@
of freedom on the patch.
\param boundaryDofs Bit is set if corresponding dofs belongs to the boundary patch
\param sfinae Dummy parameter to instantiate this method only for dune-functions bases
*/
template <class GridView, class Basis, int blocksize>
void constructBoundaryDofs(const BoundaryPatch<GridView>& boundaryPatch,
const Basis& basis,
Dune::BitSetVector<blocksize>& boundaryDofs)
Dune::BitSetVector<blocksize>& boundaryDofs,
typename Basis::LocalView* sfinae = nullptr)
{
// Check consistency of the input
static_assert((std::is_same<GridView, typename Basis::GridView>::value),
"BoundaryPatch and global basis must be for the same grid view!");
//////////////////////////////////////////////////////////
// Init output bitfield
//////////////////////////////////////////////////////////
boundaryDofs.resize(basis.size({}));
boundaryDofs.unsetAll();
auto localView = basis.localView();
for (auto it = boundaryPatch.begin(); it != boundaryPatch.end(); ++it)
{
localView.bind(it->inside());
const auto& localCoefficients = localView.tree().finiteElement().localCoefficients();
for (size_t i=0; i<localCoefficients.size(); i++)
{
////////////////////////////////////////////////////
// Test whether dof is on the boundary face
////////////////////////////////////////////////////
unsigned int entity = localCoefficients.localKey(i).subEntity();
unsigned int codim = localCoefficients.localKey(i).codim();
if (it.containsInsideSubentity(entity, codim))
boundaryDofs[localView.index(i)] = true;
}
}
}
/** \brief For a given basis and boundary patch, determine all degrees
of freedom on the patch.
Same method as above, but this time for dune-fufem bases.
*/
template <class GridView, class Basis, int blocksize>
void constructBoundaryDofs(const BoundaryPatch<GridView>& boundaryPatch,
const Basis& basis,
Dune::BitSetVector<blocksize>& boundaryDofs,
typename Basis::LocalFiniteElement* sfinae=nullptr)
{
// Check consistency of the input
static_assert((std::is_same<GridView, typename Basis::GridView>::value),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment