79 std::size_t max_dofs_per_elem,
81 unsigned int num_vars_in_system = 0)
86 "If our element type is anything other than ElementType::Element, then you " 87 "must supply num_vars_in_system in order to calculate the offset");
92 return var_num * max_dofs_per_elem;
95 return num_vars_in_system * max_dofs_per_elem + var_num * max_dofs_per_elem;
98 return 2 * num_vars_in_system * max_dofs_per_elem + var_num * max_dofs_per_elem;
102 "Unsupported element type ",
103 static_cast<typename std::underlying_type<decltype(element_type)>::type
>(element_type));
109 std::size_t max_dofs_per_elem,
111 unsigned int num_vars_in_system = 0)
123 std::unordered_map<dof_id_type, Real>
133 template <
typename T>
139 -> std::vector<std::unordered_map<
141 typename std::enable_if<std::is_same<ADReal, typename T::value_type>::value,
Real>::type>>
143 std::vector<std::unordered_map<dof_id_type, Real>> ret_val(ad_real_container.size());
145 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.