Skip to content
Merged
Show file tree
Hide file tree
Changes from 122 commits
Commits
Show all changes
133 commits
Select commit Hold shift + click to select a range
fa17cb9
sketch out
schnellerhase May 9, 2025
0a36e2d
Working rank 0 assembly
schnellerhase May 10, 2025
71d2ebf
Move urls into environment file -> fork support
schnellerhase May 10, 2025
78e310c
Switch ffcx reference branch
schnellerhase May 10, 2025
6124269
Missed one
schnellerhase May 10, 2025
25ebace
Loop over forms
schnellerhase May 10, 2025
5d5329e
Domain marker support
schnellerhase May 10, 2025
a2d78c8
Missed forms.py
schnellerhase May 10, 2025
b72fa07
Remove python match
schnellerhase May 10, 2025
dffa202
Tidy compute_integration_domains
schnellerhase May 10, 2025
105fdab
Debug partitioned domain
schnellerhase May 10, 2025
5210a13
Format
schnellerhase May 10, 2025
64353e0
Simplify test
schnellerhase May 10, 2025
1e34560
Try with new line in .env
schnellerhase May 10, 2025
57ced5d
Vector assembly
schnellerhase May 10, 2025
cfcdecf
Fix sign
schnellerhase May 11, 2025
575fbb5
Explicit clone in oneapi
schnellerhase May 11, 2025
01eff1a
ANother
schnellerhase May 11, 2025
dbc7e0e
Tidy up
schnellerhase May 11, 2025
b5aa433
Coefficient packing
schnellerhase May 11, 2025
51365b5
deactivate c interface install
schnellerhase May 11, 2025
eca4568
Debug oneapi
schnellerhase May 11, 2025
d602ee0
Merge branch 'main' into point_source
schnellerhase May 11, 2025
6ce1f1b
Fix assertions and add non constant coefficient test
schnellerhase May 12, 2025
368fdfa
Merge branch 'main' into point_source
schnellerhase May 16, 2025
aee26a7
Central extract kernel
schnellerhase May 16, 2025
1507fa5
Use has_complex_ufcx_kernels instead of macro
schnellerhase May 16, 2025
ddd3004
Tidy casting
schnellerhase May 16, 2025
3b93b69
Env: repo + ref
schnellerhase May 16, 2025
263fff5
CI done?
schnellerhase May 16, 2025
27f02a5
Add docs
schnellerhase May 16, 2025
0cd5444
Add space
schnellerhase May 16, 2025
fbb595d
Tidy up packing code duplication
schnellerhase May 16, 2025
42273ef
kern_t template types
schnellerhase May 16, 2025
1cd3d37
format
schnellerhase May 16, 2025
10ddac2
capture
schnellerhase May 16, 2025
944b5b6
Apply suggestions from code review
schnellerhase May 16, 2025
8c4e7be
Ruff
schnellerhase May 16, 2025
f61acce
Parametrize over dtype
schnellerhase May 16, 2025
a539295
Debug: test without rank 1
schnellerhase May 17, 2025
dc3c8c7
Fix tolerances
schnellerhase May 17, 2025
e91624a
Reactivate rank1
schnellerhase May 17, 2025
eec970d
Merge branch 'main' into point_source
schnellerhase May 27, 2025
d130c8d
Merge branch 'main' into point_source
schnellerhase Jun 7, 2025
cbf2212
Merge branch 'main' into point_source
garth-wells Jun 11, 2025
666f82d
Merge branch 'main' into point_source
schnellerhase Jul 2, 2025
6d4d19d
Merge branch 'main' into point_source
schnellerhase Jul 23, 2025
98790c9
Remove workflows removed on main
schnellerhase Jul 26, 2025
6229d37
Merge branch 'main' into point_source
schnellerhase Jul 26, 2025
aafb729
Update CI
garth-wells Jul 26, 2025
09582e5
Update .github/workflows/ci-spack.yml
schnellerhase Jul 26, 2025
e6cd4ee
Merge branch 'main' into point_source
schnellerhase Jul 27, 2025
d3d0a41
Merge branch 'main' into point_source
schnellerhase Aug 1, 2025
171b484
Remove capture everything
schnellerhase Aug 1, 2025
f2b4b0a
Remove future comment
schnellerhase Aug 1, 2025
bff97b1
Change test helper function name
schnellerhase Aug 1, 2025
bcfb361
Change to md::
schnellerhase Aug 1, 2025
d90075d
Move kernel extraction to own header
schnellerhase Aug 1, 2025
5836e55
Fix bad rebase
schnellerhase Aug 1, 2025
8ab65ea
Rely on impliciy span conversion
schnellerhase Aug 1, 2025
62a9642
Merge branch 'main' into point_source
jorgensd Aug 7, 2025
d19f02e
Update cpp/dolfinx/fem/kernel.h
schnellerhase Aug 7, 2025
3479a56
cell_connectivity -> get_cell_facet_connectivity
schnellerhase Aug 7, 2025
4c68c1d
Remove codim>0 check
schnellerhase Aug 7, 2025
f634468
Inline/Remove cell_and_vertex mdspan
schnellerhase Aug 7, 2025
ee9b92f
Update docstring compute_integration_domain
schnellerhase Aug 7, 2025
42c6a84
Integration domain is (cell, local_vertex) for vertex integrals
schnellerhase Aug 7, 2025
30bb8de
format
schnellerhase Aug 7, 2025
aa6e2a4
Bad
schnellerhase Aug 7, 2025
4ab0a49
Update cpp/dolfinx/fem/pack.h
schnellerhase Aug 7, 2025
8ae982d
Only copy if already packed
schnellerhase Aug 7, 2025
63ea524
Avoid double case handling
schnellerhase Aug 7, 2025
8153664
Merge branch 'main' into point_source
schnellerhase Aug 15, 2025
2709b8c
Use vertex integral consistently
schnellerhase Aug 15, 2025
b217c22
Merge branch 'main' into point_source
schnellerhase Aug 17, 2025
0a904b0
Merge branch 'main' into point_source
schnellerhase Aug 18, 2025
a40385a
Update cpp/dolfinx/fem/assemble_vector_impl.h
schnellerhase Aug 20, 2025
eb1c1df
Rename data to vertices
schnellerhase Aug 20, 2025
b0d95dc
kern_c_t -> kernelptr_t
schnellerhase Aug 20, 2025
e1d76e7
Name shape1
schnellerhase Aug 20, 2025
457c656
Fix shape type
schnellerhase Aug 20, 2025
88295f0
Fix
schnellerhase Aug 20, 2025
268fa5e
Update .github/workflows/fenicsx-refs.env
schnellerhase Aug 20, 2025
cb2ef5e
Merge branch 'main' into point_source
schnellerhase Aug 20, 2025
5ce9bdb
Merge branch 'main' into point_source
schnellerhase Aug 21, 2025
c684b73
Update cpp/dolfinx/fem/assemble_vector_impl.h
schnellerhase Aug 21, 2025
c076436
Switch consistently to num_adjacenet_cells + values per entity
schnellerhase Aug 21, 2025
5b815d3
Apply suggestions from code review
schnellerhase Aug 21, 2025
2a740ff
kern_t -> kernel_t
schnellerhase Aug 21, 2025
2bf3d1b
Format
schnellerhase Aug 21, 2025
ec43b19
Move test_vertex_integral into test_assembler
schnellerhase Aug 21, 2025
1f8b00f
Merge branch 'main' into point_source
schnellerhase Aug 22, 2025
7fa9950
Change to geometrically defined subdomains in vertex integral rank 0 …
schnellerhase Aug 22, 2025
c3bb599
Simplify
schnellerhase Aug 22, 2025
9b4b5cc
More
schnellerhase Aug 22, 2025
fd76955
Start on rank 1
schnellerhase Aug 22, 2025
64bee13
Change to geometrically defined subdomains in vertex integral rank 1 …
schnellerhase Aug 22, 2025
1cfcaed
Merge branch 'main' into point_source
schnellerhase Aug 22, 2025
516cd07
Merge branch 'main' into point_source
schnellerhase Aug 26, 2025
1b22ffa
Remove merge confilt
schnellerhase Aug 26, 2025
1f2b221
Adapt to new kernel storage
schnellerhase Aug 26, 2025
a304733
Merge branch 'main' into point_source
schnellerhase Aug 27, 2025
db60ea2
Apply suggestions from code review
schnellerhase Aug 27, 2025
d092b75
Change to assert for c->v
schnellerhase Aug 27, 2025
73c6fbd
Introduce convenience wrapper get_cell_vertex_pairs
schnellerhase Aug 27, 2025
5689562
Bad dimension check
schnellerhase Aug 27, 2025
8a9359a
Explain weighting
schnellerhase Aug 27, 2025
3901400
Fix doc
schnellerhase Aug 27, 2025
88ed802
Merge branch 'main' into point_source
schnellerhase Aug 27, 2025
f2ccd3c
Fix
schnellerhase Aug 27, 2025
41381c5
Add custom packing tests
schnellerhase Aug 27, 2025
eb4092d
Reorder with vertex->dof map
schnellerhase Aug 27, 2025
e7ecf2b
Add additional custom packing test through subdomain_data
schnellerhase Aug 27, 2025
94e0e3d
Fix?
schnellerhase Aug 27, 2025
5aed601
Defend against empty mesh on process
schnellerhase Aug 27, 2025
acc1be2
Merge branch 'main' into point_source
schnellerhase Aug 27, 2025
25a640a
Merge branch 'main' into point_source
schnellerhase Aug 28, 2025
341f08a
Remove entity access code duplication
schnellerhase Aug 28, 2025
ce1f2fe
Add docstring
schnellerhase Aug 28, 2025
ffb4ef5
Merge branch 'main' into point_source
schnellerhase Aug 29, 2025
de9791b
Merge branch 'main' into point_source
michalhabera Aug 29, 2025
336b777
Merge branch 'main' into point_source
schnellerhase Aug 29, 2025
befc652
Merge branch 'main' into point_source
schnellerhase Aug 30, 2025
65f828f
Merge branch 'main' into point_source
schnellerhase Sep 1, 2025
7cbe01a
Use branch in spack ci
schnellerhase Sep 1, 2025
db88924
Revert "Use branch in spack ci"
schnellerhase Sep 1, 2025
796f9f2
Add --no-clone
schnellerhase Sep 1, 2025
a847719
Clone all FEniCS dependencies
schnellerhase Sep 1, 2025
d452c3e
On PR
schnellerhase Sep 1, 2025
e98ce4a
One more
schnellerhase Sep 1, 2025
c4eeb59
First cehckout
schnellerhase Sep 1, 2025
0cdb4ed
Same order as on branch
schnellerhase Sep 1, 2025
72bb24e
Merge branch 'main' into point_source
schnellerhase Sep 1, 2025
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
18 changes: 9 additions & 9 deletions .github/workflows/ccpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ jobs:

