Skip to content
Snippets Groups Projects
Commit 15d76bae authored by Norihiro Watanabe's avatar Norihiro Watanabe Committed by GitHub
Browse files

Merge pull request #1565 from norihiro-w/fix-Dof-resize

[Num/DOF] don't use conservative resize in DoF table 
parents f6fc1222 6ac1c686
No related branches found
No related tags found
No related merge requests found
...@@ -37,13 +37,6 @@ LocalToGlobalIndexMap::findGlobalIndicesWithElementID( ...@@ -37,13 +37,6 @@ LocalToGlobalIndexMap::findGlobalIndicesWithElementID(
std::vector<MeshLib::Node*> const& nodes, std::size_t const mesh_id, std::vector<MeshLib::Node*> const& nodes, std::size_t const mesh_id,
const unsigned comp_id, const unsigned comp_id_write) const unsigned comp_id, const unsigned comp_id_write)
{ {
// _rows should be resized based on an element ID
std::size_t max_elem_id = 0;
for (ElementIterator e = first; e != last; ++e)
max_elem_id = std::max(max_elem_id, (*e)->getID());
if (max_elem_id+1 > static_cast<unsigned>(_rows.rows()))
_rows.conservativeResize(max_elem_id + 1, _mesh_subsets.size());
std::unordered_set<MeshLib::Node*> const set_nodes(nodes.begin(), nodes.end()); std::unordered_set<MeshLib::Node*> const set_nodes(nodes.begin(), nodes.end());
// For each element find the global indices for node/element // For each element find the global indices for node/element
...@@ -161,6 +154,14 @@ LocalToGlobalIndexMap::LocalToGlobalIndexMap( ...@@ -161,6 +154,14 @@ LocalToGlobalIndexMap::LocalToGlobalIndexMap(
// For all MeshSubsets and each of their MeshSubset's and each element // For all MeshSubsets and each of their MeshSubset's and each element
// of that MeshSubset save a line of global indices. // of that MeshSubset save a line of global indices.
// _rows should be resized based on an element ID
std::size_t max_elem_id = 0;
for (std::vector<MeshLib::Element*>const* eles : vec_var_elements)
{
for (auto e : *eles)
max_elem_id = std::max(max_elem_id, e->getID());
}
_rows.resize(max_elem_id + 1, _mesh_subsets.size());
std::size_t offset = 0; std::size_t offset = 0;
for (int variable_id = 0; variable_id < static_cast<int>(vec_var_n_components.size()); for (int variable_id = 0; variable_id < static_cast<int>(vec_var_n_components.size());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment