Skip to content
Snippets Groups Projects
Commit 9cc0c1d8 authored by Denis Louis's avatar Denis Louis
Browse files

never too late for debugging

parent a940996b
No related branches found
No related tags found
No related merge requests found
...@@ -286,38 +286,31 @@ void boundaryElementTags(std::vector<std::size_t> &domainBoundaryElementTags, ...@@ -286,38 +286,31 @@ void boundaryElementTags(std::vector<std::size_t> &domainBoundaryElementTags,
const std::vector<elementStruct> &elementVector, const std::vector<elementStruct> &elementVector,
const int domainPhysicalGroupTag) const int domainPhysicalGroupTag)
{ {
#pragma omp parallel std::vector<std::size_t> localElementTags;
// This loop goes through all the nodes of the boundary (node 1 of each element). We then use getElementsByCoordinates to obtain all the elements in common with the node considered. We only take the 2d elements.
for(std::size_t i = 0; i < elementVector.size(); i++)
{ {
std::vector<std::size_t> localElementTags; std::vector<size_t> elementTags;
gmsh::model::mesh::getElementsByCoordinates(elementVector[i].x1, elementVector[i].y1, 0, elementTags, 2);
// This loop goes through all the nodes of the boundary (node 1 of each element). We then use getElementsByCoordinates to obtain all the elements in common with the node considered. We only take the 2d elements. // We loop on the 2d elements which are in common with the considered node of the boundary. Depending on their type, they are added to the vector comprising all the 2d elements in contact with the boundary.
#pragma omp for schedule(guided) for(std::size_t j = 0; j < elementTags.size(); j++)
for(std::size_t i = 0; i < elementVector.size(); i++)
{ {
std::vector<size_t> elementTags; int elementType;
gmsh::model::mesh::getElementsByCoordinates(elementVector[i].x1, elementVector[i].y1, 0, elementTags, 2); std::vector<size_t> nodeTags;
int entityDim;
// We loop on the 2d elements which are in common with the considered node of the boundary. Depending on their type, they are added to the vector comprising all the 2d elements in contact with the boundary. int entityTag;
for(std::size_t j = 0; j < elementTags.size(); j++) std::vector<int> physicalTags;
{
int elementType; gmsh::model::mesh::getElement(elementTags[j], elementType, nodeTags, entityDim, entityTag);
std::vector<size_t> nodeTags; gmsh::model::getPhysicalGroupsForEntity(entityDim, entityTag, physicalTags);
int entityDim;
int entityTag; for(std::size_t k = 0; k < physicalTags.size(); k++)
std::vector<int> physicalTags; if(physicalTags[k] == domainPhysicalGroupTag)
#pragma omp critical localElementTags.push_back(elementTags[j]);
{
gmsh::model::mesh::getElement(elementTags[j], elementType, nodeTags, entityDim, entityTag);
gmsh::model::getPhysicalGroupsForEntity(entityDim, entityTag, physicalTags);
}
for(std::size_t k = 0; k < physicalTags.size(); k++)
if(physicalTags[k] == domainPhysicalGroupTag)
localElementTags.push_back(elementTags[j]);
}
} }
#pragma omp critical
domainBoundaryElementTags.insert(domainBoundaryElementTags.end(), localElementTags.begin(), localElementTags.end()); domainBoundaryElementTags.insert(domainBoundaryElementTags.end(), localElementTags.begin(), localElementTags.end());
} }
......
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