LCOV - code coverage report
Current view: top level - include/neml2/userobjects - NEML2Assembly.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #32971 (54bef8) with base c6cf66 Lines: 0 3 0.0 %
Date: 2026-05-29 20:35:17 Functions: 0 3 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //* This file is part of the MOOSE framework
       2             : //* https://mooseframework.inl.gov
       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             : #ifdef NEML2_ENABLED
      13             : 
      14             : // MOOSE includes
      15             : #include "ElementUserObject.h"
      16             : 
      17             : #include "neml2/tensors/Tensor.h"
      18             : 
      19             : /// This user object caches assembly information from MOOSE.
      20             : class NEML2Assembly : public ElementUserObject
      21             : {
      22             : public:
      23             :   static InputParameters validParams();
      24             : 
      25             :   NEML2Assembly(const InputParameters & parameters);
      26             : 
      27             :   /// Number of active elements on this rank
      28           0 :   int64_t numElem() const { return _nelem; }
      29             : 
      30             :   /// Number of quadrature points per element
      31           0 :   int64_t numQP() const { return _nqp; }
      32             : 
      33             :   /**
      34             :    * @brief Get the cached JxWxT for each element, each quadrature point
      35             :    *
      36             :    * The NEML2 tensor will have shape (nelem, nqp;), where nelem is the number of elements, and nqp
      37             :    * is the number of quadrature points per element. The tensor is stored in the device memory.
      38             :    *
      39             :    * @warning The JxWxT value is only available after finalize() is called.
      40             :    */
      41             :   const neml2::Tensor & JxWxT() const { return _neml2_JxWxT; }
      42             : 
      43             :   /// Whether the current assembly cache is up to date
      44             :   bool upToDate() const { return _up_to_date; }
      45             : 
      46             :   /// Invalidate the cached assembly information
      47             :   void invalidate();
      48             : 
      49           0 :   void meshChanged() override { invalidate(); }
      50             : 
      51             :   void initialize() override;
      52             :   void execute() override;
      53             :   void finalize() override;
      54             :   void threadJoin(const UserObject &) override;
      55             : 
      56             : protected:
      57             :   /// Whether the current assembly cache is up to date
      58             :   bool _up_to_date = false;
      59             : 
      60             :   /// number of elements on this rank
      61             :   int64_t _nelem;
      62             :   /// number of quadrature points per element
      63             :   int64_t _nqp;
      64             : 
      65             :   /// JxWxT (product of Jacobian determinant, quadrature weight, and coordinate transformation factor) for each element, qp
      66             :   std::vector<Real> _moose_JxWxT;
      67             :   neml2::Tensor _neml2_JxWxT;
      68             : };
      69             : 
      70             : #endif

Generated by: LCOV version 1.14