Skip to content

Commit a147fe7

Browse files
These changes allowed the mixed wedge-tet BL (like the bump) tests to pass. Note the bigger changes were in getting the bump version of MGEN to write in the new (modelDim)*1M+dmg_model_dim approach. Some retooling was necessary since the box model has 0 values for tags of all 4 dimensions so error flags had to move to -1.
1 parent 81600e9 commit a147fe7

File tree

1 file changed

+23
-11
lines changed

1 file changed

+23
-11
lines changed

test/matchedNodeElmReader.cc

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,17 @@ int findRegionTag2Face(gmi_model* model, int* cAll, int nverts) {
110110
}
111111
}
112112
}
113-
return 0;
113+
return -1;
114+
}
115+
116+
int findRegionTag1Face(gmi_model* model, int cmax) {
117+
int rtag,dimE, cnd;
118+
dimE=cmax/1000000;
119+
cnd=cmax-dimE*1000000;
120+
gmi_ent* maxE = gmi_find(model,dimE,cnd);
121+
gmi_set* RegionsAdjMax = gmi_adjacent(model,maxE,3);
122+
rtag=gmi_tag(model,RegionsAdjMax->e[0]);
123+
return rtag;
114124
}
115125

116126
void setVtxClassification(gmi_model* model, apf::Mesh2* mesh, apf::MeshTag* vtxClass) {
@@ -150,7 +160,7 @@ void setEdgeClassification(gmi_model* model, apf::Mesh2* mesh,apf::MeshTag* vtxC
150160
apf::Adjacent verts;
151161
int k,ff;
152162
double distFromDebug1;
153-
apf::Vector3 xd1(-0.0047625, -0.477012, 0.1);
163+
apf::Vector3 xd1(0.000509276, 0, 0.0797419);
154164
apf::Vector3 dx1;
155165
apf::Vector3 dx2;
156166
apf::Vector3 tmp;
@@ -192,7 +202,7 @@ void setEdgeClassification(gmi_model* model, apf::Mesh2* mesh,apf::MeshTag* vtxC
192202
nverts=2;
193203
int ctri[2]={cmax,cmin};
194204
int rtag = findRegionTag2Face(model, ctri, nverts);
195-
assert(rtag!=0); // bad input list of ctri (e.g., not two distinct faces)
205+
assert(rtag != -1); // bad input list of ctri (e.g., not two distinct faces)
196206
mesh->setModelEntity(e,getMdlRegion(mesh,rtag));
197207
} else {
198208
//FAILS ROLL OUR OWN int res = gmi_is_in_closure_of(model,gmi_find(model,dimMin,tagMin), gmi_find(model,dimMax,tagMax));
@@ -213,8 +223,10 @@ void setEdgeClassification(gmi_model* model, apf::Mesh2* mesh,apf::MeshTag* vtxC
213223
}
214224
if( ff!=-1 ) { // is it in cls
215225
mesh->setModelEntity(e,getMdlFace(mesh,cmax-2000000));
216-
} else // edge not in closure so interior
217-
assert(false); // hoping we don't get here
226+
} else { // edge not in closure so interior
227+
int rtag = findRegionTag1Face(model, cmax) ;
228+
mesh->setModelEntity(e,getMdlRegion(mesh,rtag));
229+
}
218230
}
219231
} else if (cmax >= 1000000) { // max is an edge
220232
if (cmin == cmax) // cls on same edge
@@ -264,7 +276,7 @@ void setFaceClassification(gmi_model* model, apf::Mesh2* mesh, apf::MeshTag* vtx
264276
int c,rtag;
265277
apf::Adjacent verts;
266278
double distFromDebug1;
267-
apf::Vector3 xd1(-2.63644, -0.953687, 0.00762);
279+
apf::Vector3 xd1(-0.597998, 0.41004, 0.08);
268280
apf::Vector3 dx1;
269281
apf::Vector3 dx2;
270282
apf::Vector3 tmp;
@@ -288,7 +300,7 @@ void setFaceClassification(gmi_model* model, apf::Mesh2* mesh, apf::MeshTag* vtx
288300
cmax=std::max(cmax,c);
289301
ctri[i]=c;
290302
}
291-
if(1==0 && distFromDebug1 < 1e-3) {
303+
if(0==1 && distFromDebug1 < 1e-11) {
292304
fprintf(stderr, "%d %d %.15e %.15E %.15E \n", cmin, cmax, Centroid[0], Centroid[1], Centroid[2]);
293305
for (int i=0; i < nverts; i++) {
294306
mesh->getPoint(verts[i],0,tmp); // fprintf(stderr, "%d %.15e %.15E %.15E \n", i , tmp[0], tmp[1], tmp[2]);
@@ -299,7 +311,7 @@ void setFaceClassification(gmi_model* model, apf::Mesh2* mesh, apf::MeshTag* vtx
299311
} else if(cmin >= 2000000) { // all nodes on model face(s?)
300312
if(cmax != cmin) { // all on faces but not all on same so classified on interior
301313
rtag = findRegionTag2Face(model, ctri, nverts);
302-
assert(rtag!=0); // bad input list of ctri (e.g., not two distinct faces)
314+
assert(rtag!=-1); // bad input list of ctri (e.g., not two distinct faces)
303315
mesh->setModelEntity(f,getMdlRegion(mesh,rtag));
304316
} else { // all on same face so classify on that one
305317
mesh->setModelEntity(f,getMdlFace(mesh,cmax-2000000));
@@ -347,7 +359,7 @@ void setFaceClassification(gmi_model* model, apf::Mesh2* mesh, apf::MeshTag* vtx
347359
gmi_end(model,gi);
348360
if(faceFound != nverts ) { // none of the model face's closure held all verts classificaton so interior wedges can sit in corner with a face with 1 vertex on each of two faces and other one on the edge that intersects the two faces (or a model vertex) so the above fails in this LITERAL conner case)
349361
rtag = findRegionTag2Face(model, ctri, nverts);
350-
assert(rtag!=0); //bad input list of ctri (e.g., not two distinct faces) POSSIBLE yet unseen/unhandled case
362+
assert(rtag!=-1); //bad input list of ctri (e.g., not two distinct faces) POSSIBLE yet unseen/unhandled case
351363
mesh->setModelEntity(f,getMdlRegion(mesh,rtag));
352364
}
353365
}
@@ -377,11 +389,11 @@ void setRgnClassification(gmi_model* model, apf::Mesh2* mesh, apf::MeshTag* vtxC
377389
cmax=std::max(cmax,c);
378390
cAll[i]=c;
379391
}
380-
if(cmax > 3000000) {
392+
if(cmax >= 3000000) {
381393
mesh->setModelEntity(rgn,getMdlRegion(mesh,cmax-3000000));
382394
} else {
383395
int rtag = findRegionTag2Face(model, cAll, nverts);
384-
assert(rtag!=0); // bad input list of ctri (e.g., not two distinct faces) POSSIBLE yet unseen/unhandled case
396+
assert(rtag!=-1); // bad input list of ctri (e.g., not two distinct faces) POSSIBLE yet unseen/unhandled case
385397
mesh->setModelEntity(rgn,getMdlRegion(mesh,rtag));
386398
}
387399
}

0 commit comments

Comments
 (0)