...
  View open merge request
Commits (3)
  • Carsten Gräser's avatar
    [test] Add continuity check for global bases · e0baf90e
    Carsten Gräser authored
    This checks for continuity of basis functions across intersections.
    Hence not all bases should pass it. Currently it's not called at all
    and there's two possibilities to include this:
    * Call the check manually for C^0 conforming bases
    * Include the check conditionally into checkBasis() and
      and a flag to enable it.
    
    One can also think of other variants for different types of
    bases:
    * A strong discontinuity check, that ensures that each basis function
      only appears in a single element (for DG-basis)
    * A weak continuity check, that is parametrized with a basis-specific
      per-intersection check (for nonconforming bases, e.g. Crouzeix-Raviart).
    e0baf90e
  • Carsten Gräser's avatar
    [test] Move more checks to basistest.hh · 4c1ca0e3
    Carsten Gräser authored
    These are also more general now. Since gridviewfunctionspacebasistest.cc
    executes the other tests, we can remove the parts that have an analouge
    there.
    4c1ca0e3
  • Carsten Gräser's avatar
    Add missing header and namespace · b3bba4dc
    Carsten Gräser authored
    b3bba4dc
......@@ -50,20 +50,6 @@ void testScalarBasisConst(const Basis& feBasis,
auto localView = feBasis.localView();
// Test the LocalFiniteElement
for (auto it = gridView.template begin<0>(); it!=gridView.template end<0>(); ++it)
{
// Bind the local FE basis view to the current element
localView.bind(*it);
// The general LocalFiniteElement unit test from dune/localfunctions/test/test-localfe.hh
const auto& lFE = localView.tree().finiteElement();
// testFE(lFE, disabledLocalTests);
if (lFE.size() != localView.size())
DUNE_THROW(Exception, "Size of leaf node and finite element do not coincide");
}
/////////////////////////////////////////////////////////////////////////
// Make sure the basis is a partition of unity
/////////////////////////////////////////////////////////////////////////
......@@ -89,42 +75,6 @@ void testScalarBasisConst(const Basis& feBasis,
}
}
////////////////////////////////////////////////////////////////////////////
// Make sure the basis does not give out constant zero shape functions
////////////////////////////////////////////////////////////////////////////
for(const auto& e : elements(gridView))
{
// Bind the local FE basis view to the current element
localView.bind(e);
const auto& lFE = localView.tree().finiteElement();
const QuadratureRule<double,dim>& quad = QuadratureRules<double,dim>::rule(e.type(), 3);
std::vector<FieldVector<double,1> > values;
std::vector<double> sumOfAbsValues(lFE.size());
std::fill(sumOfAbsValues.begin(), sumOfAbsValues.end(), 0.0);
for (size_t i=0; i<quad.size(); i++)
{
lFE.localBasis().evaluateFunction(quad[i].position(), values);
// Sum the absolute values for each quadrature point
for (size_t j=0; j<values.size(); j++)
sumOfAbsValues[j] += std::fabs(values[j][0]);
}
for (size_t i=0; i<values.size(); i++)
if ( sumOfAbsValues[i] <= 1e-5)
DUNE_THROW(Exception, "Basis gives out a constant-zero shape function!");
}
// Check whether the basis exports a type 'MultiIndex'
typedef typename Basis::MultiIndex MultiIndex;
// And this type must be indexable
static_assert(IsIndexable<MultiIndex>(), "MultiIndex must support operator[]");
///////////////////////////////////////////////////////////////////////////////////
// Check whether the global indices are in the correct range,
// and whether each global index appears at least once.
......