Directory: | ./ |
---|---|
File: | Model/solutionBackup.cpp |
Date: | 2024-04-14 07:32:34 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 17 | 27 | 63.0% |
Branches: | 10 | 32 | 31.2% |
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-F. Gerbeau, E. Schenone | ||
13 | // | ||
14 | |||
15 | // System includes | ||
16 | |||
17 | // External includes | ||
18 | |||
19 | // Project includes | ||
20 | #include "Model/solutionBackup.hpp" | ||
21 | |||
22 | namespace felisce | ||
23 | { | ||
24 | 513 | SolutionBackup::SolutionBackup(): | |
25 |
1/2✓ Branch 3 taken 513 times.
✗ Branch 4 not taken.
|
513 | m_meshIsWritten(false) |
26 | 513 | {} | |
27 | |||
28 | 513 | SolutionBackup::~SolutionBackup() = default; | |
29 | |||
30 | 513 | void SolutionBackup::initialize(const std::string& inputDirectory,const std::string& inputFile, const std::vector<std::string>& inputMesh, const std::vector<std::string>& outputMesh, | |
31 | const std::string& meshDir, const std::string& resultDir, const std::vector<std::string>& prefixName) | ||
32 | { | ||
33 | 513 | m_io.resize(inputMesh.size()); | |
34 | 513 | m_meshIsWritten.resize(inputMesh.size(),false); | |
35 | |||
36 |
2/2✓ Branch 1 taken 525 times.
✓ Branch 2 taken 513 times.
|
1038 | for (std::size_t i = 0; i < m_io.size(); i++){ |
37 |
1/2✓ Branch 2 taken 525 times.
✗ Branch 3 not taken.
|
525 | std::string outputMesh_bkp = outputMesh[i]; |
38 |
1/2✓ Branch 6 taken 525 times.
✗ Branch 7 not taken.
|
525 | outputMesh_bkp.replace(outputMesh_bkp.end()-4,outputMesh_bkp.end(),"_bkp.geo"); |
39 | |||
40 |
3/6✓ Branch 2 taken 525 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 525 times.
✗ Branch 6 not taken.
✓ Branch 9 taken 525 times.
✗ Branch 10 not taken.
|
525 | m_io[i] = felisce::make_shared<IO>(inputDirectory, inputFile, inputMesh[i], outputMesh_bkp, meshDir, resultDir+"/bkp/", prefixName[i]+"_bkp"); |
41 |
1/2✓ Branch 3 taken 525 times.
✗ Branch 4 not taken.
|
525 | m_io[i]->initializeOutput(); |
42 | 525 | } | |
43 | 513 | } | |
44 | |||
45 | 12825 | bool SolutionBackup::hasToBackup(int iter, int freq) const | |
46 | { | ||
47 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 12825 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
12825 | if (freq != 0 && iter % freq == 0) { |
48 | ✗ | return true; | |
49 | } else { | ||
50 | 12825 | return false; | |
51 | } | ||
52 | } | ||
53 | |||
54 | ✗ | void SolutionBackup::backup(double time, std::vector<GeometricMeshRegion::Pointer>& mesh, int rank) | |
55 | { | ||
56 | ✗ | for (std::size_t i = 0; i < m_io.size(); i++){ | |
57 | ✗ | if (!m_meshIsWritten[i]) { | |
58 | ✗ | m_io[i]->writeMesh(*mesh[i]); | |
59 | ✗ | m_meshIsWritten[i] = true; | |
60 | } | ||
61 | |||
62 | ✗ | if ( rank == 0 ) { | |
63 | ✗ | if ( m_io[i]->typeOutput == 1 ) { // 1 : ensight{ | |
64 | ✗ | m_io[i]->postProcess(time); | |
65 | } | ||
66 | } | ||
67 | } | ||
68 | } | ||
69 | |||
70 | ✗ | void SolutionBackup::print(int verbose, std::ostream& outstr) const | |
71 | { | ||
72 | IGNORE_UNUSED_VERBOSE; | ||
73 | IGNORE_UNUSED_OUTSTR; | ||
74 | } | ||
75 | |||
76 | } | ||
77 | |||
78 |