Quinoa all test code coverage report
Current view: top level - PDE - DGPDE.hpp (source / functions) Hit Total Coverage
Commit: -128-NOTFOUND Lines: 83 99 83.8 %
Date: 2024-04-29 14:42:33 Functions: 261 978 26.7 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 35 168 20.8 %

           Branch data     Line data    Source code
       1                 :            : // *****************************************************************************
       2                 :            : /*!
       3                 :            :   \file      src/PDE/DGPDE.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     Partial differential equation base for discontinuous Galerkin PDEs
       9                 :            :   \details   This file defines a generic partial differential equation (PDE)
      10                 :            :     class for PDEs that use discontinuous Galerkin spatial discretization.
      11                 :            :     The class uses runtime polymorphism without client-side inheritance:
      12                 :            :     inheritance is confined to the internals of the class, invisible to
      13                 :            :     client-code. The class exclusively deals with ownership enabling client-side
      14                 :            :     value semantics. Credit goes to Sean Parent at Adobe:
      15                 :            :     https://github.com/sean-parent/sean-parent.github.com/wiki/
      16                 :            :     Papers-and-Presentations.
      17                 :            : */
      18                 :            : // *****************************************************************************
      19                 :            : #ifndef DGPDE_h
      20                 :            : #define DGPDE_h
      21                 :            : 
      22                 :            : #include <array>
      23                 :            : #include <string>
      24                 :            : #include <vector>
      25                 :            : #include <memory>
      26                 :            : #include <unordered_set>
      27                 :            : #include <functional>
      28                 :            : 
      29                 :            : #include "Types.hpp"
      30                 :            : #include "Fields.hpp"
      31                 :            : #include "FaceData.hpp"
      32                 :            : #include "UnsMesh.hpp"
      33                 :            : #include "Inciter/InputDeck/InputDeck.hpp"
      34                 :            : #include "FunctionPrototypes.hpp"
      35                 :            : #include "History.hpp"
      36                 :            : 
      37                 :            : namespace inciter {
      38                 :            : 
      39                 :            : extern ctr::InputDeck g_inputdeck;
      40                 :            : 
      41                 :            : using ncomp_t = tk::ncomp_t;
      42                 :            : using BCStateFn =
      43                 :            :   std::vector< std::pair< std::vector< std::size_t >, tk::StateFn > >;
      44                 :            : 
      45                 :            : //! Extract BC configuration ignoring if BC not specified
      46                 :            : //! \note A more preferable way of catching errors such as this function
      47                 :            : //!   hides is during parsing, so that we don't even get here if BCs are
      48                 :            : //!   not correctly specified. For now we simply ignore if BCs are not
      49                 :            : //!   specified by allowing empty BC vectors from the user input.
      50                 :            : struct ConfigBC {
      51                 :            :   BCStateFn& state;    //!< BC state config: sidesets + statefn
      52                 :            :   const std::vector< tk::StateFn >& fn;    //!< BC state functions
      53                 :            :   std::size_t c;       //!< Counts BC types configured
      54                 :            :   //! Constructor
      55                 :            :   ConfigBC( BCStateFn& s,
      56                 :        477 :             const std::vector< tk::StateFn >& f ) :
      57 [ -  - ][ +  - ]:        477 :     state(s), fn(f), c(0) {}
         [ +  - ][ +  - ]
         [ -  - ][ +  - ]
         [ +  - ][ -  - ]
         [ +  - ][ +  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ +  - ]
         [ +  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ +  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
      58                 :            :   //! Function to call for each BC type
      59                 :       2862 :   template< typename U > void operator()( brigand::type_<U> ) {
      60                 :            :     std::vector< std::size_t > cfg, v;
      61                 :            :     // collect sidesets across all meshes
      62         [ +  + ]:       5724 :     for (const auto& ibc : g_inputdeck.get< tag::bc >()) {
      63         [ +  - ]:       2862 :       v.insert(v.end(), ibc.get< U >().begin(), ibc.get< U >().end());
      64                 :            :     }
      65 [ +  + ][ +  - ]:       2862 :     if (v.size() > 0) cfg = v;
      66                 :            :     Assert( fn.size() > c, "StateFn missing for BC type" );
      67 [ +  - ][ +  + ]:       5724 :     state.push_back( { cfg, fn[c++] } );
                 [ -  - ]
      68                 :       2862 :   }
      69                 :            : };
      70                 :            : 
      71                 :            : //! State function for invalid/un-configured boundary conditions
      72                 :            : [[noreturn]] tk::StateFn::result_type
      73                 :            : invalidBC( ncomp_t, const std::vector< EOS >&,
      74                 :            :            const std::vector< tk::real >&, tk::real, tk::real, tk::real,
      75                 :            :            tk::real, const std::array< tk::real, 3> & );
      76                 :            : 
      77                 :            : //! \brief Partial differential equation base for discontinuous Galerkin PDEs
      78                 :            : //! \details This class uses runtime polymorphism without client-side
      79                 :            : //!   inheritance: inheritance is confined to the internals of the this class,
      80                 :            : //!   invisible to client-code. The class exclusively deals with ownership
      81                 :            : //!   enabling client-side value semantics. Credit goes to Sean Parent at Adobe:
      82                 :            : //!   https://github.com/sean-parent/sean-parent.github.com/wiki/
      83                 :            : //!   Papers-and-Presentations. For example client code that models a DGPDE,
      84                 :            : //!   see inciter::CompFlow.
      85                 :        398 : class DGPDE {
      86                 :            : 
      87                 :            :   private:
      88                 :            :     using ncomp_t = tk::ncomp_t;
      89                 :            : 
      90                 :            :   public:
      91                 :            :     //! Default constructor taking no arguments for Charm++
      92                 :            :     explicit DGPDE() = default;
      93                 :            : 
      94                 :            :     //! \brief Constructor taking an object modeling Concept.
      95                 :            :     //! \details The object of class T comes pre-constructed.
      96                 :            :     //! \param[in] x Instantiated object of type T given by the template
      97                 :            :     //!   argument.
      98                 :            :     template< typename T > explicit DGPDE( T x ) :
      99                 :            :       self( std::make_unique< Model<T> >( std::move(x) ) ) {}
     100                 :            : 
     101                 :            :     //! \brief Constructor taking a function pointer to a constructor of an
     102                 :            :     //!   object modeling Concept.
     103                 :            :     //! \details Passing std::function allows late execution of the constructor,
     104                 :            :     //!   i.e., as late as inside this class' constructor, and thus usage from
     105                 :            :     //!   a factory. Note that there are at least two different ways of using
     106                 :            :     //!   this constructor:
     107                 :            :     //!   - Bind T's constructor arguments and place it in std::function<T()>
     108                 :            :     //!   and passing no arguments as args.... This case then instantiates the
     109                 :            :     //!   model via its constructor and stores it in here.
     110                 :            :     //!   - Bind a single placeholder argument to T's constructor and pass it in
     111                 :            :     //!   as host's args..., which then forwards it to model's constructor. This
     112                 :            :     //!   allows late binding, i.e., binding the argument only here.
     113                 :            :     //! \see See also the wrapper tk::recordModel() which does the former and
     114                 :            :     //!   tk::recordModelLate() which does the latter, both defined in
     115                 :            :     //!   src/Base/Factory.h.
     116                 :            :     //! \param[in] x Function pointer to a constructor of an object modeling
     117                 :            :     //!    Concept.
     118                 :            :     //! \param[in] args Zero or more constructor arguments
     119                 :            :     template< typename T, typename...Args >
     120         [ -  + ]:        398 :     explicit DGPDE( std::function<T(Args...)> x, Args&&... args ) :
     121                 :            :       self( std::make_unique< Model<T> >(
     122         [ +  - ]:        398 :               std::move( x( std::forward<Args>(args)... ) ) ) ) {}
     123                 :            : 
     124                 :            :     //! Public interface to find number of primitive quantities for the diff eq
     125                 :            :     std::size_t nprim() const
     126 [ +  - ][ -  - ]:        853 :     { return self->nprim(); }
     127                 :            : 
     128                 :            :     //! Public interface to find number of materials for the diff eq
     129                 :            :     std::size_t nmat() const
     130                 :            :     { return self->nmat(); }
     131                 :            : 
     132                 :            :     //! Public interface to find Dofs for each equation in pde system
     133                 :            :     void numEquationDofs(std::vector< std::size_t >& numEqDof) const
     134 [ +  - ][ -  - ]:        853 :     { return self->numEquationDofs(numEqDof); }
     135                 :            : 
     136                 :            :     //! Public interface to determine elements that lie inside the IC box
     137                 :            :     void IcBoxElems( const tk::Fields& geoElem,
     138                 :            :       std::size_t nielem,
     139                 :            :       std::vector< std::unordered_set< std::size_t > >& inbox ) const
     140                 :        853 :     { self->IcBoxElems( geoElem, nielem, inbox ); }
     141                 :            : 
     142                 :            :     //! Public interface to setting the initial conditions for the diff eq
     143                 :            :     void initialize(
     144                 :            :       const tk::Fields& L,
     145                 :            :       const std::vector< std::size_t >& inpoel,
     146                 :            :       const tk::UnsMesh::Coords& coord,
     147                 :            :       const std::vector< std::unordered_set< std::size_t > >& inbox,
     148                 :            :       const std::unordered_map< std::size_t, std::set< std::size_t > >&
     149                 :            :         elemblkid,
     150                 :            :       tk::Fields& unk,
     151                 :            :       tk::real t,
     152                 :            :       const std::size_t nielem ) const
     153 [ +  - ][ +  - ]:        985 :     { self->initialize( L, inpoel, coord, inbox, elemblkid, unk, t, nielem ); }
     154                 :            : 
     155                 :            :     //! Public interface to computing the left-hand side matrix for the diff eq
     156                 :            :     void lhs( const tk::Fields& geoElem, tk::Fields& l ) const
     157 [ +  - ][ +  - ]:        985 :     { self->lhs( geoElem, l ); }
     158                 :            : 
     159                 :            :     //! Public interface to updating the interface cells for the diff eq
     160                 :            :     void updateInterfaceCells( tk::Fields& unk,
     161                 :            :                                std::size_t nielem,
     162                 :            :                                std::vector< std::size_t >& ndofel ) const
     163                 :      72480 :     { self->updateInterfaceCells( unk, nielem, ndofel ); }
     164                 :            : 
     165                 :            :     //! Public interface to updating the primitives for the diff eq
     166                 :            :     void updatePrimitives( const tk::Fields& unk,
     167                 :            :                            const tk::Fields& L,
     168                 :            :                            const tk::Fields& geoElem,
     169                 :            :                            tk::Fields& prim,
     170                 :            :                            std::size_t nielem ) const
     171                 :      73333 :     { self->updatePrimitives( unk, L, geoElem, prim, nielem ); }
     172                 :            : 
     173                 :            :     //! Public interface to cleaning up trace materials for the diff eq
     174                 :            :     void cleanTraceMaterial( tk::real t,
     175                 :            :                              const tk::Fields& geoElem,
     176                 :            :                              tk::Fields& unk,
     177                 :            :                              tk::Fields& prim,
     178                 :            :                              std::size_t nielem ) const
     179                 :      72480 :     { self->cleanTraceMaterial( t, geoElem, unk, prim, nielem ); }
     180                 :            : 
     181                 :            :     //! Public interface to reconstructing the second-order solution
     182                 :            :     void reconstruct( tk::real t,
     183                 :            :                       const tk::Fields& geoFace,
     184                 :            :                       const tk::Fields& geoElem,
     185                 :            :                       const inciter::FaceData& fd,
     186                 :            :                       const std::map< std::size_t, std::vector< std::size_t > >&
     187                 :            :                         esup,
     188                 :            :                       const std::vector< std::size_t >& inpoel,
     189                 :            :                       const tk::UnsMesh::Coords& coord,
     190                 :            :                       tk::Fields& U,
     191                 :            :                       tk::Fields& P ) const
     192                 :            :     {
     193                 :      44640 :       self->reconstruct( t, geoFace, geoElem, fd, esup, inpoel, coord, U, P );
     194                 :      44640 :     }
     195                 :            : 
     196                 :            :     //! Public interface to limiting the second-order solution
     197                 :            :     void limit( tk::real t,
     198                 :            :                 const tk::Fields& geoFace,
     199                 :            :                 const tk::Fields& geoElem,
     200                 :            :                 const inciter::FaceData& fd,
     201                 :            :                 const std::map< std::size_t, std::vector< std::size_t > >& esup,
     202                 :            :                 const std::vector< std::size_t >& inpoel,
     203                 :            :                 const tk::UnsMesh::Coords& coord,
     204                 :            :                 const std::vector< std::size_t >& ndofel,
     205                 :            :                 const std::vector< std::size_t >& gid,
     206                 :            :                 const std::unordered_map< std::size_t, std::size_t >& bid,
     207                 :            :                 const std::vector< std::vector<tk::real> >& uNodalExtrm,
     208                 :            :                 const std::vector< std::vector<tk::real> >& pNodalExtrm,
     209                 :            :                 const std::vector< std::vector<tk::real> >& mtInv,
     210                 :            :                 tk::Fields& U,
     211                 :            :                 tk::Fields& P,
     212                 :            :                 std::vector< std::size_t >& shockmarker ) const
     213                 :            :     {
     214                 :      44640 :       self->limit( t, geoFace, geoElem, fd, esup, inpoel, coord, ndofel, gid,
     215                 :      44640 :                    bid, uNodalExtrm, pNodalExtrm, mtInv, U, P, shockmarker );
     216                 :            :     }
     217                 :            : 
     218                 :            :     //! Public interface to update the conservative variable solution
     219                 :            :     void CPL( const tk::Fields& prim,
     220                 :            :               const tk::Fields& geoElem,
     221                 :            :               const std::vector< std::size_t >& inpoel,
     222                 :            :               const tk::UnsMesh::Coords& coord,
     223                 :            :               tk::Fields& unk,
     224                 :            :               std::size_t nielem ) const
     225                 :            :     {
     226                 :      40515 :       self->CPL( prim, geoElem, inpoel, coord, unk, nielem );
     227                 :      40515 :     }
     228                 :            : 
     229                 :            :     //! Public interface to getting the cell-averaged deformation gradients
     230                 :            :     std::array< std::vector< tk::real >, 9 > cellAvgDeformGrad(
     231                 :            :       const tk::Fields& U,
     232                 :            :       std::size_t nielem ) const
     233                 :            :     {
     234                 :            :       return self->cellAvgDeformGrad( U, nielem );
     235                 :            :     }
     236                 :            : 
     237                 :            :     //! Public interface to computing the P1 right-hand side vector
     238                 :            :     void rhs( tk::real t,
     239                 :            :               const tk::Fields& geoFace,
     240                 :            :               const tk::Fields& geoElem,
     241                 :            :               const inciter::FaceData& fd,
     242                 :            :               const std::vector< std::size_t >& inpoel,
     243                 :            :               const std::vector< std::unordered_set< std::size_t > >& boxelems,
     244                 :            :               const tk::UnsMesh::Coords& coord,
     245                 :            :               const tk::Fields& U,
     246                 :            :               const tk::Fields& P,
     247                 :            :               const std::vector< std::size_t >& ndofel,
     248                 :            :               const tk::real dt,
     249                 :            :               tk::Fields& R ) const
     250                 :            :     {
     251                 :      72480 :       self->rhs( t, geoFace, geoElem, fd, inpoel, boxelems, coord, U, P,
     252                 :      72480 :                  ndofel, dt, R );
     253                 :            :     }
     254                 :            : 
     255                 :            :     //! Evaluate the adaptive indicator and mark the ndof for each element
     256                 :            :     void eval_ndof( std::size_t nunk,
     257                 :            :                     const tk::UnsMesh::Coords& coord,
     258                 :            :                     const std::vector< std::size_t >& inpoel,
     259                 :            :                     const inciter::FaceData& fd,
     260                 :            :                     const tk::Fields& unk,
     261                 :            :                     const tk::Fields& prim,
     262                 :            :                     inciter::ctr::PrefIndicatorType indicator,
     263                 :            :                     std::size_t ndof,
     264                 :            :                     std::size_t ndofmax,
     265                 :            :                     tk::real tolref,
     266                 :            :                     std::vector< std::size_t >& ndofel ) const
     267                 :            :     {
     268                 :       1636 :       self->eval_ndof( nunk, coord, inpoel, fd, unk, prim, indicator, ndof,
     269                 :       1636 :         ndofmax, tolref, ndofel );
     270                 :       1636 :     }
     271                 :            : 
     272                 :            :     //! Public interface for computing the minimum time step size
     273                 :            :     tk::real dt( const std::array< std::vector< tk::real >, 3 >& coord,
     274                 :            :                  const std::vector< std::size_t >& inpoel,
     275                 :            :                  const inciter::FaceData& fd,
     276                 :            :                  const tk::Fields& geoFace,
     277                 :            :                  const tk::Fields& geoElem,
     278                 :            :                  const std::vector< std::size_t >& ndofel,
     279                 :            :                  const tk::Fields& U,
     280                 :            :                  const tk::Fields& P,
     281                 :            :                  const std::size_t nielem ) const
     282                 :       2405 :     { return self->dt( coord, inpoel, fd, geoFace, geoElem, ndofel, U,
     283                 :       2405 :                        P, nielem ); }
     284                 :            : 
     285                 :            :     //! Public interface to returning maps of output var functions
     286                 :            :     std::map< std::string, tk::GetVarFn > OutVarFn() const
     287 [ +  - ][ +  - ]:       4352 :     { return self->OutVarFn(); }
     288                 :            : 
     289                 :            :     //! Public interface to returning analytic field output labels
     290                 :            :     std::vector< std::string > analyticFieldNames() const
     291                 :       1640 :     { return self->analyticFieldNames(); }
     292                 :            : 
     293                 :            :     //! Public interface to returning time history field output labels
     294         [ -  - ]:          0 :     std::vector< std::string > histNames() const { return self->histNames(); }
     295                 :            : 
     296                 :            :     //! Public interface to returning variable names
     297                 :            :     std::vector< std::string > names() const { return self->names(); }
     298                 :            : 
     299                 :            :     //! Public interface to returning surface field output
     300                 :            :     std::vector< std::vector< tk::real > >
     301                 :            :     surfOutput( const std::map< int, std::vector< std::size_t > >& bnd,
     302                 :            :                 tk::Fields& U ) const
     303                 :            :     { return self->surfOutput( bnd, U ); }
     304                 :            : 
     305                 :            :     //! Public interface to return point history output
     306                 :            :     std::vector< std::vector< tk::real > >
     307                 :            :     histOutput( const std::vector< HistData >& h,
     308                 :            :       const std::vector< std::size_t >& inpoel,
     309                 :            :       const tk::UnsMesh::Coords& coord,
     310                 :            :       const tk::Fields& U,
     311                 :            :       const tk::Fields& P ) const
     312         [ -  - ]:          0 :     { return self->histOutput( h, inpoel, coord, U, P ); }
     313                 :            : 
     314                 :            :     //! Public interface to returning analytic solution
     315                 :            :     tk::InitializeFn::result_type
     316                 :            :     analyticSolution( tk::real xi, tk::real yi, tk::real zi, tk::real t ) const
     317                 :    1220990 :     { return self->analyticSolution( xi, yi, zi, t ); }
     318                 :            : 
     319                 :            :     //! Public interface to returning the analytic solution for conserved vars
     320                 :            :     tk::InitializeFn::result_type
     321                 :            :     solution( tk::real xi, tk::real yi, tk::real zi, tk::real t ) const
     322         [ +  - ]:    6460365 :     { return self->solution( xi, yi, zi, t ); }
     323                 :            : 
     324                 :            :     //! Public interface to returning the specific total energy
     325                 :            :     tk::real
     326                 :            :     sp_totalenergy( std::size_t e, const tk::Fields& unk ) const
     327         [ +  - ]:    3609011 :     { return self->sp_totalenergy( e, unk ); }
     328                 :            : 
     329                 :            :     //! Copy assignment
     330                 :            :     DGPDE& operator=( const DGPDE& x )
     331                 :            :     { DGPDE tmp(x); *this = std::move(tmp); return *this; }
     332                 :            :     //! Copy constructor
     333                 :            :     DGPDE( const DGPDE& x ) : self( x.self->copy() ) {}
     334                 :            :     //! Move assignment
     335                 :            :     DGPDE& operator=( DGPDE&& ) noexcept = default;
     336                 :            :     //! Move constructor
     337         [ -  - ]:          0 :     DGPDE( DGPDE&& ) noexcept = default;
     338                 :            : 
     339                 :            :   private:
     340                 :            :     //! \brief Concept is a pure virtual base class specifying the requirements
     341                 :            :     //!   of polymorphic objects deriving from it
     342                 :            :     struct Concept {
     343                 :            :       Concept() = default;
     344                 :          0 :       Concept( const Concept& ) = default;
     345                 :            :       virtual ~Concept() = default;
     346                 :            :       virtual Concept* copy() const = 0;
     347                 :            :       virtual std::size_t nprim() const = 0;
     348                 :            :       virtual std::size_t nmat() const = 0;
     349                 :            :       virtual void numEquationDofs(std::vector< std::size_t >&) const = 0;
     350                 :            :       virtual void IcBoxElems( const tk::Fields&,
     351                 :            :         std::size_t,
     352                 :            :         std::vector< std::unordered_set< std::size_t > >& ) const = 0;
     353                 :            :       virtual void initialize(
     354                 :            :         const tk::Fields&,
     355                 :            :         const std::vector< std::size_t >&,
     356                 :            :         const tk::UnsMesh::Coords&,
     357                 :            :         const std::vector< std::unordered_set< std::size_t > >&,
     358                 :            :         const std::unordered_map< std::size_t, std::set< std::size_t > >&,
     359                 :            :         tk::Fields&,
     360                 :            :         tk::real,
     361                 :            :         const std::size_t nielem ) const = 0;
     362                 :            :       virtual void lhs( const tk::Fields&, tk::Fields& ) const = 0;
     363                 :            :       virtual void updateInterfaceCells( tk::Fields&,
     364                 :            :                                          std::size_t,
     365                 :            :                                          std::vector< std::size_t >& ) const = 0;
     366                 :            :       virtual void updatePrimitives( const tk::Fields&,
     367                 :            :                                      const tk::Fields&,
     368                 :            :                                      const tk::Fields&,
     369                 :            :                                      tk::Fields&,
     370                 :            :                                      std::size_t ) const = 0;
     371                 :            :       virtual void cleanTraceMaterial( tk::real,
     372                 :            :                                        const tk::Fields&,
     373                 :            :                                        tk::Fields&,
     374                 :            :                                        tk::Fields&,
     375                 :            :                                        std::size_t ) const = 0;
     376                 :            :       virtual void reconstruct( tk::real,
     377                 :            :                                 const tk::Fields&,
     378                 :            :                                 const tk::Fields&,
     379                 :            :                                 const inciter::FaceData&,
     380                 :            :                                 const std::map< std::size_t,
     381                 :            :                                   std::vector< std::size_t > >&,
     382                 :            :                                 const std::vector< std::size_t >&,
     383                 :            :                                 const tk::UnsMesh::Coords&,
     384                 :            :                                 tk::Fields&,
     385                 :            :                                 tk::Fields& ) const = 0;
     386                 :            :       virtual void limit( tk::real,
     387                 :            :                           const tk::Fields&,
     388                 :            :                           const tk::Fields&,
     389                 :            :                           const inciter::FaceData&,
     390                 :            :                           const std::map< std::size_t,
     391                 :            :                             std::vector< std::size_t > >&,
     392                 :            :                           const std::vector< std::size_t >&,
     393                 :            :                           const tk::UnsMesh::Coords&,
     394                 :            :                           const std::vector< std::size_t >&,
     395                 :            :                           const std::vector< std::size_t >&,
     396                 :            :                           const std::unordered_map< std::size_t, std::size_t >&,
     397                 :            :                           const std::vector< std::vector<tk::real> >&,
     398                 :            :                           const std::vector< std::vector<tk::real> >&,
     399                 :            :                           const std::vector< std::vector<tk::real> >&,
     400                 :            :                           tk::Fields&,
     401                 :            :                           tk::Fields&,
     402                 :            :                           std::vector< std::size_t >& ) const = 0;
     403                 :            :       virtual void CPL( const tk::Fields&,
     404                 :            :                         const tk::Fields&,
     405                 :            :                         const std::vector< std::size_t >&,
     406                 :            :                         const tk::UnsMesh::Coords&,
     407                 :            :                         tk::Fields&,
     408                 :            :                         std::size_t ) const = 0;
     409                 :            :       virtual std::array< std::vector< tk::real >, 9 > cellAvgDeformGrad(
     410                 :            :         const tk::Fields&,
     411                 :            :         std::size_t ) const = 0;
     412                 :            :       virtual void rhs( tk::real,
     413                 :            :                         const tk::Fields&,
     414                 :            :                         const tk::Fields&,
     415                 :            :                         const inciter::FaceData&,
     416                 :            :                         const std::vector< std::size_t >&,
     417                 :            :                         const std::vector< std::unordered_set< std::size_t > >&,
     418                 :            :                         const tk::UnsMesh::Coords&,
     419                 :            :                         const tk::Fields&,
     420                 :            :                         const tk::Fields&,
     421                 :            :                         const std::vector< std::size_t >&,
     422                 :            :                         const tk::real,
     423                 :            :                         tk::Fields& ) const = 0;
     424                 :            :       virtual void eval_ndof( std::size_t,
     425                 :            :                               const tk::UnsMesh::Coords&,
     426                 :            :                               const std::vector< std::size_t >&,
     427                 :            :                               const inciter::FaceData&,
     428                 :            :                               const tk::Fields&,
     429                 :            :                               const tk::Fields&,
     430                 :            :                               inciter::ctr::PrefIndicatorType,
     431                 :            :                               std::size_t,
     432                 :            :                               std::size_t,
     433                 :            :                               tk::real,
     434                 :            :                               std::vector< std::size_t >& ) const = 0;
     435                 :            :       virtual tk::real dt( const std::array< std::vector< tk::real >, 3 >&,
     436                 :            :                            const std::vector< std::size_t >&,
     437                 :            :                            const inciter::FaceData&,
     438                 :            :                            const tk::Fields&,
     439                 :            :                            const tk::Fields&,
     440                 :            :                            const std::vector< std::size_t >&,
     441                 :            :                            const tk::Fields&,
     442                 :            :                            const tk::Fields&,
     443                 :            :                            const std::size_t ) const = 0;
     444                 :            :       virtual std::map< std::string, tk::GetVarFn > OutVarFn() const = 0;
     445                 :            :       virtual std::vector< std::string > analyticFieldNames() const = 0;
     446                 :            :       virtual std::vector< std::string > histNames() const = 0;
     447                 :            :       virtual std::vector< std::string > names() const = 0;
     448                 :            :       virtual std::vector< std::vector< tk::real > > surfOutput(
     449                 :            :         const std::map< int, std::vector< std::size_t > >&,
     450                 :            :         tk::Fields& ) const = 0;
     451                 :            :       virtual std::vector< std::vector< tk::real > > histOutput(
     452                 :            :         const std::vector< HistData >&,
     453                 :            :         const std::vector< std::size_t >&,
     454                 :            :         const tk::UnsMesh::Coords&,
     455                 :            :         const tk::Fields&,
     456                 :            :         const tk::Fields& ) const = 0;
     457                 :            :       virtual tk::InitializeFn::result_type analyticSolution(
     458                 :            :         tk::real xi, tk::real yi, tk::real zi, tk::real t ) const = 0;
     459                 :            :       virtual tk::InitializeFn::result_type solution(
     460                 :            :         tk::real xi, tk::real yi, tk::real zi, tk::real t ) const = 0;
     461                 :            :       virtual tk::real sp_totalenergy(
     462                 :            :         std::size_t, const tk::Fields& ) const = 0;
     463                 :            :     };
     464                 :            : 
     465                 :            :     //! \brief Model models the Concept above by deriving from it and overriding
     466                 :            :     //!   the virtual functions required by Concept
     467                 :            :     template< typename T >
     468 [ -  - ][ -  - ]:          0 :     struct Model : Concept {
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
     469                 :        398 :       explicit Model( T x ) : data( std::move(x) ) {}
     470                 :          0 :       Concept* copy() const override { return new Model( *this ); }
     471                 :        853 :       std::size_t nprim() const override
     472                 :        853 :       { return data.nprim(); }
     473                 :          0 :       std::size_t nmat() const override
     474                 :          0 :       { return data.nmat(); }
     475                 :        853 :       void numEquationDofs(std::vector< std::size_t >& numEqDof) const override
     476                 :        853 :       { data.numEquationDofs(numEqDof); }
     477                 :        853 :       void IcBoxElems( const tk::Fields& geoElem,
     478                 :            :         std::size_t nielem,
     479                 :            :         std::vector< std::unordered_set< std::size_t > >& inbox )
     480                 :        853 :       const override { data.IcBoxElems( geoElem, nielem, inbox ); }
     481                 :        985 :       void initialize(
     482                 :            :         const tk::Fields& L,
     483                 :            :         const std::vector< std::size_t >& inpoel,
     484                 :            :         const tk::UnsMesh::Coords& coord,
     485                 :            :         const std::vector< std::unordered_set< std::size_t > >& inbox,
     486                 :            :         const std::unordered_map< std::size_t, std::set< std::size_t > >&
     487                 :            :           elemblkid,
     488                 :            :         tk::Fields& unk,
     489                 :            :         tk::real t,
     490                 :            :         const std::size_t nielem )
     491                 :        985 :       const override { data.initialize( L, inpoel, coord, inbox, elemblkid, unk,
     492                 :        985 :         t, nielem ); }
     493                 :        985 :       void lhs( const tk::Fields& geoElem, tk::Fields& l ) const override
     494                 :        985 :       { data.lhs( geoElem, l ); }
     495                 :      72480 :       void updateInterfaceCells( tk::Fields& unk,
     496                 :            :                                  std::size_t nielem,
     497                 :            :                                  std::vector< std::size_t >& ndofel )
     498                 :      72480 :       const override { data.updateInterfaceCells( unk, nielem, ndofel ); }
     499                 :      73333 :       void updatePrimitives( const tk::Fields& unk,
     500                 :            :                              const tk::Fields& L,
     501                 :            :                              const tk::Fields& geoElem,
     502                 :            :                              tk::Fields& prim,
     503                 :            :                              std::size_t nielem )
     504                 :      73333 :       const override { data.updatePrimitives( unk, L, geoElem, prim, nielem ); }
     505                 :      72480 :       void cleanTraceMaterial( tk::real t,
     506                 :            :                                const tk::Fields& geoElem,
     507                 :            :                                tk::Fields& unk,
     508                 :            :                                tk::Fields& prim,
     509                 :            :                                std::size_t nielem )
     510                 :      72480 :       const override { data.cleanTraceMaterial( t, geoElem, unk, prim, nielem ); }
     511                 :      44640 :       void reconstruct( tk::real t,
     512                 :            :                         const tk::Fields& geoFace,
     513                 :            :                         const tk::Fields& geoElem,
     514                 :            :                         const inciter::FaceData& fd,
     515                 :            :                         const std::map< std::size_t,
     516                 :            :                           std::vector< std::size_t > >& esup,
     517                 :            :                         const std::vector< std::size_t >& inpoel,
     518                 :            :                         const tk::UnsMesh::Coords& coord,
     519                 :            :                         tk::Fields& U,
     520                 :            :                         tk::Fields& P ) const override
     521                 :            :       {
     522                 :      44640 :         data.reconstruct( t, geoFace, geoElem, fd, esup, inpoel, coord, U, P );
     523                 :      44640 :       }
     524                 :      44640 :       void limit( tk::real t,
     525                 :            :                   const tk::Fields& geoFace,
     526                 :            :                   const tk::Fields& geoElem,
     527                 :            :                   const inciter::FaceData& fd,
     528                 :            :                   const std::map< std::size_t, std::vector< std::size_t > >&
     529                 :            :                     esup,
     530                 :            :                   const std::vector< std::size_t >& inpoel,
     531                 :            :                   const tk::UnsMesh::Coords& coord,
     532                 :            :                   const std::vector< std::size_t >& ndofel,
     533                 :            :                   const std::vector< std::size_t >& gid,
     534                 :            :                   const std::unordered_map< std::size_t, std::size_t >& bid,
     535                 :            :                   const std::vector< std::vector<tk::real> >& uNodalExtrm,
     536                 :            :                   const std::vector< std::vector<tk::real> >& pNodalExtrm,
     537                 :            :                   const std::vector< std::vector<tk::real> >& mtInv,
     538                 :            :                   tk::Fields& U,
     539                 :            :                   tk::Fields& P,
     540                 :            :                   std::vector< std::size_t >& shockmarker ) const override
     541                 :            :       {
     542                 :      44640 :         data.limit( t, geoFace, geoElem, fd, esup, inpoel, coord, ndofel, gid,
     543                 :            :                     bid, uNodalExtrm, pNodalExtrm, mtInv, U, P, shockmarker );
     544                 :      44640 :       }
     545                 :      40515 :       void CPL( const tk::Fields& prim,
     546                 :            :                 const tk::Fields& geoElem,
     547                 :            :                 const std::vector< std::size_t >& inpoel,
     548                 :            :                 const tk::UnsMesh::Coords& coord,
     549                 :            :                 tk::Fields& unk,
     550                 :            :                 std::size_t nielem ) const override
     551                 :            :       {
     552                 :            :         data.CPL( prim, geoElem, inpoel, coord, unk, nielem );
     553                 :      40515 :       }
     554                 :          0 :       std::array< std::vector< tk::real >, 9 > cellAvgDeformGrad(
     555                 :            :         const tk::Fields& U,
     556                 :            :         std::size_t nielem ) const override
     557                 :            :       {
     558                 :          0 :         return data.cellAvgDeformGrad( U, nielem );
     559                 :            :       }
     560                 :      72480 :       void rhs(
     561                 :            :         tk::real t,
     562                 :            :         const tk::Fields& geoFace,
     563                 :            :         const tk::Fields& geoElem,
     564                 :            :         const inciter::FaceData& fd,
     565                 :            :         const std::vector< std::size_t >& inpoel,
     566                 :            :         const std::vector< std::unordered_set< std::size_t > >& boxelems,
     567                 :            :         const tk::UnsMesh::Coords& coord,
     568                 :            :         const tk::Fields& U,
     569                 :            :         const tk::Fields& P,
     570                 :            :         const std::vector< std::size_t >& ndofel,
     571                 :            :         const tk::real dt,
     572                 :            :         tk::Fields& R ) const override
     573                 :            :       {
     574                 :      72480 :         data.rhs( t, geoFace, geoElem, fd, inpoel, boxelems, coord, U, P,
     575                 :            :                   ndofel, dt, R );
     576                 :      72480 :       }
     577                 :       1636 :       void eval_ndof( std::size_t nunk,
     578                 :            :                       const tk::UnsMesh::Coords& coord,
     579                 :            :                       const std::vector< std::size_t >& inpoel,
     580                 :            :                       const inciter::FaceData& fd,
     581                 :            :                       const tk::Fields& unk,
     582                 :            :                       const tk::Fields& prim,
     583                 :            :                       inciter::ctr::PrefIndicatorType indicator,
     584                 :            :                       std::size_t ndof,
     585                 :            :                       std::size_t ndofmax,
     586                 :            :                       tk::real tolref,
     587                 :            :                       std::vector< std::size_t >& ndofel ) const override
     588                 :       1636 :       { data.eval_ndof( nunk, coord, inpoel, fd, unk, prim, indicator, ndof,
     589                 :       1636 :                         ndofmax, tolref, ndofel ); }
     590                 :       2405 :       tk::real dt( const std::array< std::vector< tk::real >, 3 >& coord,
     591                 :            :                    const std::vector< std::size_t >& inpoel,
     592                 :            :                    const inciter::FaceData& fd,
     593                 :            :                    const tk::Fields& geoFace,
     594                 :            :                    const tk::Fields& geoElem,
     595                 :            :                    const std::vector< std::size_t >& ndofel,
     596                 :            :                    const tk::Fields& U,
     597                 :            :                    const tk::Fields& P,
     598                 :            :                    const std::size_t nielem ) const override
     599                 :            :       { return data.dt( coord, inpoel, fd, geoFace, geoElem, ndofel,
     600                 :       2405 :                         U, P, nielem ); }
     601                 :       4352 :       std::map< std::string, tk::GetVarFn > OutVarFn() const override
     602                 :       4352 :       { return data.OutVarFn(); }
     603                 :       1640 :       std::vector< std::string > analyticFieldNames() const override
     604                 :       1640 :       { return data.analyticFieldNames(); }
     605                 :          0 :       std::vector< std::string > histNames() const override
     606                 :          0 :       { return data.histNames(); }
     607                 :         89 :       std::vector< std::string > names() const override
     608                 :         89 :       { return data.names(); }
     609                 :          0 :       std::vector< std::vector< tk::real > > surfOutput(
     610                 :            :         const std::map< int, std::vector< std::size_t > >& bnd,
     611                 :            :         tk::Fields& U ) const override
     612                 :          0 :       { return data.surfOutput( bnd, U ); }
     613                 :          0 :       std::vector< std::vector< tk::real > > histOutput(
     614                 :            :         const std::vector< HistData >& h,
     615                 :            :         const std::vector< std::size_t >& inpoel,
     616                 :            :         const tk::UnsMesh::Coords& coord,
     617                 :            :         const tk::Fields& U,
     618                 :            :         const tk::Fields& P ) const override
     619                 :          0 :       { return data.histOutput( h, inpoel, coord, U, P ); }
     620                 :            :       tk::InitializeFn::result_type
     621                 :    1220990 :       analyticSolution( tk::real xi, tk::real yi, tk::real zi, tk::real t )
     622                 :    1220990 :        const override { return data.analyticSolution( xi, yi, zi, t ); }
     623                 :            :       tk::InitializeFn::result_type
     624                 :    6460365 :       solution( tk::real xi, tk::real yi, tk::real zi, tk::real t )
     625                 :    6460365 :        const override { return data.solution( xi, yi, zi, t ); }
     626                 :    3609011 :       tk::real sp_totalenergy( std::size_t e, const tk::Fields& unk )
     627                 :    3609011 :        const override { return data.sp_totalenergy( e, unk ); }
     628                 :            :       T data;
     629                 :            :     };
     630                 :            : 
     631                 :            :     std::unique_ptr< Concept > self;    //!< Base pointer used polymorphically
     632                 :            : };
     633                 :            : 
     634                 :            : } // inciter::
     635                 :            : 
     636                 :            : #endif // DGPDE_h

Generated by: LCOV version 1.14