cashocs.io.function#
Function input and output.
Functions
|
Imports a function from an xdmf file to cashocs. |
|
Reads a function from a .xdmf file containing a checkpointed function. |
- cashocs.io.function.import_function(filename, name, function_space, step=0)[source]#
Imports a function from an xdmf file to cashocs.
- Parameters:
filename (str) – The path / filename to the xdmf file.
name (str) – The name of the function in the xdmf file.
function_space (fenics.FunctionSpace) – The corresponding function space for the function. Note that this must be created on a suitable mesh, which has been reimported with
cashocs.io.reimport_mesh()
.step (int) – The checkpoint number. Default is
0
.
- Returns:
The fenics function which is stored in the xdmf file.
- Return type:
fenics.Function
- cashocs.io.function.read_function_from_xdmf(filename, name, family, degree, vector_dim=0, step=0, comm=None)[source]#
Reads a function from a .xdmf file containing a checkpointed function.
- Parameters:
filename (str) – The name of the .xdmf file.
name (str) – The name of the function.
family (str) – The finite element family of the function.
degree (int) – The degree of the finite element.
vector_dim (int) – The dimension of the vector, if the function is vector-valued. In case that this is
0
, a scalar finite element is assumed. Default is 0.step (int) – The checkpoint number. Default is
0
.comm (Optional[MPI.Comm]) – The MPI communicator that shall be used. Default is None, which means that fenics.MPI.comm_world is used.
- Returns:
A fenics representation of the function stored in the file.
- Return type:
fenics.Function