Skip to content

Commit fb9cddb

Browse files
committed
Sort mesh indices before saving culled meshes
We need to create the graph file only after sorting has happened.
1 parent ee813d3 commit fb9cddb

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

compass/ocean/mesh/cull.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from mpas_tools.io import write_netcdf
1111
from mpas_tools.logging import LoggingContext, check_call
1212
from mpas_tools.mesh.conversion import cull
13+
from mpas_tools.mesh.creation.sort_mesh import sort_mesh
1314
from mpas_tools.mesh.mask import compute_mpas_flood_fill_mask
1415
from mpas_tools.ocean import inject_bathymetry
1516
from mpas_tools.ocean.coastline_alteration import (
@@ -19,6 +20,7 @@
1920
)
2021
from mpas_tools.viz.paraview_extractor import extract_vtk
2122

23+
from compass.model import make_graph_file
2224
from compass.step import Step
2325

2426

@@ -365,11 +367,18 @@ def _cull_mesh_with_logging(logger, with_cavities, with_critical_passages,
365367
logger=logger)
366368

367369
# cull the mesh a second time using a flood fill from the seed points
368-
dsCulledMesh = cull(dsCulledMesh, dsInverse=dsSeedMask,
369-
graphInfoFileName='culled_graph.info', logger=logger,
370+
dsCulledMesh = cull(dsCulledMesh, dsInverse=dsSeedMask, logger=logger,
370371
dir='.')
372+
373+
# sort the cell, edge and vertex indices for better performances
374+
dsCulledMesh = sort_mesh(dsCulledMesh)
375+
371376
write_netcdf(dsCulledMesh, 'culled_mesh.nc')
372377

378+
# we need to make the graph file after sorting
379+
make_graph_file(mesh_filename='culled_mesh.nc',
380+
graph_filename='culled_graph.info')
381+
373382
if critical_passages:
374383
# make a new version of the critical passages mask on the culled mesh
375384
fcCritPassages.to_geojson('critical_passages.geojson')

0 commit comments

Comments
 (0)