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

FINAL DEADLINE AND FINAL VERSION OF THE CODE

parent f546eb61
No related branches found
No related tags found
No related merge requests found
...@@ -317,47 +317,42 @@ void boundaryElementTags(std::vector<std::size_t> &domainBoundaryElementTags, ...@@ -317,47 +317,42 @@ void boundaryElementTags(std::vector<std::size_t> &domainBoundaryElementTags,
const int domainPhysicalGroupTag) const int domainPhysicalGroupTag)
{ {
// #pragma omp parallel // #pragma omp parallel
std::vector<std::size_t> localElementTags; // For parallelization.
// Loops over each boundary element and retrieves the element in contact with its boundary nodes.
// #pragma omp for schedule(guided)
for(std::size_t i = 0; i < elementVector.size(); i++)
{ {
std::vector<std::size_t> localElementTags; // For parallelization. std::vector<size_t> elementTags;
gmsh::model::mesh::getElementsByCoordinates(elementVector[i].x1, elementVector[i].y1, 0, elementTags, 2);
// Loops over each boundary element and retrieves the element in contact with its boundary nodes. // Adds the elements tags to the local vector.
// #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++)
{ {
// Retrieves the physical group to which the element belongs because it is possible that the element belongs to
// an adjacent physical surface.
int elementType; int elementType;
std::vector<size_t> nodeTags; std::vector<size_t> nodeTags;
int entityDim; int entityDim;
int entityTag; int entityTag;
std::vector<int> physicalTags; std::vector<int> physicalTags;
// #pragma omp critical
// Adds the elements tags to the local vector.
for(std::size_t j = 0; j < elementTags.size(); j++)
{ {
// Retrieves the physical group to which the element belongs because it is possible that the element belongs to gmsh::model::mesh::getElement(elementTags[j], elementType, nodeTags, entityDim, entityTag);
// an adjacent physical surface. gmsh::model::getPhysicalGroupsForEntity(entityDim, entityTag, physicalTags);
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);
}
// Add the element tag (to a local 'thread safe' vector) if the physical tag is the right one.
for(std::size_t k = 0; k < physicalTags.size(); k++)
if(physicalTags[k] == domainPhysicalGroupTag)
localElementTags.push_back(elementTags[j]);
} }
// Add the element tag (to a local 'thread safe' vector) if the physical tag is the right one.
for(std::size_t k = 0; k < physicalTags.size(); k++)
if(physicalTags[k] == domainPhysicalGroupTag)
localElementTags.push_back(elementTags[j]);
} }
// // Fills the "domainBoundaryElementTags" vector.
// #pragma omp critical
domainBoundaryElementTags.insert(domainBoundaryElementTags.end(), localElementTags.begin(), localElementTags.end());
} }
// // Fills the "domainBoundaryElementTags" vector.
// #pragma omp critical
domainBoundaryElementTags.insert(domainBoundaryElementTags.end(), localElementTags.begin(), localElementTags.end());
// Allows duplicate tags to be removed. If an element has several nodes in common with the boundary, it has been counted // Allows duplicate tags to be removed. If an element has several nodes in common with the boundary, it has been counted
// several times before. // several times before.
......
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