https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ADReal.h
Go to the documentation of this file.
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
17namespace Moose
18{
19template <std::size_t N>
20inline void
21derivInsert(SemiDynamicSparseNumberArray<Real, libMesh::dof_id_type, NWrapper<N>> & derivs,
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 derivs.insert(index) = value;
41#endif
42}
43}
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
void derivInsert(SemiDynamicSparseNumberArray< Real, libMesh::dof_id_type, NWrapper< N > > &derivs, libMesh::dof_id_type index, Real value)
Definition ADReal.h:21
uint8_t dof_id_type