From b5a2c0717adbc44ce8473e41776446b77e499241 Mon Sep 17 00:00:00 2001 From: Stefan Girke <stefan.girke@wwu.de> Date: Fri, 19 Feb 2016 18:08:39 +0100 Subject: [PATCH] provide missing steady state methods --- dune/fem-dg/algorithm/caller/adapt.hh | 76 +++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/dune/fem-dg/algorithm/caller/adapt.hh b/dune/fem-dg/algorithm/caller/adapt.hh index 3f94ad36..b4021296 100644 --- a/dune/fem-dg/algorithm/caller/adapt.hh +++ b/dune/fem-dg/algorithm/caller/adapt.hh @@ -216,6 +216,33 @@ namespace Fem } } + /** + * \brief Prepare an initial refined grid. + * + * \param[in] alg pointer to the calling sub-algorithm + * \param[in] loop number of eoc loop + */ + template< class SubAlgImp > + void initializeEnd( SubAlgImp* alg, int loop ) + { + if( adaptive() ) + { + // call initial adaptation + estimateMark( true ); + adapt( alg, loop ); + + // setup problem again + alg->initialize( loop ); + + // some info in verbose mode + if( Fem::Parameter::verbose() ) + { + std::cout << "Start adaptation: step " << startCount << ", grid size: " << alg->gridSize() + << std::endl; + } + } + } + /** * \brief Calls the estimate, mark and adaptation routines to refine the grid. * @@ -233,6 +260,19 @@ namespace Fem } } + /** + * \brief Calls the estimate, mark and adaptation routines to refine the grid. + * + * \param[in] alg pointer to the calling sub-algorithm + * \param[in] loop number of eoc loop + */ + template< class SubAlgImp > + void solveStart( SubAlgImp* alg, int loop ) + { + estimateMark( false ); + adapt( alg, loop ); + } + /** * \brief finalize all indicators * @@ -246,6 +286,17 @@ namespace Fem ForLoopType< Finalize >::apply( tuple_ ); } + /** + * \brief finalize all indicators + * + * \param[in] alg pointer to the calling sub-algorithm + * \param[in] loop number of eoc loop + */ + template< class SubAlgImp > + void finalizeStart( SubAlgImp* alg, int loop ) + { + ForLoopType< Finalize >::apply( tuple_ ); + } /** * \brief Returns true, if all sub-algorithms are adaptive. @@ -300,6 +351,14 @@ namespace Fem ForLoopType< SetAdaptation >::apply( tuple_, tp ); } + /** + * \brief Set adaptation manager of sub-algorithms. + */ + void setAdaptation() + { + ForLoopType< SetAdaptation >::apply( tuple_ ); + } + /** * \brief Returns the adaptation time used by adaptation manager. */ @@ -363,6 +422,23 @@ namespace Fem } } + template< class SubAlgImp > + void adapt( SubAlgImp* alg, int loop ) + { + if( adaptive() ) + { + //int sequence = getSequence( get<0>( tuple_ ) ); + + ForLoopType< PreAdapt >::apply( tuple_ ); + adaptationManager().adapt(); + ForLoopType< PostAdapt >::apply( tuple_ ); + + //TODO think about it + //if( sequence != getSequence( get<0>( tuple_ ) ) ) + // alg->postProcessing().solveEnd( alg, loop ); + } + } + template< class T > static typename enable_if< std::is_void< typename std::remove_pointer<T>::type::AdaptIndicatorType >::value, int >::type getSequence( T ){} -- GitLab