Skip to content

Commit 1774acf

Browse files
committed
add create_reference function
1 parent 28b6f14 commit 1774acf

File tree

1 file changed

+23
-11
lines changed

1 file changed

+23
-11
lines changed

symfem/__init__.py

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,32 +32,44 @@
3232
_elementlist[_cell_class][_n] = _element
3333

3434

35-
def create_element(cell_type, element_type, order):
36-
"""Make a finite element.
35+
def create_reference(cell_type):
36+
"""Make a reference cell.
3737
3838
Parameters
3939
----------
4040
cell_type : str
4141
The reference cell type.
4242
Supported values: interval, triangle, quadrilateral, tetrahedron, hexahedron
43-
element_type: str
44-
The type of the element.
45-
order: int
46-
The order of the element.
4743
"""
4844
if cell_type == "interval":
49-
reference = _references.Interval()
45+
return _references.Interval()
5046
elif cell_type == "triangle":
51-
reference = _references.Triangle()
47+
return _references.Triangle()
5248
elif cell_type == "tetrahedron":
53-
reference = _references.Tetrahedron()
49+
return _references.Tetrahedron()
5450
elif cell_type == "quadrilateral":
55-
reference = _references.Quadrilateral()
51+
return _references.Quadrilateral()
5652
elif cell_type == "hexahedron":
57-
reference = _references.Hexahedron()
53+
return _references.Hexahedron()
5854
else:
5955
raise ValueError(f"Unknown cell type: {cell_type}")
6056

57+
58+
def create_element(cell_type, element_type, order):
59+
"""Make a finite element.
60+
61+
Parameters
62+
----------
63+
cell_type : str
64+
The reference cell type.
65+
Supported values: interval, triangle, quadrilateral, tetrahedron, hexahedron
66+
element_type: str
67+
The type of the element.
68+
order: int
69+
The order of the element.
70+
"""
71+
reference = create_reference(cell_type)
72+
6173
if reference.simplex:
6274
if element_type in _elementlist["simplex"]:
6375
return _elementlist["simplex"][element_type](reference, order)

0 commit comments

Comments
 (0)