@@ -339,6 +339,11 @@ def reconstruct(self, **kwargs: typing.Any) -> Cell:
339
339
raise TypeError (f"reconstruct() got unexpected keyword argument '{ key } '" )
340
340
return Cell (self ._cellname )
341
341
342
+ @property
343
+ def cells (self ):
344
+ """Return the component cells."""
345
+ return (self ,)
346
+
342
347
343
348
class TensorProductCell (AbstractCell ):
344
349
"""Tensor product cell."""
@@ -440,6 +445,11 @@ def reconstruct(self, **kwargs: typing.Any) -> AbstractCell:
440
445
raise TypeError (f"reconstruct() got unexpected keyword argument '{ key } '" )
441
446
return TensorProductCell (* self ._cells )
442
447
448
+ @property
449
+ def cells (self ):
450
+ """Return the component cells."""
451
+ return (self ,)
452
+
443
453
444
454
def simplex (topological_dimension : int ):
445
455
"""Return a simplex cell of the given dimension."""
@@ -484,3 +494,107 @@ def as_cell(cell: AbstractCell | str | tuple[AbstractCell, ...]) -> AbstractCell
484
494
return TensorProductCell (* cell )
485
495
else :
486
496
raise ValueError (f"Invalid cell { cell } ." )
497
+
498
+
499
+ class CellSequence (AbstractCell ):
500
+ """Representation of a named finite element cell with known structure."""
501
+
502
+ __slots__ = (
503
+ "_cells" ,
504
+ "_tdim" ,
505
+ )
506
+
507
+ def __init__ (self , cells ):
508
+ """Initialise.
509
+
510
+ Args:
511
+ cellname: Name of the cell
512
+ """
513
+ self ._cells = cells
514
+ #self._tdim = len(self._sub_entity_celltypes) - 1
515
+
516
+ def topological_dimension (self ) -> int :
517
+ """Return the dimension of the topology of this cell."""
518
+ #return self._tdim
519
+ raise RuntimeError (f"Should not call this method on { type (self )} " )
520
+
521
+ def is_simplex (self ) -> bool :
522
+ """Return True if this is a simplex cell."""
523
+ #return self._cellname in ["vertex", "interval", "triangle", "tetrahedron"]
524
+ raise RuntimeError (f"Should not call this method on { type (self )} " )
525
+
526
+ def has_simplex_facets (self ) -> bool :
527
+ """Return True if all the facets of this cell are simplex cells."""
528
+ #return self._cellname in ["interval", "triangle", "quadrilateral", "tetrahedron"]
529
+ raise RuntimeError (f"Should not call this method on { type (self )} " )
530
+
531
+ def num_sub_entities (self , dim : int ) -> int :
532
+ """Get the number of sub-entities of the given dimension."""
533
+ #if dim < 0:
534
+ # return 0
535
+ #try:
536
+ # return self._num_cell_entities[dim]
537
+ #except IndexError:
538
+ # return 0
539
+ raise RuntimeError (f"Should not call this method on { type (self )} " )
540
+
541
+ def sub_entities (self , dim : int ) -> typing .Tuple [AbstractCell , ...]:
542
+ """Get the sub-entities of the given dimension."""
543
+ #if dim < 0:
544
+ # return ()
545
+ #try:
546
+ # return self._sub_entities[dim]
547
+ #except IndexError:
548
+ # return ()
549
+ raise RuntimeError (f"Should not call this method on { type (self )} " )
550
+
551
+ def sub_entity_types (self , dim : int ) -> typing .Tuple [AbstractCell , ...]:
552
+ """Get the unique sub-entity types of the given dimension."""
553
+ #if dim < 0:
554
+ # return ()
555
+ #try:
556
+ # return self._sub_entity_types[dim]
557
+ #except IndexError:
558
+ # return ()
559
+ raise RuntimeError (f"Should not call this method on { type (self )} " )
560
+
561
+ def _lt (self , other ) -> bool :
562
+ #return self._cellname < other._cellname
563
+ raise RuntimeError (f"Should not call this method on { type (self )} " )
564
+
565
+ def cellname (self ) -> str :
566
+ """Return the cellname of the cell."""
567
+ #return self._cellname
568
+ raise RuntimeError (f"Should not call this method on { type (self )} " )
569
+
570
+ def reconstruct (self , ** kwargs : typing .Any ) -> CellSequence :
571
+ """Reconstruct this cell, overwriting properties by those in kwargs."""
572
+ #for key, value in kwargs.items():
573
+ # raise TypeError(f"reconstruct() got unexpected keyword argument '{key}'")
574
+ #return Cell(self._cellname)
575
+ raise RuntimeError (f"Should not call this method on { type (self )} " )
576
+
577
+ def __repr__ (self ):
578
+ """Representation."""
579
+ return "CellSequence(%s)" % (repr (self ._cells ),)
580
+
581
+ def __str__ (self ):
582
+ """Format as a string."""
583
+ return "<CellSequence #%s>" % (self ._cells ,)
584
+
585
+ def _ufl_hash_data_ (self ):
586
+ """UFL hash data."""
587
+ return ("CellSequence" , tuple (c ._ufl_hash_data_ () for c in self ._cells ))
588
+
589
+ def _ufl_signature_data_ (self , renumbering ):
590
+ """UFL signature data."""
591
+ return ("CellSequence" , tuple (c ._ufl_signature_data_ (renumbering ) for c in self ._cells ))
592
+
593
+ def _ufl_sort_key_ (self ):
594
+ """UFL sort key."""
595
+ return ("CellSequence" , tuple (c ._ufl_sort_key_ () for c in self ._cells ))
596
+
597
+ @property
598
+ def cells (self ):
599
+ """Return the component cells."""
600
+ return self ._cells
0 commit comments