4747class ContextBase (ProxyKernelInterface ):
4848 """Common UFL -> GEM translation context."""
4949
50- keywords = ('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' )
50+ keywords = (
51+ 'ufl_cell' ,
52+ 'fiat_cell' ,
53+ 'integral_type' ,
54+ 'integration_dim' ,
55+ 'entity_ids' ,
56+ 'argument_multiindices' ,
57+ 'facetarea' ,
58+ 'index_cache' ,
59+ 'scalar_type' ,
60+ 'use_canonical_quadrature_point_ordering' ,
61+ )
5962
6063 def __init__ (self , interface , ** kwargs ):
6164 ProxyKernelInterface .__init__ (self , interface )
@@ -113,6 +116,9 @@ def translator(self):
113116
114117 @cached_property
115118 def use_canonical_quadrature_point_ordering (self ):
119+ # Directly set use_canonical_quadrature_point_ordering = False in context
120+ # for translation of special nodes, e.g., CellVolume, FacetArea, CellOrigin, and CellVertices,
121+ # as quadrature point ordering is not relevant for those node types.
116122 return isinstance (self .fiat_cell , UFCHexahedron ) and self .integral_type in ['exterior_facet' , 'interior_facet' ]
117123
118124
@@ -162,6 +168,7 @@ def jacobian_at(self, point):
162168 expr = NegativeRestricted (expr )
163169 config = {"point_set" : PointSingleton (point )}
164170 config .update (self .config )
171+ config .update (use_canonical_quadrature_point_ordering = False ) # quad point ordering not relevant.
165172 context = PointSetContext (** config )
166173 expr = self .preprocess (expr , context )
167174 return map_expr_dag (context .translator , expr )
@@ -174,6 +181,7 @@ def detJ_at(self, point):
174181 expr = NegativeRestricted (expr )
175182 config = {"point_set" : PointSingleton (point )}
176183 config .update (self .config )
184+ config .update (use_canonical_quadrature_point_ordering = False ) # quad point ordering not relevant.
177185 context = PointSetContext (** config )
178186 expr = self .preprocess (expr , context )
179187 return map_expr_dag (context .translator , expr )
@@ -222,6 +230,7 @@ def physical_edge_lengths(self):
222230 expr = ufl .as_vector ([ufl .sqrt (ufl .dot (expr [i , :], expr [i , :])) for i in range (num_edges )])
223231 config = {"point_set" : PointSingleton (cell .make_points (sd , 0 , sd + 1 )[0 ])}
224232 config .update (self .config )
233+ config .update (use_canonical_quadrature_point_ordering = False ) # quad point ordering not relevant.
225234 context = PointSetContext (** config )
226235 expr = self .preprocess (expr , context )
227236 return map_expr_dag (context .translator , expr )
@@ -244,6 +253,7 @@ def physical_points(self, point_set, entity=None):
244253 if entity is not None :
245254 config .update ({name : getattr (self .interface , name )
246255 for name in ["integration_dim" , "entity_ids" ]})
256+ config .update (use_canonical_quadrature_point_ordering = False ) # quad point ordering not relevant.
247257 context = PointSetContext (** config )
248258 expr = self .preprocess (expr , context )
249259 mapped = map_expr_dag (context .translator , expr )
@@ -539,7 +549,7 @@ def translate_cellvolume(terminal, mt, ctx):
539549
540550 config = {name : getattr (ctx , name )
541551 for name in ["ufl_cell" , "index_cache" , "scalar_type" ]}
542- config .update (interface = interface , quadrature_degree = degree )
552+ config .update (interface = interface , quadrature_degree = degree , use_canonical_quadrature_point_ordering = False )
543553 expr , = compile_ufl (integrand , PointSetContext (** config ), point_sum = True )
544554 return expr
545555
@@ -553,7 +563,7 @@ def translate_facetarea(terminal, mt, ctx):
553563 config = {name : getattr (ctx , name )
554564 for name in ["ufl_cell" , "integration_dim" , "scalar_type" ,
555565 "entity_ids" , "index_cache" ]}
556- config .update (interface = ctx , quadrature_degree = degree )
566+ config .update (interface = ctx , quadrature_degree = degree , use_canonical_quadrature_point_ordering = False )
557567 expr , = compile_ufl (integrand , PointSetContext (** config ), point_sum = True )
558568 return expr
559569
@@ -567,7 +577,7 @@ def translate_cellorigin(terminal, mt, ctx):
567577
568578 config = {name : getattr (ctx , name )
569579 for name in ["ufl_cell" , "index_cache" , "scalar_type" ]}
570- config .update (interface = ctx , point_set = point_set )
580+ config .update (interface = ctx , point_set = point_set , use_canonical_quadrature_point_ordering = False )
571581 context = PointSetContext (** config )
572582 return context .translator (expression )
573583
@@ -580,7 +590,7 @@ def translate_cell_vertices(terminal, mt, ctx):
580590
581591 config = {name : getattr (ctx , name )
582592 for name in ["ufl_cell" , "index_cache" , "scalar_type" ]}
583- config .update (interface = ctx , point_set = ps )
593+ config .update (interface = ctx , point_set = ps , use_canonical_quadrature_point_ordering = False )
584594 context = PointSetContext (** config )
585595 expr = context .translator (ufl_expr )
586596
0 commit comments