351
351
# -------------------------------------------------------------------------
352
352
# FacetNormal, CellVolume, Circumradius, FacetArea (geometry.py).
353
353
# -------------------------------------------------------------------------
354
def facet_normal(self, o, *operands):
354
def facet_normal(self, o):
355
355
#print("Visiting FacetNormal:")
357
357
# Get the component
358
358
components = self.component()
361
ffc_assert(not operands, "Didn't expect any operands for FacetNormal: " + repr(operands))
362
361
ffc_assert(len(components) == 1, "FacetNormal expects 1 component index: " + repr(components))
364
363
# Handle 1D as a special case.
365
364
# FIXME: KBO: This has to change for mD elements in R^n : m < n
366
if self.geo_dim == 1: # FIXME: MSA UFL uses shape (1,) now, can we remove the special case here then?
365
if self.geo_dim == 1: # FIXME: MSA: UFL uses shape (1,) now, can we remove the special case here then?
367
366
normal_component = format["normal component"](self.restriction, "")
369
368
normal_component = format["normal component"](self.restriction, components[0])
372
371
return {():normal_component}
374
def cell_volume(self, o, *operands):
376
ffc_assert(not operands, "Didn't expect any operands for CellVolume: " + repr(operands))
373
def cell_volume(self, o):
378
374
# FIXME: KBO: This has to change for higher order elements
379
375
volume = format["cell volume"](self.restriction)
380
376
self.trans_set.add(volume)
382
378
return {():volume}
384
def circumradius(self, o, *operands):
386
ffc_assert(not operands, "Didn't expect any operands for Circumradius: " + repr(operands))
380
def circumradius(self, o):
388
381
# FIXME: KBO: This has to change for higher order elements
389
382
circumradius = format["circumradius"](self.restriction)
390
383
self.trans_set.add(circumradius)
392
385
return {():circumradius}
394
def facet_area(self, o, *operands):
396
ffc_assert(not operands, "Didn't expect any operands for FacetArea: " + repr(operands))
387
def facet_area(self, o):
398
388
# FIXME: KBO: This has to change for higher order elements
399
389
# NOTE: Omitting restriction because the area of a facet is the same
632
622
def _count_operations(self, expression):
633
623
return operation_count(expression, format)
635
def _create_entry_data(self, val):
625
def _create_entry_data(self, val, domain_type):
636
626
# Multiply value by weight and determinant
637
627
# Create weight and scale factor.
638
628
weight = format["weight"](self.points)
639
629
if self.points > 1:
640
630
weight += format["component"]("", format["integration points"])
641
f_scale_factor = format["scale factor"]
643
632
# Update sets of used variables.
644
trans_set = set([f_scale_factor])
633
if domain_type == "point":
635
value = format["mul"]([val, weight])
637
f_scale_factor = format["scale factor"]
638
trans_set = set([f_scale_factor])
639
value = format["mul"]([val, weight, f_scale_factor])
645
641
trans_set.update(self.trans_set)
646
642
used_points = set([self.points])
647
value = format["mul"]([val, weight, f_scale_factor])
648
643
ops = self._count_operations(value)
649
644
used_psi_tables = set([v for k, v in self.psi_tables_map.items()])