LCOV - code coverage report
Current view: top level - coupling/solvers - LBCouetteSolverState.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 69.2 % 26 18
Test Date: 2026-08-21 15:14:06 Functions: 100.0 % 2 2

            Line data    Source code
       1              : // Copyright (C) 2023 Helmut Schmidt University
       2              : // This file is part of the Mamico project. For conditions of distribution
       3              : // and use, please see the copyright notice in Mamico's main folder
       4              : 
       5              : #include "coupling/solvers/LBCouetteSolver.h"
       6              : 
       7              : using State = coupling::interface::PintableMacroSolverState;
       8              : 
       9           16 : std::unique_ptr<State> coupling::solvers::LBCouetteSolverState::operator+(const State& rhs) {
      10           16 :   const LBCouetteSolverState* other = dynamic_cast<const LBCouetteSolverState*>(&rhs);
      11              : 
      12              : #if (COUPLING_MD_ERROR == COUPLING_MD_YES)
      13           16 :   if (other == nullptr) {
      14            0 :     std::cout << "ERROR LBCouetteSolverState operator+ type mismatch" << std::endl;
      15            0 :     exit(EXIT_FAILURE);
      16              :   }
      17           16 :   if (other->_pdf.size() != _pdf.size()) {
      18            0 :     std::cout << "ERROR LBCouetteSolverState operator+ size mismatch" << std::endl;
      19            0 :     exit(EXIT_FAILURE);
      20              :   }
      21              : #endif
      22              : 
      23           16 :   std::unique_ptr<LBCouetteSolverState> res = std::make_unique<LBCouetteSolverState>(*this);
      24           64 :   for (std::vector<double>::size_type i = 0; i < _pdf.size(); ++i)
      25           48 :     res->_pdf[i] += other->_pdf[i];
      26              : 
      27           16 :   return res;
      28           16 : }
      29              : 
      30            8 : std::unique_ptr<State> coupling::solvers::LBCouetteSolverState::operator-(const State& rhs) {
      31            8 :   const LBCouetteSolverState* other = dynamic_cast<const LBCouetteSolverState*>(&rhs);
      32              : 
      33              : #if (COUPLING_MD_ERROR == COUPLING_MD_YES)
      34            8 :   if (other == nullptr) {
      35            0 :     std::cout << "ERROR LBCouetteSolverState operator- type mismatch" << std::endl;
      36            0 :     exit(EXIT_FAILURE);
      37              :   }
      38            8 :   if (other->_pdf.size() != _pdf.size()) {
      39            0 :     std::cout << "ERROR LBCouetteSolverState operator- size mismatch" << std::endl;
      40            0 :     exit(EXIT_FAILURE);
      41              :   }
      42              : #endif
      43              : 
      44            8 :   std::unique_ptr<LBCouetteSolverState> res = std::make_unique<LBCouetteSolverState>(*this);
      45           32 :   for (std::vector<double>::size_type i = 0; i < _pdf.size(); ++i)
      46           24 :     res->_pdf[i] -= other->_pdf[i];
      47              : 
      48            8 :   return res;
      49            8 : }
        

Generated by: LCOV version 2.0-1