~chaffra/ffc/main-old

« back to all changes in this revision

Viewing changes to ffc/quadrature/quadraturetransformer.py

  • Committer: Chaffra Affouda
  • Date: 2013-03-17 13:09:45 UTC
  • mfrom: (1675.1.153 work)
  • Revision ID: chaffra@gmail.com-20130317130945-6znd0m92hslnarkb
commit to trunk r1828

Show diffs side-by-side

added added

removed removed

Lines of Context:
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:")
356
356
 
357
357
        # Get the component
358
358
        components = self.component()
359
359
 
360
360
        # Safety check.
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))
363
362
 
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, "")
368
367
        else:
369
368
            normal_component = format["normal component"](self.restriction, components[0])
371
370
 
372
371
        return {():normal_component}
373
372
 
374
 
    def cell_volume(self, o,  *operands):
375
 
        # Safety check.
376
 
        ffc_assert(not operands, "Didn't expect any operands for CellVolume: " + repr(operands))
377
 
 
 
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)
381
377
 
382
378
        return {():volume}
383
379
 
384
 
    def circumradius(self, o,  *operands):
385
 
        # Safety check.
386
 
        ffc_assert(not operands, "Didn't expect any operands for Circumradius: " + repr(operands))
387
 
 
 
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)
391
384
 
392
385
        return {():circumradius}
393
386
 
394
 
    def facet_area(self, o,  *operands):
395
 
        # Safety check.
396
 
        ffc_assert(not operands, "Didn't expect any operands for FacetArea: " + repr(operands))
397
 
 
 
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
400
390
        # on both sides.
632
622
    def _count_operations(self, expression):
633
623
        return operation_count(expression, format)
634
624
 
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"]
642
631
 
643
632
        # Update sets of used variables.
644
 
        trans_set = set([f_scale_factor])
 
633
        if domain_type == "point":
 
634
            trans_set = set()
 
635
            value = format["mul"]([val, weight])
 
636
        else:
 
637
            f_scale_factor = format["scale factor"]
 
638
            trans_set = set([f_scale_factor])
 
639
            value = format["mul"]([val, weight, f_scale_factor])
 
640
 
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()])
650
645