#NEWLINE# def c_map_bcs( self , sign , is_facet ) : #NEWLINE# #INDENT# maps = as_tuple ( self . map , Map ) #NEWLINE# val = [ ] #NEWLINE# max_int = 10000000 #NEWLINE# need_bottom = False #NEWLINE# for ( i , map ) in enumerate ( maps ) : #NEWLINE# #INDENT# if ( not map . iterset . _extruded ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# for ( j , m ) in enumerate ( map ) : #NEWLINE# #INDENT# bottom_masks = None #NEWLINE# for ( location , name ) in m . implicit_bcs : #NEWLINE# #INDENT# if ( location == 'bottom' ) : #NEWLINE# #INDENT# if ( bottom_masks is None ) : #NEWLINE# #INDENT# bottom_masks = m . bottom_mask [ name ] . copy ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# bottom_masks += m . bottom_mask [ name ] #NEWLINE# #UNINDENT# need_bottom = True #NEWLINE# #UNINDENT# #UNINDENT# if ( bottom_masks is not None ) : #NEWLINE# #INDENT# for idx in range ( m . arity ) : #NEWLINE# #INDENT# if ( bottom_masks [ idx ] < 0 ) : #NEWLINE# #INDENT# val . append ( ( 'xtr_%(name)s[%(ind)s] %(sign)s= %(val)s;' % { #NEWLINE# #INDENT# 'name' : self . c_map_name ( i , j ) , #NEWLINE# 'val' : max_int , #NEWLINE# 'ind' : idx , #NEWLINE# 'sign' : sign , #NEWLINE# #UNINDENT# } ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# if need_bottom : #NEWLINE# #INDENT# val . insert ( 0 , 'if (j_0 == 0) {' ) #NEWLINE# val . append ( '}' ) #NEWLINE# #UNINDENT# need_top = False #NEWLINE# pos = len ( val ) #NEWLINE# for ( i , map ) in enumerate ( maps ) : #NEWLINE# #INDENT# if ( not map . iterset . _extruded ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# for ( j , m ) in enumerate ( map ) : #NEWLINE# #INDENT# top_masks = None #NEWLINE# for ( location , name ) in m . implicit_bcs : #NEWLINE# #INDENT# if ( location == 'top' ) : #NEWLINE# #INDENT# if ( top_masks is None ) : #NEWLINE# #INDENT# top_masks = m . top_mask [ name ] . copy ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# top_masks += idx . top_mask [ name ] #NEWLINE# #UNINDENT# need_top = True #NEWLINE# #UNINDENT# #UNINDENT# if ( top_masks is not None ) : #NEWLINE# #INDENT# facet_offset = ( m . arity if is_facet else 0 ) #NEWLINE# for idx in range ( m . arity ) : #NEWLINE# #INDENT# if ( top_masks [ idx ] < 0 ) : #NEWLINE# #INDENT# val . append ( ( 'xtr_%(name)s[%(ind)s] %(sign)s= %(val)s;' % { #NEWLINE# #INDENT# 'name' : self . c_map_name ( i , j ) , #NEWLINE# 'val' : max_int , #NEWLINE# 'ind' : ( idx + facet_offset ) , #NEWLINE# 'sign' : sign , #NEWLINE# #UNINDENT# } ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# if need_top : #NEWLINE# #INDENT# val . insert ( pos , 'if (j_0 == top_layer - 1) {' ) #NEWLINE# val . append ( '}' ) #NEWLINE# #UNINDENT# return ( '\n' . join ( val ) + '\n' )