Skip to content

API updates #119

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

Merged
merged 15 commits into from
May 28, 2024
12 changes: 5 additions & 7 deletions cpp/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ dolfinx::la::SparsityPattern create_sparsity_pattern(
const std::shared_ptr<dolfinx_mpc::MultiPointConstraint<T, U>> mpc1)
{
{
LOG(INFO) << "Generating MPC sparsity pattern";
spdlog::info("Generating MPC sparsity pattern");
dolfinx::common::Timer timer("~MPC: Create sparsity pattern");
if (a.rank() != 2)
{
Expand All @@ -402,11 +402,11 @@ dolfinx::la::SparsityPattern create_sparsity_pattern(
std::array<int, 2> bs = {bs0, bs1};
dolfinx::la::SparsityPattern pattern(mesh.comm(), new_maps, bs);

LOG(INFO) << "Build standard pattern\n";
spdlog::debug("Build standard pattern\n");
/// Create and build sparsity pattern for original form. Should be
/// equivalent to calling create_sparsity_pattern(Form a)
build_standard_pattern<T>(pattern, a);
LOG(INFO) << "Build new pattern\n";
spdlog::debug("Build new pattern\n");

// Arrays replacing slave dof with master dof in sparsity pattern
auto pattern_populator
Expand Down Expand Up @@ -491,13 +491,11 @@ dolfinx::la::SparsityPattern create_sparsity_pattern(
pattern_populator(
pattern, mpc0, mpc1,
[](auto& pattern, const auto& dofs_m, const auto& dofs_s)
{ pattern.insert(dofs_m, dofs_s); },
do_nothing_inserter);
{ pattern.insert(dofs_m, dofs_s); }, do_nothing_inserter);
pattern_populator(
pattern, mpc1, mpc0,
[](auto& pattern, const auto& dofs_m, const auto& dofs_s)
{ pattern.insert(dofs_s, dofs_m); },
do_nothing_inserter);
{ pattern.insert(dofs_s, dofs_m); }, do_nothing_inserter);
}

return pattern;
Expand Down
1 change: 1 addition & 0 deletions python/benchmarks/bench_contact_3D.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ def over_plane(p0, p1, p2):

# Find top and bottom interface facets
cells = np.arange(num_cells, dtype=np.int32)
mesh.topology.create_connectivity(tdim, tdim)
cell_midpoints = compute_midpoints(mesh, tdim, cells)
top_cube = over_plane(if_points[:, 0], if_points[:, 1], if_points[:, 2])
for facet in i_facets:
Expand Down
3 changes: 3 additions & 0 deletions python/demos/create_and_export_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ def over_line(p0, p1):
top_cube = over_line(bottom_points[:, 2], bottom_points[:, 3])

num_cells = mesh.topology.index_map(tdim).size_local
mesh.topology.create_connecitivity(tdim, tdim)
cell_midpoints = _mesh.compute_midpoints(mesh, tdim, np.arange(num_cells, dtype=np.int32))
interface = find_line_function(bottom_points[:, 2], bottom_points[:, 3])
i_facets = _mesh.locate_entities_boundary(mesh, fdim, interface)
Expand Down Expand Up @@ -602,6 +603,7 @@ def over_plane(p0, p1, p2):
bottom_interface = []
facet_to_cell = mesh.topology.connectivity(fdim, tdim)
num_cells = mesh.topology.index_map(tdim).size_local
mesh.topology.create_connecitivity(tdim, tdim)
cell_midpoints = _mesh.compute_midpoints(mesh, tdim, np.arange(num_cells, dtype=np.int32))
top_cube = over_plane(if_points[:, 0], if_points[:, 1], if_points[:, 2])
for facet in i_facets:
Expand All @@ -614,6 +616,7 @@ def over_plane(p0, p1, p2):
bottom_interface.append(facet)

num_cells = mesh.topology.index_map(tdim).size_local
mesh.topology.create_connecitivity(tdim, tdim)
cell_midpoints = _mesh.compute_midpoints(mesh, tdim, np.arange(num_cells, dtype=np.int32))
top_cube_marker = 2
indices = []
Expand Down
1 change: 1 addition & 0 deletions python/tests/test_integration_domains.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def left_side(x):
tdim = mesh.topology.dim
num_cells = mesh.topology.index_map(tdim).size_local
cells = np.arange(num_cells, dtype=np.int32)
mesh.topology.create_connecitivity(tdim, tdim)
cell_midpoints = compute_midpoints(mesh, tdim, cells)
values = np.ones_like(cells)
# All cells on right side marked one, all other with 1
Expand Down
Loading