GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: dumux/dumux/io/velocityoutput.hh
Date: 2025-04-12 19:19:20
Exec Total Coverage
Lines: 5 8 62.5%
Functions: 743 2616 28.4%
Branches: 3 5 60.0%

Line Branch Exec Source
1 // -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 // vi: set et ts=4 sw=4 sts=4:
3 //
4 // SPDX-FileCopyrightText: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5 // SPDX-License-Identifier: GPL-3.0-or-later
6 //
7 /*!
8 * \file
9 * \ingroup InputOutput
10 * \brief Default velocity output policy for porous media models
11 */
12 #ifndef DUMUX_IO_VELOCITYOUTPUT_HH
13 #define DUMUX_IO_VELOCITYOUTPUT_HH
14
15 #include <vector>
16
17 #include <dune/common/fvector.hh>
18 #include <dune/common/exceptions.hh>
19 #include <dumux/common/parameters.hh>
20
21 namespace Dumux {
22
23 /*!
24 * \ingroup InputOutput
25 * \brief Velocity output for implicit (porous media) models
26 */
27 template<class GridVariables>
28 class VelocityOutput
29 {
30 using Scalar = typename GridVariables::Scalar;
31 static constexpr int dimWorld = GridVariables::GridGeometry::GridView::dimensionworld;
32 using ElementVolumeVariables = typename GridVariables::GridVolumeVariables::LocalView;
33 using ElementFluxVarsCache = typename GridVariables::GridFluxVariablesCache::LocalView;
34 using FVElementGeometry = typename GridVariables::GridGeometry::LocalView;
35 using Element = typename GridVariables::GridGeometry::GridView::template Codim<0>::Entity;
36
37 public:
38 using VelocityVector = std::vector<Dune::FieldVector<Scalar, dimWorld>>;
39
40 /*!
41 * \brief A container for possible velocity data types
42 */
43 enum class FieldType
44 {
45 element, vertex, automatic
46 };
47
48 /*!
49 * \brief Default constructor
50 */
51
3/5
✓ Branch 1 taken 350 times.
✓ Branch 2 taken 6 times.
✓ Branch 4 taken 15 times.
✗ Branch 5 not taken.
✗ Branch 3 not taken.
745 VelocityOutput() = default;
52
53 //! virtual destructor
54 1503 virtual ~VelocityOutput() {};
55
56 //! returns whether or not velocity output is enabled
57 7806494 virtual bool enableOutput() const { return false; }
58
59 //! returns the phase name of a given phase index
60 virtual std::string phaseName(int phaseIdx) const { return "none"; }
61
62 //! returns the field type
63 14980 virtual FieldType fieldType() const { return FieldType::automatic; }
64
65 //! returns the number of phases
66 2488 virtual int numFluidPhases() const { return 0; }
67
68 //! Calculate the velocities for the scvs in the element
69 //! We assume the local containers to be bound to the complete stencil
70 virtual void calculateVelocity(VelocityVector& velocity,
71 const Element& element,
72 const FVElementGeometry& fvGeometry,
73 const ElementVolumeVariables& elemVolVars,
74 const ElementFluxVarsCache& elemFluxVarsCache,
75 int phaseIdx) const
76 {}
77 };
78
79 } // end namespace Dumux
80
81 #endif
82