Skip to content
Snippets Groups Projects
Commit 30fa96cc authored by Jonathan Lambrechts's avatar Jonathan Lambrechts
Browse files

dg : first step towards 1d in addition of 2d and 3d

parent 99a66757
Branches
Tags
No related merge requests found
...@@ -326,6 +326,7 @@ void dgAlgorithm::buildGroups(GModel *model, int dim, int order, ...@@ -326,6 +326,7 @@ void dgAlgorithm::buildGroups(GModel *model, int dim, int order,
std::vector<dgGroupOfFaces*> &fGroups, std::vector<dgGroupOfFaces*> &fGroups,
std::vector<dgGroupOfFaces*> &bGroups) std::vector<dgGroupOfFaces*> &bGroups)
{ {
std::map<const std::string,std::set<MVertex*> > boundaryVertices;
std::map<const std::string,std::set<MEdge, Less_Edge> > boundaryEdges; std::map<const std::string,std::set<MEdge, Less_Edge> > boundaryEdges;
std::map<const std::string,std::set<MFace, Less_Face> > boundaryFaces; std::map<const std::string,std::set<MFace, Less_Face> > boundaryFaces;
std::vector<GEntity*> entities; std::vector<GEntity*> entities;
...@@ -338,10 +339,19 @@ void dgAlgorithm::buildGroups(GModel *model, int dim, int order, ...@@ -338,10 +339,19 @@ void dgAlgorithm::buildGroups(GModel *model, int dim, int order,
const std::string physicalName = model->getPhysicalName(entity->dim(), entity->physicals[j]); const std::string physicalName = model->getPhysicalName(entity->dim(), entity->physicals[j]);
for (int k = 0; k < entity->getNumMeshElements(); k++) { for (int k = 0; k < entity->getNumMeshElements(); k++) {
MElement *element = entity->getMeshElement(k); MElement *element = entity->getMeshElement(k);
if(dim==2) switch(dim) {
boundaryEdges[physicalName].insert( MEdge(element->getVertex(0), element->getVertex(1)) ); case 1:
else boundaryVertices[physicalName].insert( element->getVertex(0) );
boundaryFaces[physicalName].insert( MFace(element->getVertex(0), element->getVertex(1),element->getVertex(2)) ); break;
case 2:
boundaryEdges[physicalName].insert( MEdge(element->getVertex(0), element->getVertex(1)) );
break;
case 3:
boundaryFaces[physicalName].insert( MFace(element->getVertex(0), element->getVertex(1),element->getVertex(2)) );
break;
default :
throw;
}
} }
} }
}else if(entity->dim() == dim){ }else if(entity->dim() == dim){
...@@ -351,17 +361,30 @@ void dgAlgorithm::buildGroups(GModel *model, int dim, int order, ...@@ -351,17 +361,30 @@ void dgAlgorithm::buildGroups(GModel *model, int dim, int order,
} }
eGroups.push_back(new dgGroupOfElements(allElements,order)); eGroups.push_back(new dgGroupOfElements(allElements,order));
fGroups.push_back(new dgGroupOfFaces(*eGroups[0],order)); fGroups.push_back(new dgGroupOfFaces(*eGroups[0],order));
if(dim==2){ switch(dim) {
std::map<const std::string, std::set<MEdge, Less_Edge> >::iterator mapIt; case 1 : {
for(mapIt=boundaryEdges.begin(); mapIt!=boundaryEdges.end(); mapIt++) { std::map<const std::string, std::set<MVertex*> >::iterator mapIt;
bGroups.push_back(new dgGroupOfFaces(*eGroups[0],mapIt->first,order,mapIt->second)); /*for(mapIt=boundaryVertices.begin(); mapIt!=boundaryVertices.end(); mapIt++) {
bGroups.push_back(new dgGroupOfFaces(*eGroups[0],mapIt->first,order,mapIt->second));
}*/
throw;
break;
} }
}else if(dim=3){ case 2 : {
std::map<const std::string, std::set<MFace, Less_Face> >::iterator mapIt; std::map<const std::string, std::set<MEdge, Less_Edge> >::iterator mapIt;
for(mapIt=boundaryFaces.begin(); mapIt!=boundaryFaces.end(); mapIt++) { for(mapIt=boundaryEdges.begin(); mapIt!=boundaryEdges.end(); mapIt++) {
bGroups.push_back(new dgGroupOfFaces(*eGroups[0],mapIt->first,order,mapIt->second)); bGroups.push_back(new dgGroupOfFaces(*eGroups[0],mapIt->first,order,mapIt->second));
}
break;
} }
}else throw; case 3 : {
std::map<const std::string, std::set<MFace, Less_Face> >::iterator mapIt;
for(mapIt=boundaryFaces.begin(); mapIt!=boundaryFaces.end(); mapIt++) {
bGroups.push_back(new dgGroupOfFaces(*eGroups[0],mapIt->first,order,mapIt->second));
}
break;
}
}
} }
// works only if there is only 1 group of element // works only if there is only 1 group of element
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment