Skip to content
Snippets Groups Projects
Commit 40d7dd84 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

test: OrientedBoundary" and "CombinedOrientedBoundary"

parent 5949440f
Branches
Tags
No related merge requests found
...@@ -432,7 +432,7 @@ void GModel::getEntitiesInBox(std::vector<GEntity*> &entities, SBoundingBox3d bo ...@@ -432,7 +432,7 @@ void GModel::getEntitiesInBox(std::vector<GEntity*> &entities, SBoundingBox3d bo
} }
void GModel::getBoundaryTags(std::vector<int> inTags[4], std::vector<int> outTags[4], void GModel::getBoundaryTags(std::vector<int> inTags[4], std::vector<int> outTags[4],
bool combined) bool combined, bool oriented)
{ {
for(int dim = 1; dim < 4; dim++){ for(int dim = 1; dim < 4; dim++){
for(unsigned int i = 0; i < inTags[dim].size(); i++){ for(unsigned int i = 0; i < inTags[dim].size(); i++){
...@@ -440,8 +440,16 @@ void GModel::getBoundaryTags(std::vector<int> inTags[4], std::vector<int> outTag ...@@ -440,8 +440,16 @@ void GModel::getBoundaryTags(std::vector<int> inTags[4], std::vector<int> outTag
GRegion *gr = getRegionByTag(inTags[3][i]); GRegion *gr = getRegionByTag(inTags[3][i]);
if(gr){ if(gr){
std::list<GFace*> faces(gr->faces()); std::list<GFace*> faces(gr->faces());
for(std::list<GFace*>::iterator it = faces.begin(); it != faces.end(); it++) std::list<int> orientations(gr->faceOrientations());
outTags[2].push_back((*it)->tag()); std::list<int>::iterator ito = orientations.begin();
for(std::list<GFace*>::iterator it = faces.begin(); it != faces.end(); it++){
int tag = (*it)->tag();
if(oriented && ito != orientations.end()){
tag *= *ito;
ito++;
}
outTags[2].push_back(tag);
}
} }
else else
Msg::Error("Unknown model region with tag %d", inTags[3][i]); Msg::Error("Unknown model region with tag %d", inTags[3][i]);
...@@ -450,8 +458,16 @@ void GModel::getBoundaryTags(std::vector<int> inTags[4], std::vector<int> outTag ...@@ -450,8 +458,16 @@ void GModel::getBoundaryTags(std::vector<int> inTags[4], std::vector<int> outTag
GFace *gf = getFaceByTag(inTags[2][i]); GFace *gf = getFaceByTag(inTags[2][i]);
if(gf){ if(gf){
std::list<GEdge*> edges(gf->edges()); std::list<GEdge*> edges(gf->edges());
for(std::list<GEdge*>::iterator it = edges.begin(); it != edges.end(); it++) std::list<int> orientations(gf->edgeOrientations());
outTags[1].push_back((*it)->tag()); std::list<int>::iterator ito = orientations.begin();
for(std::list<GEdge*>::iterator it = edges.begin(); it != edges.end(); it++){
int tag = (*it)->tag();
if(oriented && ito != orientations.end()){
tag *= *ito;
ito++;
}
outTags[1].push_back(tag);
}
} }
else else
Msg::Error("Unknown model face with tag %d", inTags[2][i]); Msg::Error("Unknown model face with tag %d", inTags[2][i]);
......
...@@ -291,7 +291,7 @@ class GModel { ...@@ -291,7 +291,7 @@ class GModel {
// get tags of entities of the boundary of the given input entities // get tags of entities of the boundary of the given input entities
void getBoundaryTags(std::vector<int> inTags[4], std::vector<int> outTags[4], void getBoundaryTags(std::vector<int> inTags[4], std::vector<int> outTags[4],
bool combined); bool combined, bool oriented);
// return the highest number associated with an elementary entity of // return the highest number associated with an elementary entity of
// a given dimension (or the highest overall if dim < 0) // a given dimension (or the highest overall if dim < 0)
......
This diff is collapsed.
...@@ -2234,7 +2234,10 @@ Transform : ...@@ -2234,7 +2234,10 @@ Transform :
List_Add($$, &s); List_Add($$, &s);
} }
} }
else if(action == "Boundary" || action == "CombinedBoundary"){ else if(action == "Boundary" ||
action == "CombinedBoundary" ||
action == "OrientedBoundary" ||
action == "CombinedOrientedBoundary"){
// boundary operations are performed directly on GModel, which enables // boundary operations are performed directly on GModel, which enables
// to compute the boundary of hybrid CAD models; this also automatically // to compute the boundary of hybrid CAD models; this also automatically
// binds all boundary entities for OCC models // binds all boundary entities for OCC models
...@@ -2244,7 +2247,9 @@ Transform : ...@@ -2244,7 +2247,9 @@ Transform :
if(GModel::current()->getGEOInternals()->getChanged()) if(GModel::current()->getGEOInternals()->getChanged())
GModel::current()->getGEOInternals()->synchronize(GModel::current()); GModel::current()->getGEOInternals()->synchronize(GModel::current());
std::vector<int> in[4], out[4]; ListOfShapes2Vectors($3, in); std::vector<int> in[4], out[4]; ListOfShapes2Vectors($3, in);
GModel::current()->getBoundaryTags(in, out, action == "CombinedBoundary"); GModel::current()->getBoundaryTags
(in, out, action.find("Combined") != std::string::npos,
action.find("Oriented") != std::string::npos);
Vectors2ListOfShapes(out, $$); Vectors2ListOfShapes(out, $$);
} }
else{ else{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment