Quinoa all test code coverage report
Current view: top level - PDE/MultiMat - MultiMatIndexing.hpp (source / functions) Hit Total Coverage
Commit: -128-NOTFOUND Lines: 34 34 100.0 %
Date: 2024-04-22 13:39:53 Functions: 17 17 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : // *****************************************************************************
       2                 :            : /*!
       3                 :            :   \file      src/PDE/MultiMat/MultiMatIndexing.hpp
       4                 :            :   \copyright 2012-2015 J. Bakosi,
       5                 :            :              2016-2018 Los Alamos National Security, LLC.,
       6                 :            :              2019-2021 Triad National Security, LLC.
       7                 :            :              All rights reserved. See the LICENSE file for details.
       8                 :            :   \brief     Multi-material system indexing functions
       9                 :            :   \details   This file defines functions that return indices to specific
      10                 :            :     equations for the system of multi-material compressible hydrodynamics.
      11                 :            : */
      12                 :            : // *****************************************************************************
      13                 :            : #ifndef MultiMatIndexing_h
      14                 :            : #define MultiMatIndexing_h
      15                 :            : 
      16                 :            : namespace inciter {
      17                 :            : 
      18                 :            : /** @name Functions that compute indices for physics variables for MultiMat */
      19                 :            : ///@{
      20                 :            : 
      21                 :            : // The functions below must follow the signature of MultiMatIdxFn.
      22                 :            : 
      23                 :            : //! Get the index of the required material volume fraction
      24                 :            : //! \param[in] kmat Index of required material
      25                 :            : //! \return Index of the required material volume fraction
      26                 :  578823463 : inline std::size_t volfracIdx( std::size_t /*nmat*/, std::size_t kmat )
      27                 :  578823463 : { return kmat; }
      28                 :            : 
      29                 :            : //! Get the index of the required material continuity equation
      30                 :            : //! \param[in] nmat Number of materials
      31                 :            : //! \param[in] kmat Index of required material
      32                 :            : //! \return Index of the required material continuity equation
      33                 :  592998893 : inline std::size_t densityIdx( std::size_t nmat, std::size_t kmat )
      34                 :  592998893 : { return (nmat+kmat); }
      35                 :            : 
      36                 :            : //! Get the index of the required momentum equation component
      37                 :            : //! \param[in] nmat Number of materials
      38                 :            : //! \param[in] idir Required component direction;
      39                 :            : //!   0: X-component,
      40                 :            : //!   1: Y-component,
      41                 :            : //!   2: Z-component.
      42                 :            : //! \return Index of the required momentum equation component
      43                 :  271986519 : inline std::size_t momentumIdx( std::size_t nmat, std::size_t idir )
      44                 :  271986519 : { return (2*nmat+idir); }
      45                 :            : 
      46                 :            : //! Get the index of the required material total energy equation
      47                 :            : //! \param[in] nmat Number of materials
      48                 :            : //! \param[in] kmat Index of required material
      49                 :            : //! \return Index of the required material total energy equation
      50                 :  390436559 : inline std::size_t energyIdx( std::size_t nmat, std::size_t kmat )
      51                 :  390436559 : { return (2*nmat+3+kmat); }
      52                 :            : 
      53                 :            : //! Get the index of the required material deformation gradient equation
      54                 :            : //! \param[in] nmat Number of materials
      55                 :            : //! \param[in] ksld Index of required solid
      56                 :            : //! \param[in] i Row-index of required tensor component
      57                 :            : //! \param[in] j Column-index of required tensor component
      58                 :            : //! \return Index of the required material deformation gradient equation
      59                 :   19113228 : inline std::size_t deformIdx( std::size_t nmat, std::size_t ksld,
      60                 :            :   std::size_t i, std::size_t j )
      61                 :   19113228 : { return (2*nmat+3+nmat + 9*(ksld-1)+3*i+j); }
      62                 :            : 
      63                 :            : //! Get the index of the required velocity component from vector of primitives
      64                 :            : //! \param[in] nmat Number of materials
      65                 :            : //! \param[in] idir Required component direction;
      66                 :            : //!   0: X-component,
      67                 :            : //!   1: Y-component,
      68                 :            : //!   2: Z-component.
      69                 :            : //! \return Index of the required velocity component from vector of primitives
      70                 :  145092851 : inline std::size_t velocityIdx( std::size_t nmat, std::size_t idir )
      71                 :  145092851 : { return nmat+idir; }
      72                 :            : 
      73                 :            : //! Get the index of the required material pressure from vector of primitives
      74                 :            : //! \param[in] kmat Index of required material
      75                 :            : //! \return Index of the required material pressure from vector of primitives
      76                 :  381264350 : inline std::size_t pressureIdx( std::size_t /*nmat*/, std::size_t kmat )
      77                 :  381264350 : { return kmat; }
      78                 :            : 
      79                 :            : //! Get the index of the required material stress component from primitives
      80                 :            : //! \param[in] nmat Number of materials
      81                 :            : //! \param[in] ksld Index of required solid
      82                 :            : //! \param[in] i Index of required stress component
      83                 :            : //! \return Index of the required material Cauchy stress component from vector
      84                 :            : //!   of primitives
      85                 :    7113432 : inline std::size_t stressIdx( std::size_t nmat, std::size_t ksld,
      86                 :            :   std::size_t i )
      87                 :    7113432 : { return (nmat+3 + 6*(ksld-1)+i); }
      88                 :            : 
      89                 :            : //! \brief Get the index of the required DOF of material volume fraction from
      90                 :            : //!   the DG solution vector
      91                 :            : //! \param[in] nmat Number of materials
      92                 :            : //! \param[in] kmat Index of required material
      93                 :            : //! \param[in] ndof Number of solution DOFs stored in DG solution vector
      94                 :            : //! \param[in] idof Index of required solution DOF from DG solution vector
      95                 :            : //! \return Index of the required material volume fraction
      96                 :            : //! \details This function is used to get the index of the required DOF in the
      97                 :            : //!   solution vector, which is of type tk::Fields.
      98                 :  208900458 : inline std::size_t volfracDofIdx( std::size_t nmat, std::size_t kmat,
      99                 :            :   std::size_t ndof, std::size_t idof )
     100                 :  208900458 : { return volfracIdx(nmat, kmat)*ndof+idof; }
     101                 :            : 
     102                 :            : //! \brief Get the index of the required DOF of material continuity equation
     103                 :            : //!   from the DG solution vector
     104                 :            : //! \param[in] nmat Number of materials
     105                 :            : //! \param[in] kmat Index of required material
     106                 :            : //! \param[in] ndof Number of solution DOFs stored in DG solution vector
     107                 :            : //! \param[in] idof Index of required solution DOF from DG solution vector
     108                 :            : //! \return Index of the required material continuity equation
     109                 :            : //! \details This function is used to get the index of the required DOF in the
     110                 :            : //!   solution vector, which is of type tk::Fields.
     111                 :   63096165 : inline std::size_t densityDofIdx( std::size_t nmat, std::size_t kmat,
     112                 :            :   std::size_t ndof, std::size_t idof )
     113                 :   63096165 : { return densityIdx(nmat, kmat)*ndof+idof; }
     114                 :            : 
     115                 :            : //! \brief Get the index of the required DOF of momentum equation component from
     116                 :            : //!   the DG solution vector
     117                 :            : //! \param[in] nmat Number of materials
     118                 :            : //! \param[in] idir Required component direction;
     119                 :            : //!   0: X-component,
     120                 :            : //!   1: Y-component,
     121                 :            : //!   2: Z-component.
     122                 :            : //! \param[in] ndof Number of solution DOFs stored in DG solution vector
     123                 :            : //! \param[in] idof Index of required solution DOF from DG solution vector
     124                 :            : //! \return Index of the required momentum equation component
     125                 :            : //! \details This function is used to get the index of the required DOF in the
     126                 :            : //!   solution vector, which is of type tk::Fields.
     127                 :    2816964 : inline std::size_t momentumDofIdx( std::size_t nmat, std::size_t idir,
     128                 :            :   std::size_t ndof, std::size_t idof )
     129                 :    2816964 : { return momentumIdx(nmat, idir)*ndof+idof; }
     130                 :            : 
     131                 :            : //! \brief Get the index of the required DOF of material total energy equation
     132                 :            : //!   from the DG solution vector
     133                 :            : //! \param[in] nmat Number of materials
     134                 :            : //! \param[in] kmat Index of required material
     135                 :            : //! \param[in] ndof Number of solution DOFs stored in DG solution vector
     136                 :            : //! \param[in] idof Index of required solution DOF from DG solution vector
     137                 :            : //! \return Index of the required material total energy equation
     138                 :            : //! \details This function is used to get the index of the required DOF in the
     139                 :            : //!   solution vector, which is of type tk::Fields.
     140                 :   65628769 : inline std::size_t energyDofIdx( std::size_t nmat, std::size_t kmat,
     141                 :            :   std::size_t ndof, std::size_t idof )
     142                 :   65628769 : { return energyIdx(nmat, kmat)*ndof+idof; }
     143                 :            : 
     144                 :            : //! \brief Get the index of the required DOF of material deformation gradient
     145                 :            : //!   equation from the DG solution vector
     146                 :            : //! \param[in] nmat Number of materials
     147                 :            : //! \param[in] ksld Index of required solid
     148                 :            : //! \param[in] i Row-index of required tensor component
     149                 :            : //! \param[in] j Column-index of required tensor component
     150                 :            : //! \param[in] ndof Number of solution DOFs stored in DG solution vector
     151                 :            : //! \param[in] idof Index of required solution DOF from DG solution vector
     152                 :            : //! \return Index of the required material total energy equation
     153                 :            : //! \details This function is used to get the index of the required DOF in the
     154                 :            : //!   solution vector, which is of type tk::Fields.
     155                 :    2494737 : inline std::size_t deformDofIdx( std::size_t nmat, std::size_t ksld,
     156                 :            :   std::size_t i, std::size_t j, std::size_t ndof, std::size_t idof )
     157                 :    2494737 : { return deformIdx(nmat, ksld, i, j)*ndof+idof; }
     158                 :            : 
     159                 :            : //! \brief Get the index of the required DOF of velocity component from the DG
     160                 :            : //!   vector of primitives
     161                 :            : //! \param[in] nmat Number of materials
     162                 :            : //! \param[in] idir Required component direction;
     163                 :            : //!   0: X-component,
     164                 :            : //!   1: Y-component,
     165                 :            : //!   2: Z-component.
     166                 :            : //! \param[in] ndof Number of solution DOFs stored in DG solution vector
     167                 :            : //! \param[in] idof Index of required solution DOF from DG solution vector
     168                 :            : //! \return Index of the required velocity component from vector of primitives
     169                 :            : //! \details This function is used to get the index of the required DOF in the
     170                 :            : //!   solution vector, which is of type tk::Fields.
     171                 :   15471155 : inline std::size_t velocityDofIdx( std::size_t nmat, std::size_t idir,
     172                 :            :   std::size_t ndof, std::size_t idof )
     173                 :   15471155 : { return velocityIdx(nmat, idir)*ndof+idof; }
     174                 :            : 
     175                 :            : //! \brief Get the index of the required DOF of material pressure from the DG
     176                 :            : //!   vector of primitives
     177                 :            : //! \param[in] nmat Number of materials
     178                 :            : //! \param[in] kmat Index of required material
     179                 :            : //! \param[in] ndof Number of solution DOFs stored in DG solution vector
     180                 :            : //! \param[in] idof Index of required solution DOF from DG solution vector
     181                 :            : //! \return Index of the required material pressure from vector of primitives
     182                 :            : //! \details This function is used to get the index of the required DOF in the
     183                 :            : //!   solution vector, which is of type tk::Fields.
     184                 :   66413694 : inline std::size_t pressureDofIdx( std::size_t nmat, std::size_t kmat,
     185                 :            :   std::size_t ndof, std::size_t idof )
     186                 :   66413694 : { return pressureIdx(nmat, kmat)*ndof+idof; }
     187                 :            : 
     188                 :            : //! \brief Get the index of the required DOF of material stress component from
     189                 :            : //!   the DG vector of primitives
     190                 :            : //! \param[in] nmat Number of materials
     191                 :            : //! \param[in] ksld Index of required solid
     192                 :            : //! \param[in] i Index of required stress component
     193                 :            : //! \param[in] ndof Number of solution DOFs stored in DG solution vector
     194                 :            : //! \param[in] idof Index of required solution DOF from DG solution vector
     195                 :            : //! \return Index of the required material Cauchy stress component from vector
     196                 :            : //!   of primitives
     197                 :            : //! \details This function is used to get the index of the required DOF in the
     198                 :            : //!   primitives vector, which is of type tk::Fields.
     199                 :    2130624 : inline std::size_t stressDofIdx( std::size_t nmat, std::size_t ksld,
     200                 :            :   std::size_t i, std::size_t ndof, std::size_t idof )
     201                 :    2130624 : { return stressIdx(nmat, ksld, i)*ndof+idof; }
     202                 :            : 
     203                 :    6282460 : inline bool matExists( tk::real volfrac )
     204                 :    6282460 : { return (volfrac > 1e-10) ? true : false; }
     205                 :            : 
     206                 :            : //! \brief Get the index of the quantity vel[l]*g[i][j] computed inside the
     207                 :            : //!   Riemann flux solver.
     208                 :            : //! \param[in] kmat Index of required material
     209                 :            : //! \param[in] i Row of inverse deformation tensor
     210                 :            : //! \param[in] j Column of inverse deformation tensor
     211                 :            : //! \param[in] l Velocity component
     212                 :            : //! \return Index of the quantity vel[l]*g[i][j] computed inside the
     213                 :            : //!   Riemann flux solver.
     214                 :            : //! \details This function is used to get the index of the quantity
     215                 :            : //!   vel[l]*g[i][j] computed inside the Riemann flux solver.
     216                 :            : inline std::size_t newSolidsAccFn( std::size_t kmat,
     217                 :            :   std::size_t i, std::size_t j, std::size_t l)
     218                 :            : { return 3*9*kmat+3*(3*i+j)+l; }
     219                 :            : 
     220                 :            : //! \brief Index for Cauchy stress components, since only the 6 independent
     221                 :            : //!   components are stored.
     222                 :            : const std::array< std::array< std::size_t, 3 >, 3 > stressCmp{{
     223                 :            :   {{0, 3, 4}},
     224                 :            :   {{3, 1, 5}},
     225                 :            :   {{4, 5, 2}} }};
     226                 :            : 
     227                 :            : //@}
     228                 :            : 
     229                 :            : } //inciter::
     230                 :            : 
     231                 :            : #endif // MultiMatIndexing_h

Generated by: LCOV version 1.14