Skip to content

Conversation

@UZerbinati
Copy link
Collaborator

No description provided.

nodes_to_correct_sorted.sort()
nodes_to_correct_index = np.unique(nodes_to_correct_sorted)
tic = time.time()
logger.info("\t\t\tSanpping the DMPlex to NETGEN mesh")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
logger.info("\t\t\tSanpping the DMPlex to NETGEN mesh")
logger.info("\t\t\tSnapping the DMPlex to NETGEN mesh")

petscPlexCoordinates.setArray(petscCoordinates.reshape((-1,1)))
petscPlex.setCoordinatesLocal(petscPlexCoordinates)
toc = time.time()
logger.debug(f"\t\t\tSanp the DMPlex to NETGEN mesh. Time taken: {toc - tic} seconds")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
logger.debug(f"\t\t\tSanp the DMPlex to NETGEN mesh. Time taken: {toc - tic} seconds")
logger.debug(f"\t\t\tSnap the DMPlex to NETGEN mesh. Time taken: {toc - tic} seconds")

:arg mesh: the Netgen/NGSolve mesh
:arg levs: the number of levels in the hierarchy
:arg netgen_flags: either a bool or a dictionray containing options for Netgen.
:arg flags: either a bool or a dictionray containing options for Netgen.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
:arg flags: either a bool or a dictionray containing options for Netgen.
:arg flags: either a bool or a dictionary containing options for Netgen.

WIP
Signed-off-by: Umberto Zerbinati <zerbinati@maths.ox.ac.uk>
Comment on lines +62 to +64
A[0,0] = (coordinates[cell[1]]-coordinates[cell[0]])[0]
A[0,1] = (coordinates[cell[1]]-coordinates[cell[0]])[1]
A[0,2] = (coordinates[cell[1]]-coordinates[cell[0]])[2]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
A[0,0] = (coordinates[cell[1]]-coordinates[cell[0]])[0]
A[0,1] = (coordinates[cell[1]]-coordinates[cell[0]])[1]
A[0,2] = (coordinates[cell[1]]-coordinates[cell[0]])[2]
A[0,:] = coordinates[cell[1]] - coordinates[cell[0]]

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or even better

for i in range(3):
    A[i, :] = coordinates[cell[i+1]] - coordinates[cell[i]]

if np.linalg.det(A) > 0:
cells[i] = cell
else:
cells[i] = np.array([cell[0],cell[1],cell[2], cell[2]])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is going on here?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't cell[i] the vertices?

Comment on lines +80 to +81
cStart = start_end[0]
cEnd = start_end[1]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style

Suggested change
cStart = start_end[0]
cEnd = start_end[1]
cStart, cEnd = start_end

Comment on lines +101 to +102
cStart = start_end[0]
cEnd = start_end[1]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cStart = start_end[0]
cEnd = start_end[1]
cStart, cEnd = start_end

if np.linalg.det(A) > 0:
cells[i] = cell
else:
cells[i] = np.array([cell[0],cell[1],cell[2], cell[2]])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cells[i] = np.array([cell[0],cell[1],cell[2], cell[2]])
cells[i] = np.array([cell[0], cell[1], cell[3], cell[2]])

for i in range(cStart,cEnd):
sIndex = sIndicies[i]
if len(sIndex)==4:
cell = list(set(cell_indicies[i]))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choosing a better name can help clarifying the logic here

Suggested change
cell = list(set(cell_indicies[i]))
cell_verts = list(set(cell_indicies[i]))

Comment on lines +54 to +55
cStart = start_end[0]
cEnd = start_end[1]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cStart = start_end[0]
cEnd = start_end[1]
cStart, cEnd = start_end

for i in range(cStart,cEnd):
sIndex = sIndicies[i]
if len(sIndex)==4:
cell = list(set(cell_indicies[i]))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the role of casting into a set? Are we ever going to get repeated vertices or do we only want to sort the vertices?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove duplicates

uzerbianati added 2 commits December 16, 2025 19:18
WIP
Signed-off-by: uzerbianati <zerbinati@maths.ox.ac.uk>
uzerbianati added 2 commits December 16, 2025 19:26
Signed-off-by: uzerbianati <zerbinati@maths.ox.ac.uk>
Signed-off-by: uzerbianati <zerbinati@maths.ox.ac.uk>
@UZerbinati UZerbinati merged commit 2605268 into main Dec 16, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants