import fluidity.diagnostics.vtutools as vtktools optionParser = optparse.OptionParser( \ usage = "%prog [OPTIONS] ... PROJECT [FIRSTID] [LASTID]", \ add_help_option = True, \ description = "Combines pvtus into vtus") optionParser.add_option("-v", "--verbose", action = "store_true", dest = "verbose", help = "Verbose mode", default = False) opts, args = optionParser.parse_args() if not opts.verbose: debug.SetDebugLevel(0) if len(args) > 3: debug.FatalError("Unrecognised trailing argument") inputProject = args[0] if len(args) == 2: try: firstId = int(args[1]) lastId = firstId except ValueError: debug.FatalError("Invalid first dump ID") if len(args) == 3: try: firstId = int(args[1]) lastId = int(args[2]) assert(lastId >= firstId) except:
try: opts, args = getopt.getopt(sys.argv[1:], "hv") except getopt.GetoptError: Help() sys.exit(-1) if not ("-v", "") in opts: debug.SetDebugLevel(0) if ("-h", "") in opts: Help() sys.exit(0) if len(args) < 2: debug.FatalError("Number of nodes and number of meshes required") try: nodeCount = int(args[0]) assert(nodeCount >= 0) except [ValueError, AssertionError]: debug.FatalError("Number of nodes must be a positive integer") try: meshCount = int(args[1]) assert(meshCount >= 0) except [ValueError, AssertionError]: debug.FatalError("Number of meshes must be a positive integer") baseMesh = meshes.Mesh(2) baseMesh.AddNodeCoords(([0.0, 0.0], [1.0, 0.0], [0.0, 1.0], [1.0, 1.0])) baseMesh.AddSurfaceElement(elements.Element([0, 1], ids = [1])) baseMesh.AddSurfaceElement(elements.Element([1, 3], ids = [2]))
try: opts, args = getopt.getopt(sys.argv[1:], "hv") except getopt.GetoptError: Help() sys.exit(-1) if not ("-v", "") in opts: debug.SetDebugLevel(0) if ("-h", "") in opts: Help() sys.exit(1) if len(args) == 0: debug.FatalError("Filename must be specified") class StatplotWindow(gtk.Window): def __init__(self, filenames): assert (len(filenames) > 0) self._filenames = filenames gtk.Window.__init__(self) self.set_title(self._filenames[-1]) self.connect("key-press-event", self._KeyPressed) self._ReadData() # Containers
optionParser = optparse.OptionParser( \ usage = "%prog [OPTIONS] ... MESH VTU", \ add_help_option = True, \ description = "Tool to decompose a vtu using a given decomposed gmsh mesh") optionParser.add_option("-v", "--verbose", action="store_true", dest="verbose", help="Verbose mode", default=False) opts, args = optionParser.parse_args() if len(args) < 2: debug.FatalError("GMSH base name and vtu name required") elif len(args) > 2: debug.FatalError("Unrecognised trailing argument") meshBasename = args[0] vtuFilename = args[1] possibleMeshBasenames = glob.glob(meshBasename + "_?*.msh") meshBasenames = [] meshIds = [] for possibleMeshBasename in possibleMeshBasenames: id = possibleMeshBasename[len(meshBasename) + 1:-4] try: id = int(id) except ValueError: continue
import fluidity.diagnostics.vtutools as vtktools optionParser = optparse.OptionParser( \ usage = "%prog [OPTIONS] ... PROJECT FIRSTID [LASTID]", \ add_help_option = True, \ description = "Combines pvtus into vtus") optionParser.add_option("-v", "--verbose", action = "store_true", dest = "verbose", help = "Verbose mode", default = False) opts, args = optionParser.parse_args() if not opts.verbose: debug.SetDebugLevel(0) if len(args) < 2: debug.FatalError("Project name required and first dump ID required") elif len(args) > 3: debug.FatalError("Unrecognised trailing argument") inputProject = args[0] try: firstId = int(args[1]) except ValueError: debug.FatalError("Invalid first dump ID") if len(args) > 2: try: lastId = int(args[2]) assert(lastId >= firstId) except: debug.FatalError("Invalid last dump ID") else: lastId = firstId