- name: Install FEniCS Python components
run: |
pip install --no-build-isolation git+https://github.com/fenics/ufl.git@${{ env.ufl_ref }}
pip install --no-build-isolation git+https://github.com/fenics/basix.git@${{ env.basix_ref }}
pip install --no-build-isolation git+https://github.com/fenics/ffcx.git@${{ env.ffcx_ref }}
pip install --no-build-isolation git+https://github.com/${{ env.ufl_repository }}.git@${{ env.ufl_ref }}
pip install --no-build-isolation git+https://github.com/${{ env.basix_repository }}.git@${{ env.basix_ref }}
pip install --no-build-isolation git+https://github.com/${{ env.ffcx_repository }}.git@${{ env.ffcx_ref }}

- name: Configure (C++)
working-directory: cpp
Expand Down Expand Up @@ -189,9 +189,9 @@ jobs:

- name: Install FEniCS Python components
run: |
pip install --no-build-isolation git+https://github.com/FEniCS/ufl.git@${{ env.ufl_ref }}
pip install --no-build-isolation git+https://github.com/FEniCS/basix.git@${{ env.basix_ref }}
pip install --no-build-isolation git+https://github.com/FEniCS/ffcx.git@${{ env.ffcx_ref }}
pip install --no-build-isolation git+https://github.com/${{ env.ufl_repository }}.git@${{ env.ufl_ref }}
pip install --no-build-isolation git+https://github.com/${{ env.basix_repository }}.git@${{ env.basix_ref }}
pip install --no-build-isolation git+https://github.com/${{ env.ffcx_repository }}.git@${{ env.ffcx_ref }}

