Skip to content

Commit

Permalink
Merge pull request #13 from NGSolve/uzerbinati/3dAdaptivity
Browse files Browse the repository at this point in the history
Added support for 3D adaptivity
  • Loading branch information
UZerbinati authored Nov 21, 2023
2 parents 76bd064 + 925ff7c commit 1cc888b
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion ngsPETSc/utils/firedrake.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,28 @@ def refineMarkedElements(self, mark):
self.netgen_mesh.Refine(adaptive=True)
return fd.Mesh(self.netgen_mesh)
return fd.Mesh(netgen.libngpy._meshing.Mesh(2))

elif self.geometric_dimension() == 3:
with mark.dat.vec as marked:
marked0 = marked
getIdx = self._cell_numbering.getOffset
if self.sfBCInv is not None:
getIdx = lambda x: x
_, marked0 = self.topology_dm.distributeField(self.sfBCInv,
self._cell_numbering,
marked)
if self.comm.Get_rank() == 0:
mark = marked0.getArray()
for i, el in enumerate(self.netgen_mesh.Elements3D()):
if mark[getIdx(i)]:
el.refine = True
else:
el.refine = False
self.netgen_mesh.Refine(adaptive=True)
return fd.Mesh(self.netgen_mesh)
return fd.Mesh(netgen.libngpy._meshing.Mesh(3))
else:
raise NotImplementedError("No implementation for dimension other than 2.")
raise NotImplementedError("No implementation for dimension other than 2 and 3.")

def curveField(self, order):
'''
Expand Down

0 comments on commit 1cc888b

Please sign in to comment.