Commit 54d4daf9 authored by Martin Nolte's avatar Martin Nolte

make Jacobian matrices default constructible

parent 90751ade
Pipeline #10508 passed with stage
in 17 minutes and 11 seconds
......@@ -21,6 +21,7 @@ namespace Dune
{
typedef SPDirection< dim > Direction;
SPGeometryPattern ();
explicit SPGeometryPattern ( Direction dir );
int nonzero ( const int k ) const;
......@@ -36,6 +37,7 @@ namespace Dune
{
typedef SPDirection< dim > Direction;
SPGeometryPattern () = default;
explicit SPGeometryPattern ( Direction dir ) {}
int nonzero ( const int k ) const;
......@@ -47,6 +49,7 @@ namespace Dune
{
typedef SPDirection< dim > Direction;
SPGeometryPattern () = default;
explicit SPGeometryPattern ( Direction dir ) {}
int nonzero ( const int k ) const;
......@@ -58,6 +61,7 @@ namespace Dune
{
typedef SPDirection< 0 > Direction;
SPGeometryPattern () = default;
explicit SPGeometryPattern ( Direction dir ) {}
int nonzero ( const int k ) const;
......@@ -90,6 +94,8 @@ namespace Dune
typedef Dune::FieldMatrix< field_type, rows, cols > FieldMatrix;
typedef typename Dune::FieldTraits< field_type >::real_type real_type;
SPJacobianTransposed () = default;
SPJacobianTransposed ( const GlobalVector &h, SPDirection< dim > dir )
: Pattern( std::move( dir ) )
{
......@@ -175,6 +181,8 @@ namespace Dune
typedef Dune::FieldMatrix< field_type, rows, cols > FieldMatrix;
typedef typename Dune::FieldTraits< field_type >::real_type real_type;
SPJacobianInverseTransposed () = default;
SPJacobianInverseTransposed ( const GlobalVector &h, SPDirection< dim > dir )
: Pattern( dir )
{
......@@ -277,6 +285,16 @@ namespace Dune
// Implementation of SPGeometryPattern
// -----------------------------------
template< int dim, int codim >
inline SPGeometryPattern< dim, codim >::SPGeometryPattern ()
{
const int mydim = dim - codim;
for( int k = 0; k < mydim; ++k )
nonzero_[ k ] = k;
for( int k = 0; k < codim; ++k )
zero_[ k ] = mydim + k;
}
template< int dim, int codim >
inline SPGeometryPattern< dim, codim >::SPGeometryPattern ( Direction dir )
{
......
......@@ -40,3 +40,5 @@ foreach(test test-spgrid)
)
endforeach()
endforeach()
dune_add_test(SOURCES test-jacobians.cc)
#include <config.h>
#include <type_traits>
#include <utility>
#include <dune/common/fmatrix.hh>
#include <dune/common/hybridutilities.hh>
#include <dune/grid/spgrid/geometrycache.hh>
int main ( int argc, char *argv[] )
try
{
Dune::Hybrid::forEach( std::make_integer_sequence< int, 4 >(), [] ( auto &&codim ) {
Dune::SPJacobianTransposed< double, 3, std::decay_t< decltype( codim ) >::value > jt;
Dune::FieldMatrix< double, std::decay_t< decltype( codim ) >::value, 3 > fm_jt( jt );
if( fm_jt.frobenius_norm2() > 0.0 )
DUNE_THROW( Dune::Exception, "Default initialized JacobianTransposed is not zero." );
Dune::SPJacobianInverseTransposed< double, 3, std::decay_t< decltype( codim ) >::value > jit;
Dune::FieldMatrix< double, 3, std::decay_t< decltype( codim ) >::value > fm_jit( jit );
if( fm_jt.frobenius_norm2() > 0.0 )
DUNE_THROW( Dune::Exception, "Default initialized JacobianInverseTransposed is not zero." );
} );
return 0;
}
catch( const Dune::Exception &e )
{
std::cerr << e << std::endl;
return 1;
}
Markdown is supported
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