- name: Configure (C++)
working-directory: cpp
Expand Down Expand Up @@ -293,9 +293,9 @@ jobs:
- name: Install FEniCS Python components
run: |
pip install -r python/build-requirements.txt
pip install --no-build-isolation git+https://github.com/FEniCS/ufl.git@${{ env.ufl_ref }}
pip install --no-build-isolation git+https://github.com/FEniCS/basix.git@${{ env.basix_ref }}
pip install --no-build-isolation git+https://github.com/FEniCS/ffcx.git@${{ env.ffcx_ref }}
pip install --no-build-isolation git+https://github.com/${{ env.ufl_repository }}.git@${{ env.ufl_ref }}
pip install --no-build-isolation git+https://github.com/${{ env.basix_repository }}.git@${{ env.basix_ref }}
pip install --no-build-isolation git+https://github.com/${{ env.ffcx_repository }}.git@${{ env.ffcx_ref }}

- name: Configure C++
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci-spack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ jobs:
run: |
. ./spack-src/share/spack/setup-env.sh
spack env activate .
pip install git+https://github.com/fenics/ufl.git@${{ env.ufl_ref }}
pip install git+https://github.com/fenics/basix.git@${{ env.basix_ref }}
pip install git+https://github.com/fenics/ffcx.git@${{ env.ffcx_ref }}
pip install git+https://github.com/${{ env.ufl_repository }}.git@${{ env.ufl_ref }}
pip install git+https://github.com/${{ env.basix_repository }}.git@${{ env.basix_ref }}
pip install git+https://github.com/${{ env.ffcx_repository }}.git@${{ env.ffcx_ref }}

