GCC Code Coverage Report


Directory: ./
File: DegreeOfFreedom/listVariable.hpp
Date: 2024-04-14 07:32:34
Exec Total Coverage
Lines: 12 12 100.0%
Branches: 0 0 -%

Line Branch Exec Source
1 // ______ ______ _ _ _____ ______
2 // | ____| ____| | (_)/ ____| | ____|
3 // | |__ | |__ | | _| (___ ___| |__
4 // | __| | __| | | | |\___ \ / __| __|
5 // | | | |____| |____| |____) | (__| |____
6 // |_| |______|______|_|_____/ \___|______|
7 // Finite Elements for Life Sciences and Engineering
8 //
9 // License: LGL2.1 License
10 // FELiScE default license: LICENSE in root folder
11 //
12 // Main authors: J. Foulon
13 //
14
15 #ifndef LISTVARIABLE_H
16 #define LISTVARIABLE_H
17
18 // System includes
19 #include <vector>
20
21 // External includes
22
23 // Project includes
24 #include "Core/felisce.hpp"
25 #include "DegreeOfFreedom/variable.hpp"
26 #include "Core/felisceParam.hpp"
27
28 namespace felisce {
29 /*!
30 \class ListVariable
31 \author J. Foulon
32 \date 07/10/2010
33 \brief Class containing a list of variables in the problem.
34 These variables are strore with an STL std::vector.
35 */
36
37 class ListVariable {
38
39 private:
40 //! vector STL which contains Felisce's variables.
41 std::vector<Variable> m_listVariable;
42 // Contains Idunknown associate to the variable (== -1 if no unknown associate).
43 std::vector<int> m_listIdUnknownOfVariable;
44
45 public:
46 //Constructor
47 //===========
48 ListVariable();
49
50 //Set functions
51 //=============
52 void addVariable( const PhysicalVariable& variableName, std::size_t nComp, std::size_t instanceIndex=0);
53 void addVariable( const Variable& var);
54 void print(int verbose = 0, std::ostream& outstr = std::cout) const;
55 int getVariableIdList( PhysicalVariable variable ) const;
56 int getVariableIdList( std::string nameVariable ) const;
57 Variable* getVariable( PhysicalVariable variable );
58 Variable* getVariable( std::string nameVariable );
59 1099491236 std::size_t size() const {
60 1099491236 return m_listVariable.size();
61 }
62
63 //Access Functions
64 //================
65 inline const std::vector<Variable> & listVariable() const {
66 return m_listVariable;
67 }
68 77 inline std::vector<Variable> & listVariable() {
69 77 return m_listVariable;
70 }
71
72 1099399832 inline const int & listIdUnknownOfVariable(int i) const {
73 1099399832 return m_listIdUnknownOfVariable[i];
74 }
75 740 inline int & listIdUnknownOfVariable(int i) {
76 740 return m_listIdUnknownOfVariable[i];
77 }
78
79 //Operators
80 //=========
81 216269331 Variable& operator[](int i) {
82 216269331 return m_listVariable[i];
83 }
84 2588370355 const Variable& operator[](int i) const {
85 2588370355 return m_listVariable[i];
86 }
87 };
88 }
89 #endif
90