• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

CSMMLab / KiT-RT / #117

11 Feb 2026 05:12PM UTC coverage: 57.119% (+10.5%) from 46.626%
#117

push

travis-ci

web-flow
Add comprehensive unit tests for core modules (#60)

* Add 7 new test files to increase unit test coverage

Cover previously untested areas: text processing utilities, slope
limiters, entropy classes (quadratic + Maxwell-Boltzmann), upwind flux
overloads (FluxXZ, Flux1D, FluxVanLeer, vectorized), IO round-trip
(connectivity + restart solution), problem geometry (checkerboard,
lattice, line source analytical solution), expanded config parameter
parsing, and additional optimizer scenarios.

https://claude.ai/code/session_01VcLByz1wmHxA1Wev5PwVGL

* fix memory leaks in unit tests

* modify tests for memory safety

* fix memory leak

* add reference files for validation tests

* try to fix segfault

* remove compiler warnings

* attempt to fix segfaults in tests

* added cfg files for sn validation tests

* update workflow

---------

Co-authored-by: Claude <noreply@anthropic.com>

12 of 14 new or added lines in 5 files covered. (85.71%)

21 existing lines in 1 file now uncovered.

5448 of 9538 relevant lines covered (57.12%)

31303.3 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/solvers/mnsolver_normalized.cpp
1
#include "solvers/mnsolver_normalized.hpp"
2
#include "common/config.hpp"
3
#include "common/io.hpp"
4
#include "common/mesh.hpp"
5
#include "entropies/entropybase.hpp"
6
#include "fluxes/numericalflux.hpp"
7
#include "optimizers/newtonoptimizer.hpp"
8
#include "optimizers/optimizerbase.hpp"
9
#include "optimizers/partregularizednewtonoptimizer.hpp"
10
#include "problems/problembase.hpp"
11
#include "quadratures/quadraturebase.hpp"
12
#include "solvers/mnsolver.hpp"
13
#include "toolboxes/errormessages.hpp"
14
#include "toolboxes/textprocessingtoolbox.hpp"
15
#include "velocitybasis/sphericalbase.hpp"
16

17
// externals
18
#include "spdlog/spdlog.h"
19
#include <iostream>
20

21
MNSolverNormalized::MNSolverNormalized( Config* settings ) : MNSolver( settings ) {
×
22
    _u0 = Vector( _nCells, 0.0 );
×
23
    if( _settings->GetRegularizerGamma() > 0 ) {
×
24
        _optimizer2 = new PartRegularizedNewtonOptimizer( settings );
×
25
    }
26
    else {
27
        _optimizer2 = new NewtonOptimizer( settings );
×
28
    }
29
    _sol2 = VectorVector( _nCells, Vector( _nSystem, 0.0 ) );
×
30
}
31

NEW
32
MNSolverNormalized::~MNSolverNormalized() { delete _optimizer2; }
×
33

×
34
void MNSolverNormalized::IterPreprocessing( unsigned /*idx_pseudotime*/ ) {
×
35
    Vector alpha_norm_per_cell( _nCells, 0 );    // ONLY FOR DEBUGGING! THIS SLOWS DOWN THE CODE
36

×
37
    // ------- Entropy closure Step ----------------
×
38
    for( unsigned idx_cell = 0; idx_cell < _nCells; idx_cell++ ) {
39
        _u0[idx_cell] = _sol[idx_cell][0];
40
        _sol[idx_cell] /= _u0[idx_cell];    // assume _u0 > 0 always!!
×
41
    }
×
42

×
43

44
    _optimizer->SolveMultiCell( _alpha, _sol, _momentBasis, alpha_norm_per_cell );
45

46
    // ------- Solution reconstruction step ----
×
47
#pragma omp parallel for
48
    for( unsigned idx_cell = 0; idx_cell < _nCells; idx_cell++ ) {
49

×
50
        alpha_norm_per_cell[idx_cell] *= _momentBasis[0][0] * 0.5 * _settings->GetRegularizerGamma();    // is constant
51
        // std::cout << alpha_norm << "|" << _momentBasis[0][0] << "\n";
52
        for( unsigned idx_quad = 0; idx_quad < _nq; idx_quad++ ) {
53
            // compute the kinetic density at all grid cells
54
            _kineticDensity[idx_cell][idx_quad] =
55
                _u0[idx_cell] * _entropy->EntropyPrimeDual( blaze::dot( _alpha[idx_cell], _momentBasis[idx_quad] ) - alpha_norm_per_cell[idx_cell] );
56
        }
57
    }
58

59
    // ------ Compute slope limiters and cell gradients ---
60
    if( _reconsOrder > 1 ) {
61
        _mesh->ComputeSlopes( _nq, _solDx, _solDy, _kineticDensity );               // parallel
62
        _mesh->ComputeLimiter( _nq, _solDx, _solDy, _kineticDensity, _limiter );    // parallel
×
63
    }
×
64
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc