DUNE-ACFEM (unstable)

modelboundaryindicators.hh
1#ifndef __DUNE_ACFEM_MODEL_BOUNDARYINDICATORS_HH__
2#define __DUNE_ACFEM_MODEL_BOUNDARYINDICATORS_HH__
3
4#include "indicators/boundaryindicator.hh"
5#include "expressions.hh"
6
7namespace Dune {
8
9 namespace ACFem {
10
11 namespace PDEModel {
12
24 template<class Model>
27 {
28 static_assert(IsPDEModel<Model>::value,
29 "Model better would be a proper PDE-model ...");
30 public:
31 using ModelType = Model;
32 using ModelTraits = EffectiveModelTraits<Model>;
33
34 DirichletIndicator(ModelType& model)
35 : model_(model)
36 {}
37
38 template<class Intersection>
39 bool applies(const Intersection& intersection) const
40 {
41 if (!ModelTraits::template Exists<PDEModel::dirichlet>::value) {
42 return false;
43 }
44 auto bdCond = model_.classifyBoundary(intersection);
45 if (bdCond.first) {
46 // ... later better (or other ...)
47 assert(bdCond.second.all() || bdCond.second.none());
48 return bdCond.second.all();
49 } else {
50 return false;
51 }
52 }
53
54 private:
55 ModelType& model_;
56 };
57
61 template<class Model>
64 {
65 static_assert(IsPDEModel<Model>::value,
66 "Model better would be a proper PDE-model ...");
67 public:
68 using ModelType = Model;
69 using ModelTraits = EffectiveModelTraits<Model>;
70
71 RobinIndicator(ModelType& model)
72 : model_(model)
73 {}
74
75 template<class Intersection>
76 bool applies(const Intersection& intersection) const
77 {
78 if (!ModelTraits::template Exists<PDEModel::robinFlux>::value) {
79 return false;
80 }
81 typename ModelType::BoundaryClassComponentsType components;
82 if (model_.classifyBoundary(intersection, components)) {
83 // ... later better (or other ...)
84 assert(components.all() || components.none());
85 return components.none();
86 } else {
87 return false;
88 }
89 }
90
91 private:
92 ModelType& model_;
93 };
94
98 template<class Model>
99 auto modelDirichletIndicator(Model&& model)
100 {
101 return DirichletIndicator<Model>(std::forward<Model>(model));
102 }
103
107 template<class Model>
108 auto modelRobinIndicator(Model& model)
109 {
110 return RobinIndicator<Model>(model);
111 }
112
114
116
117 } // PDEModel::
118
119 } // ACFem::
120
121} // Dune::
122
123#endif // __DUNE_ACFEM_MODEL_BOUNDARYINDICATORS_HH__
A wrapper which constructs from the given model a Dirichlet boundary indicator, using Model::classify...
Definition: modelboundaryindicators.hh:27
A wrapper which constructs from the given model a Robin boundary indicator, using Model::classifyBoun...
Definition: modelboundaryindicators.hh:64
auto modelDirichletIndicator(Model &&model)
Generate a boundary indicator evaluating to 1 on the Dirichlet segment of the model.
Definition: modelboundaryindicators.hh:99
auto modelRobinIndicator(Model &model)
Generate a boundary indicator evaluating to 1 on the Robin segment of the model.
Definition: modelboundaryindicators.hh:108
ModelIntrospection::template IsModel< Model > IsPDEModel
std::true_type if Model is derived from ModelBase.
Definition: modeltraits.hh:894
Boundary indicators need to inherit this tag-class in order to signal that they are boundary indicato...
Definition: boundaryindicator.hh:39
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden & Uni Heidelberg  |  generated with Hugo v0.111.3 (Sep 4, 22:38, 2025)