#NEWLINE# def _write_plot3d_dims( domain , stream , logger , varnames = None ) : #NEWLINE# #INDENT# ' Write dimensions of each zone to Plot3D stream. ' #NEWLINE# if isinstance ( domain , DomainObj ) : #NEWLINE# #INDENT# writing_domain = True #NEWLINE# zones = domain . zones #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# writing_domain = False #NEWLINE# zones = [ domain ] #NEWLINE# #UNINDENT# dim = 0 #NEWLINE# for zone in zones : #NEWLINE# #INDENT# if writing_domain : #NEWLINE# #INDENT# name = domain . zone_name ( zone ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# name = 'zone' #NEWLINE# #UNINDENT# shape = zone . shape #NEWLINE# if ( not dim ) : #NEWLINE# #INDENT# dim = len ( shape ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( dim != len ( shape ) ) : #NEWLINE# #INDENT# raise ValueError ( ( 'zone %r is not %dD' % ( name , dim ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# if ( dim > 2 ) : #NEWLINE# #INDENT# ( imax , jmax , kmax ) = shape #NEWLINE# logger . debug ( '    %s: %dx%dx%d' , name , imax , jmax , kmax ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( dim > 1 ) : #NEWLINE# #INDENT# ( imax , jmax ) = shape #NEWLINE# logger . debug ( '    %s: %dx%d' , name , imax , jmax ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise RuntimeError ( 'domain must be at least 2D' ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# nvars = 0 #NEWLINE# if varnames : #NEWLINE# #INDENT# flow = zones [ 0 ] . flow_solution #NEWLINE# for name in varnames : #NEWLINE# #INDENT# obj = getattr ( flow , name ) #NEWLINE# nvars += ( dim if isinstance ( obj , Vector ) else 1 ) #NEWLINE# #UNINDENT# #UNINDENT# if stream . unformatted : #NEWLINE# #INDENT# count = len ( shape ) #NEWLINE# if nvars : #NEWLINE# #INDENT# count += 1 #NEWLINE# #UNINDENT# reclen = ( len ( zones ) * stream . reclen_ints ( count ) ) #NEWLINE# stream . write_recordmark ( reclen ) #NEWLINE# #UNINDENT# for zone in zones : #NEWLINE# #INDENT# shape = list ( zone . shape ) #NEWLINE# if nvars : #NEWLINE# #INDENT# shape . append ( nvars ) #NEWLINE# #UNINDENT# stream . write_ints ( numpy . array ( shape , dtype = numpy . int32 ) ) #NEWLINE# #UNINDENT# if stream . unformatted : #NEWLINE# #INDENT# stream . write_recordmark ( reclen )