Coefficient in DOLDINx

Sorry it’s me again. I want to ask a quastion about the Forms in DOLDINx.

For old dolfin, there is the function “set_coefficient”, which can be used to assign the functions to the coefficiens of the forms. While for DOLFINx, it seems there is no such functional in Finite element (dolfinx::fem) — DOLFINx 0.3.1 documentation, does it mean that we have to put every thing inside even when we define a form?

Thanks!

Yes, you would have to define the coefficient that you want to use when you call dolfinx.fem.form(linear_or_bilinear_form). Could you show a use-case where this is not practical?
What was your use-case in old dolfin?

Thanks for quick reply!
No, there is nothing not practical. The issue is that I met a bug when coding, I just want to create a simple form, say:

u = TrailFunction(element)
v = TestFunction(element)
a = u * v * dx

and create my form as follows in the cpp code file:

auto a = std::make_shared<fem::Form>(fem::create_form(*form_poisson_a, {V, V},{},{},{}));

since I don’t have any coeffient or constant to put in, so I keep these parameters to be empty, i.e, {}, but since you can use either std::vector or std::map to initialize the form, when they are empty, it causes ambiguous. In the old DOLFIN, you only need to put in the function spaces when you define a form, so I’m kind of confused. Maybe it is a problem more about CPP, but not DILFINx.

I would just pre-define the type of the std::map that you send in.
i.e
std::map<std::string, std::shared_ptr<const Function<T, U>>> coeff_map = {}
which would avoid the ambiguity.