Skip to content

Commit baccfaf

Browse files
Merge pull request #1112 from Geode-solutions/feat/computation_grid_output
fix(convert_grid): Updated code to current grid usage.
2 parents 9e7163d + 47e04d4 commit baccfaf

File tree

2 files changed

+19
-33
lines changed

2 files changed

+19
-33
lines changed

src/geode/mesh/helpers/convert_solid_mesh.cpp

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -246,28 +246,18 @@ namespace
246246
to_densify[cell_id] = true;
247247
}
248248
geode::GenericMapping< geode::index_t > old2new_mapping;
249-
for( const auto k : geode::Range{ grid.nb_cells_in_direction( 2 ) } )
249+
for( const auto cell_id : geode::Range{ grid.nb_cells() } )
250250
{
251-
for( const auto j :
252-
geode::Range{ grid.nb_cells_in_direction( 1 ) } )
251+
if( to_densify[cell_id] )
253252
{
254-
for( const auto i :
255-
geode::Range{ grid.nb_cells_in_direction( 0 ) } )
256-
{
257-
const auto cell_id = grid.cell_index( { i, j, k } );
258-
if( to_densify[cell_id] )
259-
{
260-
continue;
261-
}
262-
const auto vertices =
263-
grid_cell_vertices( grid, { i, j, k } );
264-
const auto hex_id =
265-
builder.create_hexahedron( { vertices[0], vertices[1],
266-
vertices[3], vertices[2], vertices[4], vertices[5],
267-
vertices[7], vertices[6] } );
268-
old2new_mapping.map( cell_id, hex_id );
269-
}
253+
continue;
270254
}
255+
const auto cell_indices = grid.cell_indices( cell_id );
256+
const auto vertices = grid_cell_vertices( grid, cell_indices );
257+
const auto hex_id = builder.create_hexahedron(
258+
{ vertices[0], vertices[1], vertices[3], vertices[2],
259+
vertices[4], vertices[5], vertices[7], vertices[6] } );
260+
old2new_mapping.map( cell_id, hex_id );
271261
}
272262
for( const auto cell_index : geode::Indices{ cells_to_densify } )
273263
{

src/geode/mesh/helpers/convert_surface_mesh.cpp

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -189,22 +189,18 @@ namespace
189189
to_densify[cell_id] = true;
190190
}
191191
geode::GenericMapping< geode::index_t > old2new_mapping;
192-
for( const auto j : geode::Range{ grid.nb_cells_in_direction( 1 ) } )
192+
for( const auto cell_id : geode::Range{ grid.nb_cells() } )
193193
{
194-
for( const auto i :
195-
geode::Range{ grid.nb_cells_in_direction( 0 ) } )
194+
if( to_densify[cell_id] )
196195
{
197-
const auto cell_id = grid.cell_index( { i, j } );
198-
if( to_densify[cell_id] )
199-
{
200-
continue;
201-
}
202-
for( const auto triangle_id :
203-
create_triangles_from_diagonal_pattern(
204-
builder, grid, { i, j } ) )
205-
{
206-
old2new_mapping.map( cell_id, triangle_id );
207-
}
196+
continue;
197+
}
198+
const auto cell_indices = grid.cell_indices( cell_id );
199+
for( const auto triangle_id :
200+
create_triangles_from_diagonal_pattern(
201+
builder, grid, cell_indices ) )
202+
{
203+
old2new_mapping.map( cell_id, triangle_id );
208204
}
209205
}
210206
for( const auto cell_index : geode::Indices{ cells_to_densify } )

0 commit comments

Comments
 (0)