Skip to content
Snippets Groups Projects
Commit aa5ce962 authored by Maltez Cavalheiro Kévin's avatar Maltez Cavalheiro Kévin
Browse files

Update boundaryElements.cpp

Fixed a bug where there were two nested loops on variable i.
parent 798e430c
No related tags found
1 merge request!17Update boundaryElements.cpp
...@@ -77,7 +77,7 @@ std::size_t fillElementVector(std::vector<elementStruct> &elementVector, ...@@ -77,7 +77,7 @@ std::size_t fillElementVector(std::vector<elementStruct> &elementVector,
// tags and nodes tags) in gmsh. // tags and nodes tags) in gmsh.
std::vector<int> entityTags; std::vector<int> entityTags;
gmsh::model::getEntitiesForPhysicalGroup(physicalGroupDim, physicalGroupTag, entityTags); gmsh::model::getEntitiesForPhysicalGroup(physicalGroupDim, physicalGroupTag, entityTags);
for (std::size_t i = 0; i < entityTags.size(); i++) for (std::size_t entity = 0; entity < entityTags.size(); entity++)
{ {
std::vector<int> elementTypes = {1, 8}; // Hardcoded types of 2/3-nodes 1D elements. std::vector<int> elementTypes = {1, 8}; // Hardcoded types of 2/3-nodes 1D elements.
for(std::size_t j = 0; j < elementTypes.size(); j++) for(std::size_t j = 0; j < elementTypes.size(); j++)
...@@ -89,14 +89,14 @@ std::size_t fillElementVector(std::vector<elementStruct> &elementVector, ...@@ -89,14 +89,14 @@ std::size_t fillElementVector(std::vector<elementStruct> &elementVector,
// Get the element tags and the node tags of each element. // Get the element tags and the node tags of each element.
std::vector<std::size_t> elementTags; std::vector<std::size_t> elementTags;
std::vector<std::size_t> elementNodeTags; std::vector<std::size_t> elementNodeTags;
gmsh::model::mesh::getElementsByType(elementTypes[j], elementTags, elementNodeTags, entityTags[i]); gmsh::model::mesh::getElementsByType(elementTypes[j], elementTags, elementNodeTags, entityTags[entity]);
// Get the coordinates of each node (extracted above). // Get the coordinates of each node (extracted above).
std::vector<std::size_t> nodeTags; std::vector<std::size_t> nodeTags;
std::vector<double> nodeCoords; std::vector<double> nodeCoords;
std::vector<double> parametricNodeCoords; std::vector<double> parametricNodeCoords;
gmsh::model::mesh::getNodesByElementType(elementTypes[j], nodeTags, nodeCoords, parametricNodeCoords, gmsh::model::mesh::getNodesByElementType(elementTypes[j], nodeTags, nodeCoords, parametricNodeCoords,
entityTags[i], false); entityTags[entity], false);
// Constructs a map associating the index of each node tag in the "nodeCoords" vector. // Constructs a map associating the index of each node tag in the "nodeCoords" vector.
std::map<std::size_t, std::size_t> nodeIndices; std::map<std::size_t, std::size_t> nodeIndices;
......
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