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

Allow for blocked elements with block size 1 #2955

Merged
merged 7 commits into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cpp/dolfinx/fem/FiniteElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ template <std::floating_point T>
FiniteElement<T>::FiniteElement(const ufcx_finite_element& e)
: _signature(e.signature), _space_dim(e.space_dimension),
_value_shape(e.value_shape, e.value_shape + e.value_rank),
_bs(e.block_size)
_bs(e.block_size), _is_mixed(e.element_type == ufcx_mixed_element)
{
const ufcx_shape _shape = e.cell_shape;
switch (_shape)
Expand Down Expand Up @@ -293,7 +293,7 @@ FiniteElement<T>::FiniteElement(const ufcx_finite_element& e)
template <std::floating_point T>
FiniteElement<T>::FiniteElement(const basix::FiniteElement<T>& element,
const std::vector<std::size_t>& value_shape)
: _value_shape(element.value_shape())
: _value_shape(element.value_shape()), _is_mixed(false)
{
if (!_value_shape.empty() and !value_shape.empty())
{
Expand Down Expand Up @@ -440,7 +440,7 @@ int FiniteElement<T>::num_sub_elements() const noexcept
template <std::floating_point T>
bool FiniteElement<T>::is_mixed() const noexcept
{
return !_sub_elements.empty() and _bs == 1;
return _is_mixed;
}
//-----------------------------------------------------------------------------
template <std::floating_point T>
Expand Down
18 changes: 12 additions & 6 deletions cpp/dolfinx/fem/FiniteElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,17 +139,20 @@ class FiniteElement
tabulate(std::span<const geometry_type> X, std::array<std::size_t, 2> shape,
int order) const;

/// @brief Number of sub elements (for a mixed or blocked element)
/// @brief Number of sub elements (for a mixed or blocked element).
/// @return The number of sub elements
int num_sub_elements() const noexcept;

/// Check if element is a mixed element, i.e. composed of two or more
/// elements of different types. A block element, e.g. a Lagrange
/// element with block size > 1 is not considered mixed.
/// @return True is element is mixed.
/// @brief Check if element is a mixed element.
///
/// A mixed element i composed of two or more elements of different
/// types (a block element, e.g. a Lagrange element with block size >=
/// 1 is not considered mixed).
///
/// @return True if element is mixed.
bool is_mixed() const noexcept;

/// Subelements (if any)
/// Get subelements (if any)
const std::vector<std::shared_ptr<const FiniteElement<geometry_type>>>&
sub_elements() const noexcept;

Expand Down Expand Up @@ -686,6 +689,9 @@ class FiniteElement
// number of DOFs co-located at each dof 'point'.
int _bs;

// Indicate whether this is a mixed element
bool _is_mixed;

// Indicate whether the element needs permutations or transformations
bool _needs_dof_permutations;
bool _needs_dof_transformations;
Expand Down