def add_level(self, feval, sdc, interpolate=None, restrict=None): """Add a level to the PFASST hierarchy. :param feval: implicit/explicit function evaluator (instance of :class:`pfasst.feval.FEval`) :param sdc: implicit/explicit SDC sweeper (instance of :class:`pfasst.sdc.SDC`) :param interpolate: interpolate from coarser level to this level (callable) :param restrict: restrict from this level to coarser level (callable) Levels should be added from finest (level 0) to coarest. The *interpolate* callable is called as:: >>> interpolate(yF, yG, fevalF=fevaF, fevalG=fevalG, **kwargs) and should interpolate the coarse y values *yG* that correspond to the coarse evaluator *fevalG* to the fine y values *yF* that correspond to the fine evaluator *fevalF*. The (flattened) result should be stored in *yF*. The *restrict* callable is called as:: >>> restrict(yF, yG, fevalF=fevalF, fevalG=fevalG, **kwargs) and should restrict the fine y values *yF* that correspond to the fine evaluator *fevalF* to the coarse y values *yG* that correspond to the coarse evaluator *fevalG*. The (flattened) result should be stored in *yG*. """ level = Level() level.feval = feval level.sdc = sdc level.interpolate = interpolate level.restrict = restrict level.level = len(self.levels) level.mpi = self.mpi level.state = self.state level.hooks = {} level.sweeps = 1 self.levels.append(level)