dolfinx_adjoint.fem.function module
- class dolfinx_adjoint.fem.function.Constant(*args, **kwargs)
Bases:
ConstantOVERLOADS:
dolfinx.fem.constant.ConstantInitialize a constant function.The overloaded class modifies the initialization of the Constant to keep track of the dependencies in the computational graph and the adjoint equations. The original functionality is kept.
- class dolfinx_adjoint.fem.function.Function(*args, **kw)
Bases:
FunctionOVERLOADS:
dolfinx.fem.function.FunctionInitialize a finite element Function.The overloaded class modifies the initialization of the Function to keep track of the dependencies in the computational graph and the adjoint equations. The original functionality is kept. Two additional methods are added to the class: copy and assign. The copy method creates a new function and adds the corresponding node to the graph. The assign method assign values to the function and adds the corresponding operation to the graph.
- assign(function: Function, **kwargs)
Assign values of a different dolfinx.fem.Function to the function and adds the corresponding operation to the graph.
- Parameters:
function (dolfinx.fem.Function) – The function to assign values from.
graph (graph, optional) – An additional keyword argument to specifier whether the assemble operation should be added to the graph. If not present, the original functionality of dolfinx is used without any additional functionalities.
version (int, optional) – An additional keyword argument to specify the version of the operation in the graph. If not present, the version is set to 0.
- copy(**kwargs)
Creates a new dolfinx.fem.Function with the same function space and a copy of the PETsc vector.
- Parameters:
name (str, optional) – Keyword arguments to specify the name of the function.
graph (graph, optional) – An additional keyword argument to specifier whether the assemble operation should be added to the graph. If not present, the original functionality of dolfinx is used without any additional functionalities.
- Returns:
A new dolfinx.fem.Function with the same function space and a copy of the PETsc vector.
- Return type: