From 0a522834c7a9e7c8dcdebb17770fc2f008de97e1 Mon Sep 17 00:00:00 2001 From: Roy Stogner Date: Thu, 5 Oct 2023 16:30:58 -0500 Subject: [PATCH] Simplify IGA constraint row construction No need to use the same complicated code twice when we can reuse the first step's results. I think this was an artifact of me not realizing from the get-go that I needed to do that work for the key construction. --- src/mesh/exodusII_io.C | 42 +++++++++++------------------------------- 1 file changed, 11 insertions(+), 31 deletions(-) diff --git a/src/mesh/exodusII_io.C b/src/mesh/exodusII_io.C index 26fd01e0b7e..e5459b050fa 100644 --- a/src/mesh/exodusII_io.C +++ b/src/mesh/exodusII_io.C @@ -607,38 +607,18 @@ void ExodusII_IO::read (const std::string & fname) Real w = 0; std::vector, Real>> constraint_row; - for (auto spline_node_index : - make_range(exio_helper->bex_num_elem_cvs)) + for (auto [libmesh_spline_node_id, coef] : key) { - // global => libMesh index, with crazy 1-based data - see comments above - const int gi = (elem_num)*exio_helper->bex_num_elem_cvs + - spline_node_index; - const dof_id_type libmesh_node_id = - exio_helper->node_num_map[exio_helper->connect[gi] - 1] - 1; - - const unsigned long elem_coef_vec_index = - my_constraint_rows[spline_node_index] - 1; // Exodus isn't 0-based - - const Node & spline_node = mesh.node_ref(libmesh_node_id); - - auto & coef_vec = - bex_constraint_vec(elem_coef_vec_index, *exio_helper); - const Real coef = - libmesh_vector_at(coef_vec, elem_node_index); - - // We don't need to store 0 entries; - // constraint_rows is a sparse structure. - if (coef) - { - p.add_scaled(spline_node, coef); - const Real spline_w = weights_exist ? - spline_node.get_extra_datum(weight_index) : 1; - w += coef * spline_w; - - const Elem * nodeelem = - libmesh_map_find(spline_nodeelem_ptrs, &spline_node); - constraint_row.emplace_back(std::make_pair(nodeelem, 0), coef); - } + const Node & spline_node = mesh.node_ref(libmesh_spline_node_id); + + p.add_scaled(spline_node, coef); + const Real spline_w = weights_exist ? + spline_node.get_extra_datum(weight_index) : 1; + w += coef * spline_w; + + const Elem * nodeelem = + libmesh_map_find(spline_nodeelem_ptrs, &spline_node); + constraint_row.emplace_back(std::make_pair(nodeelem, 0), coef); } Node *n = mesh.add_point(p, n_nodes++);