On 7 July 2010 20:22, Garth N. Wells <gn...@cam.ac.uk> wrote: > > > On 07/07/10 20:14, Anders Logg wrote: >> >> On Wed, Jul 07, 2010 at 06:26:20PM +0100, Kristian Oelgaard wrote: >>> >>> Supporting CellVolume makes it possible to do: >>> >>> CG = FiniteElement("Lagrange", triangle, 2) >>> DG = FiniteElement("DG", triangle, 0) >>> v = TestFunction(DG) >>> f = Coefficient(CG) >>> vol = triangle.v >> >> Would it be better to call it vol or volume instead of v? Or does it >> have to be a one-letter word? >> > > . . . or call it 'volume'.
It can be whatever we want, I just followed what was already there. Should we then rename 'd', 'n' and 'x' to 'geometric_dimension', 'facet_normal', and 'spatial_coordinate' while we're at it? Kristian > Garth > >> -- >> Anders >> >> >>> L = 1.0/vol*v*f*dx >>> >>> instead of using a Coefficient for 'vol' and then defining an >>> Expression in DOLFIN. >>> >>> Currently, it will use the absolute value of the determinant of the >>> Jacobian in tabulate_tensor ( std::abs(detJ) ). >>> >>> Kristian >>> >>> On 7 July 2010 18:19,<nore...@launchpad.net> wrote: >>>> >>>> ------------------------------------------------------------ >>>> revno: 1498 >>>> committer: Kristian B. Ølgaard<k.b.oelga...@gmail.com> >>>> branch nick: ffc >>>> timestamp: Wed 2010-07-07 18:17:07 +0100 >>>> message: >>>> Added support for CellVolume from UFL. >>>> modified: >>>> ChangeLog >>>> ffc/quadrature/optimisedquadraturetransformer.py >>>> ffc/quadrature/quadraturetransformer.py >>>> ffc/quadrature/quadraturetransformerbase.py >>>> >>>> >>>> >>>> Your team FFC Core Team is subscribed to branch lp:ffc. >>>> To unsubscribe from this branch go to >>>> https://code.launchpad.net/~ffc-core/ffc/main/+edit-subscription >>>> >>>> === modified file 'ChangeLog' >>>> --- ChangeLog 2010-07-01 17:43:36 +0000 >>>> +++ ChangeLog 2010-07-07 17:17:07 +0000 >>>> @@ -1,3 +1,4 @@ >>>> + - Added support for new geometric quantity CellVolume in UFL. >>>> 0.9.3 [2010-07-01] >>>> - Make global_dimension for Real return an int instead of double, bug # >>>> 592088 >>>> - Add support for facet normal in 1D. >>>> >>>> === modified file 'ffc/quadrature/optimisedquadraturetransformer.py' >>>> --- ffc/quadrature/optimisedquadraturetransformer.py 2010-07-01 >>>> 17:41:40 +0000 >>>> +++ ffc/quadrature/optimisedquadraturetransformer.py 2010-07-07 >>>> 17:17:07 +0000 >>>> @@ -187,7 +187,7 @@ >>>> return {():new_val} >>>> >>>> # >>>> ------------------------------------------------------------------------- >>>> - # FacetNormal (geometry.py). >>>> + # FacetNormal, CellVolume (geometry.py). >>>> # >>>> ------------------------------------------------------------------------- >>>> def facet_normal(self, o, *operands): >>>> #print("Visiting FacetNormal:") >>>> @@ -216,6 +216,17 @@ >>>> >>>> return {(): create_symbol(normal_component, GEO)} >>>> >>>> + def cell_volume(self, o, *operands): >>>> + # Safety check. >>>> + ffc_assert(not operands, "Didn't expect any operands for >>>> FacetNormal: " + repr(operands)) >>>> + >>>> + # FIXME: KBO: This has to change for higher order elements >>>> + detJ = format["det(J)"](self.restriction) >>>> + volume = format["absolute value"](detJ) >>>> + self.trans_set.add(detJ) >>>> + >>>> + return {():create_symbol(volume, GEO)} >>>> + >>>> def create_argument(self, ufl_argument, derivatives, component, >>>> local_comp, >>>> local_offset, ffc_element, transformation, >>>> multiindices): >>>> "Create code for basis functions, and update relevant tables of >>>> used basis." >>>> >>>> === modified file 'ffc/quadrature/quadraturetransformer.py' >>>> --- ffc/quadrature/quadraturetransformer.py 2010-06-30 09:59:49 >>>> +0000 >>>> +++ ffc/quadrature/quadraturetransformer.py 2010-07-07 17:17:07 >>>> +0000 >>>> @@ -262,7 +262,7 @@ >>>> return {():f_abs(operands[0][()])} >>>> >>>> # >>>> ------------------------------------------------------------------------- >>>> - # FacetNormal (geometry.py). >>>> + # FacetNormal, CellVolume (geometry.py). >>>> # >>>> ------------------------------------------------------------------------- >>>> def facet_normal(self, o, *operands): >>>> #print("Visiting FacetNormal:") >>>> @@ -291,6 +291,18 @@ >>>> >>>> return {():normal_component} >>>> >>>> + def cell_volume(self, o, *operands): >>>> + # Safety check. >>>> + ffc_assert(not operands, "Didn't expect any operands for >>>> CellVolume: " + repr(operands)) >>>> + >>>> + # FIXME: KBO: This has to change for higher order elements >>>> + detJ = format["det(J)"](self.restriction) >>>> + volume = format["absolute value"](detJ) >>>> + self.trans_set.add(detJ) >>>> + >>>> + return {():volume} >>>> + >>>> + >>>> def create_argument(self, ufl_argument, derivatives, component, >>>> local_comp, >>>> local_offset, ffc_element, transformation, >>>> multiindices): >>>> "Create code for basis functions, and update relevant tables of >>>> used basis." >>>> >>>> === modified file 'ffc/quadrature/quadraturetransformerbase.py' >>>> --- ffc/quadrature/quadraturetransformerbase.py 2010-07-01 17:41:40 >>>> +0000 >>>> +++ ffc/quadrature/quadraturetransformerbase.py 2010-07-07 17:17:07 >>>> +0000 >>>> @@ -250,12 +250,16 @@ >>>> error("This object should be implemented by the child class.") >>>> >>>> # >>>> ------------------------------------------------------------------------- >>>> - # FacetNormal (geometry.py). >>>> + # FacetNormal, CellVolume (geometry.py). >>>> # >>>> ------------------------------------------------------------------------- >>>> def facet_normal(self, o, *operands): >>>> print "\n\nVisiting FacetNormal: ", repr(o) >>>> error("This object should be implemented by the child class.") >>>> >>>> + def cell_volume(self, o, *operands): >>>> + print "\n\nVisiting CellVolume: ", repr(o) >>>> + error("This object should be implemented by the child class.") >>>> + >>>> # >>>> ------------------------------------------------------------------------- >>>> # Things that can be handled by the base class. >>>> # >>>> ------------------------------------------------------------------------- >>>> >>>> >>>> >>> >>> _______________________________________________ >>> Mailing list: https://launchpad.net/~ffc >>> Post to : ffc@lists.launchpad.net >>> Unsubscribe : https://launchpad.net/~ffc >>> More help : https://help.launchpad.net/ListHelp >>> >>> >>> _______________________________________________ >>> Mailing list: https://launchpad.net/~ffc >>> Post to : ffc@lists.launchpad.net >>> Unsubscribe : https://launchpad.net/~ffc >>> More help : https://help.launchpad.net/ListHelp > _______________________________________________ Mailing list: https://launchpad.net/~ffc Post to : ffc@lists.launchpad.net Unsubscribe : https://launchpad.net/~ffc More help : https://help.launchpad.net/ListHelp