- name: Configure and build C++
run: |
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/fenicsx-refs.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
basix_repository=FEniCS/basix
basix_ref=main
ufl_repository=FEniCS/ufl
ufl_ref=main
ffcx_repository=FEniCS/ffcx
ffcx_ref=main

6 changes: 3 additions & 3 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ jobs:

- name: Install FEniCSx dependencies
run: |
python -m pip install git+https://github.com/fenics/ufl.git@${{ env.ufl_ref }}
python -m pip install git+https://github.com/fenics/basix.git@${{ env.basix_ref }}
python -m pip install git+https://github.com/fenics/ffcx.git@${{ env.ffcx_ref }}
python -m pip install git+https://github.com/${{ env.ufl_repository }}.git@${{ env.ufl_ref }}
python -m pip install git+https://github.com/${{ env.basix_repository }}.git@${{ env.basix_ref }}
python -m pip install git+https://github.com/${{ env.ffcx_repository }}.git@${{ env.ffcx_ref }}

- name: Configure (C++)
working-directory: cpp
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ jobs:
echo "$HOME/.sonar/build-wrapper-linux-x86" >> $GITHUB_PATH
- name: Install FEniCS Python components
run: |
python -m pip install git+https://github.com/fenics/ufl.git@${{ env.ufl_ref }}
python -m pip install git+https://github.com/fenics/basix.git@${{ env.basix_ref }}
python -m pip install git+https://github.com/fenics/ffcx.git@${{ env.ffcx_ref }}
pip install git+https://github.com/${{ env.ufl_repository }}.git@${{ env.ufl_ref }}
pip install git+https://github.com/${{ env.basix_repository }}.git@${{ env.basix_ref }}
pip install git+https://github.com/${{ env.ffcx_repository }}.git@${{ env.ffcx_ref }}
- name: Run build-wrapper
run: |
mkdir build
Expand Down
1 change: 1 addition & 0 deletions cpp/dolfinx/fem/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ set(HEADERS_fem
${CMAKE_CURRENT_SOURCE_DIR}/dofmapbuilder.h
${CMAKE_CURRENT_SOURCE_DIR}/dolfinx_fem.h
${CMAKE_CURRENT_SOURCE_DIR}/interpolate.h
${CMAKE_CURRENT_SOURCE_DIR}/kernel.h
${CMAKE_CURRENT_SOURCE_DIR}/petsc.h
${CMAKE_CURRENT_SOURCE_DIR}/pack.h
${CMAKE_CURRENT_SOURCE_DIR}/sparsitybuild.h
Expand Down
85 changes: 78 additions & 7 deletions cpp/dolfinx/fem/assemble_scalar_impl.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2019-2025 Garth N. Wells
// Copyright (C) 2019-2025 Garth N. Wells and Paul T. Kühner
//
// This file is part of DOLFINx (https://www.fenicsproject.org)
//
Expand Down Expand Up @@ -150,6 +150,43 @@ T assemble_interior_facets(
return value;
}

/// Assemble functional over vertices
template <dolfinx::scalar T>
T assemble_vertices(mdspan2_t x_dofmap,
md::mdspan<const scalar_value_t<T>,
md::extents<std::size_t, md::dynamic_extent, 3>>
x,
md::mdspan<const std::int32_t,
md::extents<std::size_t, md::dynamic_extent, 2>>
vertices,
FEkernel<T> auto fn, std::span<const T> constants,
md::mdspan<const T, md::dextents<std::size_t, 2>> coeffs)
{
T value(0);
if (vertices.empty())
return value;

// Create data structures used in assembly
std::vector<scalar_value_t<T>> cdofs(3 * x_dofmap.extent(1));

// Iterate over all cells
for (std::size_t index = 0; index < vertices.extent(0); ++index)
{
std::int32_t cell = vertices(index, 0);
std::int32_t local_vertex_index = vertices(index, 1);

// Get cell coordinates/geometry
auto x_dofs = md::submdspan(x_dofmap, cell, md::full_extent);
for (std::size_t i = 0; i < x_dofs.size(); ++i)
std::copy_n(&x(x_dofs[i], 0), 3, std::next(cdofs.begin(), 3 * i));

fn(&value, &coeffs(index, 0), constants.data(), cdofs.data(),
&local_vertex_index, nullptr, nullptr);
}

return value;
}

/// Assemble functional into an scalar with provided mesh geometry.
template <dolfinx::scalar T, std::floating_point U>
T assemble_scalar(
Expand Down Expand Up @@ -198,14 +235,19 @@ T assemble_scalar(
= coefficients.at({IntegralType::exterior_facet, i});

std::span facets = M.domain(IntegralType::exterior_facet, i, 0);

constexpr std::size_t num_adjacent_cells = 1;
// Two values per each adj. cell (cell index and local facet index).
constexpr std::size_t shape1 = 2 * num_adjacent_cells;

assert((facets.size() / 2) * cstride == coeffs.size());
value += impl::assemble_exterior_facets(
x_dofmap, x,
md::mdspan<const std::int32_t,
md::extents<std::size_t, md::dynamic_extent, 2>>(
facets.data(), facets.size() / 2, 2),
fn, constants, md::mdspan(coeffs.data(), facets.size() / 2, cstride),
perms);
facets.data(), facets.size() / shape1, 2),
fn, constants,
md::mdspan(coeffs.data(), facets.size() / shape1, cstride), perms);
}

for (int i = 0; i < M.num_integrals(IntegralType::interior_facet, 0); ++i)
Expand All @@ -215,19 +257,48 @@ T assemble_scalar(
auto& [coeffs, cstride]
= coefficients.at({IntegralType::interior_facet, i});
std::span facets = M.domain(IntegralType::interior_facet, i, 0);
assert((facets.size() / 4) * 2 * cstride == coeffs.size());

constexpr std::size_t num_adjacent_cells = 2;
// Two values per each adj. cell (cell index and local facet index).
constexpr std::size_t shape1 = 2 * num_adjacent_cells;

assert((facets.size() / shape1) * 2 * cstride == coeffs.size());
value += impl::assemble_interior_facets(
x_dofmap, x,
md::mdspan<const std::int32_t,
md::extents<std::size_t, md::dynamic_extent, 2, 2>>(
facets.data(), facets.size() / 4, 2, 2),
facets.data(), facets.size() / shape1, 2, 2),
fn, constants,
md::mdspan<const T, md::extents<std::size_t, md::dynamic_extent, 2,
md::dynamic_extent>>(
coeffs.data(), facets.size() / 4, 2, cstride),
coeffs.data(), facets.size() / shape1, 2, cstride),
perms);
}

for (int i = 0; i < M.num_integrals(IntegralType::vertex, 0); ++i)
{
auto fn = M.kernel(IntegralType::vertex, i, 0);
assert(fn);

auto& [coeffs, cstride] = coefficients.at({IntegralType::vertex, i});

std::span<const std::int32_t> vertices
= M.domain(IntegralType::vertex, i, 0);
assert(vertices.size() * cstride == coeffs.size());

constexpr std::size_t num_adjacent_cells = 1;
// Two values per adj. cell (cell index and local vertex index).
constexpr std::size_t shape1 = 2 * num_adjacent_cells;

value += impl::assemble_vertices(
x_dofmap, x,
md::mdspan<const std::int32_t,
md::extents<std::size_t, md::dynamic_extent, 2>>(
vertices.data(), vertices.size() / shape1, shape1),
fn, constants,
md::mdspan(coeffs.data(), vertices.size() / shape1, cstride));
}

