Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove duplicate tabulate functions #311

Open
mscroggs opened this issue Oct 26, 2021 · 0 comments
Open

Remove duplicate tabulate functions #311

mscroggs opened this issue Oct 26, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@mscroggs
Copy link
Member

Curently there is tabulate that returns a matrix, and tabulate_m that directly acts on memory

/// Compute basis values and derivatives at set of points.
///
/// @note The version of `FiniteElement::tabulate` with the basis data
/// as an out argument should be preferred for repeated call where
/// performance is critical
///
/// @param[in] nd The order of derivatives, up to and including, to
/// compute. Use 0 for the basis functions only.
/// @param[in] x The points at which to compute the basis functions.
/// The shape of x is (number of points, geometric dimension).
/// @return The basis functions (and derivatives). The shape is
/// (derivative, point, basis fn index, value index).
/// - The first index is the derivative, with higher derivatives are
/// stored in triangular (2D) or tetrahedral (3D) ordering, i.e. for
/// the (x,y) derivatives in 2D: (0,0), (1,0), (0,1), (2,0), (1,1),
/// (0,2), (3,0)... The function basix::indexing::idx can be used to find the
/// appropriate derivative.
/// - The second index is the point index
/// - The third index is the basis function index
/// - The fourth index is the basis function component. Its has size
/// one for scalar basis functions.
xt::xtensor<double, 4> tabulate(int nd, const xt::xarray<double>& x) const;
/// Compute basis values and derivatives at set of points.
///
/// @note This function is designed to be called at runtime, so its
/// performance is critical.
///
/// @param[in] nd The order of derivatives, up to and including, to
/// compute. Use 0 for the basis functions only.
/// @param[in] x The points at which to compute the basis functions.
/// The shape of x is (number of points, geometric dimension).
/// @param [out] basis Memory location to fill. It must be allocated
/// with shape (num_derivatives, num_points, num basis functions,
/// value_size). The function `FiniteElement::tabulate_shape` can be
/// used to get the required shape.
/// - The first index is the derivative, with higher derivatives are
/// stored in triangular (2D) or tetrahedral (3D) ordering, i.e. for
/// the (x,y) derivatives in 2D: (0,0), (1,0), (0,1), (2,0), (1,1),
/// (0,2), (3,0)... The function basix::indexing::idx can be used to
/// find the appropriate derivative.
/// - The second index is the point index
/// - The third index is the basis function index
/// - The fourth index is the basis function component. Its has size
/// one for scalar basis functions.
///
/// @todo Remove all internal dynamic memory allocation, pass scratch
/// space as required
void tabulate(int nd, const xt::xarray<double>& x,
xt::xtensor<double, 4>& basis) const;

The tabulate returning a matrix should be removed, then the memory version can be used from pybind to make the Python version that returns a matrix

See also #310.

@mscroggs mscroggs added the enhancement New feature or request label Oct 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant