DUNE-ACFEM (2.5.1)

operatorparts.hh
1#ifndef __DUNE_ACFEM_OPERATORPARTS_HH__
2#define __DUNE_ACFEM_OPERATORPARTS_HH__
3
4#include <dune/fem/misc/bartonnackmaninterface.hh>
5
6namespace Dune {
7
8 namespace ACFem {
9
35 template<class PartsImpl>
37
43 template<class FunctionSpace>
45 {
47 typedef FunctionSpace FunctionSpaceType;
48
50 typedef typename FunctionSpaceType::ScalarFunctionSpaceType ScalarFunctionSpaceType;
51
54 isLinear = false,
55 isSymmetric = false,
56 isSemiDefinite = false
57 };
58
63 hasFlux = true,
64 hasSources = true,
65 hasRobinFlux = true,
66 };
67
68 };
69
89 template<class PartsImpl>
91 : public Fem::BartonNackmanInterface<OperatorPartsInterface<PartsImpl>, PartsImpl>
92 {
94 typedef PartsImpl ImplementationType;
96 typedef Fem::BartonNackmanInterface<ThisType, ImplementationType> BaseType;
97 using BaseType::asImp;
98 protected:
102 OperatorPartsInterface& operator=(const OperatorPartsInterface& other) {}
103 public:
104 typedef typename TraitsType::FunctionSpaceType FunctionSpaceType;
105
106 typedef typename FunctionSpaceType::DomainType DomainType;
107 typedef typename FunctionSpaceType::RangeType RangeType;
108 typedef typename FunctionSpaceType::JacobianRangeType JacobianRangeType;
109 typedef typename FunctionSpaceType::HessianRangeType HessianRangeType;
110
111 typedef typename FunctionSpaceType::DomainFieldType DomainFieldType;
112 typedef typename FunctionSpaceType::RangeFieldType RangeFieldType;
113
114 enum { dimDomain = FunctionSpaceType::dimDomain,
115 dimRange = FunctionSpaceType::dimRange };
116
119 isLinear = TraitsType::isLinear,
120 isSymmetric = TraitsType::isSymmetric,
121 isSemiDefinite = TraitsType::isSemiDefinite
122 };
123
126 hasFlux = TraitsType::hasFlux,
127 hasSources = TraitsType::hasSources,
128 hasRobinFlux = TraitsType::hasRobinFlux,
129 };
130
140 template<class Entity>
141 void setEntity(const Entity& entity) const
142 {
143 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION(asImp().setEntity(entity));
144 }
145
167 template<class Intersection>
168 bool setIntersection(const Intersection& intersection) const
169 {
170 bool result;
171 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION(result = asImp().setIntersection(intersection));
172 return result;
173 }
174
176 std::string name() const
177 {
178 return asImp().name();
179 }
180
201 template<class Entity, class Point>
202 void flux(const Entity& entity,
203 const Point &x,
204 const RangeType &value,
205 const JacobianRangeType &jacobian,
206 JacobianRangeType &flux) const
207 {
208 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION(asImp().flux(entity,x,value,jacobian,flux));
209 }
210
235 template<class Entity, class Point>
236 void linearizedFlux(const RangeType& uBar,
237 const JacobianRangeType& DuBar,
238 const Entity& entity,
239 const Point &x,
240 const RangeType &value,
241 const JacobianRangeType &jacobian,
242 JacobianRangeType &flux) const
243 {
244 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION(asImp().linearizedFlux(uBar, DuBar, entity, x, value, jacobian, flux));
245 }
246
260 template<class Entity, class Point>
261 void source(const Entity& entity,
262 const Point &x,
263 const RangeType &value,
264 const JacobianRangeType &jacobian,
265 RangeType &result) const
266 {
267 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION(asImp().source(entity, x, value, jacobian, result));
268 }
269
289 template<class Entity, class Point>
290 void linearizedSource(const RangeType &uBar,
291 const JacobianRangeType& DuBar,
292 const Entity& entity,
293 const Point &x,
294 const RangeType &value,
295 const JacobianRangeType& jacobian,
296 RangeType &result) const
297 {
298 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION(asImp().linearizedSource(uBar, DuBar, entity, x, value, jacobian, result));
299 }
300
315 template<class Intersection, class Point>
316 void robinFlux(const Intersection& intersection,
317 const Point& x,
318 const DomainType& unitOuterNormal,
319 const RangeType& value,
320 RangeType& result) const
321 {
322 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION(asImp().robinFlux(intersection, x, unitOuterNormal, value, result));
323 }
324
340 template<class Intersection, class Point>
341 void linearizedRobinFlux(const RangeType& uBar,
342 const Intersection& intersection,
343 const Point& x,
344 const DomainType& unitOuterNormal,
345 const RangeType& value,
346 RangeType& result) const
347 {
348 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION(asImp().linearizedRobinFlux(uBar, intersection, x, unitOuterNormal, value, result));
349 }
350
368 template<class Entity, class Point>
369 void fluxDivergence(const Entity& entity,
370 const Point &x,
371 const RangeType &value,
372 const JacobianRangeType &jacobian,
373 const HessianRangeType &hessian,
374 RangeType &result) const
375 {
376 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION(asImp().fluxDivergence(entity, x, value, jacobian, hessian, result));
377 }
378 };
379
384 template<class PartsImpl>
386 : public OperatorPartsInterface<PartsImpl>
387 {
388 typedef PartsImpl ImplementationType;
394 protected:
396 public:
397 typedef typename DefaultTraitsType::FunctionSpaceType FunctionSpaceType;
398
399 typedef typename FunctionSpaceType::DomainType DomainType;
400 typedef typename FunctionSpaceType::RangeType RangeType;
401 typedef typename FunctionSpaceType::JacobianRangeType JacobianRangeType;
402 typedef typename FunctionSpaceType::HessianRangeType HessianRangeType;
403
404 typedef typename FunctionSpaceType::DomainFieldType DomainFieldType;
405 typedef typename FunctionSpaceType::RangeFieldType RangeFieldType;
406
407 enum {
408 dimDomain = FunctionSpaceType::dimDomain,
409 dimRange = FunctionSpaceType::dimRange
410 };
411
414 isLinear = TraitsType::isLinear,
415 isSymmetric = TraitsType::isSymmetric,
416 isSemiDefinite = TraitsType::isSemiDefinite
417 };
418
421 hasFlux = TraitsType::hasFlux,
422 hasSources = TraitsType::hasSources,
423 hasRobinFlux = TraitsType::hasRobinFlux,
424 };
425
427 template<class Entity>
428 void setEntity(const Entity& entity) const
429 {
430 // nothing
431 }
432
434 template<class Intersection>
435 bool setIntersection(const Intersection& intersection) const
436 {
437 // this is false as the default indicator classifies the
438 // empty set.
439 return hasRobinFlux;
440 }
441
443 std::string name() const
444 {
445 return "Model";
446 }
447
449 template<class Entity, class Point>
450 void flux (const Entity& entity,
451 const Point &x,
452 const RangeType &value,
453 const JacobianRangeType &jacobian,
454 JacobianRangeType &flux) const
455 {
456 BaseType::linearizedFlux(value, jacobian, entity, x, value, jacobian, flux);
457 }
458
460 template<class Entity, class Point>
461 void linearizedFlux (const RangeType& uBar,
462 const JacobianRangeType& DuBar,
463 const Entity& entity,
464 const Point &x,
465 const RangeType &value,
466 const JacobianRangeType& jacobian,
467 JacobianRangeType &flux) const
468 {
469 flux = JacobianRangeType(0.);
470 }
471
473 template<class Entity, class Point>
474 void source(const Entity& entity,
475 const Point &x,
476 const RangeType &value,
477 const JacobianRangeType &jacobian,
478 RangeType &result) const
479 {
480 BaseType::linearizedSource(value, jacobian, entity, x, value, jacobian, result);
481 }
482
484 template<class Entity, class Point>
485 void linearizedSource(const RangeType &uBar,
486 const JacobianRangeType& DuBar,
487 const Entity& entity,
488 const Point &x,
489 const RangeType &value,
490 const JacobianRangeType &jacobian,
491 RangeType &result) const
492 {
493 result = RangeType(0.);
494 }
495
497 template<class Intersection, class Point>
498 void robinFlux(const Intersection& intersection,
499 const Point& x,
500 const DomainType& unitOuterNormal,
501 const RangeType& value,
502 RangeType& result) const
503 {
504 BaseType::linearizedRobinFlux(value, intersection, x, unitOuterNormal, value, result);
505 }
506
508 template<class Intersection, class Point>
509 void linearizedRobinFlux(const RangeType& uBar,
510 const Intersection& intersection,
511 const Point& x,
512 const DomainType& unitOuterNormal,
513 const RangeType& value,
514 RangeType& result) const
515 {
516 result = RangeType(0.);
517 }
518
520 template<class Entity, class Point>
521 void fluxDivergence(const Entity& entity,
522 const Point &x,
523 const RangeType &value,
524 const JacobianRangeType &jacobian,
525 const HessianRangeType &hessian,
526 RangeType &result) const
527 {
528 result = RangeType(0.);
529 }
530
531 };
532
534
536
537 } // namespace ACFem
538
539} //Namespace Dune
540
541#endif // __DUNE_ACFEM_OPERATORPARTS_HH__
Default model implementation.
Definition: operatorparts.hh:387
void robinFlux(const Intersection &intersection, const Point &x, const DomainType &unitOuterNormal, const RangeType &value, RangeType &result) const
Definition: operatorparts.hh:498
void source(const Entity &entity, const Point &x, const RangeType &value, const JacobianRangeType &jacobian, RangeType &result) const
Definition: operatorparts.hh:474
void linearizedRobinFlux(const RangeType &uBar, const Intersection &intersection, const Point &x, const DomainType &unitOuterNormal, const RangeType &value, RangeType &result) const
Definition: operatorparts.hh:509
void linearizedSource(const RangeType &uBar, const JacobianRangeType &DuBar, const Entity &entity, const Point &x, const RangeType &value, const JacobianRangeType &jacobian, RangeType &result) const
Definition: operatorparts.hh:485
bool setIntersection(const Intersection &intersection) const
Definition: operatorparts.hh:435
void setEntity(const Entity &entity) const
Definition: operatorparts.hh:428
std::string name() const
Print a descriptive name for debugging and output.
Definition: operatorparts.hh:443
void fluxDivergence(const Entity &entity, const Point &x, const RangeType &value, const JacobianRangeType &jacobian, const HessianRangeType &hessian, RangeType &result) const
Definition: operatorparts.hh:521
void flux(const Entity &entity, const Point &x, const RangeType &value, const JacobianRangeType &jacobian, JacobianRangeType &flux) const
Definition: operatorparts.hh:450
@ isSemiDefinite
Define to true for the non-indefinite case (non trivial kernel is allowed).
Definition: operatorparts.hh:416
@ isLinear
Define to true for the affine-linear case.
Definition: operatorparts.hh:414
@ isSymmetric
Define to true for the symmetric case.
Definition: operatorparts.hh:415
void linearizedFlux(const RangeType &uBar, const JacobianRangeType &DuBar, const Entity &entity, const Point &x, const RangeType &value, const JacobianRangeType &jacobian, JacobianRangeType &flux) const
Definition: operatorparts.hh:461
Interface class for second order elliptic models.
Definition: operatorparts.hh:92
ConstituentFlags
Provide information about the constituents of the model.
Definition: operatorparts.hh:125
void flux(const Entity &entity, const Point &x, const RangeType &value, const JacobianRangeType &jacobian, JacobianRangeType &flux) const
Evaluate in local coordinates.
Definition: operatorparts.hh:202
void fluxDivergence(const Entity &entity, const Point &x, const RangeType &value, const JacobianRangeType &jacobian, const HessianRangeType &hessian, RangeType &result) const
Compute the point-wise value of the flux-part of the operator, meaning the part of the differential o...
Definition: operatorparts.hh:369
std::string name() const
Print a descriptive name for debugging and output.
Definition: operatorparts.hh:176
bool setIntersection(const Intersection &intersection) const
Per-intersection initialization for the boundary contributions.
Definition: operatorparts.hh:168
void linearizedSource(const RangeType &uBar, const JacobianRangeType &DuBar, const Entity &entity, const Point &x, const RangeType &value, const JacobianRangeType &jacobian, RangeType &result) const
The linearized source term as function of local coordinates.
Definition: operatorparts.hh:290
void source(const Entity &entity, const Point &x, const RangeType &value, const JacobianRangeType &jacobian, RangeType &result) const
The zero-order term as function of local coordinates.
Definition: operatorparts.hh:261
void linearizedRobinFlux(const RangeType &uBar, const Intersection &intersection, const Point &x, const DomainType &unitOuterNormal, const RangeType &value, RangeType &result) const
The linearized Robin-type flux term.
Definition: operatorparts.hh:341
void robinFlux(const Intersection &intersection, const Point &x, const DomainType &unitOuterNormal, const RangeType &value, RangeType &result) const
The non-linearized Robin-type flux term.
Definition: operatorparts.hh:316
StructureFlags
Static flags for the overall structure of the operator.
Definition: operatorparts.hh:118
@ isSymmetric
Define to true for the symmetric case.
Definition: operatorparts.hh:120
@ isSemiDefinite
Define to true for the non-indefinite case (non trivial kernel is allowed).
Definition: operatorparts.hh:121
@ isLinear
Define to true for the affine-linear case.
Definition: operatorparts.hh:119
void linearizedFlux(const RangeType &uBar, const JacobianRangeType &DuBar, const Entity &entity, const Point &x, const RangeType &value, const JacobianRangeType &jacobian, JacobianRangeType &flux) const
Evaluate the linearized flux in local coordinates.
Definition: operatorparts.hh:236
void setEntity(const Entity &entity) const
Per entity initialization, if that is needed.
Definition: operatorparts.hh:141
const Implementation & asImp(const Fem::BartonNackmanInterface< Interface, Implementation > &arg)
Up-cast to the implementation for any Fem::BartonNackmanInterface.
Definition: expressionoperations.hh:71
A structure defining some trivial default values for the template structure OperatorPartsTraits<Parts...
Definition: operatorparts.hh:45
FunctionSpace FunctionSpaceType
The FunctionSpace defining domain and range co-ordinates.
Definition: operatorparts.hh:47
ConstituentFlags
Provide information about the constituents of the model.
Definition: operatorparts.hh:62
@ hasFlux
non-zero flux()
Definition: operatorparts.hh:63
@ hasSources
non-zero sources()
Definition: operatorparts.hh:64
@ hasRobinFlux
non-zero robinFlux()
Definition: operatorparts.hh:65
FunctionSpaceType::ScalarFunctionSpaceType ScalarFunctionSpaceType
The compatible scalar-valued function space.
Definition: operatorparts.hh:50
StructureFlags
Static flags for the overall structure of the operator.
Definition: operatorparts.hh:53
@ isSymmetric
Define to true for the symmetric case.
Definition: operatorparts.hh:55
@ isLinear
Define to true for the affine-linear case.
Definition: operatorparts.hh:54
@ isSemiDefinite
Define to true for the non-indefinite case (non trivial kernel is allowed).
Definition: operatorparts.hh:56
Traits-template which has to be specialized for each individual model.
Definition: operatorparts.hh:36
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 12, 23:30, 2024)