Skip to content
Snippets Groups Projects
Commit 67a3ffed authored by Robert K's avatar Robert K
Browse files

[cleanup][Algorithm] Adjust to change in DGOperator constructor by

passing advection flux as parameter.
parent c38333e5
No related branches found
No related tags found
1 merge request!6Latest improvements in dune-fem-dg
......@@ -89,6 +89,8 @@ namespace Fem
typedef typename GridPartType::GridType GridType;
typedef AdaptationParameters AdaptationParametersType;
typedef typename IndicatorType :: AdvectionFluxType AdvectionFluxType;
// time provider
typedef Fem::TimeProviderBase TimeProviderType;
......@@ -97,20 +99,23 @@ namespace Fem
typedef typename IndicatorType::ExtraParameterTupleType ExtraParameterTupleType;
template< class Model, class ExtraParameterTupleImp >
AdaptIndicator( DiscreteFunctionType& sol, Model& model, const ExtraParameterTupleImp& tuple, const std::string keyPrefix = "" )
: AdaptIndicator( sol.space(), model, tuple, keyPrefix )
AdaptIndicator( DiscreteFunctionType& sol, Model& model, const AdvectionFluxType& numFlux,
const ExtraParameterTupleImp& tuple, const std::string keyPrefix = "" )
: AdaptIndicator( sol.space(), model, numFlux, tuple, keyPrefix )
{
sol_ = &sol;
}
template< class Model, class ExtraParameterTupleImp >
AdaptIndicator( const DiscreteFunctionSpaceType& space, Model& model, const ExtraParameterTupleImp& tuple, const std::string keyPrefix = "" )
AdaptIndicator( const DiscreteFunctionSpaceType& space, Model& model, const AdvectionFluxType& numFlux,
const ExtraParameterTupleImp& tuple, const std::string keyPrefix = "" )
: sol_( nullptr ),
space_( space ),
adaptationHandler_( nullptr ),
keyPrefix_( keyPrefix ),
adaptParam_( AdaptationParametersType( ParameterKey::generate( "", "fem.adaptation." ) ) ),
indicator_( const_cast<GridPartType&>(space.gridPart()), model, tuple, keyPrefix_ ),
// this is a DG operator (see operator/dg)
indicator_( const_cast<GridPartType&>(space.gridPart()), model, numFlux, tuple, keyPrefix_ ),
estimator_( space, model.problem(), adaptParam_ ),
timeProvider_( nullptr )
{}
......
......@@ -39,6 +39,9 @@ namespace Fem
// The other two are needed for semi-implicit time discretization
typedef typename BaseType::OperatorType::type FullOperatorType;
// type of advective flux implementation
typedef typename FullOperatorType :: AdvectionFluxType AdvectionFluxType;
typedef typename BaseType::SolverType::LinearSolverType LinearSolverType;
// The discrete function for the unknown solution is defined in the DgOperator
......@@ -70,9 +73,12 @@ namespace Fem
SubAdvectionAlgorithm( const std::shared_ptr< ContainerImp >& cont,
const std::shared_ptr< ExtraArgsImp >& extra )
: BaseType( cont, extra ),
advectionOperator_( std::make_unique< FullOperatorType >( solution().space().gridPart(), model_, extra, name() ) ),
adaptIndicator_( std::make_unique< AdaptIndicatorOptional<AdaptIndicatorType> >( solution(), model_, extra, name() ) )
{}
numFlux_( model_ ),
advectionOperator_( std::make_unique< FullOperatorType >( solution().space().gridPart(), model_, numFlux_, extra, name() ) ),
adaptIndicator_( std::make_unique< AdaptIndicatorOptional<AdaptIndicatorType> >( solution(), model_, numFlux_, extra, name() ) )
{
}
virtual AdaptIndicatorType* adaptIndicator ()
{
......@@ -120,6 +126,7 @@ namespace Fem
}
protected:
AdvectionFluxType numFlux_;
std::unique_ptr< FullOperatorType > advectionOperator_;
mutable std::unique_ptr< AdaptIndicatorOptional<AdaptIndicatorType> > adaptIndicator_;
};
......
......@@ -42,6 +42,8 @@ namespace Fem
typedef typename BaseType::OperatorType::ExplicitType ExplicitOperatorType;
typedef typename BaseType::OperatorType::ImplicitType ImplicitOperatorType;
typedef typename OperatorType :: AdvectionFluxType AdvectionFluxType;
typedef typename BaseType::SolverType::LinearSolverType LinearSolverType;
// The discrete function for the unknown solution is defined in the DgOperator
......@@ -73,10 +75,11 @@ namespace Fem
SubAdvectionDiffusionAlgorithm( const std::shared_ptr< ContainerImp >& cont,
const std::shared_ptr< ExtraArgsImp >& extra )
: BaseType( cont, extra ),
operator_( std::make_unique< OperatorType >( solution().space().gridPart(), model_, extra, name() ) ),
advectionOperator_( std::make_unique< ExplicitOperatorType >( solution().space().gridPart(), model_, extra, name() ) ),
diffusionOperator_( std::make_unique< ImplicitOperatorType >( solution().space().gridPart(), model_, extra, name() ) ),
adaptIndicator_( std::make_unique< AdaptIndicatorOptional<AdaptIndicatorType> >( solution(), model_, extra, name() ) )
numFlux_( model_ ),
operator_( std::make_unique< OperatorType >( solution().space().gridPart(), model_, numFlux_, extra, name() ) ),
advectionOperator_( std::make_unique< ExplicitOperatorType >( solution().space().gridPart(), model_, numFlux_, extra, name() ) ),
diffusionOperator_( std::make_unique< ImplicitOperatorType >( solution().space().gridPart(), model_, numFlux_, extra, name() ) ),
adaptIndicator_( std::make_unique< AdaptIndicatorOptional<AdaptIndicatorType> >( solution(), model_, numFlux_, extra, name() ) )
{}
virtual AdaptIndicatorType* adaptIndicator ()
......@@ -129,9 +132,10 @@ namespace Fem
}
protected:
std::unique_ptr< OperatorType > operator_;
std::unique_ptr< ExplicitOperatorType > advectionOperator_;
std::unique_ptr< ImplicitOperatorType > diffusionOperator_;
AdvectionFluxType numFlux_;
std::unique_ptr< OperatorType > operator_;
std::unique_ptr< ExplicitOperatorType > advectionOperator_;
std::unique_ptr< ImplicitOperatorType > diffusionOperator_;
mutable std::unique_ptr< AdaptIndicatorOptional<AdaptIndicatorType> > adaptIndicator_;
};
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment