4646class ContextBase (ProxyKernelInterface ):
4747 """Common UFL -> GEM translation context."""
4848
49- keywords = ('ufl_cell' ,
50- 'fiat_cell' ,
51- 'integral_type' ,
52- 'integration_dim' ,
53- 'entity_ids' ,
54- 'argument_multiindices' ,
55- 'facetarea' ,
56- 'index_cache' ,
57- 'scalar_type' )
49+ keywords = (
50+ 'ufl_cell' ,
51+ 'fiat_cell' ,
52+ 'integral_type' ,
53+ 'integration_dim' ,
54+ 'entity_ids' ,
55+ 'argument_multiindices' ,
56+ 'facetarea' ,
57+ 'index_cache' ,
58+ 'scalar_type' ,
59+ 'use_canonical_quadrature_point_ordering' ,
60+ )
5861
5962 def __init__ (self , interface , ** kwargs ):
6063 ProxyKernelInterface .__init__ (self , interface )
@@ -112,6 +115,9 @@ def translator(self):
112115
113116 @cached_property
114117 def use_canonical_quadrature_point_ordering (self ):
118+ # Directly set use_canonical_quadrature_point_ordering = False in context
119+ # for translation of special nodes, e.g., CellVolume, FacetArea, CellOrigin, and CellVertices,
120+ # as quadrature point ordering is not relevant for those node types.
115121 return isinstance (self .fiat_cell , UFCHexahedron ) and self .integral_type in ['exterior_facet' , 'interior_facet' ]
116122
117123
@@ -161,6 +167,7 @@ def jacobian_at(self, point):
161167 expr = NegativeRestricted (expr )
162168 config = {"point_set" : PointSingleton (point )}
163169 config .update (self .config )
170+ config .update (use_canonical_quadrature_point_ordering = False ) # Not relevant.
164171 context = PointSetContext (** config )
165172 expr = self .preprocess (expr , context )
166173 return map_expr_dag (context .translator , expr )
@@ -173,6 +180,7 @@ def detJ_at(self, point):
173180 expr = NegativeRestricted (expr )
174181 config = {"point_set" : PointSingleton (point )}
175182 config .update (self .config )
183+ config .update (use_canonical_quadrature_point_ordering = False ) # Not relevant.
176184 context = PointSetContext (** config )
177185 expr = self .preprocess (expr , context )
178186 return map_expr_dag (context .translator , expr )
@@ -221,6 +229,7 @@ def physical_edge_lengths(self):
221229 expr = ufl .as_vector ([ufl .sqrt (ufl .dot (expr [i , :], expr [i , :])) for i in range (num_edges )])
222230 config = {"point_set" : PointSingleton (cell .make_points (sd , 0 , sd + 1 )[0 ])}
223231 config .update (self .config )
232+ config .update (use_canonical_quadrature_point_ordering = False ) # Not relevant.
224233 context = PointSetContext (** config )
225234 expr = self .preprocess (expr , context )
226235 return map_expr_dag (context .translator , expr )
@@ -243,6 +252,7 @@ def physical_points(self, point_set, entity=None):
243252 if entity is not None :
244253 config .update ({name : getattr (self .interface , name )
245254 for name in ["integration_dim" , "entity_ids" ]})
255+ config .update (use_canonical_quadrature_point_ordering = False ) # Not relevant.
246256 context = PointSetContext (** config )
247257 expr = self .preprocess (expr , context )
248258 mapped = map_expr_dag (context .translator , expr )
@@ -528,7 +538,7 @@ def translate_cellvolume(terminal, mt, ctx):
528538
529539 config = {name : getattr (ctx , name )
530540 for name in ["ufl_cell" , "index_cache" , "scalar_type" ]}
531- config .update (interface = interface , quadrature_degree = degree )
541+ config .update (interface = interface , quadrature_degree = degree , use_canonical_quadrature_point_ordering = False )
532542 expr , = compile_ufl (integrand , PointSetContext (** config ), point_sum = True )
533543 return expr
534544
@@ -542,7 +552,7 @@ def translate_facetarea(terminal, mt, ctx):
542552 config = {name : getattr (ctx , name )
543553 for name in ["ufl_cell" , "integration_dim" , "scalar_type" ,
544554 "entity_ids" , "index_cache" ]}
545- config .update (interface = ctx , quadrature_degree = degree )
555+ config .update (interface = ctx , quadrature_degree = degree , use_canonical_quadrature_point_ordering = False )
546556 expr , = compile_ufl (integrand , PointSetContext (** config ), point_sum = True )
547557 return expr
548558
@@ -556,7 +566,7 @@ def translate_cellorigin(terminal, mt, ctx):
556566
557567 config = {name : getattr (ctx , name )
558568 for name in ["ufl_cell" , "index_cache" , "scalar_type" ]}
559- config .update (interface = ctx , point_set = point_set )
569+ config .update (interface = ctx , point_set = point_set , use_canonical_quadrature_point_ordering = False )
560570 context = PointSetContext (** config )
561571 return context .translator (expression )
562572
@@ -569,7 +579,7 @@ def translate_cell_vertices(terminal, mt, ctx):
569579
570580 config = {name : getattr (ctx , name )
571581 for name in ["ufl_cell" , "index_cache" , "scalar_type" ]}
572- config .update (interface = ctx , point_set = ps )
582+ config .update (interface = ctx , point_set = ps , use_canonical_quadrature_point_ordering = False )
573583 context = PointSetContext (** config )
574584 expr = context .translator (ufl_expr )
575585
0 commit comments