CEPS  24.01
Cardiac ElectroPhysiology Simulator
DegreeOfFreedom.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 
32 #include "common/CepsCommon.hpp"
33 #include "pde/common/Unknown.hpp"
34 
41  public ceps::HoldsBoundary,
42  public ceps::HoldsProcIds,
44 {
45  public:
47  DegreeOfFreedom() = delete;
48 
51  Unknown* unknown,
52  const CepsSet<CepsAttribute>& attrs,
53  CepsGlobalIndex geomId,
54  CepsIndex dofId = CepsUniversal,
55  CepsProcId procId = ceps::getRank(),
56  CepsSet<DegreeOfFreedom*> neighs = {}
57  );
58 
60  DegreeOfFreedom(const DegreeOfFreedom&) = delete;
61 
64  operator=(const DegreeOfFreedom&) = delete;
65 
67  ~DegreeOfFreedom() = default;
68 
69  // --------------------------------------------------------------------------------
70  // Unknown
71  // --------------------------------------------------------------------------------
72 
74  void
75  setUnknown(Unknown* unknown);
76 
78  Unknown*
79  getUnknown() const;
80 
82  const CepsLocationFlag &
83  getLocation() const;
84 
85  // --------------------------------------------------------------------------------
86  // Geometric
87  // --------------------------------------------------------------------------------
88 
90  void
91  setGeomId(CepsGlobalIndex geomId);
92 
94  const CepsGlobalIndex &
95  getGeomId() const;
96 
98  void
99  setDiscrId(CepsGlobalIndex discrId);
100 
102  const CepsGlobalIndex &
103  getDiscrId() const;
104 
106  void
107  setVertex(CepsVertex* vertex);
108 
110  CepsVertex*
111  getVertex() const;
112 
113  // --------------------------------------------------------------------------------
114  // Neighboors
115  // --------------------------------------------------------------------------------
116 
118  void
120 
122  CepsUInt
123  getNumberOfNeighbors() const;
124 
127  getNeighbors() const;
128 
129 
130  protected:
131 
134 
137 
141 
144 
147 };
148 
CepsLocationFlag
DataLocation: an enum that will be used by various elements of the code (pde, readers,...
Definition: CepsEnums.hpp:108
std::set< _Type, _Compare, _Alloc > CepsSet
C++ set.
Definition: CepsTypes.hpp:209
CepsIndex CepsGlobalIndex
Many uses. Has to be signed for PETSc.
Definition: CepsTypes.hpp:218
std::make_unsigned_t< CepsInt > CepsUInt
Unsigned version on CepsInt.
Definition: CepsTypes.hpp:109
CepsUInt CepsProcId
For CPU indices.
Definition: CepsTypes.hpp:123
constexpr CepsAttribute CepsUniversal
This attribute means "everywhere".
Definition: CepsTypes.hpp:232
CepsInt CepsIndex
Index rowid etc.
Definition: CepsTypes.hpp:111
CepsStandardArgs getStandardArgsFrom(DegreeOfFreedom *dof)
Returns a standard args structure with data from a dof.
A degree of freedom for any kind of problem The dof can be associated to a geometrical element or not...
const CepsGlobalIndex & getGeomId() const
Get the Geom Identity for the dof (-1 means no geometric entity)
CepsGlobalIndex m_discrId
A global index used only for finite elements : it is the ID of the FE Node which may be different fro...
const CepsLocationFlag & getLocation() const
Shorcut from unknown to know the location.
CepsVertex * getVertex() const
Get the vertex pointer.
void setGeomId(CepsGlobalIndex geomId)
Set the geom id (replace the existing one)
CepsGlobalIndex m_geomId
Id of geometric entity on which the dof is defined.
Unknown * getUnknown() const
Get the unknow defined at this dof.
~DegreeOfFreedom()=default
Destructor.
Unknown * m_unknown
Link to unknown defined at that dof.
const CepsGlobalIndex & getDiscrId() const
Get the spatial discretization ID (FEnode id for FE)
void setDiscrId(CepsGlobalIndex discrId)
Set the FE node id (replace the existing one)
void setVertex(CepsVertex *vertex)
Set the vertex pointer where is defined the dof.
DegreeOfFreedom(const DegreeOfFreedom &)=delete
Copy constructor.
void setUnknown(Unknown *unknown)
Set the unknown (replace the existing one)
CepsSet< DegreeOfFreedom * > m_neigh
Pointers on nieghboring dofs.
DegreeOfFreedom & operator=(const DegreeOfFreedom &)=delete
Copy assignement.
const CepsSet< DegreeOfFreedom * > & getNeighbors() const
Neighbor dofs.
CepsVertex * m_vertex
Geometrical location of the dof.
void addNeighbor(DegreeOfFreedom *x)
Add a neihboring dof.
CepsUInt getNumberOfNeighbors() const
Neighbor dofs #.
DegreeOfFreedom()=delete
Deleted default constructor.
A class used to defined an unknown of a PDE problem The unknown can be defined on a specific region,...
Definition: Unknown.hpp:45
An abstract class from which all objects that contain region attributes should derive.
Abstract class to describe if an entity is on a boundary or not Objects that can be located in a mesh...
Abstract class for objects that have a global index.
Abstract class for objects that contain a CPU Id.
CepsUInt getRank()
Returns current processor rank.
Structure used to pass arguments to SAFunc (see pde directory) The flags of the SAFunc allows extract...
Definition: CepsTypes.hpp:239