diff --git a/srcs/BEM/postProcessing.cpp b/srcs/BEM/postProcessing.cpp index 7a45cc63409d842bee3bc799a04536f7a788eb64..d5b16836c486042a3d5b94ba00815f105d0fc988 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()); }