Skip to content

Commit dc23545

Browse files
committed
v9.34.13
2 parents 6af8f60 + e6b19ea commit dc23545

3 files changed

Lines changed: 368 additions & 31 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cmake_minimum_required(VERSION 3.7.0...${CMAKE_VERSION})
22

3-
project(Omega_h VERSION 9.34.12 LANGUAGES CXX)
3+
project(Omega_h VERSION 9.34.13 LANGUAGES CXX)
44

55
set(Omega_h_USE_STK_DEFAULT OFF)
66
option(Omega_h_USE_STK "Whether to build the STK interface" ${Omega_h_USE_STK_DEFAULT})

src/Omega_h_gmsh.cpp

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -552,15 +552,15 @@ Mesh read_parallel(filesystem::path filename, CommPtr comm) {
552552
if (nnodes == 0) {
553553
Omega_h_fail("Please check that filename is correct!\n");
554554
}
555+
555556
std::map<GO, LO> node_number_map;
556-
HostWrite<GO> host_vert_globals(nnodes);
557+
Write<GO> vert_globals_w(nnodes);
557558
for (LO local_index = 0; local_index < nnodes; ++local_index) {
558559
const auto global_index =
559560
static_cast<GO>(node_tags[static_cast<std::size_t>(local_index)]);
560561
node_number_map[global_index] = local_index;
561-
host_vert_globals[local_index] = global_index;
562+
vert_globals_w[local_index] = global_index;
562563
}
563-
Read<GO> vert_globals(host_vert_globals.write());
564564

565565
std::array<std::vector<int>, 4> ent_class_ids;
566566
std::array<std::vector<LO>, 4> ent_nodes;
@@ -631,6 +631,23 @@ Mesh read_parallel(filesystem::path filename, CommPtr comm) {
631631
Omega_h_fail("There were no Elements of dimension higher than zero!\n");
632632
}
633633

634+
// function to decrement the values of container given in parameter
635+
// by the minimum value of the container across all ranks
636+
auto shift_container_values = [&](auto& container) {
637+
auto local_min_it = std::min_element(container.begin(), container.end());
638+
OMEGA_H_CHECK(local_min_it != container.end());
639+
auto global_min = comm->allreduce(*local_min_it, OMEGA_H_MIN);
640+
if (global_min != 0) {
641+
for (auto& id : container) {
642+
id -= global_min;
643+
}
644+
}
645+
};
646+
// shift elements global identifiers so that they start at 0
647+
shift_container_values(ent_globals[max_dim]);
648+
// shift vertices global identifiers so that they start at 0
649+
shift_container_values(vert_globals_w);
650+
634651
HostWrite<Real> host_coords(nnodes * max_dim);
635652
for (LO local_index = 0; local_index < nnodes; ++local_index) {
636653
for (LO j = 0; j < max_dim; ++j) {
@@ -640,7 +657,7 @@ Mesh read_parallel(filesystem::path filename, CommPtr comm) {
640657
}
641658
for (Int ent_dim = max_dim; ent_dim >= 0; --ent_dim) {
642659
const auto ndim_ents = static_cast<LO>(ent_globals[ent_dim].size());
643-
HostWrite<GO> host_elem_globals(ndim_ents);
660+
Write<GO> host_elem_globals(ndim_ents);
644661
HostWrite<LO> host_class_id(ndim_ents);
645662
HostWrite<LO> host_ev2v(ent_nodes[ent_dim].size());
646663
if (ndim_ents > 0) {
@@ -660,21 +677,20 @@ Mesh read_parallel(filesystem::path filename, CommPtr comm) {
660677
}
661678
LOs eqv2v(host_ev2v.write());
662679
if (ent_dim == max_dim) {
663-
Read<GO> elem_globals(host_elem_globals.write());
664680
// build_from_elems2verts(
665681
// &mesh, mesh.library()->self(), OMEGA_H_SIMPLEX, dim, eqv2v,
666682
// vert_globals);
667683
mesh.set_comm(comm);
668684
mesh.set_parting(OMEGA_H_ELEM_BASED);
669685
mesh.set_family(family);
670686
mesh.set_dim(ent_dim);
671-
build_verts_from_globals(&mesh, vert_globals);
687+
build_verts_from_globals(&mesh, vert_globals_w);
672688
// build_ents_from_elems2verts(&mesh, eqv2v, vert_globals, elem_globals);
673689
for (Int mdim = 1; mdim < ent_dim; ++mdim) {
674690
auto mv2v = find_unique(eqv2v, mesh.family(), ent_dim, mdim);
675-
add_ents2verts(&mesh, mdim, mv2v, vert_globals, GOs());
691+
add_ents2verts(&mesh, mdim, mv2v, vert_globals_w, GOs());
676692
}
677-
add_ents2verts(&mesh, ent_dim, eqv2v, vert_globals, elem_globals);
693+
add_ents2verts(&mesh, ent_dim, eqv2v, vert_globals_w, host_elem_globals);
678694
// if (!comm->reduce_and(is_sorted(vert_globals))) {
679695
// reorder_by_globals(&mesh);
680696
//}

0 commit comments

Comments
 (0)