FEniCS / dolfinx

Next generation FEniCS problem solving environment
https://fenicsproject.org
GNU Lesser General Public License v3.0
734 stars 179 forks source link

`create_form` needs better documentation #2602

Open IgorBaratta opened 1 year ago

IgorBaratta commented 1 year ago

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)
jorgensd commented 4 days ago

@IgorBaratta is this resolved with: https://github.com/FEniCS/dolfinx/blob/main/cpp/demo/codim_0_assembly/main.cpp#L114-L122 or do we need to add more doc-strings to it?