1919# You should have received a copy of the GNU Lesser General Public License
2020# along with FFC. If not, see <http://www.gnu.org/licenses/>.
2121
22- from functools import singledispatch , partial
2322import weakref
23+ from functools import partial , singledispatch
2424
2525import FIAT
2626import finat
27- import ufl
2827import finat .ufl
29-
28+ import ufl
3029
3130__all__ = ("as_fiat_cell" , "create_base_element" ,
3231 "create_element" , "supported_elements" )
5251 "Hermite" : finat .Hermite ,
5352 "Kong-Mulder-Veldhuizen" : finat .KongMulderVeldhuizen ,
5453 "Argyris" : finat .Argyris ,
54+ "Hsieh-Clough-Tocher" : finat .HsiehCloughTocher ,
55+ "Reduced-Hsieh-Clough-Tocher" : finat .ReducedHsiehCloughTocher ,
5556 "Mardal-Tai-Winther" : finat .MardalTaiWinther ,
5657 "Morley" : finat .Morley ,
5758 "Bell" : finat .Bell ,
@@ -144,12 +145,10 @@ def convert_finiteelement(element, **kwargs):
144145 kind = 'spectral' # default variant
145146
146147 if element .family () == "Lagrange" :
147- if kind == 'equispaced' :
148- lmbda = finat .Lagrange
149- elif kind == 'spectral' :
148+ if kind == 'spectral' :
150149 lmbda = finat .GaussLobattoLegendre
151- elif kind == 'integral' :
152- lmbda = finat .IntegratedLegendre
150+ elif kind . startswith ( 'integral' ) :
151+ lmbda = partial ( finat .IntegratedLegendre , variant = kind )
153152 elif kind in ['fdm' , 'fdm_ipdg' ] and is_interval :
154153 lmbda = finat .FDMLagrange
155154 elif kind == 'fdm_quadrature' and is_interval :
@@ -167,17 +166,16 @@ def convert_finiteelement(element, **kwargs):
167166 deps = {"shift_axes" , "restriction" }
168167 return finat .RuntimeTabulated (cell , degree , variant = kind , shift_axes = shift_axes , restriction = restriction ), deps
169168 else :
170- raise ValueError ("Variant %r not supported on %s" % (kind , element .cell ))
169+ # Let FIAT handle the general case
170+ lmbda = partial (finat .Lagrange , variant = kind )
171171 elif element .family () in {"Raviart-Thomas" , "Nedelec 1st kind H(curl)" ,
172172 "Brezzi-Douglas-Marini" , "Nedelec 2nd kind H(curl)" }:
173173 lmbda = partial (lmbda , variant = element .variant ())
174174 elif element .family () in ["Discontinuous Lagrange" , "Discontinuous Lagrange L2" ]:
175- if kind == 'equispaced' :
176- lmbda = finat .DiscontinuousLagrange
177- elif kind == 'spectral' :
175+ if kind == 'spectral' :
178176 lmbda = finat .GaussLegendre
179- elif kind == 'integral' :
180- lmbda = finat .Legendre
177+ elif kind . startswith ( 'integral' ) :
178+ lmbda = partial ( finat .Legendre , variant = kind )
181179 elif kind in ['fdm' , 'fdm_quadrature' ] and is_interval :
182180 lmbda = finat .FDMDiscontinuousLagrange
183181 elif kind == 'fdm_ipdg' and is_interval :
@@ -191,7 +189,8 @@ def convert_finiteelement(element, **kwargs):
191189 deps = {"shift_axes" , "restriction" }
192190 return finat .RuntimeTabulated (cell , degree , variant = kind , shift_axes = shift_axes , restriction = restriction , continuous = False ), deps
193191 else :
194- raise ValueError ("Variant %r not supported on %s" % (kind , element .cell ))
192+ # Let FIAT handle the general case
193+ lmbda = partial (finat .DiscontinuousLagrange , variant = kind )
195194 elif element .family () == ["DPC" , "DPC L2" ]:
196195 if element .cell .geometric_dimension () == 2 :
197196 element = element .reconstruct (cell = ufl .cell .hypercube (2 ))
0 commit comments