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,
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());
}
......
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