Skip to content
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
2 changes: 1 addition & 1 deletion demos/netgen/netgen_mesh.py.rst
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ Then a SLEPc Eigenvalue Problem Solver (``EPS``) is initialised and set up to us
PC.setFactorSolverType("mumps")
E.setST(ST)
E.solve()
vr, vi = Asc.getVecs()
vr, vi = Asc.createVecs()
with uh.dat.vec_wo as vr:
lam = E.getEigenpair(0, vr, vi)
return (lam, uh, V)
Expand Down
2 changes: 1 addition & 1 deletion firedrake/adapt.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def _adapt_marked_cells(mesh, cell_marker):
adapt_indicator = np.zeros(cell_marker.dat.data_ro_with_halos.shape, dtype=IntType)
adapt_indicator[:ncoarse] = cell_marker.dat.data_ro.real > 0
dmcommon.mark_points_with_function_array(
dm, cell_marker.function_space().dm.getSection(), 0,
dm, cell_marker.function_space().dm.getLocalSection(), 0,
adapt_indicator, adapt_label, DM_ADAPT_REFINE,
)

Expand Down
10 changes: 5 additions & 5 deletions firedrake/checkpointing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1458,7 +1458,7 @@ def _load_function_space_topology(self, tmesh, element):
dm.setPointSF(topology_dm.getPointSF())
section = PETSc.Section().create(comm=tmesh.comm)
section.setPermutation(tmesh._dm_renumbering)
dm.setSection(section)
dm.setLocalSection(section)
base_tmesh = tmesh._base_mesh if isinstance(tmesh, ExtrudedMeshTopology) else tmesh
sfXC = base_tmesh.sfXC
topology_dm.setName(tmesh.name)
Expand All @@ -1467,10 +1467,10 @@ def _load_function_space_topology(self, tmesh, element):
nodes_per_entity, real_tensorproduct, block_size = sd_key
# Don't cache if the section has been expanded by block_size
if block_size == 1:
cached_section = get_global_numbering(tmesh, (nodes_per_entity, real_tensorproduct), global_numbering=dm.getSection())
if dm.getSection() is not cached_section:
cached_section = get_global_numbering(tmesh, (nodes_per_entity, real_tensorproduct), global_numbering=dm.getLocalSection())
if dm.getLocalSection() is not cached_section:
# The same section has already been cached.
dm.setSection(cached_section)
dm.setLocalSection(cached_section)
self._function_load_utils[tmesh_key + sd_key] = (dm, gsf, lsf)
return impl.FunctionSpace(tmesh, element)

