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,
)
| 203 | |
| 204 | |
| 205 | def 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 = { |
no outgoing calls