def __init__(self, args=None, **kwargs): description="""\ Generates snapshots of an OpenFOAM-case and a predefined paraview-State-File using the PV3FoamReader that comes with OpenFOAM. The state-file can be generated using a different case (the script adjusts it before using) but the original case has to have a similar structure to the current one. Also exactly one PV3Reader has to be used in the state-file (this requirement is fullfilled if the StateFile was generated using paraFoam) In TextSources the string "%(casename)s" gets replaced by the casename. Additional replacements can be specified """ CommonSelectTimesteps.__init__(self) PyFoamApplication.__init__(self, args=args, description=description, usage="%prog [options] <case>", interspersed=True, nr=1, **kwargs)
def addOptions(self): CommonStandardOutput.addOptions(self,logname="RunAtMultipleTimes") CommonParallel.addOptions(self) CommonServer.addOptions(self) CommonSelectTimesteps.addOptions(self,defaultUnique=True) CommonReportUsage.addOptions(self) CommonReportRunnerData.addOptions(self)
def addOptions(self): CommonSelectTimesteps.addOptions(self,defaultUnique=False) paraview=OptionGroup(self.parser, "Paraview specifications", "Options concerning paraview") paraview.add_option("--state-file", dest="state", default=None, help="The pvsm-file that should be used. If none is specified the file 'default.pvsm' in the case-directory is used") paraview.add_option("--maginfication", dest="magnification", default=1, type="int", help="Magnification factor of the picture (integer). Default: %default") paraview.add_option("--type", dest="type", type="choice", choices=self.typeTable.keys(), default="png", help="The type of the bitmap-file. Possibilities are "+string.join(self.typeTable.keys(),", ")+". Default: %default") paraview.add_option("--no-progress", dest="progress", action="store_false", default=True, help="Paraview will not print the progress of the filters") self.parser.add_option_group(paraview) filename=OptionGroup(self.parser, "Filename specifications", "The names of the resulting files") filename.add_option("--file-prefix", dest="prefix", default="Snapshot", help="Start of the filename for the bitmap-files") filename.add_option("--no-casename", dest="casename", action="store_false", default=True, help="Do not add the casename to the filename") filename.add_option("--no-timename", dest="timename", action="store_false", default=True, help="Do not append the string 't=<time>' to the filename") self.parser.add_option_group(filename) replace=OptionGroup(self.parser, "Replacements etc", "Manipuations of the statefile") replace.add_option("--replacements", dest="replacements", default="{}", help="Dictionary with replacement strings. Default: %default") replace.add_option("--casename-key", dest="casenameKey", default="casename", help="Key with which the caename should be replaced. Default: %default")
def addOptions(self): CommonSelectTimesteps.addOptions(self,defaultUnique=False) paraview=OptionGroup(self.parser, "Paraview specifications", "Options concerning paraview") paraview.add_option("--state-file", dest="state", default=None, help="The pvsm-file that should be used. If none is specified the file 'default.pvsm' in the case-directory is used") paraview.add_option("--maginfication", dest="magnification", default=1, type="int", help="Magnification factor of the picture (integer). Default: %default") paraview.add_option("--type", dest="picType", type="choice", choices=self.picTypeTable.keys(), default="png", help="The type of the bitmap-file. Possibilities are "+", ".join(self.picTypeTable.keys())+". Default: %default") paraview.add_option("--no-progress", dest="progress", action="store_false", default=True, help="Paraview will not print the progress of the filters") paraview.add_option("--no-offscreen-rendering", dest="offscreenRender", action="store_false", default=True, help="Do not do offscreen rendering (use if offscreen rendering produces a segmentation fault)") self.parser.add_option_group(paraview) geometry=OptionGroup(self.parser, "Geometry specification", "Options for writing out geometry files") geometry.add_option("--geometry-type", dest="geomType", type="choice", choices=self.geomTypeTable.keys(), default=None, help="The type of the geometry-files. Possibilities are "+", ".join(self.geomTypeTable.keys())+". Default: unset. Nothing is written") geometry.add_option("--no-picture-with-geometry", dest="pictureWithGeometry", action="store_false", default=True, help="Do not write a picture if geometries are written. Default is that pictures are written as well") geometry.add_option("--get-sources-list", dest="sourcesList", action="store_true", default=False, help="Get a list of all the sources. Nothing is written") geometry.add_option("--sources", dest="sources", default=[], action="append", help="Only write sources where the name matches this substring. Can be specified more than once (will write more than one file)") self.parser.add_option_group(geometry) filename=OptionGroup(self.parser, "Filename specifications", "The names of the resulting files") filename.add_option("--file-prefix", dest="prefix", default="Snapshot", help="Start of the filename for the bitmap-files") filename.add_option("--no-casename", dest="casename", action="store_false", default=True, help="Do not add the casename to the filename") filename.add_option("--no-timename", dest="timename", action="store_false", default=True, help="Do not append the string 't=<time>' to the filename") self.parser.add_option_group(filename) replace=OptionGroup(self.parser, "Replacements etc", "Manipuations of the statefile") replace.add_option("--replacements", dest="replacements", default="{}", help="Dictionary with replacement strings. Default: %default") replace.add_option("--casename-key", dest="casenameKey", default="casename", help="Key with which the caename should be replaced. Default: %default") self.parser.add_option_group(replace) behaviour=OptionGroup(self.parser, "Behaviour", "General behaviour of the utility") behaviour.add_option("--verbose", dest="verbose", action="store_true", default=False, help="Print more information") self.parser.add_option_group(behaviour)
def addOptions(self): CommonSelectTimesteps.addOptions(self, defaultUnique=False) paraview = OptionGroup(self.parser, "Paraview specifications", "Options concerning paraview") paraview.add_option( "--state-file", dest="state", default=None, help= "The pvsm-file that should be used. If none is specified the file 'default.pvsm' in the case-directory is used" ) paraview.add_option( "--maginfication", dest="magnification", default=1, type="int", help= "Magnification factor of the picture (integer). Default: %default") paraview.add_option( "--type", dest="picType", type="choice", choices=self.picTypeTable.keys(), default="png", help="The type of the bitmap-file. Possibilities are " + string.join(self.picTypeTable.keys(), ", ") + ". Default: %default") paraview.add_option( "--no-progress", dest="progress", action="store_false", default=True, help="Paraview will not print the progress of the filters") paraview.add_option( "--no-offscreen-rendering", dest="offscreenRender", action="store_false", default=True, help= "Do not do offscreen rendering (use if offscreen rendering produces a segmentation fault)" ) self.parser.add_option_group(paraview) geometry = OptionGroup(self.parser, "Geometry specification", "Options for writing out geometry files") geometry.add_option( "--geometry-type", dest="geomType", type="choice", choices=self.geomTypeTable.keys(), default=None, help="The type of the geometry-files. Possibilities are " + string.join(self.geomTypeTable.keys(), ", ") + ". Default: unset. Nothing is written") geometry.add_option( "--no-picture-with-geometry", dest="pictureWithGeometry", action="store_false", default=True, help= "Do not write a picture if geometries are written. Default is that pictures are written as well" ) geometry.add_option( "--get-sources-list", dest="sourcesList", action="store_true", default=False, help="Get a list of all the sources. Nothing is written") geometry.add_option( "--sources", dest="sources", default=[], action="append", help= "Only write sources where the name matches this substring. Can be specified more than once (will write more than one file)" ) self.parser.add_option_group(geometry) filename = OptionGroup(self.parser, "Filename specifications", "The names of the resulting files") filename.add_option("--file-prefix", dest="prefix", default="Snapshot", help="Start of the filename for the bitmap-files") filename.add_option("--no-casename", dest="casename", action="store_false", default=True, help="Do not add the casename to the filename") filename.add_option( "--no-timename", dest="timename", action="store_false", default=True, help="Do not append the string 't=<time>' to the filename") self.parser.add_option_group(filename) replace = OptionGroup(self.parser, "Replacements etc", "Manipuations of the statefile") replace.add_option( "--replacements", dest="replacements", default="{}", help="Dictionary with replacement strings. Default: %default") replace.add_option( "--casename-key", dest="casenameKey", default="casename", help= "Key with which the caename should be replaced. Default: %default") self.parser.add_option_group(replace) behaviour = OptionGroup(self.parser, "Behaviour", "General behaviour of the utility") behaviour.add_option("--verbose", dest="verbose", action="store_true", default=False, help="Print more information") self.parser.add_option_group(behaviour)
def addOptions(self): CommonSelectTimesteps.addOptions(self,defaultUnique=False) paraview=OptionGroup(self.parser, "Paraview specifications", "Options concerning paraview") paraview.add_option("--state-file", dest="state", default=None, help="The pvsm-file that should be used. If none is specified the file 'default.pvsm' in the case-directory is used") paraview.add_option("--magnification", dest="magnification", default=1, type="int", help="Magnification factor of the picture (integer). Default: %default") paraview.add_option("--type", dest="picType", type="choice", choices=self.picTypeTable.keys(), default="png", help="The type of the bitmap-file. Possibilities are "+", ".join(self.picTypeTable.keys())+". Default: %default") paraview.add_option("--no-progress", dest="progress", action="store_false", default=True, help="Paraview will not print the progress of the filters") paraview.add_option("--no-offscreen-rendering", dest="offscreenRender", action="store_false", default=True, help="Do not do offscreen rendering (use if offscreen rendering produces a segmentation fault)") if PVVersion()>=(4,2): paraview.add_option("--no-layouts", dest="doLayouts", action="store_false", default=True, help="Do not use the layouts but generate separate pictures of the view (this is the behaviour before Paraview 4.2)") self.parser.add_option_group(paraview) geometry=OptionGroup(self.parser, "Geometry specification", "Options for writing out geometry files") geometry.add_option("--geometry-type", dest="geomType", type="choice", choices=self.geomTypeTable.keys(), default=None, help="The type of the geometry-files. Possibilities are "+", ".join(self.geomTypeTable.keys())+". Default: unset. Nothing is written") geometry.add_option("--no-picture-with-geometry", dest="pictureWithGeometry", action="store_false", default=True, help="Do not write a picture if geometries are written. Default is that pictures are written as well") geometry.add_option("--get-sources-list", dest="sourcesList", action="store_true", default=False, help="Get a list of all the sources. Nothing is written") geometry.add_option("--sources", dest="sources", default=[], action="append", help="Only write sources where the name matches this substring. Can be specified more than once (will write more than one file)") self.parser.add_option_group(geometry) filename=OptionGroup(self.parser, "Filename specifications", "The names of the resulting files") filename.add_option("--file-prefix", dest="prefix", default="Snapshot", help="Start of the filename for the bitmap-files") filename.add_option("--no-casename", dest="casename", action="store_false", default=True, help="Do not add the casename to the filename") filename.add_option("--no-timename", dest="timename", action="store_false", default=True, help="Do not append the string 't=<time>' to the filename") filename.add_option("--no-color-prefix", dest="colorPrefix", action="store_false", default=True, help="Do not generate an automatic filename prefix if --colors-for-filters is used") self.parser.add_option_group(filename) replace=OptionGroup(self.parser, "Replacements etc", "Manipuations of the statefile") replace.add_option("--replacements", dest="replacements", default="{}", help="Dictionary with replacement strings. Default: %default") replace.add_option("--casename-key", dest="casenameKey", default="casename", help="Key with which the caename should be replaced. Default: %default") decoChoices=["keep","decomposed","reconstructed","auto"] replace.add_option("--decompose-mode", dest="decomposeMode", type="choice", default="auto", choices=decoChoices, help="Whether the decomposed or the reconstructed data should be used. Possible values are"+", ".join(decoChoices)+" with default value %default. 'auto' means that the data set where more time-steps are present is used. 'keep' doesn't change the mode in the state-file") replace.add_option("--list-replacements", dest="listReplacements", action="store_true", default=False, help="Print a list with all the possible replacement keys and their values for this case") replace.add_option("--add-prepare-case-parameters", dest="addPrepareCaseParameters", action="store_true", default=False, help="Add parameters from the file "+PrepareCase.parameterOutFile+" to the replacements if such a file is present in the case") self.parser.add_option_group(replace) manipulate=OptionGroup(self.parser, "Manipulation", "How the state should be manipulated before rendering a bitmap") manipulate.add_option("--colors-for-filters", dest="filterColors", default="{}", help="Dictionary which assigns colors to sources. Only working for Paraview 4.2 and higher. Note: the color function saved in the state file is used. If none is saved in the state-file a default is used (which probably is unsuitable). Default: %default. Entries are either of the form 'Clip1':'T' (then the currently used association is used) or of the form 'Clip1':('POINTS','T') or 'Clip1':('CELLS','T') then the associations are switched to point or cell values") manipulate.add_option("--no-color-bar", dest="noColorbar", action="append", default=[], help="To be used with --color-for-filters: If the source is specified here the script does not attempt to add a colorbar. Can be specified more than once") manipulate.add_option("--views-with-colorbars", dest="colorbarView", action="append", type="int", default=[], help="To be used with --color-for-filters: On which views the colorbars should be created. Can be specified more than once. If unspecified all views are used") manipulate.add_option("--default-field-for-colors", dest="defaultField", default=None, help="To be used with --color-for-filters: If the color is unspecified then this color is used") manipulate.add_option("--rescale-color-to-source", dest="rescaleToSource", default=[], action="append", help="Looks at the specified source and rescale the field that this source is colored with to the range present in the source data. Done after everything else is set up. Can be specified more than once. Only available for Paraview 4.2 and later") manipulate.add_option("--color-ranges", dest="colorRanges", default="{}", help="Dictionary with color ranges for fields. Ranges are tuples. If one of the entries is None the current minimum/maximum of the range is used. Default: %default. Example: {'T':(300,400),'U':(None,1e-3)}. Only available for Paraview 4.2 and later. If set then this value overrules --rescale-color-to-source") manipulate.add_option("--percentile-ranges", dest="percentileRanges", default="{}", help="Dictionary with percentile ranges for fields. Used together wit --rescale-color-to-source. Instead of the minimum or maximum smallest and biggest cells are ignored. This allows eliminating outliers. Ranges are tuples. If one of the entries is None then 0 or 100 is used. Default: %default. Example: {'T':(1,1),'U':(None,0.5)} means that for 'T' the lowest and highest 1% are ignored. For 'U' the highest 0.5% are ignored. Only available for Paraview 4.2 and later") self.parser.add_option_group(manipulate) behaviour=OptionGroup(self.parser, "Behaviour", "General behaviour of the utility") behaviour.add_option("--verbose", dest="verbose", action="store_true", default=False, help="Print more information") self.parser.add_option_group(behaviour)