<s> """<STR_LIT>""" <EOL> import os . path <EOL> import shutil <EOL> import sys <EOL> if '<STR_LIT:.>' not in sys . path : <EOL> sys . path . append ( '<STR_LIT:.>' ) <EOL> from numpy import float32 , zeros <EOL> import axod as axod <EOL> from openmdao . main . api import Component , Container <EOL> from openmdao . main . datatypes . api import Float , Array , Str <EOL> from datain import Datain <EOL> __all__ = ( '<STR_LIT>' , ) <EOL> _ZEROS48 = zeros ( ( <NUM_LIT> , ) , float32 ) <EOL> _ZEROS5 = zeros ( ( <NUM_LIT:5> , ) , float32 ) <EOL> _case = int ( <NUM_LIT:0> ) <EOL> _stage = int ( <NUM_LIT:0> ) <EOL> nml_name = Str ( '<STR_LIT>' ) <EOL> _nstages = int ( <NUM_LIT:1> ) <EOL> _ncases = int ( <NUM_LIT:1> ) <EOL> class Case ( Container ) : <EOL> title1 = Str ( ) <EOL> title2 = Str ( ) <EOL> oline = Str ( ) <EOL> def __init__ ( self ) : <EOL> super ( Case , self ) . __init__ ( ) <EOL> self . _stages = [ ] <EOL> def read ( self , stream ) : <EOL> """<STR_LIT>""" <EOL> line = stream . readline ( ) <EOL> if not line : <EOL> return False <EOL> self . title1 = line <EOL> line = stream . readline ( ) <EOL> if not line : <EOL> return False <EOL> self . title2 = line <EOL> pos = stream . tell ( ) <EOL> line = stream . readline ( ) <EOL> while line and '<STR_LIT>' in line : <EOL> stagein = Datain ( ) <EOL> if stagein . read ( stream ) : <EOL> stage_num = len ( self . _stages ) + <NUM_LIT:1> <EOL> self . add ( '<STR_LIT>' % stage_num , stagein ) <EOL> self . _stages . append ( stagein ) <EOL> if stagein . endjob : <EOL> return <NUM_LIT:0> <EOL> if stagein . endstg : <EOL> return <NUM_LIT:1> <EOL> else : <EOL> return - <NUM_LIT:1> <EOL> pos = stream . tell ( ) <EOL> line = stream . readline ( ) <EOL> if line : <EOL> stream . seek ( os . SEEK_SET , pos ) <EOL> return <NUM_LIT:1> <EOL> def write ( self , stream ) : <EOL> stream . write ( self . title1 ) <EOL> stream . write ( self . title2 ) <EOL> for stagein in self . _stages : <EOL> stagein . write ( stream ) <EOL> class AxodCompn ( Component ) : <EOL> """<STR_LIT>""" <EOL> input_filename = Str ( iotype = '<STR_LIT>' ) <EOL> results = [ ] <EOL> hpower = Float ( iotype = '<STR_LIT>' , units = '<STR_LIT>' ) <EOL> tott = Array ( _ZEROS48 , dtype = float32 , shape = ( <NUM_LIT> , ) , iotype = '<STR_LIT>' ) <EOL> totp = Array ( _ZEROS48 , dtype = float32 , shape = ( <NUM_LIT> , ) , iotype = '<STR_LIT>' ) <EOL> mflow = Array ( _ZEROS48 , dtype = float32 , shape = ( <NUM_LIT> , ) , iotype = '<STR_LIT>' ) <EOL> effs = Array ( _ZEROS48 , dtype = float32 , shape = ( <NUM_LIT> , ) , iotype = '<STR_LIT>' ) <EOL> effr = Array ( _ZEROS48 , dtype = float32 , shape = ( <NUM_LIT> , ) , iotype = '<STR_LIT>' ) <EOL> def __init__ ( self , input_filename = '<STR_LIT>' ) : <EOL> super ( AxodCompn , self ) . __init__ ( ) <EOL> self . input_filename = input_filename <EOL> self . out_filename = self . input_filename + '<STR_LIT:O>' <EOL> self . ncases = _ncases <EOL> self . _cases = [ ] <EOL> def read_input ( self , infilename ) : <EOL> inp = open ( infilename , '<STR_LIT:r>' ) <EOL> status = <NUM_LIT:1> <EOL> while status == <NUM_LIT:1> : <EOL> casein = Case ( ) <EOL> status = casein . read ( inp ) <EOL> if status >= <NUM_LIT:0> : <EOL> self . add ( '<STR_LIT>' % self . ncases , casein ) <EOL> self . _cases . append ( casein ) <EOL> self . ncases = self . ncases + <NUM_LIT:1> <EOL> inp . close ( ) <EOL> def write_input ( self , outfname ) : <EOL> outp = open ( outfname , '<STR_LIT:w>' ) <EOL> for casein in self . _cases : <EOL> casein . write ( outp ) <EOL> outp . close ( ) <EOL> def configure ( self ) : <EOL> with self . dir_context : <EOL> self . read_input ( self . input_filename ) <EOL> def execute ( self ) : <EOL> """<STR_LIT>""" <EOL> if os . path . exists ( '<STR_LIT>' ) : <EOL> os . remove ( '<STR_LIT>' ) <EOL> self . results = [ ] <EOL> self . write_input ( self . out_filename ) <EOL> self . _logger . debug ( '<STR_LIT>' ) <EOL> try : <EOL> shutil . copyfile ( self . out_filename , '<STR_LIT>' ) <EOL> ( self . hpower , self . tott , self . totp , <EOL> self . mflow , self . effs , self . effr ) = axod . axod ( ) <EOL> except Exception , exc : <EOL> self . raise_exception ( str ( exc ) , type ( exc ) ) <EOL> self . _logger . debug ( '<STR_LIT>' ) <EOL> if os . path . exists ( '<STR_LIT>' ) : <EOL> inp = open ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . results = inp . readlines ( ) <EOL> inp . close ( ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> one = AxodCompn ( input_filename = '<STR_LIT>' ) <EOL> one . Case1 . Stage1 . ptin = <NUM_LIT> <EOL> one . Case1 . Stage1 . ttin = <NUM_LIT> <EOL> one . Case1 . Stage1 . vctd = <NUM_LIT:1.0> <EOL> one . Case1 . Stage1 . rwg = [ <NUM_LIT:1.0> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] <EOL> one . Case1 . Stage2 . rwg = [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] <EOL> one . Case1 . Stage1 . seta = [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] <EOL> one . Case1 . Stage1 . rpm = <NUM_LIT> <EOL> one . Case3 . Stage1 . rpm = <NUM_LIT> <EOL> one . run ( ) </s>
