https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Classes | Namespaces | Enumerations | Functions | Variables
NEML2Utils.h File Reference

Go to the source code of this file.

Classes

struct  NEML2Utils::Layout< T >
 
struct  NEML2Utils::Layout< Real >
 
struct  NEML2Utils::Layout< RealVectorValue >
 
struct  NEML2Utils::Layout< RankTwoTensor >
 
struct  NEML2Utils::Layout< SymmetricRankTwoTensor >
 
struct  NEML2Utils::Layout< RankFourTensor >
 
struct  NEML2Utils::Layout< SymmetricRankFourTensor >
 
class  NEML2Utils::ScopedNumThreads
 RAII guard that pins libtorch's intra-op thread count for the current scope and restores the previous value on destruction. More...
 
class  NEML2Utils::ScopedDefaultDtype
 RAII guard forcing libtorch's default scalar type to Float64 for its lifetime, restoring the previous default on destruction. More...
 

Namespaces

namespace  NEML2Utils
 

Enumerations

enum class  NEML2Utils::MOOSEIOType {
  NEML2Utils::TIME , NEML2Utils::SCALAR , NEML2Utils::FUNCTION , NEML2Utils::VARIABLE ,
  NEML2Utils::MATERIAL
}
 

Functions

std::string NEML2Utils::stringify (MOOSEIOType type)
 
std::pair< std::string, int > NEML2Utils::parseLag (const std::string &name)
 Parse NEML2 v3 lag notation: "var~N" is the N-th old value of a variable (var~1 == old var, var~2 == older, ...).
 
std::string NEML2Utils::lagName (const std::string &base, int lag)
 Inverse of parseLag: build the variable name for a base name + lag.
 
bool NEML2Utils::contains (const std::vector< std::string > &v, const std::string &s)
 Whether a vector of strings contains a given string.
 
template<typename T >
at::Tensor NEML2Utils::fromBlob (const std::vector< T > &data)
 Map from std::vector<T> to an at::Tensor without copying the data.
 
template<typename T >
void NEML2Utils::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.
 
template<typename T >
void NEML2Utils::copyBlobToMOOSEData (const Real *src, T &dest)
 Copy one element's worth of doubles from a contiguous host buffer into a MOOSE datum of type T.
 
void NEML2Utils::redirectLogsToConsole (const ConsoleStream &console)
 Route NEML2's log output into MOOSE's console.
 
void NEML2Utils::dumpInputsToTorchScript (const std::map< std::string, at::Tensor > &inputs, const std::string &filename)
 Serialize a set of named NEML2 input tensors to a TorchScript archive at filename (a torch::jit::Module whose buffers are the input tensors), loadable offline in Python via torch.jit.load.
 
std::string NEML2Utils::docstring (const std::string &desc)
 Augment docstring if NEML2 is not enabled.
 
void NEML2Utils::assertNEML2Enabled ()
 Assert that NEML2 is enabled.
 

Variables

static std::string NEML2Utils::NEML2_help_message