return value;
}

Expand Down
116 changes: 115 additions & 1 deletion cpp/dolfinx/fem/assemble_vector_impl.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2018-2021 Garth N. Wells
// Copyright (C) 2018-2025 Garth N. Wells and Paul T. Kühner
//
// This file is part of DOLFINx (https://www.fenicsproject.org)
//
Expand Down Expand Up @@ -941,6 +941,94 @@ void assemble_interior_facets(
}
}

/// @brief Execute kernel over a set of vertices and accumulate result in
/// vector.
///
/// @tparam T Scalar type
/// @tparam _bs Block size of the form test function dof map. If less
/// than zero the block size is determined at runtime. If `_bs` is
/// positive the block size is used as a compile-time constant, which
/// has performance benefits.
/// @param[in] P0 Function that applies transformation `P0.b` in-place
/// to `b` to transform test degrees-of-freedom.
/// @param[in,out] b Array to accumulate into.
/// @param[in] x_dofmap Dofmap for the mesh geometry.
/// @param[in] x Mesh geometry (coordinates).
/// @param[in] vertices Vertex indices `(vertices.size(), 2)` - first entry
/// holds the index of the cell adjacent to the vertex, and the second
/// stores the local index of the vertex within the cell.
/// @param[in] dofmap Test function (row) degree-of-freedom data holding
/// the (0) dofmap, (1) dofmap block size and (2) dofmap cell indices.
/// @param[in] kernel Kernel function to execute over each cell.
/// @param[in] constants Constant coefficient data in the kernel.
/// @param[in] coeffs Coefficient data in the kernel. It has shape
/// `(vertices.size(), num_cell_coeffs)`. `coeffs(i, j)` is the `j`th
/// coefficient for cell `i`.
/// @param[in] cell_info0 Cell permutation information for the test
/// function mesh.
template <dolfinx::scalar T, int _bs = -1>
void assemble_vertices(
fem::DofTransformKernel<T> auto P0, std::span<T> b, mdspan2_t x_dofmap,
md::mdspan<const scalar_value_t<T>,
md::extents<std::size_t, md::dynamic_extent, 3>>
x,
md::mdspan<const std::int32_t,
md::extents<std::size_t, md::dynamic_extent, 2>>
vertices,
std::tuple<mdspan2_t, int,
md::mdspan<const std::int32_t,
md::extents<std::size_t, md::dynamic_extent, 2>>>
dofmap,
FEkernel<T> auto kernel, std::span<const T> constants,
md::mdspan<const T, md::dextents<std::size_t, 2>> coeffs,
std::span<const std::uint32_t> cell_info0)
{
if (vertices.empty())
return;

const auto [dmap, bs, vertices0] = dofmap;
assert(_bs < 0 or _bs == bs);

// Create data structures used in assembly
std::vector<scalar_value_t<T>> cdofs(3 * x_dofmap.extent(1));
std::vector<T> be(bs * dmap.extent(1));

// Iterate over active vertices
for (std::size_t index = 0; index < vertices.extent(0); ++index)
{
// Integration domain cell, local index, and test function cell
std::int32_t cell = vertices(index, 0);
std::int32_t local_index = vertices(index, 1);
std::int32_t c0 = vertices0(index, 0);

// Get cell coordinates/geometry
auto x_dofs = md::submdspan(x_dofmap, cell, md::full_extent);
for (std::size_t i = 0; i < x_dofs.size(); ++i)
std::copy_n(&x(x_dofs[i], 0), 3, std::next(cdofs.begin(), 3 * i));

// Tabulate vector for vertex
std::ranges::fill(be, 0);
kernel(be.data(), &coeffs(index, 0), constants.data(), cdofs.data(),
&local_index, nullptr, nullptr);
P0(be, cell_info0, c0, 1);

// Scatter vertex vector to 'global' vector array
auto dofs = md::submdspan(dmap, c0, md::full_extent);
if constexpr (_bs > 0)
{
for (std::size_t i = 0; i < dofs.size(); ++i)
for (int k = 0; k < _bs; ++k)
b[_bs * dofs[i] + k] += be[_bs * i + k];
}
else
{
for (std::size_t i = 0; i < dofs.size(); ++i)
for (int k = 0; k < bs; ++k)
b[bs * dofs[i] + k] += be[bs * i + k];
}
}
}

