From 9cc0c1d8fd5bb9db8728a7976e26bff769a46fae Mon Sep 17 00:00:00 2001 From: Louis Denis <louis.denis@student.uliege.be> Date: Fri, 20 May 2022 23:19:57 +0200 Subject: [PATCH] never too late for debugging --- srcs/BEM/postProcessing.cpp | 47 ++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 27 deletions(-) diff --git a/srcs/BEM/postProcessing.cpp b/srcs/BEM/postProcessing.cpp index 7a45cc6..d5b1683 100644 --- a/srcs/BEM/postProcessing.cpp +++ b/srcs/BEM/postProcessing.cpp @@ -286,38 +286,31 @@ void boundaryElementTags(std::vector<std::size_t> &domainBoundaryElementTags, const std::vector<elementStruct> &elementVector, 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. - #pragma omp for schedule(guided) - for(std::size_t i = 0; i < elementVector.size(); i++) + // 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. + for(std::size_t j = 0; j < elementTags.size(); j++) { - std::vector<size_t> elementTags; - gmsh::model::mesh::getElementsByCoordinates(elementVector[i].x1, elementVector[i].y1, 0, elementTags, 2); - - // 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. - for(std::size_t j = 0; j < elementTags.size(); j++) - { - int elementType; - std::vector<size_t> nodeTags; - int entityDim; - int entityTag; - std::vector<int> physicalTags; - #pragma omp critical - { - 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]); - } + int elementType; + std::vector<size_t> nodeTags; + int entityDim; + int entityTag; + std::vector<int> physicalTags; + + 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()); } -- GitLab