MCPcopy Create free account
hub / github.com/FEniCS/dolfinx / form_cpp_class

Function form_cpp_class

python/dolfinx/fem/forms.py:205–234  ·  view source on GitHub ↗

Wrapped C++ class of a variational form of a specific scalar type. Args: dtype: Scalar type of the required form class. Returns: Wrapped C++ form class of the requested type. Note: This function is for advanced usage, typically when writing custom kerne

(
    dtype: npt.DTypeLike,
)

Source from the content-addressed store, hash-verified

203
204
205def form_cpp_class(
206 dtype: npt.DTypeLike,
207) -> (
208 _cpp.fem.Form_float32
209 | _cpp.fem.Form_float64
210 | _cpp.fem.Form_complex64
211 | _cpp.fem.Form_complex128
212):
213 """Wrapped C++ class of a variational form of a specific scalar type.
214
215 Args:
216 dtype: Scalar type of the required form class.
217
218 Returns:
219 Wrapped C++ form class of the requested type.
220
221 Note:
222 This function is for advanced usage, typically when writing
223 custom kernels using Numba or C.
224 """
225 if np.issubdtype(dtype, np.float32):
226 return _cpp.fem.Form_float32
227 elif np.issubdtype(dtype, np.float64):
228 return _cpp.fem.Form_float64
229 elif np.issubdtype(dtype, np.complex64):
230 return _cpp.fem.Form_complex64
231 elif np.issubdtype(dtype, np.complex128):
232 return _cpp.fem.Form_complex128
233 else:
234 raise NotImplementedError(f"Type {dtype} not supported.")
235
236
237_ufl_to_dolfinx_domain = {

Callers 6

test_incorrect_elementFunction · 0.90
test_numba_assemblyFunction · 0.90
test_coefficientFunction · 0.90
mixed_topology_formFunction · 0.85
formFunction · 0.85

Calls

no outgoing calls

Tested by 3

test_incorrect_elementFunction · 0.72
test_numba_assemblyFunction · 0.72
test_coefficientFunction · 0.72