Quinoa all test code coverage report
Current view: top level - PDE - CGPDE.hpp (source / functions) Hit Total Coverage
Commit: -128-NOTFOUND Lines: 78 81 96.3 %
Date: 2024-04-29 14:42:33 Functions: 156 800 19.5 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 21 102 20.6 %

           Branch data     Line data    Source code
       1                 :            : // *****************************************************************************
       2                 :            : /*!
       3                 :            :   \file      src/PDE/CGPDE.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 continuous Galerkin PDEs
       9                 :            :   \details   This file defines a generic partial differential equation (PDE)
      10                 :            :     class for PDEs that use continuous 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 CGPDE_h
      20                 :            : #define CGPDE_h
      21                 :            : 
      22                 :            : #include <array>
      23                 :            : #include <string>
      24                 :            : #include <vector>
      25                 :            : #include <functional>
      26                 :            : #include <memory>
      27                 :            : #include <unordered_set>
      28                 :            : #include <unordered_map>
      29                 :            : 
      30                 :            : #include "Types.hpp"
      31                 :            : #include "Fields.hpp"
      32                 :            : #include "UnsMesh.hpp"
      33                 :            : #include "FunctionPrototypes.hpp"
      34                 :            : #include "Mesh/CommMap.hpp"
      35                 :            : #include "History.hpp"
      36                 :            : #include "Table.hpp"
      37                 :            : 
      38                 :            : namespace inciter {
      39                 :            : 
      40                 :            : namespace cg {
      41                 :            : 
      42                 :            : using ncomp_t = tk::ncomp_t;
      43                 :            : 
      44                 :            : //! \brief Evaluate the increment from t to t+dt of an analytical solution at
      45                 :            : //!   (x,y,z) for all components
      46                 :            : std::vector< tk::real >
      47                 :            : solinc( tk::ncomp_t ncomp, const std::vector< EOS >&, tk::real x, tk::real y,
      48                 :            :         tk::real z, tk::real t, tk::real dt, tk::InitializeFn solution );
      49                 :            : 
      50                 :            : //! Compute boundary point normals
      51                 :            : std::unordered_map< int,
      52                 :            :   std::unordered_map< std::size_t, std::array< tk::real, 4 > > >
      53                 :            : bnorm( const std::map< int, std::vector< std::size_t > >& bface,
      54                 :            :        const std::vector< std::size_t >& triinpoel,
      55                 :            :        const std::array< std::vector< tk::real >, 3 >& coord,
      56                 :            :        const std::vector< std::size_t >& gid,
      57                 :            :        const std::unordered_map< int,
      58                 :            :          std::unordered_set< std::size_t > >& bcnodes );
      59                 :            : 
      60                 :            : } // cg::
      61                 :            : 
      62                 :            : //! \brief Partial differential equation base for continuous Galerkin PDEs
      63                 :            : //! \details This class uses runtime polymorphism without client-side
      64                 :            : //!   inheritance: inheritance is confined to the internals of the this class,
      65                 :            : //!   invisible to client-code. The class exclusively deals with ownership
      66                 :            : //!   enabling client-side value semantics. Credit goes to Sean Parent at Adobe:
      67                 :            : //!   https://github.com/sean-parent/sean-parent.github.com/wiki/
      68                 :            : //!   Papers-and-Presentations. For example client code that models a CGPDE,
      69                 :            : //!   see inciter::CompFlow.
      70                 :        335 : class CGPDE {
      71                 :            : 
      72                 :            :   private:
      73                 :            :     using ncomp_t = tk::ncomp_t;
      74                 :            :     using real = tk::real;
      75                 :            : 
      76                 :            :   public:
      77                 :            :     //! Default constructor taking no arguments for Charm++
      78                 :            :     explicit CGPDE() = default;
      79                 :            : 
      80                 :            :     //! Constructor taking an object modeling Concept.
      81                 :            :     //! \details The object of class T comes pre-constructed.
      82                 :            :     //! \param[in] x Instantiated object of type T given by the template
      83                 :            :     //!   argument.
      84                 :            :     template< typename T > explicit CGPDE( T x ) :
      85                 :            :       self( std::make_unique< Model<T> >( std::move(x) ) ) {}
      86                 :            : 
      87                 :            :     //! \brief Constructor taking a function pointer to a constructor of an
      88                 :            :     //!   object modeling Concept.
      89                 :            :     //! \details Passing std::function allows late execution of the constructor,
      90                 :            :     //!   i.e., as late as inside this class' constructor, and thus usage from
      91                 :            :     //!   a factory. Note that there are at least two different ways of using
      92                 :            :     //!   this constructor:
      93                 :            :     //!   - Bind T's constructor arguments and place it in std::function<T()>
      94                 :            :     //!   and passing no arguments as args.... This case then instantiates the
      95                 :            :     //!   model via its constructor and stores it in here.
      96                 :            :     //!   - Bind a single placeholder argument to T's constructor and pass it in
      97                 :            :     //!   as host's args..., which then forwards it to model's constructor. This
      98                 :            :     //!   allows late binding, i.e., binding the argument only here.
      99                 :            :     //! \see See also the wrapper tk::recordModel() which does the former and
     100                 :            :     //!   tk::recordModelLate() which does the latter, both defined in
     101                 :            :     //!   src/Base/Factory.h.
     102                 :            :     //! \param[in] x Function pointer to a constructor of an object modeling
     103                 :            :     //!    Concept.
     104                 :            :     //! \param[in] args Zero or more constructor arguments
     105                 :            :     template< typename T, typename...Args >
     106         [ -  + ]:        326 :     explicit CGPDE( std::function<T(Args...)> x, Args&&... args ) :
     107                 :            :       self( std::make_unique< Model<T> >(
     108 [ +  - ][ -  + ]:        326 :               std::move( x( std::forward<Args>(args)... ) ) ) ) {}
     109                 :            : 
     110                 :            :     //! Public interface to determining which nodes are in IC box
     111                 :            :     void IcBoxNodes( const tk::UnsMesh::Coords& coord,
     112                 :            :       const std::vector< std::size_t >& inpoel,
     113                 :            :       const std::unordered_map< std::size_t, std::set< std::size_t > >& elemblkid,
     114                 :            :       std::vector< std::unordered_set< std::size_t > >& inbox,
     115                 :            :       std::unordered_map< std::size_t, std::set< std::size_t > >& nodeblkid,
     116                 :            :       std::size_t& nuserblk )
     117                 :        844 :     { self->IcBoxNodes( coord, inpoel, elemblkid, inbox, nodeblkid, nuserblk );
     118                 :            :     }
     119                 :            : 
     120                 :            :     //! Public interface to setting the initial conditions for the diff eq
     121                 :            :     void initialize(
     122                 :            :       const std::array< std::vector< real >, 3 >& coord,
     123                 :            :       tk::Fields& unk,
     124                 :            :       real t,
     125                 :            :       real V,
     126                 :            :       const std::vector< std::unordered_set< std::size_t > >& inbox,
     127                 :            :       const std::vector< tk::real >& blkvols,
     128                 :            :       const std::unordered_map< std::size_t, std::set< std::size_t > >&
     129                 :            :         nodeblkid )
     130 [ +  - ][ +  - ]:       1026 :     { self->initialize( coord, unk, t, V, inbox, blkvols, nodeblkid ); }
     131                 :            : 
     132                 :            :     //! Public interface to querying a velocity
     133                 :            :     void velocity( const tk::Fields& u, tk::UnsMesh::Coords& v ) const
     134         [ +  - ]:      43686 :     { self->velocity(u,v); }
     135                 :            : 
     136                 :            :     //! Public interface to querying a sound speed
     137                 :            :     void soundspeed( const tk::Fields& u, std::vector< tk::real >& s ) const
     138         [ +  - ]:      43686 :     { self->soundspeed(u,s); }
     139                 :            : 
     140                 :            :     //! Public interface to computing the nodal gradients for ALECG
     141                 :            :     void chBndGrad( const std::array< std::vector< real >, 3 >& coord,
     142                 :            :       const std::vector< std::size_t >& inpoel,
     143                 :            :       const std::vector< std::size_t >& bndel,
     144                 :            :       const std::vector< std::size_t >& gid,
     145                 :            :       const std::unordered_map< std::size_t, std::size_t >& bid,
     146                 :            :       const tk::Fields& U,
     147                 :            :       tk::Fields& G ) const
     148                 :      53337 :     { self->chBndGrad( coord, inpoel, bndel, gid, bid, U, G ); }
     149                 :            : 
     150                 :            :     //! Public interface to computing the right-hand side vector for ALECG
     151                 :            :     void rhs(
     152                 :            :       real t,
     153                 :            :       const std::array< std::vector< real >, 3 >& coord,
     154                 :            :       const std::vector< std::size_t >& inpoel,
     155                 :            :       const std::vector< std::size_t >& triinpoel,
     156                 :            :       const std::vector< std::size_t >& gid,
     157                 :            :       const std::unordered_map< std::size_t, std::size_t >& bid,
     158                 :            :       const std::unordered_map< std::size_t, std::size_t >& lid,
     159                 :            :       const std::vector< real >& dfn,
     160                 :            :       const std::pair< std::vector< std::size_t >,
     161                 :            :                        std::vector< std::size_t > >& psup,
     162                 :            :       const std::pair< std::vector< std::size_t >,
     163                 :            :                        std::vector< std::size_t > >& esup,
     164                 :            :       const std::vector< int >& symbctri,
     165                 :            :       const std::vector< real >& vol,
     166                 :            :       const std::vector< std::size_t >& edgenode,
     167                 :            :       const std::vector< std::size_t >& edgeid,
     168                 :            :       const std::vector< std::unordered_set< std::size_t > >& boxnodes,
     169                 :            :       const tk::Fields& G,
     170                 :            :       const tk::Fields& U,
     171                 :            :       const tk::Fields& W,
     172                 :            :       const std::vector< real >& tp,
     173                 :            :       real V,
     174                 :            :       tk::Fields& R ) const
     175                 :      53337 :     { self->rhs( t, coord, inpoel, triinpoel, gid, bid, lid, dfn, psup,
     176                 :            :         esup, symbctri, vol, edgenode, edgeid,
     177                 :      53337 :         boxnodes, G, U, W, tp, V, R ); }
     178                 :            : 
     179                 :            :     //! Public interface to compute the mesh velocity for OversetFE
     180                 :            :     void getMeshVel(
     181                 :            :       real t,
     182                 :            :       const std::array< std::vector< real >, 3 >& coord,
     183                 :            :       const std::pair< std::vector< std::size_t >,
     184                 :            :                        std::vector< std::size_t > >& psup,
     185                 :            :       const std::unordered_set< std::size_t >& symbcnodes,
     186                 :            :       const std::array< tk::real, 3 >& uservel,
     187                 :            :       const tk::Fields& U,
     188                 :            :       tk::Fields& meshvel,
     189                 :            :       int& movedmesh ) const
     190                 :       3396 :     { self->getMeshVel( t, coord, psup, symbcnodes, uservel, U, meshvel,
     191                 :       3396 :         movedmesh ); }
     192                 :            : 
     193                 :            :     //! Public interface for computing the minimum time step size
     194                 :            :     real dt( const std::array< std::vector< real >, 3 >& coord,
     195                 :            :              const std::vector< std::size_t >& inpoel,
     196                 :            :              tk::real t,
     197                 :            :              tk::real dtn,
     198                 :            :              const tk::Fields& U,
     199                 :            :              const std::vector< tk::real >& vol,
     200                 :            :              const std::vector< tk::real >& voln ) const
     201                 :       7489 :     { return self->dt( coord, inpoel, t, dtn, U, vol, voln ); }
     202                 :            : 
     203                 :            :     //! Public interface for computing a time step size for each mesh node
     204                 :            :     void dt( uint64_t it,
     205                 :            :              const std::vector< real >& vol,
     206                 :            :              const tk::Fields& U,
     207                 :            :              std::vector< real >& dtp ) const
     208                 :        200 :     { self->dt( it, vol, U, dtp ); }
     209                 :            : 
     210                 :            :     //! \brief Public interface for querying Dirichlet boundary condition values
     211                 :            :     //!  set by the user on a given side set for all components in a PDE system
     212                 :            :     std::map< std::size_t, std::vector< std::pair<bool,real> > >
     213                 :            :     dirbc( real t,
     214                 :            :            real deltat,
     215                 :            :            const std::vector< real >& tp,
     216                 :            :            const std::vector< real >& dtp,
     217                 :            :            const std::pair< const int, std::vector< std::size_t > >& sides,
     218                 :            :            const std::array< std::vector< real >, 3 >& coord,
     219                 :            :            bool increment ) const
     220         [ +  - ]:      73684 :     { return self->dirbc( t, deltat, tp, dtp, sides, coord, increment ); }
     221                 :            : 
     222                 :            :     //! Public interface to set symmetry boundary conditions at nodes
     223                 :            :     void
     224                 :            :     symbc( tk::Fields& U,
     225                 :            :            const std::array< std::vector< real >, 3 >& coord,
     226                 :            :            const std::unordered_map< int,
     227                 :            :                    std::unordered_map< std::size_t,
     228                 :            :                      std::array< real, 4 > > >& bnorm,
     229                 :            :            const std::unordered_set< std::size_t >& nodes ) const
     230         [ +  - ]:      62087 :     { self->symbc( U, coord, bnorm, nodes ); }
     231                 :            : 
     232                 :            :     //! Public interface to set farfield boundary conditions at nodes
     233                 :            :     void
     234                 :            :     farfieldbc( tk::Fields& U,
     235                 :            :                 const std::array< std::vector< real >, 3 >& coord,
     236                 :            :                 const std::unordered_map< int,
     237                 :            :                         std::unordered_map< std::size_t,
     238                 :            :                           std::array< real, 4 > > >& bnorm,
     239                 :            :                 const std::unordered_set< std::size_t >& nodes ) const
     240         [ +  - ]:      61478 :     { self->farfieldbc( U, coord, bnorm, nodes ); }
     241                 :            : 
     242                 :            :     //! Public interface to applying time dependent boundary conditions at nodes
     243                 :            :     void
     244                 :            :     timedepbc( tk::real t,
     245                 :            :       tk::Fields& U,
     246                 :            :       const std::vector< std::unordered_set< std::size_t > >& nodes,
     247                 :            :       const std::vector< tk::Table<5> >& timedepfn ) const
     248         [ +  - ]:      45114 :     { self->timedepbc( t, U, nodes, timedepfn ); }
     249                 :            : 
     250                 :            :     //! Public interface to returning maps of output var functions
     251                 :            :     std::map< std::string, tk::GetVarFn > OutVarFn() const
     252         [ +  - ]:       1507 :     { return self->OutVarFn(); }
     253                 :            : 
     254                 :            :     //! Public interface to returning analytic field output labels
     255                 :            :     std::vector< std::string > analyticFieldNames() const
     256                 :       1275 :     { return self->analyticFieldNames(); }
     257                 :            : 
     258                 :            :     //! Public interface to returning surface field output labels
     259         [ +  - ]:       1507 :     std::vector< std::string > surfNames() const { return self->surfNames(); }
     260                 :            : 
     261                 :            :     //! Public interface to returning time history field output labels
     262         [ +  - ]:         30 :     std::vector< std::string > histNames() const { return self->histNames(); }
     263                 :            : 
     264                 :            :     //! Public interface to returning variable names
     265                 :            :     std::vector< std::string > names() const { return self->names(); }
     266                 :            : 
     267                 :            :     //! Public interface to returning nodal surface field output
     268                 :            :     std::vector< std::vector< real > >
     269                 :            :     surfOutput( const std::map< int, std::vector< std::size_t > >& bnd,
     270                 :            :                 const tk::Fields& U ) const
     271         [ +  - ]:       1507 :     { return self->surfOutput( bnd, U ); }
     272                 :            : 
     273                 :            :     //! Public interface to returning elemental surface field output
     274                 :            :     std::vector< std::vector< real > >
     275                 :            :     elemSurfOutput( const std::map< int, std::vector< std::size_t > >& bface,
     276                 :            :       const std::vector< std::size_t >& triinpoel,
     277                 :            :       const tk::Fields& U ) const
     278         [ +  - ]:       1507 :     { return self->elemSurfOutput( bface, triinpoel, U ); }
     279                 :            : 
     280                 :            :     //! Public interface to returning time history output
     281                 :            :     std::vector< std::vector< real > >
     282                 :            :     histOutput( const std::vector< HistData >& h,
     283                 :            :                 const std::vector< std::size_t >& inpoel,
     284                 :            :                 const tk::Fields& U ) const
     285         [ +  - ]:        254 :     { return self->histOutput( h, inpoel, U ); }
     286                 :            : 
     287                 :            :     //! Public interface to returning analytic solution
     288                 :            :     tk::InitializeFn::result_type
     289                 :            :     analyticSolution( real xi, real yi, real zi, real t ) const
     290                 :     114817 :     { return self->analyticSolution( xi, yi, zi, t ); }
     291                 :            : 
     292                 :            :     //! Public interface to returning the analytic solution for conserved vars
     293                 :            :     tk::InitializeFn::result_type
     294                 :            :     solution( tk::real xi, tk::real yi, tk::real zi, tk::real t ) const
     295         [ +  - ]:    1520096 :     { return self->solution( xi, yi, zi, t ); }
     296                 :            : 
     297                 :            :     //! Copy assignment
     298                 :            :     CGPDE& operator=( const CGPDE& x )
     299                 :            :     { CGPDE tmp(x); *this = std::move(tmp); return *this; }
     300                 :            :     //! Copy constructor
     301                 :            :     CGPDE( const CGPDE& x ) : self( x.self->copy() ) {}
     302                 :            :     //! Move assignment
     303                 :            :     CGPDE& operator=( CGPDE&& ) noexcept = default;
     304                 :            :     //! Move constructor
     305         [ -  + ]:          9 :     CGPDE( CGPDE&& ) noexcept = default;
     306                 :            : 
     307                 :            :   private:
     308                 :            :     //! \brief Concept is a pure virtual base class specifying the requirements
     309                 :            :     //!   of polymorphic objects deriving from it
     310                 :            :     struct Concept {
     311                 :            :       Concept() = default;
     312                 :          0 :       Concept( const Concept& ) = default;
     313                 :            :       virtual ~Concept() = default;
     314                 :            :       virtual Concept* copy() const = 0;
     315                 :            :       virtual void IcBoxNodes( const tk::UnsMesh::Coords&,
     316                 :            :         const std::vector< std::size_t >&,
     317                 :            :         const std::unordered_map< std::size_t, std::set< std::size_t > >&,
     318                 :            :         std::vector< std::unordered_set< std::size_t > >&,
     319                 :            :         std::unordered_map< std::size_t, std::set< std::size_t > >&,
     320                 :            :         std::size_t& ) = 0;
     321                 :            :       virtual void initialize(
     322                 :            :         const std::array< std::vector< real >, 3 >&,
     323                 :            :         tk::Fields&,
     324                 :            :         real,
     325                 :            :         real,
     326                 :            :         const std::vector< std::unordered_set< std::size_t > >&,
     327                 :            :         const std::vector< tk::real >&,
     328                 :            :         const std::unordered_map< std::size_t, std::set< std::size_t > >& ) = 0;
     329                 :            :       virtual void velocity( const tk::Fields&, tk::UnsMesh::Coords& )
     330                 :            :         const = 0;
     331                 :            :       virtual void soundspeed( const tk::Fields&, std::vector< tk::real >& )
     332                 :            :         const = 0;
     333                 :            :       virtual void chBndGrad( const std::array< std::vector< real >, 3 >&,
     334                 :            :         const std::vector< std::size_t >&,
     335                 :            :         const std::vector< std::size_t >&,
     336                 :            :         const std::vector< std::size_t >&,
     337                 :            :         const std::unordered_map< std::size_t, std::size_t >&,
     338                 :            :         const tk::Fields&,
     339                 :            :         tk::Fields& ) const = 0;
     340                 :            :       virtual void rhs(
     341                 :            :         real,
     342                 :            :         const std::array< std::vector< real >, 3 >&,
     343                 :            :         const std::vector< std::size_t >&,
     344                 :            :         const std::vector< std::size_t >&,
     345                 :            :         const std::vector< std::size_t >&,
     346                 :            :         const std::unordered_map< std::size_t, std::size_t >&,
     347                 :            :         const std::unordered_map< std::size_t, std::size_t >&,
     348                 :            :         const std::vector< real >&,
     349                 :            :         const std::pair< std::vector< std::size_t >,
     350                 :            :                          std::vector< std::size_t > >&,
     351                 :            :         const std::pair< std::vector< std::size_t >,
     352                 :            :                          std::vector< std::size_t > >&,
     353                 :            :         const std::vector< int >&,
     354                 :            :         const std::vector< real >&,
     355                 :            :         const std::vector< std::size_t >&,
     356                 :            :         const std::vector< std::size_t >&,
     357                 :            :         const std::vector< std::unordered_set< std::size_t > >&,
     358                 :            :         const tk::Fields&,
     359                 :            :         const tk::Fields&,
     360                 :            :         const tk::Fields&,
     361                 :            :         const std::vector< real >&,
     362                 :            :         real,
     363                 :            :         tk::Fields& ) const = 0;
     364                 :            :       virtual void getMeshVel(
     365                 :            :         real,
     366                 :            :         const std::array< std::vector< real >, 3 >&,
     367                 :            :         const std::pair< std::vector< std::size_t >,
     368                 :            :                          std::vector< std::size_t > >&,
     369                 :            :         const std::unordered_set< std::size_t >&,
     370                 :            :         const std::array< tk::real, 3 >&,
     371                 :            :         const tk::Fields&,
     372                 :            :         tk::Fields&,
     373                 :            :         int& ) const = 0;
     374                 :            :       virtual real dt( const std::array< std::vector< real >, 3 >&,
     375                 :            :                        const std::vector< std::size_t >&,
     376                 :            :                        tk::real,
     377                 :            :                        tk::real,
     378                 :            :                        const tk::Fields&,
     379                 :            :                        const std::vector< tk::real >& ,
     380                 :            :                        const std::vector< tk::real >& ) const = 0;
     381                 :            :       virtual void dt( uint64_t,
     382                 :            :                        const std::vector< real > &,
     383                 :            :                        const tk::Fields&,
     384                 :            :                        std::vector< real >& ) const = 0;
     385                 :            :       virtual std::map< std::size_t, std::vector< std::pair<bool,real> > >
     386                 :            :       dirbc( real,
     387                 :            :              real,
     388                 :            :              const std::vector< real >&,
     389                 :            :              const std::vector< real >&,
     390                 :            :              const std::pair< const int, std::vector< std::size_t > >&,
     391                 :            :              const std::array< std::vector< real >, 3 >&,
     392                 :            :              bool ) const = 0;
     393                 :            :       virtual void symbc(
     394                 :            :         tk::Fields& U,
     395                 :            :         const std::array< std::vector< real >, 3 >&,
     396                 :            :         const std::unordered_map< int,
     397                 :            :                 std::unordered_map< std::size_t,
     398                 :            :                   std::array< real, 4 > > >&,
     399                 :            :         const std::unordered_set< std::size_t >& ) const = 0;
     400                 :            :       virtual void farfieldbc(
     401                 :            :         tk::Fields&,
     402                 :            :         const std::array< std::vector< real >, 3 >&,
     403                 :            :         const std::unordered_map< int,
     404                 :            :                 std::unordered_map< std::size_t,
     405                 :            :                   std::array< real, 4 > > >&,
     406                 :            :         const std::unordered_set< std::size_t >& ) const = 0;
     407                 :            :       virtual void timedepbc(
     408                 :            :         tk::real,
     409                 :            :         tk::Fields&,
     410                 :            :         const std::vector< std::unordered_set< std::size_t > >&,
     411                 :            :         const std::vector< tk::Table<5> >& ) const = 0;
     412                 :            :       virtual std::map< std::string, tk::GetVarFn > OutVarFn() const = 0;
     413                 :            :       virtual std::vector< std::string > analyticFieldNames() const = 0;
     414                 :            :       virtual std::vector< std::string > surfNames() const = 0;
     415                 :            :       virtual std::vector< std::string > histNames() const = 0;
     416                 :            :       virtual std::vector< std::string > names() const = 0;
     417                 :            :       virtual std::vector< std::vector< real > > surfOutput(
     418                 :            :         const std::map< int, std::vector< std::size_t > >&,
     419                 :            :         const tk::Fields& ) const = 0;
     420                 :            :       virtual std::vector< std::vector< real > > elemSurfOutput(
     421                 :            :         const std::map< int, std::vector< std::size_t > >&,
     422                 :            :         const std::vector< std::size_t >&,
     423                 :            :         const tk::Fields& ) const = 0;
     424                 :            :       virtual std::vector< std::vector< real > > histOutput(
     425                 :            :         const std::vector< HistData >&,
     426                 :            :         const std::vector< std::size_t >&,
     427                 :            :         const tk::Fields& ) const = 0;
     428                 :            :       virtual tk::InitializeFn::result_type analyticSolution(
     429                 :            :         real xi, real yi, real zi, real t ) const = 0;
     430                 :            :       virtual tk::InitializeFn::result_type solution(
     431                 :            :         tk::real xi, tk::real yi, tk::real zi, tk::real t ) const = 0;
     432                 :            :     };
     433                 :            : 
     434                 :            :     //! \brief Model models the Concept above by deriving from it and overriding
     435                 :            :     //!   the virtual functions required by Concept
     436                 :            :     template< typename T >
     437 [ -  - ][ -  - ]:          0 :     struct Model : Concept {
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
     438 [ -  - ][ -  - ]:        326 :       explicit Model( T x ) : data( std::move(x) ) {}
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ +  - ]
         [ +  - ][ -  - ]
     439                 :          0 :       Concept* copy() const override { return new Model( *this ); }
     440                 :        844 :       void IcBoxNodes( const tk::UnsMesh::Coords& coord,
     441                 :            :         const std::vector< std::size_t >& inpoel,
     442                 :            :         const std::unordered_map< std::size_t, std::set< std::size_t > >& elemblkid,
     443                 :            :         std::vector< std::unordered_set< std::size_t > >& inbox,
     444                 :            :         std::unordered_map< std::size_t, std::set< std::size_t > >& nodeblkid,
     445                 :            :         std::size_t& nuserblk )
     446                 :        154 :       override { data.IcBoxNodes( coord, inpoel, elemblkid, inbox, nodeblkid,
     447                 :        844 :         nuserblk ); }
     448                 :       1026 :       void initialize(
     449                 :            :         const std::array< std::vector< real >, 3 >& coord,
     450                 :            :         tk::Fields& unk,
     451                 :            :         real t,
     452                 :            :         real V,
     453                 :            :         const std::vector< std::unordered_set< std::size_t > >& inbox,
     454                 :            :         const std::vector< tk::real >& blkvols,
     455                 :            :         const std::unordered_map< std::size_t, std::set< std::size_t > >&
     456                 :            :           nodeblkid)
     457                 :       1026 :       override { data.initialize( coord, unk, t, V, inbox, blkvols, nodeblkid ); }
     458                 :      43686 :       void velocity( const tk::Fields& u, tk::UnsMesh::Coords& v ) const
     459                 :      43686 :       override { data.velocity(u,v); }
     460                 :      43686 :       void soundspeed( const tk::Fields& u, std::vector< tk::real >& s ) const
     461                 :      43686 :       override { data.soundspeed(u,s); }
     462                 :      53337 :       void chBndGrad( const std::array< std::vector< real >, 3 >& coord,
     463                 :            :         const std::vector< std::size_t >& inpoel,
     464                 :            :         const std::vector< std::size_t >& bndel,
     465                 :            :         const std::vector< std::size_t >& gid,
     466                 :            :         const std::unordered_map< std::size_t, std::size_t >& bid,
     467                 :            :         const tk::Fields& U,
     468                 :            :         tk::Fields& G ) const override
     469                 :      53337 :       { data.chBndGrad( coord, inpoel, bndel, gid, bid, U, G ); }
     470                 :      53337 :       void rhs(
     471                 :            :         real t,
     472                 :            :         const std::array< std::vector< real >, 3 >& coord,
     473                 :            :         const std::vector< std::size_t >& inpoel,
     474                 :            :         const std::vector< std::size_t >& triinpoel,
     475                 :            :         const std::vector< std::size_t >& gid,
     476                 :            :         const std::unordered_map< std::size_t, std::size_t >& bid,
     477                 :            :         const std::unordered_map< std::size_t, std::size_t >& lid,
     478                 :            :         const std::vector< real >& dfn,
     479                 :            :         const std::pair< std::vector< std::size_t >,
     480                 :            :                          std::vector< std::size_t > >& psup,
     481                 :            :         const std::pair< std::vector< std::size_t >,
     482                 :            :                          std::vector< std::size_t > >& esup,
     483                 :            :         const std::vector< int >& symbctri,
     484                 :            :         const std::vector< real >& vol,
     485                 :            :         const std::vector< std::size_t >& edgenode,
     486                 :            :         const std::vector< std::size_t >& edgeid,
     487                 :            :         const std::vector< std::unordered_set< std::size_t > >& boxnodes,
     488                 :            :         const tk::Fields& G,
     489                 :            :         const tk::Fields& U,
     490                 :            :         const tk::Fields& W,
     491                 :            :         const std::vector< real >& tp,
     492                 :            :         real V,
     493                 :            :         tk::Fields& R ) const override
     494                 :      53337 :       { data.rhs( t, coord, inpoel, triinpoel, gid, bid, lid, dfn, psup,
     495                 :            :                   esup, symbctri, vol, edgenode,
     496                 :      53337 :                   edgeid, boxnodes, G, U, W, tp, V, R ); }
     497                 :       3396 :       void getMeshVel(
     498                 :            :         real t,
     499                 :            :         const std::array< std::vector< real >, 3 >& coord,
     500                 :            :         const std::pair< std::vector< std::size_t >,
     501                 :            :                          std::vector< std::size_t > >& psup,
     502                 :            :         const std::unordered_set< std::size_t >& symbcnodes,
     503                 :            :         const std::array< tk::real, 3 >& uservel,
     504                 :            :         const tk::Fields& U,
     505                 :            :         tk::Fields& meshvel,
     506                 :            :         int& movedmesh ) const override
     507                 :        476 :       { data.getMeshVel( t, coord, psup, symbcnodes, uservel, U, meshvel,
     508                 :       3396 :           movedmesh ); }
     509                 :       7489 :       real dt( const std::array< std::vector< real >, 3 >& coord,
     510                 :            :                const std::vector< std::size_t >& inpoel,
     511                 :            :                tk::real t,
     512                 :            :                tk::real dtn,
     513                 :            :                const tk::Fields& U,
     514                 :            :                const std::vector< tk::real >& vol,
     515                 :            :                const std::vector< tk::real >& voln ) const override
     516                 :       7489 :       { return data.dt( coord, inpoel, t, dtn, U, vol, voln ); }
     517                 :        200 :       void dt( uint64_t it,
     518                 :            :                const std::vector< real > & vol,
     519                 :            :                const tk::Fields& U,
     520                 :            :                std::vector< real >& dtp ) const override
     521                 :        200 :       { data.dt( it, vol, U, dtp ); }
     522                 :            :       std::map< std::size_t, std::vector< std::pair<bool,real> > >
     523                 :      73684 :       dirbc( real t,
     524                 :            :              real deltat,
     525                 :            :              const std::vector< real >& tp,
     526                 :            :              const std::vector< real >& dtp,
     527                 :            :              const std::pair< const int, std::vector< std::size_t > >& sides,
     528                 :            :              const std::array< std::vector< real >, 3 >& coord,
     529                 :            :              bool increment ) const
     530                 :            :         override { return data.dirbc( t, deltat, tp, dtp, sides, coord,
     531                 :      73684 :                                       increment ); }
     532                 :      62087 :       void symbc(
     533                 :            :         tk::Fields& U,
     534                 :            :         const std::array< std::vector< real >, 3 >& coord,
     535                 :            :         const std::unordered_map< int,
     536                 :            :                 std::unordered_map< std::size_t,
     537                 :            :                   std::array< real, 4 > > >& bnorm,
     538                 :            :         const std::unordered_set< std::size_t >& nodes ) const override
     539                 :      62087 :       { data.symbc( U, coord, bnorm, nodes ); }
     540                 :      61478 :       void farfieldbc(
     541                 :            :         tk::Fields& U,
     542                 :            :         const std::array< std::vector< real >, 3 >& coord,
     543                 :            :         const std::unordered_map< int,
     544                 :            :                 std::unordered_map< std::size_t,
     545                 :            :                   std::array< real, 4 > > >& bnorm,
     546                 :            :         const std::unordered_set< std::size_t >& nodes ) const override
     547                 :      61478 :       { data.farfieldbc( U, coord, bnorm, nodes ); }
     548                 :            :       void
     549                 :      45114 :       timedepbc(
     550                 :            :         tk::real t,
     551                 :            :         tk::Fields& U,
     552                 :            :         const std::vector< std::unordered_set< std::size_t > >& nodes,
     553                 :            :         const std::vector< tk::Table<5> >& timedepfn ) const override
     554                 :      45114 :       { data.timedepbc( t, U, nodes, timedepfn ); }
     555                 :       1507 :       std::map< std::string, tk::GetVarFn > OutVarFn() const override
     556                 :       1507 :       { return data.OutVarFn(); }
     557                 :       1275 :       std::vector< std::string > analyticFieldNames() const override
     558                 :       1275 :       { return data.analyticFieldNames(); }
     559                 :       1507 :       std::vector< std::string > surfNames() const override
     560                 :       1507 :       { return data.surfNames(); }
     561                 :         30 :       std::vector< std::string > histNames() const override
     562                 :         30 :       { return data.histNames(); }
     563                 :         90 :       std::vector< std::string > names() const override
     564                 :         90 :       { return data.names(); }
     565                 :       1507 :       std::vector< std::vector< real > > surfOutput(
     566                 :            :         const std::map< int, std::vector< std::size_t > >& bnd,
     567                 :            :         const tk::Fields& U ) const override
     568                 :       1507 :       { return data.surfOutput( bnd, U ); }
     569                 :       1507 :       std::vector< std::vector< real > > elemSurfOutput(
     570                 :            :         const std::map< int, std::vector< std::size_t > >& bface,
     571                 :            :         const std::vector< std::size_t >& triinpoel,
     572                 :            :         const tk::Fields& U ) const override
     573                 :       1507 :       { return data.elemSurfOutput( bface, triinpoel, U ); }
     574                 :        254 :       std::vector< std::vector< real > > histOutput(
     575                 :            :         const std::vector< HistData >& h,
     576                 :            :         const std::vector< std::size_t >& inpoel,
     577                 :            :         const tk::Fields& U ) const override
     578                 :        254 :       { return data.histOutput( h, inpoel, U ); }
     579                 :            :       tk::InitializeFn::result_type
     580                 :     114817 :       analyticSolution( real xi, real yi, real zi, real t )
     581                 :     114817 :        const override { return data.analyticSolution( xi, yi, zi, t ); }
     582                 :            :       tk::InitializeFn::result_type
     583                 :    1520096 :       solution( real xi, real yi, real zi, real t )
     584                 :    1520096 :        const override { return data.solution( xi, yi, zi, t ); }
     585                 :            :       T data;
     586                 :            :     };
     587                 :            : 
     588                 :            :     std::unique_ptr< Concept > self;    //!< Base pointer used polymorphically
     589                 :            : };
     590                 :            : 
     591                 :            : } // inciter::
     592                 :            : 
     593                 :            : #endif // CGPDE_h

Generated by: LCOV version 1.14