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 : #include "ADRealForward.h" 13 : 14 : #include "metaphysicl/dualsemidynamicsparsenumberarray.h" 15 : #include "metaphysicl/metaphysicl_exceptions.h" 16 : 17 : namespace Moose 18 : { 19 : template <std::size_t N> 20 : inline void 21 73994491 : derivInsert(SemiDynamicSparseNumberArray<Real, libMesh::dof_id_type, NWrapper<N>> & derivs, 22 : libMesh::dof_id_type index, 23 : Real value) 24 : { 25 : #ifndef NDEBUG 26 : try 27 : { 28 : derivs.insert(index) = value; 29 : } 30 : catch (MetaPhysicL::LogicError &) 31 : { 32 : // We don't want to use a MooseError here to keep the list of includes in parsed ADReal logic 33 : // minimal 34 : libmesh_error_msg( 35 : "The last insertion into the sparse derivative storage container exceeded the " 36 : "underlying array size. Consider running `configure --with-derivative-size=<n>` to " 37 : "obtain a larger underlying container"); 38 : } 39 : #else 40 73994491 : derivs.insert(index) = value; 41 : #endif 42 73994491 : } 43 : }