/// Modify RHS vector to account for boundary condition such that:
///
/// b <- b - alpha * A.(x_bc - x0)
Expand Down Expand Up @@ -1381,6 +1469,32 @@ void assemble_vector(
cell_info0, perms);
}
}

for (int i = 0; i < L.num_integrals(IntegralType::vertex, 0); ++i)
{
auto fn = L.kernel(IntegralType::vertex, i, 0);
assert(fn);

std::span vertices = L.domain(IntegralType::vertex, i, cell_type_idx);
std::span vertices0
= L.domain_arg(IntegralType::vertex, 0, i, cell_type_idx);

auto& [coeffs, cstride] = coefficients.at({IntegralType::vertex, i});

assert(vertices.size() * cstride == coeffs.size());

impl::assemble_vertices<T>(
P0, b, x_dofmap, x,
md::mdspan<const std::int32_t,
md::extents<std::size_t, md::dynamic_extent, 2>>(
vertices.data(), vertices.size() / 2, 2),
{dofs, bs,
md::mdspan<const std::int32_t,
md::extents<std::size_t, md::dynamic_extent, 2>>(
vertices0.data(), vertices0.size() / 2, 2)},
fn, constants,
md::mdspan(coeffs.data(), vertices.size() / 2, cstride), cell_info0);
}
}
}

Expand Down
Loading
Loading