We could have a new class InitialConditionFromXDMF and remove the arguments label, time_step from InitialCondition.
This would make things less confusing and would make the implementation more straightforward, we now just have to check for the type of the initial condition object:
if isintance(initial_condition, F.InitialConditon):
# do something
elif isinstance(initial_condition, F.InitialConditionFromXDMF):
# do something else
Currently we have the
InitialCondition
class that can be used for initialising fields with mathematical expressions or XDMF files.From an mathematical expression:
From a XDMFfile:
We then look check if
value
is a string and if it ends by.xdmf
and initialise fields accordingly: https://github.com/festim-dev/FESTIM/blob/31864c86690750ab854942c82110c3f711187246/festim/concentration/concentration.py#L43-L47https://github.com/festim-dev/FESTIM/blob/31864c86690750ab854942c82110c3f711187246/festim/temperature/temperature_solver.py#L114-L122
Proposition
We could have a new class
InitialConditionFromXDMF
and remove the argumentslabel
,time_step
fromInitialCondition
.This would make things less confusing and would make the implementation more straightforward, we now just have to check for the type of the initial condition object: