warp.fem.scalar_type#

warp.fem.scalar_type = <warp._src.fem.operator.Operator object>#

Return the scalar type (warp.float32 or warp.float64) for the current geometry.

Resolved at integrand transformation time to a type constructor, so it can be used to create precision-correct scalar literals. Accepts either a Domain or a Field argument:

@fem.integrand
def my_form(s: fem.Sample, domain: fem.Domain, u: fem.Field):
    half = fem.scalar_type(domain)(0.5)
    # or equivalently:
    half = fem.scalar_type(u)(0.5)