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

fix skin for "sparse" time datasets

parent f73be0ae
No related branches found
No related tags found
No related merge requests found
...@@ -153,11 +153,19 @@ PView *GMSH_SkinPlugin::execute(PView *v) ...@@ -153,11 +153,19 @@ PView *GMSH_SkinPlugin::execute(PView *v)
std::set<ElmData, ElmDataLessThan> skin; std::set<ElmData, ElmDataLessThan> skin;
ElmDataLessThan::tolerance = CTX::instance()->lc * 1.e-12; ElmDataLessThan::tolerance = CTX::instance()->lc * 1.e-12;
for(int ent = 0; ent < data1->getNumEntities(0); ent++){ int firstNonEmptyStep = 0;
for(int ele = 0; ele < data1->getNumElements(0, ent); ele++){ for(int step = 0; step < data1->getNumTimeSteps(); step++){
if(data1->skipElement(0, ent, ele)) continue; if(data1->hasTimeStep(step)){
int numComp = data1->getNumComponents(0, ent, ele); firstNonEmptyStep = step;
int type = data1->getType(0, ent, ele); break;
}
}
for(int ent = 0; ent < data1->getNumEntities(firstNonEmptyStep); ent++){
for(int ele = 0; ele < data1->getNumElements(firstNonEmptyStep, ent); ele++){
if(data1->skipElement(firstNonEmptyStep, ent, ele)) continue;
int numComp = data1->getNumComponents(firstNonEmptyStep, ent, ele);
int type = data1->getType(firstNonEmptyStep, ent, ele);
const int (*boundary)[6][4]; const int (*boundary)[6][4];
int numBoundary = getBoundary(type, &boundary); int numBoundary = getBoundary(type, &boundary);
if(!numBoundary) continue; if(!numBoundary) continue;
...@@ -167,7 +175,7 @@ PView *GMSH_SkinPlugin::execute(PView *v) ...@@ -167,7 +175,7 @@ PView *GMSH_SkinPlugin::execute(PView *v)
int nod = (*boundary)[i][j]; int nod = (*boundary)[i][j];
if(nod < 0) continue; if(nod < 0) continue;
double x, y, z; double x, y, z;
data1->getNode(0, ent, ele, nod, x, y, z); data1->getNode(firstNonEmptyStep, ent, ele, nod, x, y, z);
e.x.push_back(x); e.x.push_back(x);
e.y.push_back(y); e.y.push_back(y);
e.z.push_back(z); e.z.push_back(z);
...@@ -175,6 +183,7 @@ PView *GMSH_SkinPlugin::execute(PView *v) ...@@ -175,6 +183,7 @@ PView *GMSH_SkinPlugin::execute(PView *v)
std::set<ElmData, ElmDataLessThan>::iterator it = skin.find(e); std::set<ElmData, ElmDataLessThan>::iterator it = skin.find(e);
if(it == skin.end()){ if(it == skin.end()){
for(int step = 0; step < data1->getNumTimeSteps(); step++){ for(int step = 0; step < data1->getNumTimeSteps(); step++){
if(data1->hasTimeStep(step)){
for(int j = 0; j < 4; j++){ for(int j = 0; j < 4; j++){
int nod = (*boundary)[i][j]; int nod = (*boundary)[i][j];
if(nod < 0) continue; if(nod < 0) continue;
...@@ -185,6 +194,7 @@ PView *GMSH_SkinPlugin::execute(PView *v) ...@@ -185,6 +194,7 @@ PView *GMSH_SkinPlugin::execute(PView *v)
} }
} }
} }
}
skin.insert(e); skin.insert(e);
} }
else else
...@@ -198,6 +208,7 @@ PView *GMSH_SkinPlugin::execute(PView *v) ...@@ -198,6 +208,7 @@ PView *GMSH_SkinPlugin::execute(PView *v)
it->addInView(data2); it->addInView(data2);
for(int i = 0; i < data1->getNumTimeSteps(); i++) for(int i = 0; i < data1->getNumTimeSteps(); i++)
if(data1->hasTimeStep(i))
data2->Time.push_back(data1->getTime(i)); data2->Time.push_back(data1->getTime(i));
data2->setName(data1->getName() + "_Skin"); data2->setName(data1->getName() + "_Skin");
data2->setFileName(data1->getName() + "_Skin.pos"); data2->setFileName(data1->getName() + "_Skin.pos");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment