LCOV - code coverage report
Current view: top level - src/Communicate - Environment.cpp (source / functions) Coverage Total Hit
Test: report.info Lines: 100.0 % 17 17
Test Date: 2025-05-21 11:16:25 Functions: 100.0 % 4 4
Branches: 50.0 % 8 4

             Branch data     Line data    Source code
       1                 :             : //
       2                 :             : // Class Environment
       3                 :             : //
       4                 :             : #include "Ippl.h"
       5                 :             : 
       6                 :             : #include "Environment.h"
       7                 :             : 
       8                 :             : namespace ippl {
       9                 :             :     namespace mpi {
      10                 :             : 
      11                 :         836 :         Environment::Environment(int& argc, char**& argv, const MPI_Comm& comm)
      12                 :         836 :             : comm_m(comm) {
      13         [ +  - ]:         836 :             if (!initialized()) {
      14                 :         836 :                 MPI_Init(&argc, &argv);
      15                 :             :             }
      16                 :         836 :         }
      17                 :             : 
      18                 :         836 :         Environment::~Environment() {
      19         [ +  - ]:         836 :             if (!finalized()) {
      20                 :         836 :                 MPI_Finalize();
      21                 :             :             }
      22                 :         836 :         }
      23                 :             : 
      24                 :         836 :         bool Environment::initialized() {
      25                 :         836 :             int flag = 0;
      26         [ +  - ]:         836 :             MPI_Initialized(&flag);
      27                 :         836 :             return (flag != 0);
      28                 :             :         }
      29                 :             : 
      30                 :         836 :         bool Environment::finalized() {
      31                 :         836 :             int flag = 0;
      32         [ +  - ]:         836 :             MPI_Finalized(&flag);
      33                 :         836 :             return (flag != 0);
      34                 :             :         }
      35                 :             :     }  // namespace mpi
      36                 :             : }  // namespace ippl
        

Generated by: LCOV version 2.0-1