1 """
2 Class that implements the common functionality for clearing the cases
3 """
4
5 from PyFoam.ThirdParty.six import print_
6
8 """ The class that clears the case
9 """
10
12 self.ensureGeneralOptions()
13 self.generalOpts.add_option("--clear-case",
14 action="store_true",
15 default=False,
16 dest="clearCase",
17 help="Clear all timesteps except for the first before running")
18 self.generalOpts.add_option("--complete-clear",
19 action="store_true",
20 default=False,
21 dest="clearComplete",
22 help="Like clear-case but removes the function-object data as well")
23
25 if self.opts.clearComplete:
26 self.opts.clearCase=True
27 if self.opts.clearCase:
28 print_("Clearing out old timesteps ....")
29 sol.clearResults(functionObjectData=self.opts.clearComplete)
30
31
32