Skip to content

Commit

Permalink
Sort mesh indices before saving culled meshes
Browse files Browse the repository at this point in the history
We need to create the graph file only after sorting has happened.
  • Loading branch information
xylar committed Aug 8, 2023
1 parent 204ffcd commit a3ba192
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions compass/ocean/mesh/cull.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from mpas_tools.io import write_netcdf
from mpas_tools.logging import LoggingContext, check_call
from mpas_tools.mesh.conversion import cull
from mpas_tools.mesh.creation.sort_mesh import sort_mesh
from mpas_tools.mesh.mask import compute_mpas_flood_fill_mask
from mpas_tools.ocean import inject_bathymetry
from mpas_tools.ocean.coastline_alteration import (
Expand All @@ -19,6 +20,7 @@
)
from mpas_tools.viz.paraview_extractor import extract_vtk

from compass.model import make_graph_file
from compass.step import Step


Expand Down Expand Up @@ -365,11 +367,18 @@ def _cull_mesh_with_logging(logger, with_cavities, with_critical_passages,
logger=logger)

# cull the mesh a second time using a flood fill from the seed points
dsCulledMesh = cull(dsCulledMesh, dsInverse=dsSeedMask,
graphInfoFileName='culled_graph.info', logger=logger,
dsCulledMesh = cull(dsCulledMesh, dsInverse=dsSeedMask, logger=logger,
dir='.')

# sort the cell, edge and vertex indices for better performances
dsCulledMesh = sort_mesh(dsCulledMesh)

write_netcdf(dsCulledMesh, 'culled_mesh.nc')

# we need to make the graph file after sorting
make_graph_file(mesh_filename='culled_mesh.nc',
graph_filename='culled_graph.info')

if critical_passages:
# make a new version of the critical passages mask on the culled mesh
fcCritPassages.to_geojson('critical_passages.geojson')
Expand Down

0 comments on commit a3ba192

Please sign in to comment.