DUNE-ACFEM (2.5.1)

constantfunction.hh
1#ifndef CONSTANT_FUNCTION_HH
2#define CONSTANT_FUNCTION_HH
3
4#include <cassert>
5#include <cmath>
6
7#include <dune/common/exceptions.hh>
8#include <dune/fem/function/common/function.hh>
9#include <dune/fem/function/common/gridfunctionadapter.hh>
10
11#include "../functions/gridfunctionexpressionbase.hh"
12#include "../common/stringconversion.hh"
13
14namespace Dune {
15
16 namespace ACFem {
17
24 template<class FunctionSpace>
26 : public Fem::Function<typename FunctionSpace::FunctionSpaceType,
27 ConstantFunction<typename FunctionSpace::FunctionSpaceType> >,
29 {
30 public:
31 typedef typename FunctionSpace::FunctionSpaceType FunctionSpaceType;
32
33 enum { dimRange = FunctionSpaceType::dimRange };
34 enum { dimDomain = FunctionSpaceType::dimDomain };
35
36 typedef typename FunctionSpaceType::RangeFieldType RangeFieldType;
37
38 typedef typename FunctionSpaceType::RangeType RangeType;
39 typedef typename FunctionSpaceType::DomainType DomainType;
40
41 typedef typename FunctionSpaceType::JacobianRangeType JacobianRangeType;
42 typedef typename FunctionSpaceType::HessianRangeType HessianRangeType;
43
44 ConstantFunction(const RangeType& value) : value_(value) {}
45
46 void evaluate(const DomainType& x, RangeType& res) const
47 {
48 res = value_;
49 }
50
51 void jacobian(const DomainType& x, JacobianRangeType& res) const
52 {
53 res = 0;
54 }
55
56 void hessian(const DomainType& x, HessianRangeType& res) const
57 {
58 res = 0;
59 }
60
61 const RangeType& value() const
62 {
63 return value_;
64 }
65
66 private:
67 const RangeType value_; // with or wihtout reference?
68 };
69
70 // ConstantGridFunction
71 // -------------------
72
73 template<class FunctionSpace, class GridPart>
75
76 template<class FunctionSpace, class GridPart>
77 struct ConstantGridFunctionTraits
78 {
79 typedef FunctionSpace FunctionSpaceType;
80
81 typedef typename FunctionSpaceType::RangeFieldType RangeFieldType;
82 typedef typename FunctionSpaceType::DomainFieldType DomainFieldType;
83 typedef typename FunctionSpaceType::RangeType RangeType;
84 typedef typename FunctionSpaceType::DomainType DomainType;
85 typedef typename FunctionSpaceType::JacobianRangeType JacobianRangeType;
86 typedef typename FunctionSpaceType::HessianRangeType HessianRangeType;
87
88 typedef Fem::DiscreteFunctionSpaceAdapter<FunctionSpaceType, GridPart> DiscreteFunctionSpaceType;
89
90 typedef typename DiscreteFunctionSpaceType::GridPartType GridPartType;
91 typedef typename GridPartType::GridType GridType;
92 typedef typename GridPartType::template Codim<0>::EntityType EntityType;
94 typedef typename GridPartType::template Codim<0>::IteratorType IteratorType;
96 typedef typename GridPartType::IndexSetType IndexSetType;
97
98 typedef ConstantGridFunction<FunctionSpace, GridPart> DiscreteFunctionType;
99 };
100
101
104 template<class FunctionSpace, class GridPart>
106 : public GridFunctionExpression<FunctionSpace, ConstantGridFunction<FunctionSpace, GridPart> >,
108 {
110 typedef Function<FunctionSpace, ThisType> BaseType;
112
113 public:
116
118 typedef ConstantGridFunctionTraits<FunctionSpace, GridPart> TraitsType;
119
121 typedef typename TraitsType::DiscreteFunctionSpaceType DiscreteFunctionSpaceType;
122
123 // type of discrete function space
124 typedef typename TraitsType::FunctionSpaceType FunctionSpaceType;
125
126 enum { dimRange = FunctionSpaceType::dimRange };
127 enum { dimDomain = FunctionSpaceType::dimDomain };
128
130 typedef typename DiscreteFunctionSpaceType::GridPartType GridPartType;
131
133 typedef typename DiscreteFunctionSpaceType::GridType GridType;
134
136 typedef typename DiscreteFunctionSpaceType::DomainFieldType DomainFieldType ;
138 typedef typename DiscreteFunctionSpaceType::RangeFieldType RangeFieldType ;
140 typedef typename DiscreteFunctionSpaceType::DomainType DomainType ;
142 typedef typename DiscreteFunctionSpaceType::RangeType RangeType ;
144 typedef typename DiscreteFunctionSpaceType::JacobianRangeType JacobianRangeType;
146 typedef typename DiscreteFunctionSpaceType::HessianRangeType HessianRangeType;
147
149 typedef typename TraitsType::EntityType EntityType;
150
151 private:
152 class LocalFunction;
153 using ExpressionBaseType::expressionName_;
154
155 public:
157 typedef LocalFunction LocalFunctionType;
158
162 ConstantGridFunction(const RangeType& value, const GridPart& grid)
163 : space_(grid, 0), value_(value)
164 {
165 if (!objectToString(value, expressionName_)) {
166 expressionName_ = "C";
167 }
168 expressionName_ = "(x -> [" + expressionName_ + "])";
169 }
170
172 void evaluate(const DomainType &global, RangeType &result) const
173 {
174 result = value_;
175 }
176
178 void jacobian(const DomainType &global, JacobianRangeType &result) const
179 {
180 result = 0;
181 }
182
184 void hessian(const DomainType &global, HessianRangeType &result) const
185 {
186 result = 0;
187 }
188
190 const LocalFunctionType localFunction(const EntityType &entity) const
191 {
192 return LocalFunctionType(entity, *this);
193 }
194
197 {
198 return LocalFunctionType(entity, *this);
199 }
200
203 {
204 return space_;
205 }
206
207 const GridPartType &gridPart() const { return space().gridPart(); }
208
209 const RangeType value() const
210 {
211 return value_;
212 }
213
214 protected:
216 const RangeType value_;
217 };
218
219 // ConstantGridFunction::LocalFunction
220 // ----------------------------------
221
222 template<class FunctionSpace, class GridPart>
223 class ConstantGridFunction<FunctionSpace, GridPart>::LocalFunction
224 {
225 typedef LocalFunction ThisType;
226 public:
227 typedef ConstantGridFunction<FunctionSpace, GridPart> DiscreteFunctionType;
229 typedef typename DiscreteFunctionType::FunctionSpaceType FunctionSpaceType;
230 private:
231 typedef typename DiscreteFunctionSpaceType::GridPartType GridPartType;
232 typedef typename EntityType::Geometry GeometryType;
233 public:
234
235 static const int dimRange = DiscreteFunctionSpaceType::dimRange;
236 static const int dimDomain = GridPartType::GridType::dimensionworld;
237 static const int dimLocal = GridPartType::GridType::dimension;
238
240 typedef typename DiscreteFunctionSpaceType::DomainFieldType DomainFieldType ;
242 typedef typename DiscreteFunctionSpaceType::RangeFieldType RangeFieldType ;
244 typedef typename DiscreteFunctionSpaceType::DomainType DomainType ;
246 typedef typename DiscreteFunctionSpaceType::RangeType RangeType ;
248 typedef typename DiscreteFunctionSpaceType::JacobianRangeType JacobianRangeType;
250 typedef typename DiscreteFunctionSpaceType::HessianRangeType HessianRangeType;
251
253 LocalFunction(const EntityType &entity, const DiscreteFunctionType &df)
254 : df_(df),
255 value_(df.value_),
256 entity_(&entity)
257 {}
258
259 LocalFunction(const DiscreteFunctionType &df)
260 : df_(df),
261 value_(df.value_),
262 entity_(0)
263 {}
264
266 template<class PointType>
267 void evaluate(const PointType &x, RangeType &ret) const
268 {
269 ret = value_;
270 }
271
273 template<class PointType>
274 void jacobian(const PointType &x, JacobianRangeType &ret) const
275 {
276 ret = 0;
277 }
278
280 template<class PointType>
281 void hessian(const PointType &x, HessianRangeType &ret) const
282 {
283 ret = 0;
284 }
285
287 template<class QuadratureType, class VectorType>
288 void evaluateQuadrature(const QuadratureType& quadrature, VectorType& values) const
289 {
290 assert(values.size() == quadrature.nop());
291 DiscreteFunctionType::evaluateQuadratureImp(*this, quadrature, values, values[0]);
292 }
293
295 int order() const { return 0; }
296
298 void init(const EntityType &entity)
299 {
300 entity_ = &entity;
301 }
302
303 const EntityType &entity() const
304 {
305 assert(entity_);
306 return *entity_;
307 }
308
309 private:
310 const DiscreteFunctionType& df_;
311 const RangeType& value_;
312 const EntityType *entity_;
313 };
314
315 // ZeroGridFunction
316 // -------------------
317
318 template<class FunctionSpace, class GridPart>
319 class ZeroGridFunction;
320
322 template<class FunctionSpace, class GridPart>
324 {
325 typedef FunctionSpace FunctionSpaceType;
326
327 typedef typename FunctionSpaceType::RangeFieldType RangeFieldType;
328 typedef typename FunctionSpaceType::DomainFieldType DomainFieldType;
329 typedef typename FunctionSpaceType::RangeType RangeType;
330 typedef typename FunctionSpaceType::DomainType DomainType;
331 typedef typename FunctionSpaceType::JacobianRangeType JacobianRangeType;
332 typedef typename FunctionSpaceType::HessianRangeType HessianRangeType;
333
334 typedef Fem::DiscreteFunctionSpaceAdapter<FunctionSpaceType, GridPart> DiscreteFunctionSpaceType;
335
336 typedef typename DiscreteFunctionSpaceType::GridPartType GridPartType;
337 typedef typename GridPartType::GridType GridType;
338 typedef typename GridPartType::template Codim<0>::EntityType EntityType;
340 typedef typename GridPartType::template Codim<0>::IteratorType IteratorType;
342 typedef typename GridPartType::IndexSetType IndexSetType;
343
345 };
346
348 template<class FunctionSpace, class GridPart>
350 : public ZeroGridFunctionExpression<FunctionSpace, ZeroGridFunction<FunctionSpace, GridPart> >,
352 {
354 typedef Function<FunctionSpace, ThisType> BaseType;
356
357 public:
360
362 typedef typename TraitsType::DiscreteFunctionSpaceType DiscreteFunctionSpaceType;
363
364 // type of discrete function space
365 typedef typename TraitsType::FunctionSpaceType FunctionSpaceType;
366
368 typedef typename DiscreteFunctionSpaceType::GridPartType GridPartType;
369
371 typedef typename DiscreteFunctionSpaceType::GridType GridType;
372
374 typedef typename DiscreteFunctionSpaceType::DomainFieldType DomainFieldType ;
376 typedef typename DiscreteFunctionSpaceType::RangeFieldType RangeFieldType ;
378 typedef typename DiscreteFunctionSpaceType::DomainType DomainType ;
380 typedef typename DiscreteFunctionSpaceType::RangeType RangeType ;
382 typedef typename DiscreteFunctionSpaceType::JacobianRangeType JacobianRangeType;
384 typedef typename DiscreteFunctionSpaceType::HessianRangeType HessianRangeType;
385
387 typedef typename TraitsType::EntityType EntityType;
388
389 private:
390 class LocalFunction;
391 using ExpressionBaseType::expressionName_;
392
393 public:
395 typedef LocalFunction LocalFunctionType;
396
400 ZeroGridFunction(const GridPart& grid)
401 : space_(grid, 0)
402 {
403 expressionName_ = "(x -> 0)";
404 }
405
407 void evaluate(const DomainType &global, RangeType &result) const
408 {
409 result = 0;
410 }
411
413 void jacobian(const DomainType &global, JacobianRangeType &result) const
414 {
415 result = 0;
416 }
417
419 void hessian(const DomainType &global, HessianRangeType &result) const
420 {
421 result = 0;
422 }
423
425 const LocalFunctionType localFunction(const EntityType &entity) const
426 {
427 return LocalFunctionType(entity, *this);
428 }
429
432 {
433 return LocalFunctionType(entity, *this);
434 }
435
438 {
439 return space_;
440 }
441
442 const GridPartType &gridPart() const
443 {
444 return space().gridPart();
445 }
446
447 RangeType value() const
448 {
449 return RangeType(0);
450 }
451
452
453 protected:
455 };
456
457 // ZeroGridFunction::LocalFunction
458 // ----------------------------------
459
460 template<class FunctionSpace, class GridPart>
461 class ZeroGridFunction<FunctionSpace, GridPart>::LocalFunction
462 {
463 typedef LocalFunction ThisType;
464 public:
465 typedef ZeroGridFunction<FunctionSpace, GridPart> DiscreteFunctionType;
466 typedef typename DiscreteFunctionType::DiscreteFunctionSpaceType DiscreteFunctionSpaceType;
467 typedef typename DiscreteFunctionType::FunctionSpaceType FunctionSpaceType;
468 private:
469 typedef typename DiscreteFunctionSpaceType::GridPartType GridPartType;
470 typedef typename EntityType::Geometry GeometryType;
471 public:
472
473 static const int dimRange = DiscreteFunctionSpaceType::dimRange;
474 static const int dimDomain = GridPartType::GridType::dimensionworld;
475 static const int dimLocal = GridPartType::GridType::dimension;
476
478 typedef typename DiscreteFunctionSpaceType::DomainFieldType DomainFieldType ;
480 typedef typename DiscreteFunctionSpaceType::RangeFieldType RangeFieldType ;
482 typedef typename DiscreteFunctionSpaceType::DomainType DomainType ;
484 typedef typename DiscreteFunctionSpaceType::RangeType RangeType ;
486 typedef typename DiscreteFunctionSpaceType::JacobianRangeType JacobianRangeType;
488 typedef typename DiscreteFunctionSpaceType::HessianRangeType HessianRangeType;
489
491 LocalFunction(const EntityType &entity, const DiscreteFunctionType &df) : entity_(&entity) {}
492
493 LocalFunction(const DiscreteFunctionType &df) : entity_(0) {}
494
496 template<class PointType>
497 void evaluate(const PointType &x, RangeType &ret) const
498 {
499 ret = 0;
500 }
501
503 template<class PointType>
504 void jacobian(const PointType &x, JacobianRangeType &ret) const
505 {
506 ret = 0;
507 }
508
510 template<class PointType>
511 void hessian(const PointType &x, HessianRangeType &ret) const
512 {
513 ret = 0;
514 }
515
517 template<class QuadratureType, class VectorType>
518 void evaluateQuadrature(const QuadratureType& quadrature, VectorType& values) const
519 {
520 assert(values.size() == quadrature.nop());
521 DiscreteFunctionType::evaluateQuadratureImp(*this, quadrature, values, values[0]);
522 }
523
525 int order() const { return 0; }
526
528 void init(const EntityType &entity) { entity_ = &entity; }
529
530 const EntityType &entity() const
531 {
532 assert(entity_);
533 return *entity_;
534 }
535
536 private:
537 const EntityType *entity_;
538 };
539
540 // FractionGridFunction
541 // -------------------
542
543 template<class FunctionSpace, class GridPart, ssize_t numerator, size_t denominator = 1L>
544 class FractionGridFunction;
545
547 template<class FunctionSpace, class GridPart, ssize_t numerator, size_t denominator>
549 {
550 typedef typename FunctionSpace::ScalarFunctionSpaceType FunctionSpaceType;
551
552 typedef typename FunctionSpaceType::RangeFieldType RangeFieldType;
553 typedef typename FunctionSpaceType::DomainFieldType DomainFieldType;
554 typedef typename FunctionSpaceType::RangeType RangeType;
555 typedef typename FunctionSpaceType::DomainType DomainType;
556 typedef typename FunctionSpaceType::JacobianRangeType JacobianRangeType;
557 typedef typename FunctionSpaceType::HessianRangeType HessianRangeType;
558
559 typedef Fem::DiscreteFunctionSpaceAdapter<FunctionSpaceType, GridPart> DiscreteFunctionSpaceType;
560
561 typedef typename DiscreteFunctionSpaceType::GridPartType GridPartType;
562 typedef typename GridPartType::GridType GridType;
563 typedef typename GridPartType::template Codim<0>::EntityType EntityType;
565 typedef typename GridPartType::template Codim<0>::IteratorType IteratorType;
567 typedef typename GridPartType::IndexSetType IndexSetType;
568
570
571 typedef typename
572 std::conditional<numerator == 0,
574 typename
575 std::conditional<numerator/denominator == 1,
578 >::type
579 >::type
580 ExpressionBaseType;
581 };
582
594 template<class FunctionSpace, class GridPart, ssize_t numerator, size_t denominator>
596 : public FractionGridFunctionTraits<FunctionSpace, GridPart, numerator, denominator>::ExpressionBaseType,
598 {
599 public:
602 private:
604 typedef Function<FunctionSpace, ThisType> BaseType;
605 typedef typename TraitsType::ExpressionBaseType ExpressionBaseType;
606 public:
608 typedef typename TraitsType::DiscreteFunctionSpaceType DiscreteFunctionSpaceType;
609
610 // type of discrete function space
611 typedef typename TraitsType::FunctionSpaceType FunctionSpaceType;
612
613 // field
614 typedef typename FunctionSpaceType::RangeFieldType RangeFieldType;
615
617 typedef typename DiscreteFunctionSpaceType::GridPartType GridPartType;
618
620 typedef typename DiscreteFunctionSpaceType::GridType GridType;
621
623 typedef typename DiscreteFunctionSpaceType::DomainFieldType DomainFieldType ;
625 typedef typename DiscreteFunctionSpaceType::DomainType DomainType ;
627 typedef typename DiscreteFunctionSpaceType::RangeType RangeType ;
629 typedef typename DiscreteFunctionSpaceType::JacobianRangeType JacobianRangeType;
631 typedef typename DiscreteFunctionSpaceType::HessianRangeType HessianRangeType;
632
634 typedef typename TraitsType::EntityType EntityType;
635
636 private:
637 class LocalFunction;
638 using ExpressionBaseType::expressionName_;
639
640 public:
642 typedef LocalFunction LocalFunctionType;
643
647 FractionGridFunction(const GridPart& grid)
648 : space_(grid, 0)
649 {
650 expressionName_ =
651 "(x -> "
652 +
653 std::to_string(numerator)
654 +
655 (denominator == 1 ? "" : "/" + std::to_string(denominator)) + ")";
656 }
657
659 void evaluate(const DomainType &global, RangeType &result) const
660 {
661 result = value();
662 }
663
665 void jacobian(const DomainType &global, JacobianRangeType &result) const
666 {
667 result = 0;
668 }
669
671 void hessian(const DomainType &global, HessianRangeType &result) const
672 {
673 result = 0;
674 }
675
677 const LocalFunctionType localFunction(const EntityType &entity) const
678 {
679 return LocalFunctionType(entity, *this);
680 }
681
684 {
685 return LocalFunctionType(entity, *this);
686 }
687
690 {
691 return space_;
692 }
693
694 const GridPartType &gridPart() const { return space().gridPart(); }
695
698 {
699 return RangeFieldType(numerator) / RangeFieldType(denominator);
700 }
701
702 protected:
704 };
705
706 // FractionGridFunction::LocalFunction
707 // ----------------------------------
708
709 template<class FunctionSpace, class GridPart, ssize_t numerator, size_t denominator>
710 class FractionGridFunction<FunctionSpace, GridPart, numerator, denominator>::LocalFunction
711 {
712 typedef LocalFunction ThisType;
713 typedef FractionGridFunction<FunctionSpace, GridPart, numerator, denominator> DiscreteFunctionType;
714 public:
715 typedef typename DiscreteFunctionType::DiscreteFunctionSpaceType DiscreteFunctionSpaceType;
716 typedef typename DiscreteFunctionType::FunctionSpaceType FunctionSpaceType;
717 private:
718 typedef typename DiscreteFunctionSpaceType::GridPartType GridPartType;
719 typedef typename EntityType::Geometry GeometryType;
720 public:
721
722 static const int dimRange = DiscreteFunctionSpaceType::dimRange;
723 static const int dimDomain = GridPartType::GridType::dimensionworld;
724 static const int dimLocal = GridPartType::GridType::dimension;
725
727 typedef typename DiscreteFunctionSpaceType::DomainFieldType DomainFieldType ;
729 typedef typename DiscreteFunctionSpaceType::RangeFieldType RangeFieldType ;
731 typedef typename DiscreteFunctionSpaceType::DomainType DomainType ;
733 typedef typename DiscreteFunctionSpaceType::RangeType RangeType ;
735 typedef typename DiscreteFunctionSpaceType::JacobianRangeType JacobianRangeType;
737 typedef typename DiscreteFunctionSpaceType::HessianRangeType HessianRangeType;
738
740 LocalFunction(const EntityType &entity, const DiscreteFunctionType &df) : entity_(&entity) {}
741
742 LocalFunction(const DiscreteFunctionType &df) : entity_(0) {}
743
745 template<class PointType>
746 void evaluate(const PointType &x, RangeType &ret) const
747 {
748 ret = value();
749 }
750
752 template<class PointType>
753 void jacobian(const PointType &x, JacobianRangeType &ret) const
754 {
755 ret = 0;
756 }
757
759 template<class PointType>
760 void hessian(const PointType &x, HessianRangeType &ret) const
761 {
762 ret = 0;
763 }
764
766 template<class QuadratureType, class VectorType>
767 void evaluateQuadrature(const QuadratureType& quadrature, VectorType& values) const
768 {
769 assert(values.size() == quadrature.nop());
770 DiscreteFunctionType::evaluateQuadratureImp(*this, quadrature, values, values[0]);
771 }
772
774 int order() const { return 0; }
775
777 void init(const EntityType &entity) { entity_ = &entity; }
778
779 const EntityType &entity() const
780 {
781 assert(entity_);
782 return *entity_;
783 }
784
785 RangeType value() const
786 {
787 return RangeFieldType(numerator) / RangeFieldType(denominator);
788 }
789
790 private:
791 const EntityType *entity_;
792 };
793
795
796 } // ACFem::
797
798} // Dune::
799
800#endif
A class describing a constant function.
Definition: constantfunction.hh:29
ConstantGridFunction implements a constant function.
Definition: constantfunction.hh:108
ConstantGridFunction(const RangeType &value, const GridPart &grid)
Construct the constant grid function from its constituents: the value and the grid.
Definition: constantfunction.hh:162
void hessian(const DomainType &global, HessianRangeType &result) const
Evaluate hessian in global coordinates.
Definition: constantfunction.hh:184
TraitsType::EntityType EntityType
type of codim 0 entity
Definition: constantfunction.hh:149
LocalFunctionType localFunction(const EntityType &entity)
See Dune::Fem::DiscreteFunctionInterface::localFunction(const EntityType &entity)
Definition: constantfunction.hh:196
const LocalFunctionType localFunction(const EntityType &entity) const
See Dune::Fem::DiscreteFunctionInterface::localFunction(const EntityType &entity) const.
Definition: constantfunction.hh:190
DiscreteFunctionSpaceType::RangeFieldType RangeFieldType
range type (from function space)
Definition: constantfunction.hh:138
DiscreteFunctionSpaceType::GridPartType GridPartType
type of gridPart
Definition: constantfunction.hh:130
void jacobian(const DomainType &global, JacobianRangeType &result) const
Evaluate jacobian in global coordinates.
Definition: constantfunction.hh:178
DiscreteFunctionSpaceType::DomainFieldType DomainFieldType
domain type (from function space)
Definition: constantfunction.hh:136
DiscreteFunctionSpaceType::GridType GridType
type of grid
Definition: constantfunction.hh:133
DiscreteFunctionSpaceType::DomainType DomainType
domain type (from function space)
Definition: constantfunction.hh:140
TraitsType::DiscreteFunctionSpaceType DiscreteFunctionSpaceType
type of discrete function space
Definition: constantfunction.hh:121
const DiscreteFunctionSpaceType & space() const
See Dune::Fem::DiscreteFunctionInterface::space() const.
Definition: constantfunction.hh:202
DiscreteFunctionSpaceType::RangeType RangeType
range type (from function space)
Definition: constantfunction.hh:142
LocalFunction LocalFunctionType
type of local function to export
Definition: constantfunction.hh:157
DiscreteFunctionSpaceType::JacobianRangeType JacobianRangeType
jacobian type (from function space)
Definition: constantfunction.hh:144
void evaluate(const DomainType &global, RangeType &result) const
Evaluate function in global coordinates.
Definition: constantfunction.hh:172
ThisType DiscreteFunctionType
ourselves
Definition: constantfunction.hh:115
DiscreteFunctionSpaceType::HessianRangeType HessianRangeType
hessian type (from function space)
Definition: constantfunction.hh:146
ConstantGridFunctionTraits< FunctionSpace, GridPart > TraitsType
type of traits
Definition: constantfunction.hh:118
A grid-function which is constant with a scalar fractional value.
Definition: constantfunction.hh:598
DiscreteFunctionSpaceType::DomainFieldType DomainFieldType
domain type (from function space)
Definition: constantfunction.hh:623
DiscreteFunctionSpaceType::GridPartType GridPartType
type of gridPart
Definition: constantfunction.hh:617
LocalFunctionType localFunction(const EntityType &entity)
See Dune::Fem::DiscreteFunctionInterface::localFunction(const EntityType &entity)
Definition: constantfunction.hh:683
DiscreteFunctionSpaceType::DomainType DomainType
domain type (from function space)
Definition: constantfunction.hh:625
FractionGridFunction(const GridPart &grid)
The value of this function is built into its type, so the only dynamic constituent for the constructo...
Definition: constantfunction.hh:647
void jacobian(const DomainType &global, JacobianRangeType &result) const
Evaluate jacobian in global coordinates.
Definition: constantfunction.hh:665
const LocalFunctionType localFunction(const EntityType &entity) const
See Dune::Fem::DiscreteFunctionInterface::localFunction(const EntityType &entity) const.
Definition: constantfunction.hh:677
TraitsType::DiscreteFunctionSpaceType DiscreteFunctionSpaceType
type of discrete function space
Definition: constantfunction.hh:608
FractionGridFunctionTraits< FunctionSpace, GridPart, numerator, denominator > TraitsType
type of traits
Definition: constantfunction.hh:601
void hessian(const DomainType &global, HessianRangeType &result) const
Evaluate hessian in global coordinates.
Definition: constantfunction.hh:671
void evaluate(const DomainType &global, RangeType &result) const
Evaluate function in global coordinates.
Definition: constantfunction.hh:659
RangeType value() const
Return the one constant value.
Definition: constantfunction.hh:697
DiscreteFunctionSpaceType::RangeType RangeType
range type (from function space)
Definition: constantfunction.hh:627
const DiscreteFunctionSpaceType & space() const
See Dune::Fem::DiscreteFunctionInterface::space() const.
Definition: constantfunction.hh:689
TraitsType::EntityType EntityType
type of codim 0 entity
Definition: constantfunction.hh:634
LocalFunction LocalFunctionType
type of local function to export
Definition: constantfunction.hh:642
DiscreteFunctionSpaceType::GridType GridType
type of grid
Definition: constantfunction.hh:620
DiscreteFunctionSpaceType::HessianRangeType HessianRangeType
hessian type (from function space)
Definition: constantfunction.hh:631
DiscreteFunctionSpaceType::JacobianRangeType JacobianRangeType
jacobian type (from function space)
Definition: constantfunction.hh:629
A class providing some basic functionality common to all expressions.
Definition: gridfunctionexpressionbase.hh:35
A base class for zero function expression.
Definition: gridfunctionexpressionbase.hh:110
A grid-function always returning 0.
Definition: constantfunction.hh:352
ZeroGridFunctionTraits< FunctionSpace, GridPart > TraitsType
type of traits
Definition: constantfunction.hh:359
ZeroGridFunction(const GridPart &grid)
Construct the ZeroGridFunction from its only constituent: the grid.
Definition: constantfunction.hh:400
void hessian(const DomainType &global, HessianRangeType &result) const
Evaluate hessian in global coordinates.
Definition: constantfunction.hh:419
DiscreteFunctionSpaceType::DomainType DomainType
domain type (from function space)
Definition: constantfunction.hh:378
const DiscreteFunctionSpaceType & space() const
See Dune::Fem::DiscreteFunctionInterface::space() const.
Definition: constantfunction.hh:437
void evaluate(const DomainType &global, RangeType &result) const
Evaluate function in global coordinates.
Definition: constantfunction.hh:407
DiscreteFunctionSpaceType::HessianRangeType HessianRangeType
hessian type (from function space)
Definition: constantfunction.hh:384
void jacobian(const DomainType &global, JacobianRangeType &result) const
Evaluate jacobian in global coordinates.
Definition: constantfunction.hh:413
LocalFunction LocalFunctionType
type of local function to export
Definition: constantfunction.hh:395
TraitsType::EntityType EntityType
type of codim 0 entity
Definition: constantfunction.hh:387
DiscreteFunctionSpaceType::RangeType RangeType
range type (from function space)
Definition: constantfunction.hh:380
const LocalFunctionType localFunction(const EntityType &entity) const
See Dune::Fem::DiscreteFunctionInterface::localFunction(const EntityType &entity) const.
Definition: constantfunction.hh:425
DiscreteFunctionSpaceType::DomainFieldType DomainFieldType
domain type (from function space)
Definition: constantfunction.hh:374
DiscreteFunctionSpaceType::JacobianRangeType JacobianRangeType
jacobian type (from function space)
Definition: constantfunction.hh:382
TraitsType::DiscreteFunctionSpaceType DiscreteFunctionSpaceType
type of discrete function space
Definition: constantfunction.hh:362
DiscreteFunctionSpaceType::GridType GridType
type of grid
Definition: constantfunction.hh:371
LocalFunctionType localFunction(const EntityType &entity)
See Dune::Fem::DiscreteFunctionInterface::localFunction(const EntityType &entity)
Definition: constantfunction.hh:431
DiscreteFunctionSpaceType::RangeFieldType RangeFieldType
range type (from function space)
Definition: constantfunction.hh:376
DiscreteFunctionSpaceType::GridPartType GridPartType
type of gridPart
Definition: constantfunction.hh:368
bool objectToString(const T &something, std::string &text)
Convert any object which has an associated output stream operator "<<" to a string,...
Definition: stringconversion.hh:20
A grid-function which is constant with a fractional value.
Definition: constantfunction.hh:549
GridPartType::template Codim< 0 >::IteratorType IteratorType
type of iterator
Definition: constantfunction.hh:565
GridPartType::IndexSetType IndexSetType
type of IndexSet
Definition: constantfunction.hh:567
Tag type, consequences are zero Jacobian and Hessian.
Definition: gridfunctionexpressionbase.hh:114
A grid-function tight to zero.
Definition: constantfunction.hh:324
GridPartType::IndexSetType IndexSetType
type of IndexSet
Definition: constantfunction.hh:342
GridPartType::template Codim< 0 >::IteratorType IteratorType
type of iterator
Definition: constantfunction.hh:340
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Aug 13, 22:30, 2024)