CEPS  24.01
Cardiac ElectroPhysiology Simulator
BoundaryCondition.hpp
Go to the documentation of this file.
1 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2  This file is part of CEPS.
3 
4  CEPS is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  CEPS is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with CEPS (see file LICENSE at root of project).
16  If not, see <https://www.gnu.org/licenses/>.
17 
18 
19  Copyright 2019-2024 Inria, Universite de Bordeaux
20 
21  Authors, in alphabetical order:
22 
23  Pierre-Elliott BECUE, Florian CARO, Yves COUDIERE(*), Andjela DAVIDOVIC,
24  Charlie DOUANLA-LONTSI, Marc FUENTES, Mehdi JUHOOR, Michael LEGUEBE(*),
25  Pauline MIGERDITICHAN, Valentin PANNETIER(*), Nejib ZEMZEMI.
26  * : currently active authors
27 
28 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
30 #pragma once
31 
33 
34 template <class _Result>
35 class BoundaryCondition;
36 
43 
48 template <class _Result>
49 class BoundaryCondition : public Field<_Result,DegreeOfFreedom>,
50  public SAFunc<_Result>,
51  public ceps::HoldsDimension,
53 {
54 
55  public:
56 
67  CoeffFunc functor,
68  const CepsVector<DegreeOfFreedom*>* domain,
69  CepsUnknownIndex unknown
70  );
71 
73  ~BoundaryCondition() override;
74 
76  void
78 
82 
85  getUnknownId() const;
86 
88  void
90 
92  CoeffFunc
93  getAlpha() const;
94 
96  typename std::remove_pointer_t<CoeffFunc>::ReturnType
98 
100  void
102 
104  CoeffFunc
105  getBeta() const;
106 
108  typename std::remove_pointer_t<CoeffFunc>::ReturnType
110 
115  void
116  applyAsDirichlet(DMatPtr mat, DVecPtr sec, CepsReal t=0., CepsReal scalingFactor = 1.0);
117 
119  _Result
120  eval(CepsStandardArgs args) override;
121 
124  CepsEnum
125  getFlags() const override;
126 
129 
131  // template <class _R>
132  // friend std::ostream& operator<<(std::ostream &, const BoundaryCondition<_R>&);
133 
134  protected:
139 };
140 
CepsBoundaryConditionFlag
Enumeration for boundary condition type.
Definition: CepsEnums.hpp:155
CepsIndex CepsUnknownIndex
For unknowns.
Definition: CepsTypes.hpp:217
int CepsEnum
Enum type.
Definition: CepsTypes.hpp:216
std::vector< _Type, _Alloc > CepsVector
C++ vector.
Definition: CepsTypes.hpp:155
float CepsReal
Need single precision floating point.
Definition: CepsTypes.hpp:100
std::shared_ptr< DistributedMatrix > DMatPtr
Short typedef for pointer on dist matrix.
std::shared_ptr< DistributedVector > DVecPtr
Short typedef for pointer on distributed vector.
Boundary condition to manage Dirichlet, Neumann and Robin conditions.
Boundary condition.
CepsUnknownIndex m_unknown
The unknown for which the BC applies.
std::remove_pointer_t< CoeffFunc >::ReturnType getAlpha(CepsStandardArgs args) const
Evaluate alpha in .
CepsUnknownIndex getUnknownId() const
Get the id of the unknown that this BC is for.
_Result eval(CepsStandardArgs args) override
Evaluate a boundary condition, essentially call the functor inside.
CoeffFunc m_beta
beta in
void setBoundaryConditionType(CepsBoundaryConditionFlag type)
Set boundary condition type.
CepsBoundaryConditionFlag m_type
friend display operator
~BoundaryCondition() override
Delete data.
CoeffFunc getBeta() const
Get beta in .
void setAlpha(CoeffFunc alpha)
Set alpha in .
void setBeta(CoeffFunc beta)
Set beta in .
CoeffFunc m_alpha
alpha in
CepsBoundaryConditionFlag getBoundaryConditionType() const
Get boundary condition type.
void applyAsDirichlet(DMatPtr mat, DVecPtr sec, CepsReal t=0., CepsReal scalingFactor=1.0)
Apply this boundary condition as Dirichlet bc (zeroed row and col of mat and u in sec) The scaling fa...
CepsEnum getFlags() const override
The final flag is a combination of Attribute and of the flags of the stored object type (if it has an...
CoeffFunc getAlpha() const
Get alpha in .
std::remove_pointer_t< CoeffFunc >::ReturnType getBeta(CepsStandardArgs args) const
Evaluate beta in .
BoundaryCondition(CoeffFunc functor, const CepsVector< DegreeOfFreedom * > *domain, CepsUnknownIndex unknown)
Construct a new BoundaryCondition object.
A Field is an object wrapped around a SAFunc functor, defined on at least one domain.
Definition: Field.hpp:80
A SAFunc is a ceps::Function that uses CepsStandardArgs as argument of call operator (),...
Definition: SAFunc.hpp:100
An abstract class from which all objects that contain region attributes should derive.
Abstract class for objects that have a dimensionality (0D to 3D)
Structure used to pass arguments to SAFunc (see pde directory) The flags of the SAFunc allows extract...
Definition: CepsTypes.hpp:239