1 #ifndef DUNE_FEM_SPACEOPERATORIF_HH 2 #define DUNE_FEM_SPACEOPERATORIF_HH 27 template <
class DestinationImp>
42 virtual int size ()
const = 0 ;
53 virtual void operator() (
const double *u,
double *f )
const = 0;
59 virtual void limit (
const double *u,
double *f )
const { }
70 virtual void setTime (
const double time ) {}
100 template<
class DiscreteFunction >
113 typedef typename DestinationType::DiscreteFunctionSpaceType
SpaceType;
116 template <
class Op,
class DF,
class Field >
119 static inline void apply(
const Op& op,
const double* u,
double* f )
121 std::cerr <<
"ERROR: SpaceOperatorInterface::operator()( const double*, double* ) only works for RangeFieldType double" << std::endl;
125 static inline void limit(
const Op& op,
const double* u,
double* f )
127 std::cerr <<
"ERROR: SpaceOperatorInterface::limit( const double*, double* ) only works for RangeFieldType double" << std::endl;
134 template <
class Op >
137 static inline void apply(
const Op& op,
const double* u,
double* f )
141 const SpaceType &spc = op.
space();
144 const Destination arg(
"SpaceOperatorIF::ARG", spc, u );
145 Destination dest(
"SpaceOperatorIF::DEST", spc, f );
151 static inline void limit(
const Op& op,
const double* u,
double* f )
155 const SpaceType &spc = op.
space();
158 const Destination arg(
"SpaceOperatorIF::limitARG", spc, u );
159 Destination dest(
"SpaceOperatorIF::limitDEST", spc, f );
162 op.limit( arg, dest );
169 using BaseType::operator ();
172 virtual const SpaceType &space()
const = 0;
175 virtual int size ()
const {
return space().size(); }
182 virtual void operator() (
const double *u,
double *f )
const;
188 virtual void limit (
const double *u,
double *f )
const;
197 virtual void limit (
const DestinationType& arg, DestinationType& dest)
const 211 template <
class OperatorType>
221 mutable OperatorType*
op_;
233 : op_(op), model_(model)
241 delete model_; model_ = 0;
253 template <
class OperatorType>
263 using BaseType :: pass;
270 typedef typename DestinationType :: DiscreteFunctionSpaceType SpaceType;
291 virtual void operator () (
const DestinationType& arg, DestinationType& dest)
const 299 const SpaceType&
space()
const {
return pass().space(); }
302 void setTime(
const double time) { pass().setTime(time); }
310 pass().allocateLocalMemory();
311 return & (pass().destination());
316 template <
class OperatorType>
324 using BaseType :: pass;
333 typedef typename DestinationType :: DiscreteFunctionSpaceType
SpaceType;
346 void operator () (
const DestinationType& arg, DestinationType& dest)
const 356 template<
class DiscreteFunction >
362 typename DiscreteFunction :: RangeFieldType >::apply( *
this, u, f );
365 template<
class DiscreteFunction >
371 typename DiscreteFunction :: RangeFieldType >
::limit( *
this, u, f );
374 template<
class DiscreteFunction >
388 #endif // #ifndef DUNE_FEM_SPACEOPERATORIF_HH Definition: spaceoperatorif.hh:117
virtual void operator()(const double *u, double *f) const =0
application operator to apply right hand side
ODESpaceOperatorInterface for Operators that work with PARDG ODE solvers of the type where is a dis...
Definition: spaceoperatorif.hh:28
const DestinationType * destination() const
return reference to pass's local memory
Definition: spaceoperatorif.hh:308
operator providing a Jacobian through automatic differentiation
Definition: automaticdifferenceoperator.hh:22
apply wrapper
Definition: spaceoperatorif.hh:317
only for keeping the pointer
Definition: spaceoperatorif.hh:254
OperatorType * op_
Definition: spaceoperatorif.hh:221
DestinationType::DiscreteFunctionSpaceType SpaceType
type of discrete function space
Definition: spaceoperatorif.hh:113
SpaceOperatorStorage(OperatorType *op, ObjPointerStorage *model)
constructor storing pointer
Definition: spaceoperatorif.hh:232
SpaceOperatorPtr(OperatorType *op, ObjPointerStorage *model)
constructor storing pointer
Definition: spaceoperatorif.hh:283
static void apply(const Op &op, const double *u, double *f)
Definition: spaceoperatorif.hh:137
static constexpr T max(T a)
Definition: utility.hh:65
Definition: adaptivefunction/adaptivefunction.hh:34
SpaceOperatorStorage(OperatorType *op)
constructor storing pointer
Definition: spaceoperatorif.hh:227
virtual const DestinationType * destination() const
return reference to pass's local memory
Definition: spaceoperatorif.hh:207
DiscreteFunction DestinationType
type of argument and destination
Definition: spaceoperatorif.hh:110
virtual ~PARDGSpaceOperatorInterface()
destructor
Definition: spaceoperatorif.hh:39
virtual void limit(const DestinationType &arg, DestinationType &dest) const
limiter application operator
Definition: spaceoperatorif.hh:197
void setTime(const double time)
set time for operators
Definition: spaceoperatorif.hh:302
const SpaceType & space() const
return reference to space
Definition: spaceoperatorif.hh:299
virtual int size() const
return size of discrete function space, i.e. number of unknowns
Definition: spaceoperatorif.hh:175
virtual ~SpaceOperatorPtr()
destructor
Definition: spaceoperatorif.hh:288
virtual void initializeTimeStepSize(const DestinationType &U0) const
call operator once to calculate initial time step size
Definition: spaceoperatorif.hh:376
OperatorType & pass() const
return reference to pass
Definition: spaceoperatorif.hh:245
virtual ~SpaceOperatorInterface()
destructor
Definition: spaceoperatorif.hh:167
ObjPointerStorage * model_
Definition: spaceoperatorif.hh:223
abstract operator
Definition: operator.hh:25
Definition: objpointer.hh:37
interface for time evolution operators
Definition: spaceoperatorif.hh:101
virtual void limit(const double *u, double *f) const
apply limiter to u and store result in f
Definition: spaceoperatorif.hh:59
static void limit(const Op &op, const double *u, double *f)
Definition: spaceoperatorif.hh:125
DestinationType::DiscreteFunctionSpaceType SpaceType
type of discrete function space
Definition: spaceoperatorif.hh:333
SpaceOperatorWrapper(OperatorType *op)
constructor storing pointer
Definition: spaceoperatorif.hh:336
Definition: coordinate.hh:4
virtual bool hasLimiter() const
return true if explicit limiter is available
Definition: spaceoperatorif.hh:191
SpaceOperatorWrapper(OperatorType *op, ObjPointerStorage *model)
constructor storing pointer
Definition: spaceoperatorif.hh:341
PARDGSpaceOperatorInterface()
Definition: spaceoperatorif.hh:32
double timeStepEstimate() const
estimate maximum time step
Definition: spaceoperatorif.hh:305
virtual int size() const =0
return size of discrete function space, i.e. number of unknowns
SpaceOperatorPtr(OperatorType *op)
constructor storing pointer
Definition: spaceoperatorif.hh:278
virtual double timeStepEstimate() const
estimate maximum time step
Definition: spaceoperatorif.hh:80
virtual void setTime(const double time)
set time for operators
Definition: spaceoperatorif.hh:70
static void limit(const Op &op, const double *u, double *f)
Definition: spaceoperatorif.hh:151
DestinationImp DestinationType
type of argument and destination
Definition: spaceoperatorif.hh:36
virtual void limit(const double *u, double *f) const
limiter application operator
Definition: spaceoperatorif.hh:367
virtual void initializeTimeStepSize(const DestinationType &U0) const =0
call operator once to calculate initial time step size
~SpaceOperatorStorage()
destructor deletes operator
Definition: spaceoperatorif.hh:237
static void apply(const Op &op, const double *u, double *f)
Definition: spaceoperatorif.hh:119
virtual bool hasLimiter() const
return true if limit method is implemented
Definition: spaceoperatorif.hh:65
virtual void operator()(const double *u, double *f) const
application operator to apply right hand side
Definition: spaceoperatorif.hh:358
only for keeping the pointer
Definition: spaceoperatorif.hh:212
const DiscreteFunctionSpaceType & space() const
obtain a reference to the corresponding DiscreteFunctionSpace
Definition: discretefunction.hh:704
OperatorType::DestinationType DestinationType
type of Argument and Destination
Definition: spaceoperatorif.hh:331