NEML2 2.1.0
Loading...
Searching...
No Matches
neml2.core Namespace Reference

Classes

class  Factory
class  LabeledAxis
class  Model
class  NonlinearSystem
class  TensorValue
class  VariableName

Functions

neml2.Tensor assemble_matrix (list[neml2.Tensor] tensors, list[tuple[int,...]] row_base_shapes, list[tuple[int,...]] col_base_shapes)
neml2.Tensor assemble_vector (list[neml2.Tensor] tensors, list[tuple[int,...]] base_shapes)
dict[VariableName|str, neml2.Tensorbind (typing.Any variable_names, list[neml2.Tensor] values)
list[str] diagnose (Model model)
list[neml2.Tensordisassemble_matrix (neml2.Tensor tensor, list[tuple[int,...]] row_base_shapes, list[tuple[int,...]] col_base_shapes)
list[neml2.Tensordisassemble_vector (neml2.Tensor tensor, list[tuple[int,...]] base_shapes)
neml2.Tensor from_assembly (neml2.Tensor from, tuple[int,...] intmd_shape, tuple[int,...] base_shape)
neml2.Tensor from_assembly (neml2.Tensor from, tuple[int,...] intmd_shape1, tuple[int,...] intmd_shape2, tuple[int,...] base_shape1, tuple[int,...] base_shape2)
Factory load_input (typing.Any path, str cli_args='')
Model load_model (typing.Any path, str name)
NonlinearSystem load_nonlinear_system (typing.Any path, str name)
neml2.Tensor to_assembly (neml2.Tensor from, tuple[int,...] intmd_shape, tuple[int,...] base_shape)
neml2.Tensor to_assembly (neml2.Tensor from, tuple[int,...] intmd_shape1, tuple[int,...] intmd_shape2, tuple[int,...] base_shape1, tuple[int,...] base_shape2)

Detailed Description

NEML2 Python bindings

Function Documentation

◆ assemble_matrix()

neml2.Tensor assemble_matrix ( list[neml2.Tensor] tensors,
list[tuple[int, ...]] row_base_shapes,
list[tuple[int, ...]] col_base_shapes )
Assemble a list of tensors into a single tensor (matrix, with two base dimensions) in assembly format

◆ assemble_vector()

neml2.Tensor assemble_vector ( list[neml2.Tensor] tensors,
list[tuple[int, ...]] base_shapes )
Assemble a list of tensors into a single tensor (vector, with one base dimension) in assembly format

◆ bind()

dict[VariableName | str, neml2.Tensor] bind ( typing.Any variable_names,
list[neml2.Tensor] values )
Bind a vector of Tensors to variable names to form a dictionary whose keys are
variable names and values are sub-tensors.

:param variable_names: List of variable names
:param values: Vector of Tensors to be bound

◆ diagnose()

list[str] diagnose ( Model model)
  Diagnose common issues in model setup. Raises a runtime error including all identified issues,
  if any.

  :param model: Model to be diagnosed

◆ disassemble_matrix()

list[neml2.Tensor] disassemble_matrix ( neml2.Tensor tensor,
list[tuple[int, ...]] row_base_shapes,
list[tuple[int, ...]] col_base_shapes )
Disassemble a tensor (matrix, with two base dimensions) into a list of tensors from assembly format

◆ disassemble_vector()

list[neml2.Tensor] disassemble_vector ( neml2.Tensor tensor,
list[tuple[int, ...]] base_shapes )
Disassemble a tensor (vector, with one base dimension) into a list of tensors from assembly format

◆ from_assembly() [1/2]

neml2.Tensor from_assembly ( neml2.Tensor from,
tuple[int, ...] intmd_shape,
tuple[int, ...] base_shape )
Convert a tensor (variable value) from assembly format to normal format

◆ from_assembly() [2/2]

neml2.Tensor from_assembly ( neml2.Tensor from,
tuple[int, ...] intmd_shape1,
tuple[int, ...] intmd_shape2,
tuple[int, ...] base_shape1,
tuple[int, ...] base_shape2 )
Convert a tensor (variable derivative) from assembly format to normal format

◆ load_input()

Factory load_input ( typing.Any path,
str cli_args = '' )
  Parse all options from an input file. Note that Previously loaded input options
  will be discarded.

  :param path:     Path to the input file to be parsed
  :param cli_args: Additional command-line arguments to pass to the parser

◆ load_model()

Model load_model ( typing.Any path,
str name )
  A convenient function to load an input file and get a model.

  This function is equivalent to calling core.load_input followed by
  Factory.get_model. Note that this convenient function does not support passing
  additional command-line arguments and will force the creation of a new
  core.Model even if one has already been created. Use core.load_input and
  Factory.get_model if you need finer control over the model creation behavior.

  :param path:      Path to the input file to be parsed
  :param name:      Name of the model

◆ load_nonlinear_system()

NonlinearSystem load_nonlinear_system ( typing.Any path,
str name )
  A convenient function to load an input file and get a nonlinear system.

  This function is equivalent to calling core.load_input followed by
  Factory.get_nonlinear_system. Note that this convenient function does not
  support passing additional command-line arguments and will force the creation of a new
  core.NonlinearSystem even if one has already been created. Use core.load_input and
  Factory.get_nonlinear_system if you need finer control over the model creation behavior.

  :param path:      Path to the input file to be parsed
  :param name:      Name of the nonlinear system

◆ to_assembly() [1/2]

neml2.Tensor to_assembly ( neml2.Tensor from,
tuple[int, ...] intmd_shape,
tuple[int, ...] base_shape )
Convert a tensor (variable value) to assembly format from normal format

◆ to_assembly() [2/2]

neml2.Tensor to_assembly ( neml2.Tensor from,
tuple[int, ...] intmd_shape1,
tuple[int, ...] intmd_shape2,
tuple[int, ...] base_shape1,
tuple[int, ...] base_shape2 )
Convert a tensor (variable derivative) to assembly format from normal format