Expand Down Expand Up @@ -1601,7 +1601,7 @@ def _get_dm_for_checkpointing(self, tV):
topology_dm = tV.mesh().topology_dm
dm = PETSc.DMShell().create(tV.mesh().comm)
dm.setPointSF(topology_dm.getPointSF())
dm.setSection(global_numbering)
dm.setLocalSection(global_numbering)
else:
dm = tV.dm
dm.setName(self._generate_dm_name(*sd_key))
Expand Down
2 changes: 1 addition & 1 deletion firedrake/cython/dmcommon.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1692,7 +1692,7 @@ def facet_closure_nodes(V, sub_domain):
with the given marker.
"""
cdef:
PETSc.Section sec = V.dm.getSection()
PETSc.Section sec = V.dm.getLocalSection()
PETSc.DM dm = V.mesh().topology_dm
PetscInt nnodes, p, i, dof, offset, n, j, d
np.ndarray points
Expand Down
2 changes: 1 addition & 1 deletion firedrake/dmhooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ def attach_hooks(dm, level=None, sf=None, section=None):
if sf is not None:
dm.setPointSF(sf)
if section is not None:
dm.setDefaultSection(section)
dm.setLocalSection(section)

# Multilevel hierarchies
dm.setRefine(refine)
Expand Down
6 changes: 3 additions & 3 deletions firedrake/halo.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def __init__(self, dm, section, comm):
raise ValueError("Communicator used to create `Halo` must be at least congruent to the communicator used to create the mesh")
self.dm = PETSc.DMShell().create(self.comm)
self.dm.setPointSF(dm.getPointSF())
self.dm.setDefaultSection(section)
self.dm.setLocalSection(section)

@cached_property
def sf(self):
Expand All @@ -117,8 +117,8 @@ def comm(self):

@cached_property
def local_to_global_numbering(self):
lsec = self.dm.getDefaultSection()
gsec = self.dm.getDefaultGlobalSection()
lsec = self.dm.getLocalSection()
gsec = self.dm.getGlobalSection()
return dmcommon.make_global_numbering(lsec, gsec)

@PETSc.Log.EventDecorator()
Expand Down
8 changes: 4 additions & 4 deletions firedrake/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -1525,7 +1525,7 @@ def mark_entities(self, tf, label_value, label_name=None):
plex.createLabel(label_name)
plex.clearLabelStratum(label_name, label_value)
label = plex.getLabel(label_name)
section = tV.dm.getSection()
section = tV.dm.getLocalSection()
array = tf.dat.data_ro_with_halos.real.astype(IntType)
dmcommon.mark_points_with_function_array(plex, section, height, array, label, label_value)

Expand Down Expand Up @@ -3257,7 +3257,7 @@ def make_vom_from_vom_topology(topology, name, tolerance=0.5):
parent_tdim = topology._parent_mesh.ufl_cell().topological_dimension
if parent_tdim > 0:
reference_coordinates_fs = functionspace.VectorFunctionSpace(topology, "DG", 0, dim=parent_tdim)
reference_coordinates_data = dmcommon.reordered_coords(topology.topology_dm, reference_coordinates_fs.dm.getDefaultSection(),
reference_coordinates_data = dmcommon.reordered_coords(topology.topology_dm, reference_coordinates_fs.dm.getLocalSection(),
(topology.num_vertices(), parent_tdim),
reference_coord=True)
reference_coordinates = function.CoordinatelessFunction(reference_coordinates_fs,
Expand Down Expand Up @@ -4840,7 +4840,7 @@ def RelabeledMesh(mesh, indicator_functions, subdomain_ids, **kwargs):
# Clear label stratum; this is a copy, so safe to change.
plex1.clearLabelStratum(dmlabel_name, subid)
dmlabel = plex1.getLabel(dmlabel_name)
section = f.topological.function_space().dm.getSection()
section = f.topological.function_space().dm.getLocalSection()
dmcommon.mark_points_with_function_array(plex, section, height, f.dat.data_ro_with_halos.real.astype(IntType), dmlabel, subid)
reorder_noop = None
tmesh1 = MeshTopology(plex1, name=plex1.getName(), reorder=reorder_noop,
Expand Down Expand Up @@ -5050,7 +5050,7 @@ def coordinates_from_topology(topology: AbstractMeshTopology, element: finat.ufl

(gdim,) = element.reference_value_shape
coordinates_fs = functionspace.FunctionSpace(topology, element)
coordinates_data = dmcommon.reordered_coords(topology.topology_dm, coordinates_fs.dm.getDefaultSection(),
coordinates_data = dmcommon.reordered_coords(topology.topology_dm, coordinates_fs.dm.getLocalSection(),
(topology.num_vertices(), gdim))
return function.CoordinatelessFunction(coordinates_fs,
val=coordinates_data,
Expand Down
2 changes: 1 addition & 1 deletion firedrake/netgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def netgen_distribute(V: firedrake.functionspaceimpl.WithGeometryBase,
dtype = netgen_data.dtype

sfBCInv = sf.createInverse()
section = V.dm.getDefaultSection()
section = V.dm.getLocalSection()
vec = V.dof_dset.layout_vec
section0, vec0 = plex.distributeField(sfBCInv, section, vec)
vec0.set(0)
Expand Down
6 changes: 3 additions & 3 deletions firedrake/preconditioners/asm.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def initialize(self, pc):
# TinyASM wants local numbers, no need to translate
tinyasm.SetASMLocalSubdomains(
asmpc, ises,
[W.dm.getDefaultSF() for W in V],
[W.dm.getSectionSF() for W in V],
[W.block_size for W in V],
sum(W.block_size * W.dof_dset.total_size for W in V))
asmpc.setUp()
Expand Down Expand Up @@ -278,7 +278,7 @@ def get_patches(self, V):
raise NotImplementedError("Not implemented for general mixed meshes")
assert mesh.cell_set._extruded
dm = mesh.topology_dm
section = V.dm.getDefaultSection()
section = V.dm.getLocalSection()
# Obtain the codimensions to loop over from options, if present
opts = PETSc.Options(self.prefix)
codim_list = list(map(int, opts.getString("codims", "0, 1").split(",")))
Expand Down Expand Up @@ -338,7 +338,7 @@ def order_points(mesh_dm, points, ordering_type, prefix):

def get_basemesh_nodes(W):
pstart, pend = W.mesh().topology_dm.getChart()
section = W.dm.getDefaultSection()
section = W.dm.getLocalSection()
# location of first dof on an entity
basemeshoff = numpy.empty(pend - pstart, dtype=IntType)
# number of dofs on this entity
Expand Down
2 changes: 1 addition & 1 deletion firedrake/preconditioners/fdm.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ def assemble_reference_tensor(self, V, transpose=False, sort_interior=False):
result = self.assemble_reference_tensor(V, transpose=transpose, sort_interior=False)
if formdegree != 0:
# Compute the stiffness matrix on the interior of a cell
A00 = self._element_mass_matrix.PtAP(result)
A00 = self._element_mass_matrix.ptap(result)
indptr, indices, _ = A00.getValuesCSR()
degree = numpy.diff(indptr)
# Sort by blocks
Expand Down
2 changes: 1 addition & 1 deletion firedrake/preconditioners/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ def coords(dm, p, coordinates):
coordinatesV = coordinates.function_space()
data = coordinates.dat.data_ro_with_halos
coordinatesDM = coordinatesV.dm
coordinatesSection = coordinatesDM.getDefaultSection()
coordinatesSection = coordinatesDM.getLocalSection()

closure_of_p = [x for x in dm.getTransitiveClosure(p, useCone=True)[0] if coordinatesSection.getDof(x) > 0]

Expand Down
2 changes: 1 addition & 1 deletion firedrake/preconditioners/pmg.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def initialize(self, obj):
elements.append(ele)

sf = odm.getPointSF()
section = odm.getDefaultSection()
section = odm.getLocalSection()
attach_hooks(pdm, level=len(elements)-1, sf=sf, section=section)
# Now overwrite some routines on the DM
pdm.setRefine(None)
Expand Down
2 changes: 1 addition & 1 deletion tests/firedrake/regression/test_mesh_from_plex.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def get_plex_with_update_coordinates(mesh):
remove_pyop2_label(plex)

coord_dm = plex.getCoordinateDM()
coord_dm.setSection(coord_section)
coord_dm.setLocalSection(coord_section)
coords_local = coord_dm.createLocalVec()
coords_local.array[:] = np.reshape(
mesh.coordinates.dat.data_ro_with_halos, coords_local.array.shape
Expand Down
2 changes: 1 addition & 1 deletion tests/firedrake/regression/test_moore_spence.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def residual(theta, lmbda, ttheta):
es.setFromOptions()
es.solve()

ev_re, ev_im = petsc_B.getVecs()
ev_re, ev_im = petsc_B.createVecs()
es.getEigenpair(0, ev_re, ev_im)
eigenmode = Function(V)
eigenmode.dat.data_wo[...] = ev_re.buffer_r
Expand Down
4 changes: 2 additions & 2 deletions tests/firedrake/regression/test_slepc.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ def test_laplace_physical_ev(parallel=False):
assert nconv > 0

# Create the results vectors
vr, wr = A.getVecs()
vi, wi = A.getVecs()
vr, wr = A.createVecs()
vi, wi = A.createVecs()
ev = []
for i in range(nconv):
k = E.getEigenpair(i, vr, vi)
Expand Down
Loading