16 #include "neml2/tensors/tensors.h"    17 #include "neml2/base/LabeledAxisAccessor.h"    18 #include "neml2/base/Parser.h"    19 #include "neml2/base/Factory.h"    20 #include "neml2/models/Model.h"    44 std::shared_ptr<neml2::Model>
    45 getModel(neml2::Factory & factory, 
const std::string & 
name, neml2::Dtype dtype = neml2::kFloat64);
    63   static constexpr std::array<neml2::Size, 0> shape{};
    64   static constexpr std::array<neml2::Size, 1> strides{1};
    69   static constexpr std::array<neml2::Size, 1> shape{3};
    70   static constexpr std::array<neml2::Size, 2> strides{3, 1};
    75   static constexpr std::array<neml2::Size, 2> shape{3, 3};
    76   static constexpr std::array<neml2::Size, 3> strides{9, 3, 1};
    81   static constexpr std::array<neml2::Size, 1> shape{6};
    82   static constexpr std::array<neml2::Size, 2> strides{6, 1};
    87   static constexpr std::array<neml2::Size, 4> shape{3, 3, 3, 3};
    88   static constexpr std::array<neml2::Size, 5> strides{81, 27, 9, 3, 1};
    93   static constexpr std::array<neml2::Size, 2> shape{6, 6};
    94   static constexpr std::array<neml2::Size, 3> strides{36, 6, 1};
   108 template <
typename T>
   114   const auto torch_tensor = at::from_blob(const_cast<T *>(data.data()),
   116                                           at::TensorOptions().dtype(neml2::kFloat64));
   117   return neml2::Tensor(torch_tensor, 1);
   133 template <
typename T>
   137   if (src.dtype() != neml2::kFloat64)
   139         "Cannot copy at::Tensor with dtype ", src.dtype(), 
" into ", 
demangle(
typeid(T).
name()));
   141     mooseError(
"Cannot copy at::Tensor with shape ",
   145                " with different number of elements.");
   146   auto dest_tensor = at::from_blob(reinterpret_cast<Real *>(&dest),
   148                                    at::TensorOptions().dtype(neml2::kFloat64));
   153 ==============================================================================   154 To debug NEML2 related issues:   155 1. Build and run MOOSE in dbg mode.   156 2. Re-run the simulation using the dbg executable, and often times   157    NEML2 will provide a more helpful error message.   158 3. If the error message is not helpful, or if there is still no error message,   159    run the simulation through a debugger: See   160    https://mooseframework.inl.gov/application_development/debugging.html   161 4. If the issue is due to a NEML2 bug, feel free to report it at   162    https://github.com/applied-material-modeling/neml2/issues   163 ==============================================================================   166 #endif // NEML2_ENABLED   174 std::string 
docstring(
const std::string & desc);
 std::string name(const ElemQuality q)
RankFourTensorTempl is designed to handle any N-dimensional fourth order tensor, C. 
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
bool shouldCompute(const SubProblem &)
Determine whether the NEML2 material model should be evaluated. 
void assertOldVariable(const neml2::VariableName &)
Assert that the NEML2 variable name sits on either the old_forces or the old_state subaxis...
static std::string NEML2_help_message
Every object that can be built by the factory should be derived from this class. 
void copyTensorToMOOSEData(const at::Tensor &src, T &dest)
Directly copy a contiguous chunk of memory of a at::Tensor to a MOOSE data of type T...
std::string docstring(const std::string &desc)
Augment docstring if NEML2 is not enabled. 
std::string demangle(const char *name)
void assertNEML2Enabled()
Assert that NEML2 is enabled. 
std::shared_ptr< neml2::Model > getModel(neml2::Factory &factory, const std::string &name, neml2::Dtype dtype=neml2::kFloat64)
Get the NEML2 Model. 
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Generic class for solving transient nonlinear problems. 
SymmetricRankFourTensorTempl is designed to handle an N-dimensional fourth order tensor with minor sy...
void assertVariable(const neml2::VariableName &)
Assert that the NEML2 variable name sits on either the forces or the state subaxis. 
neml2::VariableName parseVariableName(const std::string &)
Parse a raw string into NEML2 variable name. 
neml2::Tensor fromBlob(const std::vector< T > &data)
Map from std::vector<T> to neml2::Tensor without copying the data.