Skip to content
Snippets Groups Projects
Commit f58baa58 authored by Robert Kloefkorn's avatar Robert Kloefkorn
Browse files

make legacy code work.

parent 1292c5f5
No related branches found
No related tags found
No related merge requests found
......@@ -45,6 +45,17 @@
// problem dependent
#include <problemcreator.hh>
#ifndef NEW_STEPPER_SELECTOR_USED
#warning "Old method of stepper selection detected. Please consult dune/fem-dg/test and update your code"
#if defined EULER
#include <dune/fem-dg/stepper/advectionstepper.hh>
#define Stepper AdvectionStepper
#else
#include <dune/fem-dg/stepper/advectiondiffusionstepper.hh>
#define Stepper AdvectionDiffusionStepper
#endif
#endif
#include <dune/fem/misc/femeoc.hh>
#include <dune/fem/misc/flops.hh>
......@@ -107,35 +118,43 @@ namespace LOOPSPACE {
}
typedef Dune::GridSelector :: GridType GridType;
// old method
#ifndef NEW_STEPPER_SELECTOR_USED
typedef ProblemGenerator< GridType > ProblemTraits;
// return type of initializeGrid is Dune::GridPtr, use release such that memory of GridPtr is released
std::unique_ptr< GridType > gridptr ( ProblemTraits :: initializeGrid().release() );
// Note to me: problem description is for FemEOC
const std::string advFlux = ProblemTraits :: advectionFluxName();
const std::string diffFlux = ProblemTraits :: diffusionFluxName();
// get grid reference
GridType& grid = *gridptr;
// return type of initializeGrid is Dune::GridPtr, use release such that memory of GridPtr is released
std::unique_ptr< GridType > gridptr( ProblemTraits :: initializeGrid( advFlux + diffFlux ).release() );
#ifndef NAVIER_STOKES_STEPPER_HH
// the new way
typedef ProblemTraits :: Stepper< ProblemTraits > :: Type StepperType ;
#else
#warning "Using deprecated method of Stepper selection. Please consult the fem-dg examples for update"
// the old legacy way
typedef Stepper< GridType, ProblemTraits, POLORDER > StepperType ;
#endif
StepperType stepper( *gridptr );
// new method, the ProblemGenerator simply creates the stepper
compute( stepper );
#else
typedef ProblemCreator< GridType > ProblemTraits;
// create stepper on heap, otherwise problems with stack size
std::unique_ptr< StepperType > stepper( new StepperType( grid ) );
// return type of initializeGrid is Dune::GridPtr, use release such that memory of GridPtr is released
std::unique_ptr< GridType > gridptr( ProblemTraits :: initializeGrid().release() );
assert( stepper );
typedef ProblemTraits :: StepperType StepperType;
std::unique_ptr< StepperType > stepper( new StepperType( *gridptr ) );
// new method, the ProblemGenerator simply creates the stepper
compute( *stepper );
#endif
// stop flop counters for all threads
if( countFlops )
// stop flop counters for all threads
if( countFlops )
{
FlopStopObject stopObj ;
Dune::Fem::ThreadHandle::run( stopObj );
// print results
// print results
Dune::Fem::FlopCounter::print( std::cout );
}
}
......
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