77class  BaseFunctional :
88    """A functional.""" 
99
10+     def  __init__ (self , entity = (None , None )):
11+         self .entity  =  entity 
12+ 
1013    def  eval (self , fun ):
1114        """Apply to the functional to a function.""" 
1215        raise  NotImplementedError 
@@ -21,17 +24,17 @@ def dof_direction(self):
2124
2225    def  entity_dim (self ):
2326        """Get the dimension of the entitiy this DOF is associated with.""" 
24-         return  None 
27+         return  self . entity [ 0 ] 
2528
2629    name  =  None 
2730
2831
2932class  PointEvaluation (BaseFunctional ):
3033    """A point evaluation.""" 
3134
32-     def  __init__ (self , point , entity_dim = None ):
35+     def  __init__ (self , point , entity = (None , None )):
36+         super ().__init__ (entity )
3337        self .point  =  point 
34-         self ._entity_dim  =  entity_dim 
3538
3639    def  eval (self , function ):
3740        """Apply to the functional to a function.""" 
@@ -41,20 +44,16 @@ def dof_point(self):
4144        """Get the location of the DOF in the cell.""" 
4245        return  self .point 
4346
44-     def  entity_dim (self ):
45-         """Get the dimension of the entitiy this DOF is associated with.""" 
46-         return  self ._entity_dim 
47- 
4847    name  =  "Point evaluation" 
4948
5049
5150class  PointDirectionalDerivativeEvaluation (BaseFunctional ):
5251    """A point evaluation of a derivative in a fixed direction.""" 
5352
54-     def  __init__ (self , point , direction , entity_dim = None ):
53+     def  __init__ (self , point , direction , entity = (None , None )):
54+         super ().__init__ (entity )
5555        self .point  =  point 
5656        self .dir  =  direction 
57-         self ._entity_dim  =  entity_dim 
5857
5958    def  eval (self , function ):
6059        """Apply to the functional to a function.""" 
@@ -68,18 +67,14 @@ def dof_direction(self):
6867        """Get the direction of the DOF.""" 
6968        return  self .dir 
7069
71-     def  entity_dim (self ):
72-         """Get the dimension of the entitiy this DOF is associated with.""" 
73-         return  self ._entity_dim 
74- 
7570    name  =  "Point evaluation of directional derivative" 
7671
7772
7873class  PointNormalDerivativeEvaluation (PointDirectionalDerivativeEvaluation ):
7974    """A point evaluation of a normal derivative.""" 
8075
81-     def  __init__ (self , point , edge ):
82-         super ().__init__ (point , edge .normal (), entity_dim = edge . tdim )
76+     def  __init__ (self , point , edge ,  entity = ( None ,  None ) ):
77+         super ().__init__ (point , edge .normal (), entity = entity )
8378        self .reference  =  edge 
8479
8580    name  =  "Point evaluation of normal derivative" 
@@ -88,10 +83,10 @@ def __init__(self, point, edge):
8883class  PointComponentSecondDerivativeEvaluation (BaseFunctional ):
8984    """A point evaluation of a component of a second derivative.""" 
9085
91-     def  __init__ (self , point , component , entity_dim = None ):
86+     def  __init__ (self , point , component , entity = (None , None )):
87+         super ().__init__ (entity )
9288        self .point  =  point 
9389        self .component  =  component 
94-         self ._entity_dim  =  entity_dim 
9590
9691    def  eval (self , function ):
9792        """Apply to the functional to a function.""" 
@@ -101,20 +96,16 @@ def dof_point(self):
10196        """Get the location of the DOF in the cell.""" 
10297        return  self .point 
10398
104-     def  entity_dim (self ):
105-         """Get the dimension of the entitiy this DOF is associated with.""" 
106-         return  self ._entity_dim 
107- 
10899    name  =  "Point evaluation of Jacobian component" 
109100
110101
111102class  PointInnerProduct (BaseFunctional ):
112103    """An evaluation of an inner product at a point.""" 
113104
114-     def  __init__ (self , point , vec , entity_dim = None ):
105+     def  __init__ (self , point , vec , entity = (None , None )):
106+         super ().__init__ (entity )
115107        self .point  =  point 
116108        self .vec  =  vec 
117-         self ._entity_dim  =  entity_dim 
118109
119110    def  eval (self , function ):
120111        """Apply to the functional to a function.""" 
@@ -132,20 +123,16 @@ def dof_direction(self):
132123        """Get the location of the DOF in the cell.""" 
133124        return  self .vec 
134125
135-     def  entity_dim (self ):
136-         """Get the dimension of the entitiy this DOF is associated with.""" 
137-         return  self ._entity_dim 
138- 
139126    name  =  "Point inner product" 
140127
141128
142129class  DotPointEvaluation (BaseFunctional ):
143130    """A point evaluation in a given direction.""" 
144131
145-     def  __init__ (self , point , vector , entity_dim = None ):
132+     def  __init__ (self , point , vector , entity = (None , None )):
133+         super ().__init__ (entity )
146134        self .point  =  point 
147135        self .vector  =  vector 
148-         self ._entity_dim  =  entity_dim 
149136
150137    def  eval (self , function ):
151138        """Apply to the functional to a function.""" 
@@ -159,23 +146,22 @@ def dof_direction(self):
159146        """Get the direction of the DOF.""" 
160147        return  self .vector 
161148
162-     def  entity_dim (self ):
163-         """Get the dimension of the entitiy this DOF is associated with.""" 
164-         return  self ._entity_dim 
165- 
166149    name  =  "Dot point evaluation" 
167150
168151
169152class  IntegralMoment (BaseFunctional ):
170153    """An integral moment.""" 
171154
172-     def  __init__ (self , reference , f , dof ):
155+     def  __init__ (self , reference , f , dof , entity = (None , None )):
156+         super ().__init__ (entity )
173157        self .reference  =  reference 
174158        self .dof  =  dof 
175159        self .f  =  subs (f , x , t )
176160        if  isinstance (self .f , tuple ):
161+             # TODO: is this one of the mappings? 
177162            self .f  =  tuple (
178-                 sum (self .reference .scaled_axes ()[j ][i ] *  c  for  j , c  in  enumerate (self .f ))
163+                 sum (self .reference .axes [j ][i ] *  c  /  self .reference .jacobian ()
164+                     for  j , c  in  enumerate (self .f ))
179165                for  i , o  in  enumerate (self .reference .origin )
180166            )
181167
@@ -210,18 +196,14 @@ def dof_direction(self):
210196            for  i  in  range (self .reference .gdim )
211197        )
212198
213-     def  entity_dim (self ):
214-         """Get the dimension of the entitiy this DOF is associated with.""" 
215-         return  self .reference .tdim 
216- 
217199    name  =  "Integral moment" 
218200
219201
220202class  VecIntegralMoment (IntegralMoment ):
221203    """An integral moment applied to a component of a vector.""" 
222204
223-     def  __init__ (self , reference , f , dot_with , dof ):
224-         super ().__init__ (reference , f , dof )
205+     def  __init__ (self , reference , f , dot_with , dof ,  entity = ( None ,  None ) ):
206+         super ().__init__ (reference , f , dof ,  entity = entity )
225207        self .dot_with  =  dot_with 
226208
227209    def  dot (self , function ):
@@ -238,16 +220,16 @@ def dof_direction(self):
238220class  TangentIntegralMoment (VecIntegralMoment ):
239221    """An integral moment in the tangential direction.""" 
240222
241-     def  __init__ (self , reference , f , dof ):
242-         super ().__init__ (reference , f , reference .tangent (), dof )
223+     def  __init__ (self , reference , f , dof ,  entity = ( None ,  None ) ):
224+         super ().__init__ (reference , f , reference .tangent (), dof ,  entity = entity )
243225
244226    name  =  "Tangential integral moment" 
245227
246228
247229class  NormalIntegralMoment (VecIntegralMoment ):
248230    """An integral moment in the normal direction.""" 
249231
250-     def  __init__ (self , reference , f , dof ):
251-         super ().__init__ (reference , f , reference .normal (), dof )
232+     def  __init__ (self , reference , f , dof ,  entity = ( None ,  None ) ):
233+         super ().__init__ (reference , f , reference .normal (), dof ,  entity = entity )
252234
253235    name  =  "Normal integral moment" 
0 commit comments