LCOV - code coverage report
Current view: top level - include/kokkos/base - KokkosDatum.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #33416 (b10b36) with base 9fbd27 Lines: 125 128 97.7 %
Date: 2026-07-23 16:15:30 Functions: 46 46 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //* This file is part of the MOOSE framework
       2             : //* https://www.mooseframework.org
       3             : //*
       4             : //* All rights reserved, see COPYRIGHT for full restrictions
       5             : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
       6             : //*
       7             : //* Licensed under LGPL 2.1, please see LICENSE for details
       8             : //* https://www.gnu.org/licenses/lgpl-2.1.html
       9             : 
      10             : #pragma once
      11             : 
      12             : #include "KokkosTypes.h"
      13             : #include "KokkosAssembly.h"
      14             : #include "KokkosFESystem.h"
      15             : #include "KokkosVariable.h"
      16             : 
      17             : namespace Moose::Kokkos
      18             : {
      19             : 
      20             : /**
      21             :  * Generic datum class containing geometric information related to the mesh. This is a base class
      22             :  * for derived datum classes for both finite volume and finite element system assembly.
      23             :  */
      24             : class MeshDatum
      25             : {
      26             : public:
      27             :   /**
      28             :    * Constructor
      29             :    * @param elem The contiguous element ID
      30             :    * @param side The element side index, or \p libMesh::invalid_uint for element-only data
      31             :    * @param mesh The Kokkos mesh
      32             :    */
      33             :   KOKKOS_FUNCTION
      34             :   MeshDatum(ContiguousElementID elem, const unsigned int side, const Mesh & mesh);
      35             : 
      36             :   /**
      37             :    * Get the Kokkos mesh
      38             :    * @returns The Kokkos mesh
      39             :    */
      40             :   KOKKOS_FUNCTION const Mesh & mesh() const { return _mesh; }
      41             : 
      42             :   /**
      43             :    * Get the element information object
      44             :    * @returns The element information object
      45             :    */
      46   296450413 :   KOKKOS_FUNCTION const ElementInfo & elem() const { return _elem; }
      47             : 
      48             :   /**
      49             :    * Get the contiguous element ID
      50             :    * @returns The contiguous element ID
      51             :    */
      52      307272 :   KOKKOS_FUNCTION ContiguousElementID elemID() const { return _elem.id; }
      53             : 
      54             :   /**
      55             :    * Get whether the current side has a neighbor
      56             :    * @returns Whether the current side has a neighbor
      57             :    */
      58             :   KOKKOS_FUNCTION bool hasNeighbor() const;
      59             : 
      60             :   /**
      61             :    * Get the neighbor element information object
      62             :    * @returns The neighbor element information object. If there is no neighbor or if this datum is
      63             :    * not meant to represent face data, then this will point to a default constructed \p ElementInfo
      64             :    * whose data members represent invalid state (e.g. hold \p invalid_uint, \p invalid_id like
      65             :    * values)
      66             :    */
      67             :   KOKKOS_FUNCTION const ElementInfo & neighbor() const { return _neighbor; }
      68             : 
      69             :   /**
      70             :    * Get the contiguous neighbor element ID
      71             :    * @returns The contiguous neighbor element ID or \p libMesh::DofObject::invalid_id
      72             :    */
      73       39858 :   KOKKOS_FUNCTION ContiguousElementID neighborID() const { return _neighbor.id; }
      74             : 
      75             :   /**
      76             :    * Get the side index
      77             :    * @returns The side index
      78             :    */
      79   267066642 :   KOKKOS_FUNCTION unsigned int side() const { return _side; }
      80             : 
      81             :   /**
      82             :    * Get whether the current datum is on a side
      83             :    * @returns Whether the current datum is on a side
      84             :    */
      85    57899617 :   KOKKOS_FUNCTION bool isSide() const { return _side != libMesh::invalid_uint; }
      86             : 
      87             :   /**
      88             :    * Get the contiguous subdomain ID
      89             :    * @returns The contiguous subdomain ID
      90             :    */
      91    80699770 :   KOKKOS_FUNCTION ContiguousSubdomainID subdomain() const { return _elem.subdomain; }
      92             : 
      93             :   /**
      94             :    * Get the contiguous neighbor subdomain ID
      95             :    * @returns The contiguous neighbor subdomain ID
      96             :    */
      97             :   KOKKOS_FUNCTION ContiguousSubdomainID neighborSubdomain() const { return _neighbor.subdomain; }
      98             : 
      99             : protected:
     100             :   /**
     101             :    * Get the neighbor element information object for an element side
     102             :    * @param elem The contiguous element ID
     103             :    * @param side The side index
     104             :    * @param mesh The Kokkos mesh
     105             :    * @returns The neighbor element information object, or a default \p ElementInfo (a default
     106             :    *          constructed \p ElementInfo's data members all represent invalid state) when \p elem is
     107             :    *          \p libMesh::DofObject::invalid_id, \p side is \p libMesh::invalid_uint, or the Kokkos
     108             :    *          mesh has no contiguous neighbor ID for the side. The latter includes exterior
     109             :    *          boundary sides with no libMesh neighbor and sides whose libMesh neighbor is
     110             :    *          \p libMesh::remote_elem. Off-process neighbors present as ghost elements have
     111             :    *          contiguous IDs and return their \p ElementInfo.
     112             :    */
     113             :   static KOKKOS_FUNCTION ElementInfo neighborInfo(ContiguousElementID elem,
     114             :                                                   const unsigned int side,
     115             :                                                   const Mesh & mesh);
     116             : 
     117             :   /**
     118             :    * Reference to the Kokkos mesh
     119             :    */
     120             :   const Mesh & _mesh;
     121             : 
     122             :   /**
     123             :    * Current element information object
     124             :    */
     125             :   const ElementInfo _elem;
     126             : 
     127             :   /**
     128             :    * Current side index
     129             :    */
     130             :   const unsigned int _side = libMesh::invalid_uint;
     131             : 
     132             :   /**
     133             :    * Current neighbor element information object
     134             :    */
     135             :   const ElementInfo _neighbor;
     136             : };
     137             : 
     138    10671301 : KOKKOS_FUNCTION inline MeshDatum::MeshDatum(ContiguousElementID elem,
     139             :                                             const unsigned int side,
     140    10671301 :                                             const Mesh & mesh)
     141    10671301 :   : _mesh(mesh),
     142    10671301 :     _elem(elem != libMesh::DofObject::invalid_id ? _mesh.getElementInfo(elem) : ElementInfo{}),
     143    10671301 :     _side(side),
     144    10671301 :     _neighbor(neighborInfo(_elem.id, _side, _mesh))
     145             : {
     146    10671301 : }
     147             : 
     148             : KOKKOS_FUNCTION inline bool
     149             : MeshDatum::hasNeighbor() const
     150             : {
     151             :   return _neighbor.id != libMesh::DofObject::invalid_id;
     152             : }
     153             : 
     154             : KOKKOS_FUNCTION inline ElementInfo
     155    10671301 : MeshDatum::neighborInfo(ContiguousElementID elem, const unsigned int side, const Mesh & mesh)
     156             : {
     157    10671301 :   if (elem == libMesh::DofObject::invalid_id || side == libMesh::invalid_uint)
     158    10407861 :     return {};
     159             : 
     160      263440 :   const auto neighbor = mesh.getNeighbor(elem, side);
     161      263440 :   return neighbor == libMesh::DofObject::invalid_id ? ElementInfo{} : mesh.getElementInfo(neighbor);
     162             : }
     163             : 
     164             : /**
     165             :  * Device-side geometric context for finite volume kernels and boundary conditions.
     166             :  */
     167             : class FVDatum : public MeshDatum
     168             : {
     169             : public:
     170             :   /**
     171             :    * Constructor
     172             :    * @param elem The contiguous element ID
     173             :    * @param side The element side index, or \p libMesh::invalid_uint for element-only data
     174             :    * @param mesh The Kokkos mesh
     175             :    */
     176             :   KOKKOS_FUNCTION
     177             :   FVDatum(ContiguousElementID elem, const unsigned int side, const Mesh & mesh);
     178             : 
     179             :   /**
     180             :    * Get the centroid of the current element side
     181             :    * @pre This datum represents a valid side of a locally owned element.
     182             :    * @returns The side centroid
     183             :    */
     184       82478 :   KOKKOS_FUNCTION Real3 faceCentroid() const { return _mesh.getSideCentroid(_elem.id, _side); }
     185             : 
     186             :   /**
     187             :    * Get the outward unit normal of the current element side
     188             :    * @pre This datum represents a valid side of a locally owned element.
     189             :    * @returns The side normal
     190             :    */
     191        2032 :   KOKKOS_FUNCTION Real3 faceNormal() const { return _mesh.getSideNormal(_elem.id, _side); }
     192             : 
     193             :   /**
     194             :    * Get the distance from the current element centroid to its neighbor centroid
     195             :    * @pre This datum represents a side of a locally owned element with a neighbor.
     196             :    * @returns The element-centroid to neighbor-centroid distance
     197             :    */
     198       77740 :   KOKKOS_FUNCTION Real faceDCNMag() const
     199             :   {
     200       77740 :     return _mesh.getElementCentroidToNeighborCentroidDistance(_elem.id, _side);
     201             :   }
     202             : 
     203             :   /**
     204             :    * Get the distance from the current element centroid to the current side centroid
     205             :    * @pre This datum represents a valid side of a locally owned element.
     206             :    * @returns The element-centroid to side-centroid distance
     207             :    */
     208        1074 :   KOKKOS_FUNCTION Real faceDCFMag() const
     209             :   {
     210        1074 :     return _mesh.getElementCentroidToSideCentroidDistance(_elem.id, _side);
     211             :   }
     212             : 
     213             :   /**
     214             :    * Get the coordinate-weighted area of the current element side
     215             :    * @pre This datum represents a valid side of a locally owned element.
     216             :    * @returns The side area including the coordinate transformation factor
     217             :    */
     218       81924 :   KOKKOS_FUNCTION Real faceArea() const { return _mesh.getSideArea(_elem.id, _side); }
     219             : 
     220             :   /**
     221             :    * Get the current element centroid
     222             :    * @pre The current element is locally owned.
     223             :    * @returns The element centroid
     224             :    */
     225       10610 :   KOKKOS_FUNCTION Real3 elementCentroid() const { return _mesh.getElementCentroid(_elem.id); }
     226             : 
     227             :   /**
     228             :    * Get the coordinate-weighted current element volume
     229             :    * @pre The current element is locally owned.
     230             :    * @returns The element volume including the coordinate transformation factor
     231             :    */
     232       10610 :   KOKKOS_FUNCTION Real elementVolume() const { return _mesh.getElementVolume(_elem.id); }
     233             : };
     234             : 
     235       55262 : KOKKOS_FUNCTION inline FVDatum::FVDatum(ContiguousElementID elem,
     236             :                                         const unsigned int side,
     237       55262 :                                         const Mesh & mesh)
     238       55262 :   : MeshDatum(elem, side, mesh)
     239             : {
     240       55262 : }
     241             : 
     242             : /**
     243             :  * The Kokkos object that holds thread-private data in the parallel operations of any Kokkos object
     244             :  */
     245             : class Datum : public MeshDatum
     246             : {
     247             : public:
     248             :   /**
     249             :    * Constructor for element and side data
     250             :    * @param elem The contiguous element ID of the current thread
     251             :    * @param side The side index of the current thread
     252             :    * @param assembly The Kokkos assembly
     253             :    * @param systems The Kokkos systems
     254             :    */
     255             :   KOKKOS_FUNCTION
     256             :   Datum(const ContiguousElementID elem,
     257             :         const unsigned int side,
     258             :         const Assembly & assembly,
     259             :         const Array<FESystem> & systems);
     260             : 
     261             :   /**
     262             :    * Constructor for node data
     263             :    * @param node The contiguous node ID of the current thread
     264             :    * @param assembly The Kokkos assembly
     265             :    * @param systems The Kokkos systems
     266             :    */
     267             :   KOKKOS_FUNCTION
     268             :   Datum(const ContiguousNodeID node, const Assembly & assembly, const Array<FESystem> & systems);
     269             : 
     270             :   /**
     271             :    * Get the Kokkos assembly
     272             :    * @returns The Kokkos assembly
     273             :    */
     274   211538980 :   KOKKOS_FUNCTION const Assembly & assembly() const { return _assembly; }
     275             : 
     276             :   /**
     277             :    * Get the Kokkos system
     278             :    * @param sys The system number
     279             :    * @returns The Kokkos system
     280             :    */
     281    59883408 :   KOKKOS_FUNCTION const FESystem & system(unsigned int sys) const { return _systems[sys]; }
     282             : 
     283             :   /**
     284             :    * Get the extra element ID
     285             :    * @param index The extra element ID index
     286             :    * @returns The extra element ID
     287             :    */
     288         500 :   KOKKOS_FUNCTION dof_id_type extraElemID(unsigned int index) const
     289             :   {
     290         500 :     return isNodal() ? libMesh::DofObject::invalid_id : _mesh.getExtraElementID(_elem.id, index);
     291             :   }
     292             : 
     293             :   /**
     294             :    * Get the contiguous node ID
     295             :    * @returns The contiguous node ID
     296             :    */
     297     5719278 :   KOKKOS_FUNCTION ContiguousNodeID node() const { return _node; }
     298             : 
     299             :   /**
     300             :    * Get the number of local quadrature points
     301             :    * @returns The number of local quadrature points
     302             :    */
     303    45732082 :   KOKKOS_FUNCTION unsigned int n_qps() const { return _n_qps; }
     304             : 
     305             :   /**
     306             :    * Get the starting offset into the global quadrature point index
     307             :    * @returns The starting offset
     308             :    */
     309    55290564 :   KOKKOS_FUNCTION dof_id_type qpOffset() const { return _qp_offset; }
     310             : 
     311             :   /**
     312             :    * Get the index into the property data storage
     313             :    * @param constant_option The property constant option
     314             :    * @param qp The local quadrature point index
     315             :    * @returns The index
     316             :    */
     317             :   KOKKOS_FUNCTION dof_id_type propertyIdx(const PropertyConstantOption constant_option,
     318             :                                           const unsigned int qp) const;
     319             : 
     320             :   /**
     321             :    * Get whether the current datum is on a node
     322             :    * @returns Whether the current datum is on a node
     323             :    */
     324   211060044 :   KOKKOS_FUNCTION bool isNodal() const { return _node != libMesh::DofObject::invalid_id; }
     325             : 
     326             :   /**
     327             :    * Get whether the a variable is defined on the current node
     328             :    * @param var The variable
     329             :    * @returns Whether the variable is defined on the current node
     330             :    */
     331             :   KOKKOS_FUNCTION bool isNodalDefined(const Variable & var) const;
     332             : 
     333             :   /**
     334             :    * Get the inverse of Jacobian matrix
     335             :    * | dxi/dx deta/dx dzeta/dx |
     336             :    * | dxi/dy deta/dy dzeta/dy |
     337             :    * | dxi/dz deta/dz dzeta/dz |
     338             :    * @param qp The local quadrature point index
     339             :    * @returns The Jacobian matrix
     340             :    */
     341             :   KOKKOS_FUNCTION const Real33 & J(const unsigned int qp);
     342             : 
     343             :   /**
     344             :    * Get the transformed Jacobian weight
     345             :    * @param qp The local quadrature point index
     346             :    * @returns The transformed Jacobian weights
     347             :    */
     348             :   KOKKOS_FUNCTION Real JxW(const unsigned int qp);
     349             : 
     350             :   /**
     351             :    * Get the physical quadrature point coordinate
     352             :    * @param qp The local quadrature point index
     353             :    * @returns The physical quadrature point coordinate
     354             :    */
     355             :   KOKKOS_FUNCTION Real3 q_point(const unsigned int qp);
     356             : 
     357             :   /**
     358             :    * Get the normal vector on surface
     359             :    * @param qp The local quadrature point index
     360             :    * @returns The normal vector
     361             :    */
     362             :   KOKKOS_FUNCTION Real3 normals(const unsigned int qp);
     363             : 
     364             :   /**
     365             :    * Set local parallelization option
     366             :    * @param local_thread_id The current local thread ID
     367             :    * @param num_local_threads The number of local threads
     368             :    */
     369     5193983 :   KOKKOS_FUNCTION void set_local_parallel(const unsigned int local_thread_id,
     370             :                                           const unsigned int num_local_threads)
     371             :   {
     372     5193983 :     _local_thread_id = local_thread_id;
     373     5193983 :     _num_local_threads = num_local_threads;
     374     5193983 :   }
     375             :   /**
     376             :    * Get the current local thread ID
     377             :    * @returns The current local thread ID
     378             :    */
     379     5193983 :   KOKKOS_FUNCTION unsigned int local_thread_id() const { return _local_thread_id; }
     380             :   /**
     381             :    * Get the number of local threads
     382             :    * @returns The number of local threads
     383             :    */
     384    16310855 :   KOKKOS_FUNCTION unsigned int num_local_threads() const { return _num_local_threads; }
     385             : 
     386             : protected:
     387             :   /**
     388             :    * Reference of the Kokkos assembly
     389             :    */
     390             :   const Assembly & _assembly;
     391             : 
     392             :   /**
     393             :    * Reference of the Kokkos systems
     394             :    */
     395             :   const Array<FESystem> & _systems;
     396             : 
     397             :   /**
     398             :    * Current contiguous node ID
     399             :    */
     400             :   const ContiguousNodeID _node = libMesh::DofObject::invalid_id;
     401             : 
     402             :   /**
     403             :    * Number of local quadrature points
     404             :    */
     405             :   const unsigned int _n_qps = 1;
     406             : 
     407             :   /**
     408             :    * Starting offset into the global quadrature point index
     409             :    */
     410             :   const dof_id_type _qp_offset = libMesh::DofObject::invalid_id;
     411             : 
     412             :   /**
     413             :    * Index for element-constant material properties
     414             :    */
     415             :   const dof_id_type _elem_property_idx = libMesh::DofObject::invalid_id;
     416             : 
     417             : private:
     418             :   /**
     419             :    * Compute and cache the physical transformation data
     420             :    * @param qp The local quadrature point index
     421             :    */
     422             :   KOKKOS_FUNCTION void reinitTransform(const unsigned int qp);
     423             : 
     424             :   /**
     425             :    * Cached quadrature point index for checking whether the physical transformation data should be
     426             :    * recomputed
     427             :    */
     428             :   unsigned int _cached_qp = libMesh::invalid_uint;
     429             :   /**
     430             :    * Cached physical transformation data
     431             :    */
     432             :   ///@{
     433             :   Real33 _J;
     434             :   Real _JxW;
     435             :   Real3 _xyz;
     436             :   Real3 _normal;
     437             :   ///@}
     438             :   /**
     439             :    * Thread ID for local parallelization
     440             :    */
     441             :   unsigned int _local_thread_id = 0;
     442             :   /**
     443             :    * Number of threads for local parallelization
     444             :    */
     445             :   unsigned int _num_local_threads = 1;
     446             : };
     447             : 
     448     7173117 : KOKKOS_FUNCTION inline Datum::Datum(const ContiguousElementID elem,
     449             :                                     const unsigned int side,
     450             :                                     const Assembly & assembly,
     451     7173117 :                                     const Array<FESystem> & systems)
     452             :   : MeshDatum(elem, side, assembly.kokkosMesh()),
     453     7173117 :     _assembly(assembly),
     454     7173117 :     _systems(systems),
     455     7173117 :     _n_qps(!isSide() ? assembly.getNumQps(_elem) : assembly.getNumFaceQps(_elem, side)),
     456     7173117 :     _qp_offset(!isSide() ? assembly.getQpOffset(_elem) : assembly.getQpFaceOffset(_elem, side)),
     457     7173117 :     _elem_property_idx(!isSide() ? _elem.id - _mesh.getStartingContiguousElementID(_elem.subdomain)
     458    14346234 :                                  : assembly.getElemFacePropertyIndex(_elem, _side))
     459             : {
     460     7173117 : }
     461             : 
     462     3442922 : KOKKOS_FUNCTION inline Datum::Datum(const ContiguousNodeID node,
     463             :                                     const Assembly & assembly,
     464     3442922 :                                     const Array<FESystem> & systems)
     465             :   : MeshDatum(libMesh::DofObject::invalid_id, libMesh::invalid_uint, assembly.kokkosMesh()),
     466     3442922 :     _assembly(assembly),
     467     3442922 :     _systems(systems),
     468     3442922 :     _node(node)
     469             : {
     470     3442922 : }
     471             : 
     472             : KOKKOS_FUNCTION inline dof_id_type
     473    39941885 : Datum::propertyIdx(const PropertyConstantOption constant_option, const unsigned int qp) const
     474             : {
     475    39941885 :   dof_id_type idx = 0;
     476             : 
     477    39941885 :   if (constant_option == PropertyConstantOption::NONE)
     478    39374480 :     idx = _qp_offset + qp;
     479      567405 :   else if (constant_option == PropertyConstantOption::ELEMENT)
     480      263250 :     idx = _elem_property_idx;
     481             : 
     482    39941885 :   return idx;
     483             : }
     484             : 
     485             : KOKKOS_FUNCTION inline bool
     486      152946 : Datum::isNodalDefined(const Variable & var) const
     487             : {
     488      152946 :   if (!isNodal() || !var.nodal())
     489           0 :     return false;
     490             : 
     491      152946 :   return _systems[var.sys()].isNodalDefined(_node, var.var());
     492             : }
     493             : 
     494             : KOKKOS_FUNCTION inline const Real33 &
     495    95965156 : Datum::J(const unsigned int qp)
     496             : {
     497    95965156 :   if (!isNodal())
     498    95965156 :     reinitTransform(qp);
     499             :   else
     500           0 :     _J.identity(_assembly.getDimension());
     501             : 
     502    95965156 :   return _J;
     503             : }
     504             : 
     505             : KOKKOS_FUNCTION inline Real
     506    93053002 : Datum::JxW(const unsigned int qp)
     507             : {
     508    93053002 :   if (!isNodal())
     509    93053002 :     reinitTransform(qp);
     510             :   else
     511           0 :     _JxW = 1;
     512             : 
     513    93053002 :   return _JxW;
     514             : }
     515             : 
     516             : KOKKOS_FUNCTION inline Real3
     517    17532646 : Datum::q_point(const unsigned int qp)
     518             : {
     519    17532646 :   if (!isNodal())
     520    17092280 :     reinitTransform(qp);
     521             :   else
     522      440366 :     _xyz = _assembly.kokkosMesh().getNodePoint(_node);
     523             : 
     524    17532646 :   return _xyz;
     525             : }
     526             : 
     527             : KOKKOS_FUNCTION inline Real3
     528        2104 : Datum::normals(const unsigned int qp)
     529             : {
     530             :   KOKKOS_ASSERT(isSide());
     531             : 
     532        2104 :   if (isSide())
     533        2104 :     reinitTransform(qp);
     534             : 
     535        2104 :   return _normal;
     536             : }
     537             : 
     538             : KOKKOS_FUNCTION inline void
     539   206112542 : Datum::reinitTransform(const unsigned int qp)
     540             : {
     541   206112542 :   if (_cached_qp == qp)
     542   169734380 :     return;
     543             : 
     544    36378162 :   if (!isSide())
     545             :   {
     546    36059582 :     _J = _assembly.getJacobian(_elem, qp);
     547    36059582 :     _JxW = _assembly.getJxW(_elem, qp);
     548    36059582 :     _xyz = _assembly.getQPoint(_elem, qp);
     549             :   }
     550             :   else
     551      318580 :     _assembly.computePhysicalMap(_elem, _side, qp, &_J, &_JxW, &_xyz, &_normal);
     552             : 
     553    36378162 :   _cached_qp = qp;
     554             : }
     555             : 
     556             : /**
     557             :  * The Kokkos object that holds thread-private data in the parallel operations of Kokkos kernels
     558             :  */
     559             : class AssemblyDatum : public Datum
     560             : {
     561             : public:
     562             :   /**
     563             :    * Constructor for element and side data
     564             :    * @param elem The contiguous element ID of the current thread
     565             :    * @param side The side index of the current thread
     566             :    * @param assembly The Kokkos assembly
     567             :    * @param systems The Kokkos systems
     568             :    * @param ivar The Kokkos variable
     569             :    * @param jvar The coupled variable number
     570             :    * @param comp The variable component
     571             :    */
     572             :   KOKKOS_FUNCTION
     573     5427423 :   AssemblyDatum(const ContiguousElementID elem,
     574             :                 const unsigned int side,
     575             :                 const Assembly & assembly,
     576             :                 const Array<FESystem> & systems,
     577             :                 const Variable & ivar,
     578             :                 const unsigned int jvar,
     579             :                 const unsigned int comp = 0)
     580     5427423 :     : Datum(elem, side, assembly, systems),
     581     5427423 :       _tag(ivar.tag()),
     582     5427423 :       _sys(ivar.sys(comp)),
     583     5427423 :       _ivar(ivar.var(comp)),
     584     5427423 :       _jvar(jvar),
     585     5427423 :       _ife(systems[ivar.sys(comp)].getFETypeID(_ivar)),
     586     5427423 :       _jfe(systems[ivar.sys(comp)].getFETypeID(_jvar)),
     587     5427423 :       _n_idofs(assembly.getNumDofs(_elem.type, _ife)),
     588    10854846 :       _n_jdofs(assembly.getNumDofs(_elem.type, _jfe))
     589             :   {
     590     5427423 :   }
     591             :   /**
     592             :    * Constructor for node data
     593             :    * @param elem The contiguous element ID of the current thread
     594             :    * @param assembly The Kokkos assembly
     595             :    * @param systems The Kokkos systems
     596             :    * @param ivar The Kokkos variable
     597             :    * @param jvar The coupled variable number
     598             :    * @param comp The variable component
     599             :    */
     600             :   KOKKOS_FUNCTION
     601     3289154 :   AssemblyDatum(const ContiguousNodeID node,
     602             :                 const Assembly & assembly,
     603             :                 const Array<FESystem> & systems,
     604             :                 const Variable & ivar,
     605             :                 const unsigned int jvar,
     606             :                 const unsigned int comp = 0)
     607     3289154 :     : Datum(node, assembly, systems),
     608     3289154 :       _tag(ivar.tag()),
     609     3289154 :       _sys(ivar.sys(comp)),
     610     3289154 :       _ivar(ivar.var(comp)),
     611     3289154 :       _jvar(jvar),
     612     3289154 :       _ife(systems[ivar.sys(comp)].getFETypeID(_ivar)),
     613     6578308 :       _jfe(systems[ivar.sys(comp)].getFETypeID(_jvar))
     614             :   {
     615     3289154 :   }
     616             : 
     617             :   /**
     618             :    * Get the number of local DOFs
     619             :    * @returns The number of local DOFs
     620             :    */
     621   137805443 :   KOKKOS_FUNCTION unsigned int n_dofs() const { return _n_idofs; }
     622             :   /**
     623             :    * Get the number of local DOFs
     624             :    * @returns The number of local DOFs
     625             :    */
     626     7376202 :   KOKKOS_FUNCTION unsigned int n_idofs() const { return _n_idofs; }
     627             :   /**
     628             :    * Get the number of local DOFs for the coupled variable
     629             :    * @returns The number of local DOFs
     630             :    */
     631     3124820 :   KOKKOS_FUNCTION unsigned int n_jdofs() const { return _n_jdofs; }
     632             :   /**
     633             :    * Get the system number of variable
     634             :    * @returns The system number of variable
     635             :    */
     636     4381978 :   KOKKOS_FUNCTION unsigned int sys() const { return _sys; }
     637             :   /**
     638             :    * Get the variable number
     639             :    * @returns The variable number
     640             :    */
     641             :   KOKKOS_FUNCTION unsigned int var() const { return _ivar; }
     642             :   /**
     643             :    * Get the variable number
     644             :    * @returns The variable number
     645             :    */
     646             :   KOKKOS_FUNCTION unsigned int ivar() const { return _ivar; }
     647             :   /**
     648             :    * Get the coupled variable number
     649             :    * @returns The variable number
     650             :    */
     651    10016492 :   KOKKOS_FUNCTION unsigned int jvar() const { return _jvar; }
     652             :   /**
     653             :    * Get the variable FE type ID
     654             :    * @returns The variable FE type ID
     655             :    */
     656             :   KOKKOS_FUNCTION unsigned int fe() const { return _ife; }
     657             :   /**
     658             :    * Get the variable FE type ID
     659             :    * @returns The variable FE type ID
     660             :    */
     661   181244468 :   KOKKOS_FUNCTION unsigned int ife() const { return _ife; }
     662             :   /**
     663             :    * Get the coupled variable FE type ID
     664             :    * @returns The variable FE type ID
     665             :    */
     666    30294512 :   KOKKOS_FUNCTION unsigned int jfe() const { return _jfe; }
     667             :   /**
     668             :    * Set whether to compute derivatives for automatic differentiation (AD)
     669             :    * @param flag Whether to compute derivatives
     670             :    */
     671      374838 :   KOKKOS_FUNCTION void do_derivatives(const bool flag) { _do_derivatives = flag; }
     672             :   /**
     673             :    * Get whether to compute derivatives for automatic differentiation (AD)
     674             :    * @returns Whether to compute derivatives
     675             :    */
     676     4738908 :   KOKKOS_FUNCTION bool do_derivatives() const { return _do_derivatives; }
     677             : 
     678             : protected:
     679             :   /**
     680             :    * Solution tag ID
     681             :    */
     682             :   const TagID _tag;
     683             :   /**
     684             :    * System number
     685             :    */
     686             :   const unsigned int _sys;
     687             :   /**
     688             :    * Variable numbers
     689             :    */
     690             :   const unsigned int _ivar, _jvar;
     691             :   /**
     692             :    * FE type IDs of variables
     693             :    */
     694             :   const unsigned int _ife, _jfe;
     695             :   /**
     696             :    * Number of local DOFs
     697             :    */
     698             :   const unsigned int _n_idofs = 1, _n_jdofs = 1;
     699             :   /**
     700             :    * Whether to compute derivatives for automatic differentiation (AD)
     701             :    */
     702             :   bool _do_derivatives = true;
     703             : };
     704             : 
     705             : } // namespace Moose::Kokkos
     706             : 
     707             : using Datum = Moose::Kokkos::Datum;
     708             : using AssemblyDatum = Moose::Kokkos::AssemblyDatum;
     709             : using FVDatum = Moose::Kokkos::FVDatum;

Generated by: LCOV version 1.14