Directory: | ./ |
---|---|
File: | DegreeOfFreedom/variable.cpp |
Date: | 2024-04-14 07:32:34 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 34 | 37 | 91.9% |
Branches: | 9 | 14 | 64.3% |
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 | /*! | ||
16 | \file variable.cpp | ||
17 | \author J. Foulon | ||
18 | \date 07/10/2010 | ||
19 | \brief File contains Variable implementation | ||
20 | */ | ||
21 | |||
22 | // System includes | ||
23 | |||
24 | // External includes | ||
25 | |||
26 | // Project includes | ||
27 | #include "DegreeOfFreedom/variable.hpp" | ||
28 | |||
29 | namespace felisce { | ||
30 | |||
31 | 1916 | Variable::Variable(): | |
32 |
1/2✓ Branch 3 taken 1916 times.
✗ Branch 4 not taken.
|
1916 | m_boolInitialize(false) |
33 | 1916 | {} | |
34 | |||
35 | /***********************************************************************************/ | ||
36 | /***********************************************************************************/ | ||
37 | |||
38 | 889 | void Variable::initialize(const std::size_t iVar, std::size_t instanceIndex) | |
39 | { | ||
40 | 889 | const auto& r_instance = FelisceParam::instance(instanceIndex); | |
41 | 889 | m_name = r_instance.nameVariable[iVar]; | |
42 | 889 | m_physicalVariable = r_instance.physicalVariable[iVar]; | |
43 | 889 | m_numComponent = 0; | |
44 | 889 | m_idMesh = -1; | |
45 | 889 | m_finiteElementType = r_instance.typeOfFiniteElement[iVar]; | |
46 |
2/2✓ Branch 1 taken 287 times.
✓ Branch 2 taken 602 times.
|
889 | if (r_instance.decomposePlaneTransverse[iVar]) { |
47 | 287 | m_degreeOfExactness.resize(3); | |
48 | 287 | m_degreeOfExactness[1] = static_cast<DegreeOfExactness>(r_instance.planeDegreeOfExactness[iVar]); | |
49 | 287 | m_degreeOfExactness[2] = static_cast<DegreeOfExactness>(r_instance.transverseDegreeOfExactness[iVar]); | |
50 | } | ||
51 | 889 | m_degreeOfExactness[0] = static_cast<DegreeOfExactness>(r_instance.degreeOfExactness[iVar]); | |
52 | 889 | m_boolInitialize = true; | |
53 | 889 | } | |
54 | |||
55 | /***********************************************************************************/ | ||
56 | /***********************************************************************************/ | ||
57 | |||
58 | 889 | void Variable::setNumComponent(const std::size_t nComp) | |
59 | { | ||
60 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 889 times.
|
889 | if (!m_boolInitialize) { |
61 | ✗ | FEL_ERROR("Your variable is not initialized."); | |
62 | } | ||
63 | 889 | m_numComponent = nComp; | |
64 | 889 | } | |
65 | |||
66 | /***********************************************************************************/ | ||
67 | /***********************************************************************************/ | ||
68 | |||
69 | 889 | void Variable::setMeshId(const std::size_t idMesh) | |
70 | { | ||
71 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 889 times.
|
889 | if (!m_boolInitialize) { |
72 | ✗ | FEL_ERROR("Your variable is not initialized."); | |
73 | } | ||
74 | 889 | m_idMesh = idMesh; | |
75 | 889 | } | |
76 | |||
77 | /***********************************************************************************/ | ||
78 | /***********************************************************************************/ | ||
79 | |||
80 | /// print function. | ||
81 | 455 | void Variable::print(int verbose, std::ostream& outstr) const | |
82 | { | ||
83 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 455 times.
|
455 | if (!m_boolInitialize) { |
84 | ✗ | FEL_ERROR("Your variable is not initialized."); | |
85 | } | ||
86 | |||
87 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | if (verbose > 0) { |
88 | 455 | outstr << "<" << m_name << ">"; | |
89 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 439 times.
|
455 | if (verbose > 1) { |
90 | 16 | outstr << " with " << m_numComponent << " components, on a finite element of type " << m_finiteElementType | |
91 | 16 | << ", with degree of exactness: " << m_degreeOfExactness[0]; | |
92 | } | ||
93 | 455 | outstr << std::endl; | |
94 | } | ||
95 | 455 | } | |
96 | } | ||
97 |