Classes | |
| struct | Layout |
| struct | Layout< RankFourTensor > |
| struct | Layout< RankTwoTensor > |
| struct | Layout< Real > |
| struct | Layout< RealVectorValue > |
| struct | Layout< SymmetricRankFourTensor > |
| struct | Layout< SymmetricRankTwoTensor > |
Enumerations | |
| enum | MOOSEIOType { MOOSEIOType::TIME, MOOSEIOType::SCALAR, MOOSEIOType::FUNCTION, MOOSEIOType::VARIABLE, MOOSEIOType::MATERIAL } |
Functions | |
| std::string | stringify (MOOSEIOType type) |
| std::shared_ptr< neml2::Model > | getModel (neml2::Factory &factory, const std::string &name, neml2::Dtype dtype=neml2::kFloat64) |
| Get the NEML2 Model. More... | |
| template<typename T > | |
| neml2::Tensor | fromBlob (const std::vector< T > &data) |
| Map from std::vector<T> to neml2::Tensor without copying the data. More... | |
| template<typename T > | |
| 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. More... | |
| bool | shouldCompute (const SubProblem &) |
| Determine whether the NEML2 material model should be evaluated. More... | |
| std::string | docstring (const std::string &desc) |
| Augment docstring if NEML2 is not enabled. More... | |
| void | assertNEML2Enabled () |
| Assert that NEML2 is enabled. More... | |
Variables | |
| static std::string | NEML2_help_message |
| static const std::string | missing_neml2 |
|
strong |
| void NEML2Utils::assertNEML2Enabled | ( | ) |
Assert that NEML2 is enabled.
A MooseError is raised if NEML2 is not enabled.
Definition at line 81 of file NEML2Utils.C.
Referenced by NEML2Action::NEML2Action(), NEML2ActionCommon::NEML2ActionCommon(), and NEML2ToMOOSEMaterialProperty< T >::NEML2ToMOOSEMaterialProperty().
| 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.
This assumes the at::Tensor and T have the same layout, for example both row-major with T = RankTwoTensor. If the layouts are different, we may need to reshape/reorder/transpose the at::Tensor before copying.
For this method to work,
dest must align with the first element of the data,dest must match the number of elements in src,src tensor must be of type neml2::kFloat64, anddest must be reinterpretable as Real. Definition at line 137 of file NEML2Utils.h.
| std::string NEML2Utils::docstring | ( | const std::string & | desc | ) |
Augment docstring if NEML2 is not enabled.
Definition at line 71 of file NEML2Utils.C.
Referenced by InputParameters::renameCoupledVarInternal(), and InputParameters::renameParamInternal().
| neml2::Tensor NEML2Utils::fromBlob | ( | const std::vector< T > & | data | ) |
Map from std::vector<T> to neml2::Tensor without copying the data.
This method is used in gatherers which gather data from MOOSE as input variables to the NEML2 material model. So in theory, we only need to provide Layout specializations for MOOSE types that can potentially be used as NEML2 input variables.
For this method to work, the underlying data in data must be reinterpretable as Real (neml2::kFloat64). The data class T must also be aligned and follow the striding implied by Layout<T>::shape. The data class T must also have no padding or overhead.
Definition at line 112 of file NEML2Utils.h.
Referenced by MOOSEQuantityToNEML2< T, state >::gatheredData().
| std::shared_ptr< neml2::Model > NEML2Utils::getModel | ( | neml2::Factory & | factory, |
| const std::string & | name, | ||
| neml2::Dtype | dtype = neml2::kFloat64 |
||
| ) |
Get the NEML2 Model.
This is mostly the same as the plain neml2::get_model() method, but it also guards the default dtype and sends the model to the target device.
Definition at line 38 of file NEML2Utils.C.
Referenced by NEML2Action::NEML2Action().
| bool NEML2Utils::shouldCompute | ( | const SubProblem & | problem | ) |
Determine whether the NEML2 material model should be evaluated.
Definition at line 53 of file NEML2Utils.C.
Referenced by NEML2BatchIndexGenerator::execute(), NEML2BatchIndexGenerator::initialize(), NEML2ModelExecutor::meshChanged(), and NEML2BatchIndexGenerator::threadJoin().
| std::string NEML2Utils::stringify | ( | MOOSEIOType | type | ) |
Definition at line 18 of file NEML2Utils.C.
Referenced by Moose::SlepcSupport::clearFreeNonlinearPowerIterations(), NEML2Action::printSummary(), Moose::SlepcSupport::setFreeNonlinearPowerIterations(), Moose::SlepcSupport::setNewtonPetscOptions(), and Moose::SlepcSupport::setSlepcEigenSolverTolerances().
|
static |
Definition at line 49 of file NEML2Utils.C.
Referenced by assertNEML2Enabled(), and docstring().
|
static |
Definition at line 154 of file NEML2Utils.h.
Referenced by NEML2ModelExecutor::extractOutputs(), and NEML2ModelExecutor::fillInputs().
1.8.14