Directory: | ./ |
---|---|
File: | Solver/steklovBanner.cpp |
Date: | 2024-04-14 07:32:34 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 24 | 52 | 46.2% |
Branches: | 10 | 94 | 10.6% |
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: | ||
13 | // | ||
14 | |||
15 | // System includes | ||
16 | |||
17 | // External includes | ||
18 | |||
19 | // Project includes | ||
20 | #include "Core/felisce.hpp" | ||
21 | #include "Core/felisceParam.hpp" | ||
22 | #include "Solver/steklovBanner.hpp" | ||
23 | |||
24 | namespace felisce { | ||
25 | 4 | steklovBanner::steklovBanner(int numLocDof, int rankProc, MPI_Comm comm, int dimRoSteklov): | |
26 | 4 | m_numLoc(numLocDof), | |
27 | 4 | m_numGlob(0), | |
28 | 4 | m_rankProc(rankProc), | |
29 | 4 | m_comm(comm), | |
30 | 4 | m_counter(0), | |
31 | 4 | m_step(1), | |
32 | 4 | m_counterStep(0), | |
33 | 4 | m_dimRoSteklov(dimRoSteklov) { | |
34 | 4 | MPI_Allreduce(&m_numLoc,&m_numGlob,1,MPI_INT,MPI_SUM,m_comm); | |
35 |
2/6✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 4 times.
|
4 | if ( FelisceParam::verbose() > 1 && numLocDof > 0 ) { |
36 | ✗ | std::stringstream master; | |
37 | ✗ | master<<"The total number of degrees of freedom on the interface is"<< std::endl; | |
38 | ✗ | PetscPrintf(m_comm,"%s",master.str().c_str()); | |
39 | ✗ | MPI_Barrier(m_comm); | |
40 | ✗ | std::cout<<"["<<m_rankProc<<"] numLoc (numGlob): "<<m_numLoc<<" ( "<<m_numGlob<<" )"<< std::endl; | |
41 | ✗ | MPI_Barrier(m_comm); | |
42 | } | ||
43 | 4 | } | |
44 | void | ||
45 | 4 | steklovBanner::initComputation() { | |
46 |
2/6✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 4 times.
|
4 | if ( FelisceParam::verbose() > 0 && m_numLoc > 0 ) { |
47 | ✗ | std::stringstream master,master2; | |
48 | ✗ | if ( m_dimRoSteklov <= 0 ) { | |
49 | ✗ | master << "Starting computation of Steklov operator "<< std::endl; | |
50 | ✗ | m_NMax = std::min(100, m_numGlob ); | |
51 | ✗ | m_step = double(m_numGlob) / double(m_NMax) ; | |
52 | } else { | ||
53 | ✗ | master << "Starting computation of the reduced order Steklov operator "<< std::endl; | |
54 | ✗ | m_NMax = std::min(100, m_dimRoSteklov); | |
55 | ✗ | m_step = double(m_dimRoSteklov) / double(m_NMax) ; | |
56 | } | ||
57 | ✗ | PetscPrintf(m_comm, "%s",master.str().c_str() ); | |
58 | ✗ | master2<<"<"; | |
59 | ✗ | for ( int k(0); k<m_NMax; ++k) { | |
60 | ✗ | master2<<"-"; | |
61 | } | ||
62 | ✗ | master2<<">"<<std::endl; | |
63 | ✗ | PetscPrintf(m_comm,"%s",master2.str().c_str()); | |
64 | ✗ | PetscPrintf(m_comm,"<"); | |
65 | ✗ | MPI_Barrier(m_comm); | |
66 | } | ||
67 | 4 | } | |
68 | void | ||
69 | 324 | steklovBanner::operator++() { | |
70 | 324 | ++m_counter; | |
71 |
2/2✓ Branch 0 taken 320 times.
✓ Branch 1 taken 4 times.
|
324 | if ( m_counter > m_step * ( m_counterStep + 1 ) ) { |
72 | 320 | ++m_counterStep; | |
73 |
2/6✗ Branch 1 not taken.
✓ Branch 2 taken 320 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 320 times.
|
320 | if ( FelisceParam::verbose() > 0 && m_numLoc > 0 ) { |
74 | ✗ | PetscPrintf(m_comm,"="); | |
75 | ✗ | MPI_Barrier(m_comm); | |
76 | } | ||
77 | } | ||
78 | 324 | } | |
79 | void | ||
80 | 4 | steklovBanner::finalizeComputation() { | |
81 |
2/6✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 4 times.
|
4 | if ( FelisceParam::verbose() > 0 && m_numLoc > 0 ) { |
82 | ✗ | for (int k(0); k < m_NMax-m_counterStep; ++k) { | |
83 | ✗ | PetscPrintf(m_comm,"="); | |
84 | } | ||
85 | ✗ | PetscPrintf(m_comm,">\n"); | |
86 | ✗ | MPI_Barrier(m_comm); | |
87 | } | ||
88 | 4 | } | |
89 | } | ||
90 |