Commit db288e9c authored by Ole Klein's avatar Ole Klein Committed by Oliver Sander
Browse files

Unit-test more of the Raviart-Thomas elements

In particular, test the first-order implementations, and test them
for all facet orientations.  This uncovers a few bugs which are
fixed by this patch as well.

(cherry picked from commit 32a02606)
parent 9b18e683
Pipeline #29170 passed with stage
in 7 minutes and 15 seconds
......@@ -50,6 +50,8 @@
* Introduce a convenience header `dune/localfunctions/brezzidouglasmarini.hh`
that includes all BDM implementations.
* Fix bugs in the implementation of `interpolate` for Raviart-Thomas elements.
# Release 2.6
* The `diffOrder` value has disappeared from the `LocalBasisTraits` class.
......
......@@ -26,14 +26,8 @@ namespace Dune
typedef LocalBasisTraits<D,2,Dune::FieldVector<D,2>,R,2,Dune::FieldVector<R,2>,
Dune::FieldMatrix<R,2,2> > Traits;
//! \brief Standard constructor
RT02DLocalBasis ()
{
std::fill(sign_.begin(), sign_.end(), 1.0);
}
//! \brief Make set numer s, where 0<=s<4
RT02DLocalBasis (std::bitset<3> s)
//! \brief Make set number s, where 0 <= s < 8
RT02DLocalBasis (std::bitset<3> s = 0)
{
for (int i=0; i<3; i++)
sign_[i] = s[i] ? -1.0 : 1.0;
......
......@@ -30,14 +30,8 @@ namespace Dune
typedef LocalBasisTraits<D,2,Dune::FieldVector<D,2>,R,2,Dune::FieldVector<R,2>,
Dune::FieldMatrix<R,2,2> > Traits;
//! \brief Standard constructor
RT0Cube2DLocalBasis ()
{
std::fill(sign_.begin(), sign_.end(), 1.0);
}
//! \brief Constructor with a set of edge orientations
RT0Cube2DLocalBasis (std::bitset<4> s)
RT0Cube2DLocalBasis (std::bitset<4> s = 0)
{
for (int i=0; i<4; i++)
sign_[i] = s[i] ? -1.0 : 1.0;
......
......@@ -30,14 +30,8 @@ namespace Dune
typedef LocalBasisTraits<D,3,Dune::FieldVector<D,3>,R,3,Dune::FieldVector<R,3>,
Dune::FieldMatrix<R,3,3> > Traits;
//! \brief Standard constructor
RT0Cube3DLocalBasis ()
{
sign0 = sign1 = sign2 = sign3 = sign4 = sign5 = 1.0;
}
//! \brief Make set numer s, where 0<=s<64
RT0Cube3DLocalBasis (unsigned int s)
//! \brief Make set number s, where 0 <= s < 64
RT0Cube3DLocalBasis (unsigned int s = 0)
{
sign0 = sign1 = sign2 = sign3 = sign4 = sign5 = 1.0;
if (s&1) sign0 = -1.0;
......@@ -161,14 +155,8 @@ namespace Dune
{
public:
//! \brief Standard constructor
RT0Cube3DLocalInterpolation ()
{
sign0 = sign1 = sign2 = sign3 = sign4 = sign5 = 1.0;
}
//! \brief Make set numer s, where 0<=s<64
RT0Cube3DLocalInterpolation (unsigned int s)
//! \brief Make set number s, where 0 <= s < 64
RT0Cube3DLocalInterpolation (unsigned int s = 0)
{
sign0 = sign1 = sign2 = sign3 = sign4 = sign5 = 1.0;
if (s&1) sign0 *= -1.0;
......
......@@ -28,18 +28,13 @@ namespace Dune
public:
typedef LocalBasisTraits<D,2,Dune::FieldVector<D,2>,R,2,Dune::FieldVector<R,2>,
Dune::FieldMatrix<R,2,2> > Traits;
//! \brief Standard constructor
RT12DLocalBasis ()
{
sign0 = sign1 = sign2 = 1.0;
}
/**
* \brief Make set number s, where 0 <= s < 8
*
* \param s Edge orientation indicator
*/
RT12DLocalBasis (unsigned int s)
RT12DLocalBasis (unsigned int s = 0)
{
sign0 = sign1 = sign2 = 1.0;
if (s & 1)
......
......@@ -24,18 +24,13 @@ namespace Dune
{
public:
//! \brief Standard constructor
RT12DLocalInterpolation ()
{
sign0 = sign1 = sign2 = 1.0;
}
/**
* \brief Make set number s, where 0 <= s < 8
*
* \param s Edge orientation indicator
*/
RT12DLocalInterpolation (unsigned int s)
RT12DLocalInterpolation (unsigned int s = 0)
{
sign0 = sign1 = sign2 = 1.0;
if (s & 1)
......
......@@ -29,18 +29,12 @@ namespace Dune
typedef LocalBasisTraits<D,2,Dune::FieldVector<D,2>,R,2,Dune::FieldVector<R,2>,
Dune::FieldMatrix<R,2,2> > Traits;
//! \brief Standard constructor
RT1Cube2DLocalBasis ()
{
sign0 = sign1 = sign2 = sign3 = 1.0;
}
/**
* \brief Make set number s, where 0 <= s < 16
*
* \param s Edge orientation indicator
*/
RT1Cube2DLocalBasis (unsigned int s)
RT1Cube2DLocalBasis (unsigned int s = 0)
{
sign0 = sign1 = sign2 = sign3 = 1.0;
if (s & 1)
......
......@@ -25,18 +25,12 @@ namespace Dune
{
public:
//! \brief Standard constructor
RT1Cube2DLocalInterpolation ()
{
sign0 = sign1 = sign2 = sign3 = 1.0;
}
/**
* \brief Make set number s, where 0 <= s < 16
*
* \param s Edge orientation indicator
*/
RT1Cube2DLocalInterpolation (unsigned int s)
RT1Cube2DLocalInterpolation (unsigned int s = 0)
{
sign0 = sign1 = sign2 = sign3 = 1.0;
if (s & 1)
......
......@@ -29,18 +29,12 @@ namespace Dune
typedef LocalBasisTraits<D,3,Dune::FieldVector<D,3>,R,3,Dune::FieldVector<R,3>,
Dune::FieldMatrix<R,3,3> > Traits;
//! \brief Standard constructor
RT1Cube3DLocalBasis ()
{
sign0 = sign1 = sign2 = sign3 = sign4 = sign5 = 1.0;
}
/**
* \brief Make set number s, where 0 <= s < 64
*
* \param s Edge orientation indicator
*/
RT1Cube3DLocalBasis (unsigned int s)
RT1Cube3DLocalBasis (unsigned int s = 0)
{
sign0 = sign1 = sign2 = sign3 = sign4 = sign5 = 1.0;
if (s & 1)
......
......@@ -23,18 +23,13 @@ namespace Dune
{
public:
//! \brief Standard constructor
RT1Cube3DLocalInterpolation ()
{
sign0 = sign1 = sign2 = sign3 = sign4 = sign5 = 1.0;
}
/**
* \brief Make set number s, where 0 <= s < 64
*
* \param s Edge orientation indicator
*/
RT1Cube3DLocalInterpolation (unsigned int s)
RT1Cube3DLocalInterpolation (unsigned int s = 0)
{
sign0 = sign1 = sign2 = sign3 = sign4 = sign5 = 1.0;
if (s & 1)
......
......@@ -29,18 +29,12 @@ namespace Dune
typedef LocalBasisTraits<D,2,Dune::FieldVector<D,2>,R,2,Dune::FieldVector<R,2>,
Dune::FieldMatrix<R,2,2> > Traits;
//! \brief Standard constructor
RT2Cube2DLocalBasis ()
{
sign0 = sign1 = sign2 = sign3 = 1.0;
}
/**
* \brief Make set number s, where 0 <= s < 16
*
* \param s Edge orientation indicator
*/
RT2Cube2DLocalBasis (unsigned int s)
RT2Cube2DLocalBasis (unsigned int s = 0)
{
sign0 = sign1 = sign2 = sign3 = 1.0;
if (s & 1)
......
......@@ -24,18 +24,13 @@ namespace Dune
{
public:
//! \brief Standard constructor
RT2Cube2DLocalInterpolation ()
{
sign0 = sign1 = sign2 = sign3 = 1.0;
}
/**
* \brief Make set number s, where 0 <= s < 8
* \brief Make set number s, where 0 <= s < 16
*
* \param s Edge orientation indicator
*/
RT2Cube2DLocalInterpolation (unsigned int s)
RT2Cube2DLocalInterpolation (unsigned int s = 0)
{
sign0 = sign1 = sign2 = sign3 = 1.0;
if (s & 1)
......
......@@ -30,18 +30,12 @@ namespace Dune
typedef LocalBasisTraits<D,2,Dune::FieldVector<D,2>,R,2,Dune::FieldVector<R,2>,
Dune::FieldMatrix<R,2,2> > Traits;
//! \brief Standard constructor
RT3Cube2DLocalBasis ()
{
sign0 = sign1 = sign2 = sign3 = 1.0;
}
/**
* \brief Make set number s, where 0 <= s < 16
*
* \param s Edge orientation indicator
*/
RT3Cube2DLocalBasis (std::bitset<4> s)
RT3Cube2DLocalBasis (std::bitset<4> s = 0)
{
sign0 = (s[0]) ? -1.0 : 1.0;
sign1 = (s[1]) ? -1.0 : 1.0;
......
......@@ -24,18 +24,13 @@ namespace Dune
{
public:
//! \brief Standard constructor
RT3Cube2DLocalInterpolation ()
{
sign0 = sign1 = sign2 = sign3 = 1.0;
}
/**
* \brief Make set number s, where 0 <= s < 8
* \brief Make set number s, where 0 <= s < 16
*
* \param s Edge orientation indicator
*/
RT3Cube2DLocalInterpolation (unsigned int s)
RT3Cube2DLocalInterpolation (unsigned int s = 0)
{
sign0 = sign1 = sign2 = sign3 = 1.0;
if (s & 1)
......
......@@ -30,18 +30,12 @@ namespace Dune
typedef LocalBasisTraits<D,2,Dune::FieldVector<D,2>,R,2,Dune::FieldVector<R,2>,
Dune::FieldMatrix<R,2,2> > Traits;
//! \brief Standard constructor
RT4Cube2DLocalBasis ()
{
sign0 = sign1 = sign2 = sign3 = 1.0;
}
/**
* \brief Make set number s, where 0 <= s < 16
*
* \param s Edge orientation indicator
*/
RT4Cube2DLocalBasis (std::bitset<4> s)
RT4Cube2DLocalBasis (std::bitset<4> s = 0)
{
sign0 = (s[0]) ? -1.0 : 1.0;
sign1 = (s[1]) ? -1.0 : 1.0;
......
......@@ -24,18 +24,13 @@ namespace Dune
{
public:
//! \brief Standard constructor
RT4Cube2DLocalInterpolation ()
{
sign0 = sign1 = sign2 = sign3 = 1.0;
}
/**
* \brief Make set number s, where 0 <= s < 8
* \brief Make set number s, where 0 <= s < 16
*
* \param s Edge orientation indicator
*/
RT4Cube2DLocalInterpolation (unsigned int s)
RT4Cube2DLocalInterpolation (unsigned int s = 0)
{
sign0 = sign1 = sign2 = sign3 = 1.0;
if (s & 1)
......
......@@ -9,6 +9,7 @@
#include <dune/localfunctions/raviartthomas/raviartthomascube.hh>
#include <dune/localfunctions/raviartthomas/raviartthomas02d.hh>
#include <dune/localfunctions/raviartthomas/raviartthomaslfecache.hh>
#include <dune/localfunctions/raviartthomas/raviartthomas12d.hh>
#include <dune/localfunctions/test/test-localfe.hh>
......@@ -22,32 +23,109 @@ int main(int argc, char** argv)
Dune::RaviartThomasSimplexLocalFiniteElement<2,double,double> rt1simplex2dlfem(Dune::GeometryTypes::simplex(2),1);
TEST_FE(rt1simplex2dlfem);
Dune::RaviartThomasCubeLocalFiniteElement<double,double,2,0> rt0cube2dlfem(1);
Dune::RaviartThomasCubeLocalFiniteElement<double,double,2,0> rt0cube2dlfem;
TEST_FE(rt0cube2dlfem);
for (unsigned int s = 0; s < 16; s++)
{
Dune::RaviartThomasCubeLocalFiniteElement<double,double,2,0> rt0cube2dlfem(s);
TEST_FE(rt0cube2dlfem);
}
Dune::RaviartThomasCubeLocalFiniteElement<double,double,3,0> rt0cube3dlfem(1);
Dune::RaviartThomasCubeLocalFiniteElement<double,double,3,0> rt0cube3dlfem;
TEST_FE(rt0cube3dlfem);
for (unsigned int s = 0; s < 64; s++)
{
Dune::RaviartThomasCubeLocalFiniteElement<double,double,3,0> rt0cube3dlfem(s);
TEST_FE(rt0cube3dlfem);
}
Dune::RaviartThomasCubeLocalFiniteElement<double,double,2,1> rt1cube2dlfem(1);
Dune::RaviartThomasCubeLocalFiniteElement<double,double,2,1> rt1cube2dlfem;
TEST_FE(rt1cube2dlfem);
for (unsigned int s = 0; s < 16; s++)
{
Dune::RaviartThomasCubeLocalFiniteElement<double,double,2,1> rt1cube2dlfem(s);
TEST_FE(rt1cube2dlfem);
}
Dune::RaviartThomasCubeLocalFiniteElement<double,double,3,1> rt1cube3dlfem(1);
Dune::RaviartThomasCubeLocalFiniteElement<double,double,3,1> rt1cube3dlfem;
TEST_FE(rt1cube3dlfem);
for (unsigned int s = 0; s < 64; s++)
{
Dune::RaviartThomasCubeLocalFiniteElement<double,double,3,1> rt1cube3dlfem(s);
TEST_FE(rt1cube3dlfem);
}
Dune::RaviartThomasCubeLocalFiniteElement<double,double,2,2> rt2cube2dlfem(1);
Dune::RaviartThomasCubeLocalFiniteElement<double,double,2,2> rt2cube2dlfem;
TEST_FE(rt2cube2dlfem);
for (unsigned int s = 0; s < 16; s++)
{
Dune::RaviartThomasCubeLocalFiniteElement<double,double,2,2> rt2cube2dlfem(s);
TEST_FE(rt2cube2dlfem);
}
Dune::RaviartThomasCubeLocalFiniteElement<double,double,2,3> rt3cube2dlfem(1);
Dune::RaviartThomasCubeLocalFiniteElement<double,double,2,3> rt3cube2dlfem;
TEST_FE(rt3cube2dlfem);
for (unsigned int s = 0; s < 64; s++)
{
Dune::RaviartThomasCubeLocalFiniteElement<double,double,2,3> rt3cube2dlfem(s);
TEST_FE(rt3cube2dlfem);
}
Dune::RaviartThomasCubeLocalFiniteElement<double,double,2,4> rt4cube2dlfem(1);
Dune::RaviartThomasCubeLocalFiniteElement<double,double,2,4> rt4cube2dlfem;
TEST_FE(rt4cube2dlfem);
for (unsigned int s = 0; s < 16; s++)
{
Dune::RaviartThomasCubeLocalFiniteElement<double,double,2,4> rt4cube2dlfem(s);
TEST_FE(rt4cube2dlfem);
}
Dune::RT0Cube2DLocalFiniteElement<double,double> rt0cube2dlfemDedicated;
TEST_FE(rt0cube2dlfemDedicated);
for (unsigned int s = 0; s < 16; s++)
{
Dune::RT0Cube2DLocalFiniteElement<double,double> rt0cube2dlfemDedicated(s);
TEST_FE(rt0cube2dlfemDedicated);
}
Dune::RT1Cube2DLocalFiniteElement<double,double> rt1cube2dlfemDedicated;
TEST_FE(rt1cube2dlfemDedicated);
for (unsigned int s = 0; s < 16; s++)
{
Dune::RT1Cube2DLocalFiniteElement<double,double> rt1cube2dlfemDedicated(s);
TEST_FE(rt1cube2dlfemDedicated);
}
Dune::RT02DLocalFiniteElement<double,double> rt02dlfemDedicated;
TEST_FE(rt02dlfemDedicated);
for (unsigned int s = 0; s < 8; s++)
{
Dune::RT02DLocalFiniteElement<double,double> rt02dlfemDedicated(s);
TEST_FE(rt02dlfemDedicated);
}
Dune::RT12DLocalFiniteElement<double,double> rt12dlfemDedicated;
TEST_FE(rt12dlfemDedicated);
for (unsigned int s = 0; s < 8; s++)
{
Dune::RT12DLocalFiniteElement<double,double> rt12dlfemDedicated(s);
TEST_FE(rt12dlfemDedicated);
}
Dune::RT0Cube3DLocalFiniteElement<double,double> rt0cube3dlfemDedicated;
TEST_FE(rt0cube3dlfemDedicated);
for (unsigned int s = 0; s < 64; s++)
{
Dune::RT0Cube3DLocalFiniteElement<double,double> rt0cube3dlfemDedicated(s);
TEST_FE(rt0cube3dlfemDedicated);
}
Dune::RT1Cube3DLocalFiniteElement<double,double> rt1cube3dlfemDedicated;
TEST_FE(rt1cube3dlfemDedicated);
for (unsigned int s = 0; s < 64; s++)
{
Dune::RT1Cube3DLocalFiniteElement<double,double> rt1cube3dlfemDedicated(s);
TEST_FE(rt1cube3dlfemDedicated);
}
// Test the RaviartThomasLocalFiniteElementCache
Dune::RaviartThomasLocalFiniteElementCache<double,double,2,0> lagrangeLFECache;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment