#NEWLINE# def _read_plot3d_shape( stream , multiblock , dim , logger ) : #NEWLINE# #INDENT# ' Returns a list of zone dimensions from Plot3D `stream`. ' #NEWLINE# if multiblock : #NEWLINE# #INDENT# nblocks = stream . read_int ( full_record = True ) #NEWLINE# if ( ( nblocks < 1 ) or ( nblocks > 1000 ) ) : #NEWLINE# #INDENT# raise RuntimeError ( ( 'bad nblocks %d' % nblocks ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# nblocks = 1 #NEWLINE# #UNINDENT# logger . debug ( '    nblocks %d' , nblocks ) #NEWLINE# if stream . unformatted : #NEWLINE# #INDENT# reclen = stream . read_recordmark ( ) #NEWLINE# expected = stream . reclen_ints ( ( dim * nblocks ) ) #NEWLINE# if ( reclen != expected ) : #NEWLINE# #INDENT# logger . warning ( 'unexpected dimensions recordlength %d vs. %d' , reclen , expected ) #NEWLINE# #UNINDENT# #UNINDENT# shape = [ ] #NEWLINE# for i in range ( imax ) : #NEWLINE# #INDENT# ( imax , jmax , kmax ) = _read_plot3d_dims ( stream , dim ) #NEWLINE# if ( dim > 2 ) : #NEWLINE# #INDENT# shape . append ( ( imax , jmax , kmax ) ) #NEWLINE# logger . debug ( '    block %d: %dx%dx%d' , ( i + 1 ) , imax , jmax , kmax ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# shape . append ( ( imax , jmax ) ) #NEWLINE# logger . debug ( '    block %d: %dx%d' , ( i + 1 ) , imax , jmax ) #NEWLINE# #UNINDENT# #UNINDENT# if stream . unformatted : #NEWLINE# #INDENT# reclen2 = stream . read_recordmark ( ) #NEWLINE# if ( reclen2 != reclen ) : #NEWLINE# #INDENT# logger . warning ( 'mismatched dimensions recordlength %d vs. %d' , reclen2 , reclen ) #NEWLINE# #UNINDENT# #UNINDENT# return shape