dolfinx icon indicating copy to clipboard operation
dolfinx copied to clipboard

`create_form` needs better documentation

Open IgorBaratta opened this issue 1 year ago • 1 comments

  • and maybe a demo or test showing how to pass subdomains markers from meshtags in C++.

I think that the documentation below is not enough for a user to be able to use the function and the examples (demos and tests) are not extensive.

/// @brief Create a Form using a factory function that returns a pointer
/// to a ufcx_form
/// @param[in] fptr pointer to a function returning a pointer to
/// ufcx_form
/// @param[in] spaces The function spaces for the Form arguments
/// @param[in] coefficients Coefficient fields in the form (by name)
/// @param[in] constants Spatial constants in the form (by name)
/// @param[in] subdomains Subdomain markers
/// @pre Each value in `subdomains` must be sorted by domain id
/// @param[in] mesh The mesh of the domain. This is required if the form
/// has no arguments, e.g. a functional.
/// @return A Form
template <typename T>
Form<T> create_form(
    ufcx_form* (*fptr)(),
    const std::vector<std::shared_ptr<const FunctionSpace>>& spaces,
    const std::map<std::string, std::shared_ptr<const Function<T>>>&
        coefficients,
    const std::map<std::string, std::shared_ptr<const Constant<T>>>& constants,
    const std::map<
        IntegralType,
        std::vector<std::pair<std::int32_t, std::vector<std::int32_t>>>>&
        subdomains,
    std::shared_ptr<const mesh::Mesh> mesh = nullptr)

IgorBaratta avatar Mar 25 '23 10:03 IgorBaratta