14 #include "MooseConfig.h" 80 std::size_t max_dofs_per_elem,
82 unsigned int num_vars_in_system = 0)
87 "If our element type is anything other than ElementType::Element, then you " 88 "must supply num_vars_in_system in order to calculate the offset");
93 return var_num * max_dofs_per_elem;
96 return num_vars_in_system * max_dofs_per_elem + var_num * max_dofs_per_elem;
99 return 2 * num_vars_in_system * max_dofs_per_elem + var_num * max_dofs_per_elem;
103 "Unsupported element type ",
104 static_cast<typename std::underlying_type<decltype(element_type)>::type
>(element_type));
110 std::size_t max_dofs_per_elem,
112 unsigned int num_vars_in_system = 0)
124 std::unordered_map<dof_id_type, Real>
134 template <
typename T>
140 -> std::vector<std::unordered_map<
142 typename std::enable_if<std::is_same<ADReal, typename T::value_type>::value,
Real>::type>>
144 std::vector<std::unordered_map<dof_id_type, Real>> ret_val(ad_real_container.size());
146 for (MooseIndex(ad_real_container) i = 0; i < ad_real_container.size(); ++i)
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
bool globalADIndexing()
Whether we are using global AD indexing.
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
Base class for a system (of equations)
DualNumber< Real, DNDerivativeType, true > ADReal
std::size_t adOffset(unsigned int var_num, std::size_t max_dofs_per_elem, ElementType element_type=ElementType::Element, unsigned int num_vars_in_system=0)
Helper function for computing automatic differentiation offset.
bool doDerivatives(const SubProblem &subproblem, const SystemBase &sys)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Generic class for solving transient nonlinear problems.
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
std::unordered_map< dof_id_type, Real > globalDofIndexToDerivative(const ADReal &ad_real, const SystemBase &sys, ElementType elem_type=ElementType::Element, THREAD_ID tid=0)
Generate a map from global dof index to derivative value.