<s> import numpy as np <EOL> import matplotlib . pyplot as plt <EOL> import sys <EOL> import getopt <EOL> import mesh . patch as patch <EOL> def makeplot ( myd , solver_name , outfile , W , H ) : <EOL> exec '<STR_LIT>' + solver_name + '<STR_LIT>' <EOL> sim = solver . Simulation ( solver_name , None , None ) <EOL> sim . cc_data = myd <EOL> plt . figure ( num = <NUM_LIT:1> , figsize = ( W , H ) , dpi = <NUM_LIT:100> , facecolor = '<STR_LIT:w>' ) <EOL> sim . dovis ( ) <EOL> plt . savefig ( outfile ) <EOL> plt . show ( ) <EOL> def usage ( ) : <EOL> usage = """<STR_LIT>""" <EOL> print usage <EOL> sys . exit ( ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> try : opts , next = getopt . getopt ( sys . argv [ <NUM_LIT:1> : ] , "<STR_LIT>" ) <EOL> except getopt . GetoptError : <EOL> sys . exit ( "<STR_LIT>" ) <EOL> outfile = "<STR_LIT>" <EOL> W = <NUM_LIT> <EOL> H = <NUM_LIT> <EOL> for o , a in opts : <EOL> if o == "<STR_LIT>" : usage ( ) <EOL> if o == "<STR_LIT>" : outfile = a <EOL> if o == "<STR_LIT>" : W = float ( a ) <EOL> if o == "<STR_LIT>" : H = float ( a ) <EOL> try : solver = next [ <NUM_LIT:0> ] <EOL> except : usage ( ) <EOL> try : file = next [ <NUM_LIT:1> ] <EOL> except : usage ( ) <EOL> myg , myd = patch . read ( file ) <EOL> makeplot ( myd , solver , outfile , W , H ) </s>
