本文整理汇总了C++中BitArray::Test方法的典型用法代码示例。如果您正苦于以下问题:C++ BitArray::Test方法的具体用法?C++ BitArray::Test怎么用?C++ BitArray::Test使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitArray
的用法示例。
在下文中一共展示了BitArray::Test方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Add
void Add (int ind)
{
if (!flags.Test(ind))
{
set.Append (ind);
flags.Set (ind);
}
}
示例2: GetWorkingArea
void GetWorkingArea(BitArray & working_elements, BitArray & working_points,
const Mesh & mesh, const Array<ElementIndex> & bad_elements,
const int width)
{
working_elements.Clear();
working_points.Clear();
for(int i=0; i<bad_elements.Size(); i++)
{
working_elements.Set(bad_elements[i]);
const Element & el = mesh[bad_elements[i]];
for(int j=1; j<=el.GetNP(); j++)
working_points.Set(el.PNum(j));
}
for(int i=0; i<width; i++)
{
for(ElementIndex j=0; j<mesh.GetNE(); j++)
{
if(!working_elements.Test(j))
{
const Element & el = mesh[j];
bool set_active = false;
for(int k=1; !set_active && k<=el.GetNP(); k++)
set_active = working_points.Test(el.PNum(k));
if(set_active)
working_elements.Set(j);
}
}
for(ElementIndex j=0; j<mesh.GetNE(); j++)
{
if(working_elements.Test(j))
{
const Element & el = mesh[j];
for(int k=1; k<=el.GetNP(); k++)
working_points.Set(el.PNum(k));
}
}
}
}
示例3: ClassifySegm
HPREF_ELEMENT_TYPE ClassifySegm(HPRefElement & hpel, INDEX_2_HASHTABLE<int> & edges, INDEX_2_HASHTABLE<int> & edgepoint_dom,
BitArray & cornerpoint, BitArray & edgepoint, INDEX_3_HASHTABLE<int> & faces, INDEX_2_HASHTABLE<int> & face_edges,
INDEX_2_HASHTABLE<int> & surf_edges, Array<int, PointIndex::BASE> & facepoint)
{
int cp1 = cornerpoint.Test (hpel[0]);
int cp2 = cornerpoint.Test (hpel[1]);
INDEX_2 i2;
i2 = INDEX_2(hpel[0], hpel[1]);
i2.Sort();
if (!edges.Used (i2))
{
cp1 = edgepoint.Test (hpel[0]);
cp2 = edgepoint.Test (hpel[1]);
}
if(!edges.Used(i2) && !face_edges.Used(i2))
{
if(facepoint[hpel[0]]!=0) cp1=1;
if(facepoint[hpel[1]]!=0) cp2=1;
}
if(edges.Used(i2) && !face_edges.Used(i2))
{
if(facepoint[hpel[0]]) cp1 = 1;
if(facepoint[hpel[1]]) cp2 = 1;
}
if (!cp1 && !cp2)
hpel.type = HP_SEGM;
else if (cp1 && !cp2)
hpel.type = HP_SEGM_SINGCORNERL;
else if (!cp1 && cp2)
hpel.type = HP_SEGM_SINGCORNERR;
else
hpel.type = HP_SEGM_SINGCORNERS;
// cout << " SEGM found with " << hpel[0] << " \t" << hpel[1] << endl << " of type " << hpel.type << endl;
return(hpel.type) ;
}
示例4: GetPureBadness
void GetPureBadness(Mesh & mesh, Array<double> & pure_badness,
const BitArray & isnewpoint)
{
//const int ne = mesh.GetNE();
const int np = mesh.GetNP();
pure_badness.SetSize(np+PointIndex::BASE+1);
pure_badness = -1;
Array< Point<3>* > backup(np);
for(int i=0; i<np; i++)
{
backup[i] = new Point<3>(mesh.Point(i+1));
if(isnewpoint.Test(i+PointIndex::BASE) &&
mesh.mlbetweennodes[i+PointIndex::BASE][0] > 0)
{
mesh.Point(i+1) = Center(mesh.Point(mesh.mlbetweennodes[i+PointIndex::BASE][0]),
mesh.Point(mesh.mlbetweennodes[i+PointIndex::BASE][1]));
}
}
for (ElementIndex i = 0; i < mesh.GetNE(); i++)
{
double bad = mesh[i].CalcJacobianBadness (mesh.Points());
for(int j=0; j<mesh[i].GetNP(); j++)
if(bad > pure_badness[mesh[i][j]])
pure_badness[mesh[i][j]] = bad;
// save maximum
if(bad > pure_badness.Last())
pure_badness.Last() = bad;
}
for(int i=0; i<np; i++)
{
mesh.Point(i+1) = *backup[i];
delete backup[i];
}
}
示例5: RepairBisection
void RepairBisection(Mesh & mesh, Array<ElementIndex> & bad_elements,
const BitArray & isnewpoint, const Refinement & refinement,
const Array<double> & pure_badness,
double max_worsening, const bool uselocalworsening,
const Array< Array<int,PointIndex::BASE>* > & idmaps)
{
ostringstream ostrstr;
const int maxtrials = 100;
//bool doit;
//cout << "DOIT: " << flush;
//cin >> doit;
int ne = mesh.GetNE();
int np = mesh.GetNP();
int numbadneighbours = 3;
const int numtopimprove = 3;
PrintMessage(1,"repairing");
PushStatus("Repair Bisection");
Array<Point<3>* > should(np);
Array<Point<3>* > can(np);
Array<Vec<3>* > nv(np);
for(int i=0; i<np; i++)
{
nv[i] = new Vec<3>;
should[i] = new Point<3>;
can[i] = new Point<3>;
}
BitArray isboundarypoint(np),isedgepoint(np);
isboundarypoint.Clear();
isedgepoint.Clear();
for(int i = 1; i <= mesh.GetNSeg(); i++)
{
const Segment & seg = mesh.LineSegment(i);
isedgepoint.Set(seg[0]);
isedgepoint.Set(seg[1]);
}
Array<int> surfaceindex(np);
surfaceindex = -1;
for (int i = 1; i <= mesh.GetNSE(); i++)
{
const Element2d & sel = mesh.SurfaceElement(i);
for (int j = 1; j <= sel.GetNP(); j++)
if(!isedgepoint.Test(sel.PNum(j)))
{
isboundarypoint.Set(sel.PNum(j));
surfaceindex[sel.PNum(j) - PointIndex::BASE] =
mesh.GetFaceDescriptor(sel.GetIndex()).SurfNr();
}
}
Validate(mesh,bad_elements,pure_badness,
((uselocalworsening) ? (0.8*(max_worsening-1.) + 1.) : (0.1*(max_worsening-1.) + 1.)),
uselocalworsening); // -> larger working area
BitArray working_elements(ne);
BitArray working_points(np);
GetWorkingArea(working_elements,working_points,mesh,bad_elements,numbadneighbours);
//working_elements.Set();
//working_points.Set();
ostrstr.str("");
ostrstr << "worsening: " <<
Validate(mesh,bad_elements,pure_badness,max_worsening,uselocalworsening);
PrintMessage(4,ostrstr.str());
int auxnum=0;
for(int i=1; i<=np; i++)
if(working_points.Test(i))
auxnum++;
ostrstr.str("");
ostrstr << "Percentage working points: " << 100.*double(auxnum)/np;
PrintMessage(5,ostrstr.str());
BitArray isworkingboundary(np);
for(int i=1; i<=np; i++)
if(working_points.Test(i) && isboundarypoint.Test(i))
isworkingboundary.Set(i);
else
isworkingboundary.Clear(i);
for(int i=0; i<np; i++)
*should[i] = mesh.Point(i+1);
//.........这里部分代码省略.........
示例6: IsIn
int IsIn (int ind) const
{
return flags.Test (ind);
}
示例7: ClassifyTrig
HPREF_ELEMENT_TYPE ClassifyTrig(HPRefElement & el, INDEX_2_HASHTABLE<int> & edges, INDEX_2_HASHTABLE<int> & edgepoint_dom,
BitArray & cornerpoint, BitArray & edgepoint, INDEX_3_HASHTABLE<int> & faces, INDEX_2_HASHTABLE<int> & face_edges,
INDEX_2_HASHTABLE<int> & surf_edges, Array<int, PointIndex::BASE> & facepoint, int dim, const FaceDescriptor & fd)
{
HPREF_ELEMENT_TYPE type = HP_NONE;
int pnums[3];
INDEX_3 i3 (el.pnums[0], el.pnums[1], el.pnums[2]);
i3.Sort();
bool sing_face = faces.Used (i3);
for (int j = 1; j <= 3; j++)
{
int ep1 = edgepoint.Test (el.PNumMod (j));
int ep2 = edgepoint.Test (el.PNumMod (j+1));
int ep3 = edgepoint.Test (el.PNumMod (j+2));
if (dim == 2)
{
// JS, Dec 11
ep1 = edgepoint_dom.Used (INDEX_2 (fd.SurfNr(), el.PNumMod(j))) ||
edgepoint_dom.Used (INDEX_2 (-1, el.PNumMod(j)));
ep2 = edgepoint_dom.Used (INDEX_2 (fd.SurfNr(), el.PNumMod(j+1))) ||
edgepoint_dom.Used (INDEX_2 (-1, el.PNumMod(j+1)));
ep3 = edgepoint_dom.Used (INDEX_2 (fd.SurfNr(), el.PNumMod(j+2))) ||
edgepoint_dom.Used (INDEX_2 (-1, el.PNumMod(j+2)));
/*
ep1 = edgepoint_dom.Used (INDEX_2 (el.index, el.PNumMod(j)));
ep2 = edgepoint_dom.Used (INDEX_2 (el.index, el.PNumMod(j+1)));
ep3 = edgepoint_dom.Used (INDEX_2 (el.index, el.PNumMod(j+2)));
*/
// ep3 = edgepoint_dom.Used (INDEX_2 (mesh.SurfaceElement(i).GetIndex(), el.PNumMod(j+2)));
}
int cp1 = cornerpoint.Test (el.PNumMod (j));
int cp2 = cornerpoint.Test (el.PNumMod (j+1));
int cp3 = cornerpoint.Test (el.PNumMod (j+2));
ep1 |= cp1;
ep2 |= cp2;
ep3 |= cp3;
// (*testout) << "cp = " << cp1 << cp2 << cp3 << ", ep = " << ep1 << ep2 << ep3 << endl;
int p[3] = { el.PNumMod (j), el.PNumMod (j+1), el.PNumMod (j+2)};
if(ep1)
{
INDEX_2 i2a=INDEX_2::Sort(p[0], p[1]);
INDEX_2 i2b=INDEX_2::Sort(p[0], p[2]);
if(!edges.Used(i2a) && !edges.Used(i2b))
cp1 = 1;
}
if(ep2)
{
INDEX_2 i2a=INDEX_2::Sort(p[1], p[0]);
INDEX_2 i2b=INDEX_2::Sort(p[1], p[2]);
if(!edges.Used(i2a) && !edges.Used(i2b))
cp2 = 1;
}
if(ep3)
{
INDEX_2 i2a=INDEX_2::Sort(p[2], p[0]);
INDEX_2 i2b=INDEX_2::Sort(p[2], p[1]);
if(!edges.Used(i2a) && !edges.Used(i2b))
cp3= 1;
}
int isedge1=0, isedge2=0, isedge3=0;
if(dim == 3 )
{
INDEX_2 i2;
i2 = INDEX_2(el.PNumMod (j), el.PNumMod (j+1));
isedge1 = edges.Used (i2);
i2.Sort();
if(surf_edges.Used(i2) && surf_edges.Get(i2) != fd.SurfNr()+1 &&
(face_edges.Get(i2) == -1 || face_edges.Get(i2) == fd.DomainIn() || face_edges.Get(i2) == fd.DomainOut()) )
{
isedge1=1;
ep1 = 1; ep2=1;
}
i2 = INDEX_2(el.PNumMod (j+1), el.PNumMod (j+2));
isedge2 = edges.Used (i2);
i2.Sort();
if(surf_edges.Used(i2) && surf_edges.Get(i2) != fd.SurfNr()+1 &&
(face_edges.Get(i2) == -1 || face_edges.Get(i2) == fd.DomainIn() || face_edges.Get(i2) == fd.DomainOut()) )
{
isedge2=1;
ep2 = 1; ep3=1;
}
i2 = INDEX_2(el.PNumMod (j+2), el.PNumMod (j+3));
isedge3 = edges.Used (i2);
i2.Sort();
if(surf_edges.Used(i2) && surf_edges.Get(i2) != fd.SurfNr()+1 &&
//.........这里部分代码省略.........
示例8: ClassifyPrism
HPREF_ELEMENT_TYPE ClassifyPrism(HPRefElement & el, INDEX_2_HASHTABLE<int> & edges, INDEX_2_HASHTABLE<int> & edgepoint_dom,
BitArray & cornerpoint, BitArray & edgepoint, INDEX_3_HASHTABLE<int> & faces, INDEX_2_HASHTABLE<int> & face_edges,
INDEX_2_HASHTABLE<int> & surf_edges, Array<int, PointIndex::BASE> & facepoint)
{
HPREF_ELEMENT_TYPE type = HP_NONE;
int p[6];
for(int m=1;m<=6;m++)
{
int point_sing[6]={0,0,0,0,0,0};
int face_sing[5]={0,0,0,0,0};
int edge_sing[9]={0,0,0,0,0,0,0,0,0};
if(m<4)
{
p[0]= m; p[1]=m%3+1; p[2]=(m%3+1)%3+1;
for(int l=3;l<6;l++) p[l]=p[l-3]+3;
}
else
{
p[0] = m; p[1]=(m%3+1)%3+4; p[2]=m%3+4;
for(int l=3;l<6;l++) p[l]=p[l-3]-3;
}
for(int j=0;j<6;j++)
{
if(cornerpoint.Test(el.PNum(p[j]))) { point_sing[p[j]-1]=3;}
else if(edgepoint.Test(el.PNum(p[j]))) point_sing[p[j]-1]=2;
else if (facepoint[el.PNum(p[j])] == -1 || facepoint[el.PNum(p[j])] == el.GetIndex())
point_sing[p[j]-1] = 1;
}
const ELEMENT_EDGE * eledges = MeshTopology::GetEdges (PRISM);
for(int k=0;k<9;k++)
{
INDEX_2 i2 = INDEX_2 :: Sort(el.PNum(p[eledges[k][0]-1]),el.PNum(p[eledges[k][1]-1]));
if (edges.Used(i2)) edge_sing[k] = 2;
else edge_sing[k] = face_edges.Used(i2);
}
const ELEMENT_FACE * elfaces = MeshTopology::GetFaces (PRISM);
for (int k=0;k<5;k++)
{
INDEX_3 i3;
if(k<2)
i3 = INDEX_3::Sort(el.pnums[p[elfaces[k][0]-1]-1], el.pnums[p[elfaces[k][1]-1]-1],
el.pnums[p[elfaces[k][2]-1]-1]);
else
{
INDEX_4 i4 = INDEX_4(el.pnums[p[elfaces[k][0]-1]-1], el.pnums[p[elfaces[k][1]-1]-1], el.pnums[p[elfaces[k][2]-1]-1],el.pnums[p[elfaces[k][3]-1]-1]);
i4.Sort();
i3 = INDEX_3(i4.I1(), i4.I2(), i4.I3());
}
if (faces.Used (i3))
{
int domnr = faces.Get(i3);
if (domnr == -1 || domnr == el.GetIndex())
face_sing[k] = 1;
}
}
if (face_sing[1] > face_sing[0]) {m=m+2; continue;}
//int cp = 0;
int qfsing = face_sing[2] + face_sing[3] + face_sing[4];
int tfsing = face_sing[0] + face_sing[1];
int evsing = edge_sing[6] + edge_sing[7] + edge_sing[8];
int ehsing = edge_sing[0] + edge_sing[1] + edge_sing[2] + edge_sing[3] + edge_sing[4] + edge_sing[5];
if (qfsing + tfsing + evsing + ehsing == 0)
{ type = HP_PRISM; break;}
HPREF_ELEMENT_TYPE types[] = {HP_NONE,HP_NONE,HP_NONE};
int fb = (1-face_sing[4])* face_sing[3] * (face_sing[2] + face_sing[3]) + 3*face_sing[4]*face_sing[3]*face_sing[2];
int sve[3] = {edge_sing[7] , edge_sing[8], edge_sing[6]};
if(fb!=qfsing) continue;
switch(fb)
{
case 0:
if (evsing == 0 && ehsing==3*tfsing)
{
types[0] = HP_PRISM;
types[1] = HP_PRISM_1FA_0E_0V;
types[2] = HP_PRISM_2FA_0E_0V;
}
if(evsing > 0 && sve[0] == evsing) // 1 vertical edge 1-4
{
types[0] = HP_PRISM_SINGEDGE;
types[1] = HP_PRISM_1FA_1E_0V;
types[2] = HP_PRISM_2FA_1E_0V;
//.........这里部分代码省略.........
示例9: ClassifyPyramid
HPREF_ELEMENT_TYPE ClassifyPyramid(HPRefElement & el, INDEX_2_HASHTABLE<int> & edges, INDEX_2_HASHTABLE<int> & edgepoint_dom,
BitArray & cornerpoint, BitArray & edgepoint, INDEX_3_HASHTABLE<int> & faces, INDEX_2_HASHTABLE<int> & face_edges,
INDEX_2_HASHTABLE<int> & surf_edges, Array<int, PointIndex::BASE> & facepoint)
{
HPREF_ELEMENT_TYPE type = HP_NONE;
// implementation only for HP_PYRAMID
// HP_PYRAMID_0E_1V
// HP_PYRAMID_EDGES
// HP_PYRAMID_1FB_0E_1VA
// up to now other cases are refine dummies
// indices of bot,top-faces combinations
// int index[6][2] = {{0,1},{1,0},{2,4},{4,2},{3,5},{5,3}};
const ELEMENT_FACE * elfaces = MeshTopology::GetFaces (PYRAMID);
const ELEMENT_EDGE * eledges = MeshTopology::GetEdges (PYRAMID);
int point_sing[5]={0,0,0,0,0};
int face_sing[5] = {0,0,0,0,0};
int edge_sing[8] = {0,0,0,0,0,0,0,0};
int spoint=0, sedge=0, sface=0;
for(int m=0;m<4 && type == HP_NONE;m++)
{
int p[5] = {m%4, m%4+1, m%4+2, m%4+3, 4};
for(int l=0;l<5;l++)
{
if(cornerpoint.Test(el.pnums[p[l]]))
point_sing[l]=3;
else if(edgepoint.Test(el.pnums[p[l]]))
point_sing[l]=2;
else if (facepoint[el.pnums[p[l]]] == -1 || facepoint[el.pnums[p[l]]] == el.GetIndex())
point_sing[l] = 1;
spoint += point_sing[l];
}
for(int k=0;k<8;k++)
{
INDEX_2 i2 = INDEX_2 :: Sort(el.pnums[p[eledges[k][0]-1]],
el.pnums[p[eledges[k][1]-1]]);
if (edges.Used(i2))
edge_sing[k] = 2;
else
edge_sing[k] = face_edges.Used(i2);
sedge += edge_sing[k];
}
for (int k=0;k<5;k++)
{
INDEX_3 i3;
INDEX_4 i4 = INDEX_4(el.pnums[p[elfaces[k][0]-1]], el.pnums[p[elfaces[k][1]-1]], el.pnums[p[elfaces[k][2]-1]],
el.pnums[p[elfaces[k][3]-1]]);
i4.Sort();
i3 = INDEX_3(i4.I1(), i4.I2(), i4.I3());
if (faces.Used (i3))
{
int domnr = faces.Get(i3);
if (domnr == -1 || domnr == el.GetIndex())
face_sing[k] = 1;
}
sface +=face_sing[k];
}
if(!sface && !spoint && !sedge) return(HP_PYRAMID);
if(!sface && !sedge && point_sing[p[0]] == spoint)
type = HP_PYRAMID_0E_1V;
if(!sface && edge_sing[0] + edge_sing[2] == sedge &&
spoint == point_sing[0] + point_sing[1] + point_sing[3])
type = HP_PYRAMID_EDGES;
if(sface && sface == face_sing[0] && spoint == point_sing[4] + 2)
type = HP_PYRAMID_1FB_0E_1VA;
if(type != HP_NONE)
{
int pnums[8];
for(int l=0;l<5;l++) pnums[l] = el[p[l]];
for(int l=0;l<5;l++) el[l] = pnums[l];
el.type=type;
break;
}
}
return (type);
}
示例10: ClassifyHex
HPREF_ELEMENT_TYPE ClassifyHex(HPRefElement & el, INDEX_2_HASHTABLE<int> & edges, INDEX_2_HASHTABLE<int> & edgepoint_dom,
BitArray & cornerpoint, BitArray & edgepoint, INDEX_3_HASHTABLE<int> & faces, INDEX_2_HASHTABLE<int> & face_edges,
INDEX_2_HASHTABLE<int> & surf_edges, Array<int, PointIndex::BASE> & facepoint)
{
HPREF_ELEMENT_TYPE type = HP_NONE;
// implementation only for HP_HEX_1F_0E_0V
// HP_HEX_1FA_1FB_0E_0V
// HP_HEX
// up to now other cases are refine dummies
// indices of bot,top-faces combinations
int index[6][2] = {{0,1},{1,0},{2,4},{4,2},{3,5},{5,3}};
int p[8];
const ELEMENT_FACE * elfaces = MeshTopology::GetFaces (HEX);
const ELEMENT_EDGE * eledges = MeshTopology::GetEdges (HEX);
for(int m=0;m<6 && type == HP_NONE;m++)
for(int j=0;j<4 && type == HP_NONE;j++)
{
int point_sing[8]={0,0,0,0,0,0,0,0};
int face_sing[6] = {0,0,0,0,0,0};
int edge_sing[12] = {0,0,0,0,0,0,0,0,0,0,0,0};
int spoint=0, sface=0, sedge=0;
for(int l=0;l<4;l++)
{
p[l] = elfaces[index[m][0]][(4-j-l)%4];
p[l+4] = elfaces[index[m][1]][(j+l)%4];
}
for(int l=0;l<8;l++)
if(cornerpoint.Test(el.PNum(p[l])))
{
point_sing[p[l]-1]=3;
spoint++;
}
else if(edgepoint.Test(el.PNum(p[l]))) point_sing[p[l]-1]=2;
else if (facepoint[el.PNum(p[l])] == -1 || facepoint[el.PNum(p[l])] == el.GetIndex())
point_sing[p[l]-1] = 1;
for(int k=0;k<12;k++)
{
INDEX_2 i2 = INDEX_2 :: Sort(el.PNum(p[eledges[k][0]-1]),el.PNum(p[eledges[k][1]-1]));
if (edges.Used(i2))
{
edge_sing[k] = 2;
sedge++;
}
else edge_sing[k] = face_edges.Used(i2);
}
for (int k=0;k<6;k++)
{
INDEX_3 i3;
INDEX_4 i4 = INDEX_4(el.pnums[p[elfaces[k][0]-1]-1], el.pnums[p[elfaces[k][1]-1]-1], el.pnums[p[elfaces[k][2]-1]-1],el.pnums[p[elfaces[k][3]-1]-1]);
i4.Sort();
i3 = INDEX_3(i4.I1(), i4.I2(), i4.I3());
if (faces.Used (i3))
{
int domnr = faces.Get(i3);
if (domnr == -1 || domnr == el.GetIndex())
{
face_sing[k] = 1;
sface++;
}
}
}
if(!sface && !sedge && !spoint) type = HP_HEX;
if(!sedge && !spoint)
{
if(face_sing[0] && face_sing[2] && sface==2)
type = HP_HEX_1FA_1FB_0E_0V;
if (face_sing[0] && sface==1)
type = HP_HEX_1F_0E_0V;
}
el.type=type;
if(type != HP_NONE)
{
int pnums[8];
for(int l=0;l<8;l++) pnums[l] = el[p[l]-1];
for(int l=0;l<8;l++) el[l] = pnums[l];
/* cout << " HEX with pnums " << pnums[0] << "\t" <<
pnums[1] << "\t" << pnums[2] << "\t" << pnums[3] << "\t" <<
pnums[4] << "\t" << pnums[5] << endl << " of type " << type << endl; */
break;
}
}
return (type);
}
示例11: ClassifyQuad
HPREF_ELEMENT_TYPE ClassifyQuad(HPRefElement & el, INDEX_2_HASHTABLE<int> & edges, INDEX_2_HASHTABLE<int> & edgepoint_dom,
BitArray & cornerpoint, BitArray & edgepoint, INDEX_3_HASHTABLE<int> & faces, INDEX_2_HASHTABLE<int> & face_edges,
INDEX_2_HASHTABLE<int> & surf_edges, Array<int, PointIndex::BASE> & facepoint, int dim, const FaceDescriptor & fd)
{
HPREF_ELEMENT_TYPE type = HP_NONE;
int ep1(-1), ep2(-1), ep3(-1), ep4(-1), cp1(-1), cp2(-1), cp3(-1), cp4(-1);
int isedge1, isedge2, isedge3, isedge4;
*testout << "edges = " << edges << endl;
for (int j = 1; j <= 4; j++)
{
ep1 = edgepoint.Test (el.PNumMod (j));
ep2 = edgepoint.Test (el.PNumMod (j+1));
ep3 = edgepoint.Test (el.PNumMod (j+2));
ep4 = edgepoint.Test (el.PNumMod (j+3));
if (dim == 2)
{
ep1 = edgepoint_dom.Used (INDEX_2 (el.GetIndex(), el.PNumMod(j)));
ep2 = edgepoint_dom.Used (INDEX_2 (el.GetIndex(), el.PNumMod(j+1)));
ep3 = edgepoint_dom.Used (INDEX_2 (el.GetIndex(), el.PNumMod(j+2)));
ep4 = edgepoint_dom.Used (INDEX_2 (el.GetIndex(), el.PNumMod(j+3)));
}
cp1 = cornerpoint.Test (el.PNumMod (j));
cp2 = cornerpoint.Test (el.PNumMod (j+1));
cp3 = cornerpoint.Test (el.PNumMod (j+2));
cp4 = cornerpoint.Test (el.PNumMod (j+3));
ep1 |= cp1;
ep2 |= cp2;
ep3 |= cp3;
ep4 |= cp4;
int p[4] = { el.PNumMod (j), el.PNumMod (j+1), el.PNumMod (j+2), el.PNumMod(j+4)};
//int epp[4] = { ep1, ep2, ep3, ep4};
int cpp[4] = { cp1, cp2, cp3, cp4};
for(int k=0;k<0;k++)
{
INDEX_2 i2a=INDEX_2::Sort(p[k], p[(k+1)%4]);
INDEX_2 i2b=INDEX_2::Sort(p[k], p[(k-1)%4]);
if(!edges.Used(i2a) && !edges.Used(i2b))
cpp[k] = 1;
}
cp1= cpp[0]; cp2=cpp[1]; cp3=cpp[2]; cp4=cpp[3];
if(dim ==3)
{
INDEX_2 i2;
i2 = INDEX_2(el.PNumMod (j), el.PNumMod (j+1));
// i2.Sort();
isedge1 = edges.Used (i2);
i2.Sort();
if(surf_edges.Used(i2) && surf_edges.Get(i2) != fd.SurfNr()+1 &&
(face_edges.Get(i2) == -1 || face_edges.Get(i2) == fd.DomainIn() || face_edges.Get(i2) == fd.DomainOut()) )
{
isedge1=1;
ep1 = 1; ep2=1;
}
i2 = INDEX_2(el.PNumMod (j+1), el.PNumMod (j+2));
// i2.Sort();
isedge2 = edges.Used (i2);
i2.Sort();
if(surf_edges.Used(i2) && surf_edges.Get(i2) != fd.SurfNr()+1 &&
(face_edges.Get(i2) == -1 || face_edges.Get(i2) == fd.DomainIn() || face_edges.Get(i2) == fd.DomainOut()) )
{
isedge2=1;
ep2=1; ep3=1;
}
i2 = INDEX_2(el.PNumMod (j+2), el.PNumMod (j+3));
// i2.Sort();
isedge3 = edges.Used (i2);
i2.Sort();
if(surf_edges.Used(i2) && surf_edges.Get(i2) != fd.SurfNr()+1 && (face_edges.Get(i2) == -1 || face_edges.Get(i2) == fd.DomainIn() || face_edges.Get(i2) == fd.DomainOut()) )
{
isedge3=1;
ep3=1; ep4=1;
}
i2 = INDEX_2(el.PNumMod (j+3), el.PNumMod (j+4));
// i2.Sort();
isedge4 = edges.Used (i2);
i2.Sort();
if(surf_edges.Used(i2) && surf_edges.Get(i2) != fd.SurfNr()+1 &&
(face_edges.Get(i2) == -1 || face_edges.Get(i2) == fd.DomainIn() || face_edges.Get(i2) == fd.DomainOut()) )
{
isedge4=1;
ep4=1; ep1=1;
}
//MH***********************************************************************************************************
if(ep1)
if(edgepoint.Test(p[0]))
{
INDEX_2 i2a=INDEX_2::Sort(p[0], p[1]);
INDEX_2 i2b=INDEX_2::Sort(p[0], p[3]);
if(!edges.Used(i2a) && !edges.Used(i2b))
//.........这里部分代码省略.........
示例12: ClassifyTet
HPREF_ELEMENT_TYPE ClassifyTet(HPRefElement & el, INDEX_2_HASHTABLE<int> & edges, INDEX_2_HASHTABLE<int> & edgepoint_dom,
BitArray & cornerpoint, BitArray & edgepoint, INDEX_3_HASHTABLE<int> & faces, INDEX_2_HASHTABLE<int> & face_edges,
INDEX_2_HASHTABLE<int> & surf_edges, Array<int, PointIndex::BASE> & facepoint)
{
int ep1(0), ep2(0), ep3(0), ep4(0), cp1(0), cp2(0), cp3(0), cp4(0), fp1, fp2, fp3, fp4;
int isedge1(0), isedge2(0), isedge3(0), isedge4(0), isedge5(0), isedge6(0);
int isfedge1, isfedge2, isfedge3, isfedge4, isfedge5, isfedge6;
int isface1(0), isface2(0), isface3(0), isface4(0);
HPREF_ELEMENT_TYPE type = HP_NONE;
int debug = 0;
for (int j = 0;j < 4; j++)
{
if (el.pnums[j] == 444) debug++;
if (el.pnums[j] == 115) debug++;
if (el.pnums[j] == 382) debug++;
if (el.pnums[j] == 281) debug++;
}
if (debug < 4) debug = 0;
for (int j = 0; j < 4; j++)
for (int k = 0; k < 4; k++)
{
if (j == k) continue;
if (type) break;
int pi3 = 0;
while (pi3 == j || pi3 == k) pi3++;
int pi4 = 6 - j - k - pi3;
// preserve orientation
int sort[4];
sort[0] = j; sort[1] = k; sort[2] = pi3; sort[3] = pi4;
int cnt = 0;
for (int jj = 0; jj < 4; jj++)
for (int kk = 0; kk < 3; kk++)
if (sort[kk] > sort[kk+1])
{
cnt++;
Swap (sort[kk], sort[kk+1]);
}
if (cnt % 2 == 1) Swap (pi3, pi4);
ep1 = edgepoint.Test (el.pnums[j]);
ep2 = edgepoint.Test (el.pnums[k]);
ep3 = edgepoint.Test (el.pnums[pi3]);
ep4 = edgepoint.Test (el.pnums[pi4]);
cp1 = cornerpoint.Test (el.pnums[j]);
cp2 = cornerpoint.Test (el.pnums[k]);
cp3 = cornerpoint.Test (el.pnums[pi3]);
cp4 = cornerpoint.Test (el.pnums[pi4]);
isedge1 = edges.Used (INDEX_2::Sort (el.pnums[j], el.pnums[k]));
isedge2 = edges.Used (INDEX_2::Sort (el.pnums[j], el.pnums[pi3]));
isedge3 = edges.Used (INDEX_2::Sort (el.pnums[j], el.pnums[pi4]));
isedge4 = edges.Used (INDEX_2::Sort (el.pnums[k], el.pnums[pi3]));
isedge5 = edges.Used (INDEX_2::Sort (el.pnums[k], el.pnums[pi4]));
isedge6 = edges.Used (INDEX_2::Sort (el.pnums[pi3], el.pnums[pi4]));
if (debug)
{
cout << "debug" << endl;
*testout << "debug" << endl;
*testout << "ep = " << ep1 << ep2 << ep3 << ep4 << endl;
*testout << "cp = " << cp1 << cp2 << cp3 << cp4 << endl;
*testout << "edge = " << isedge1 << isedge2 << isedge3 << isedge4 << isedge5 << isedge6 << endl;
}
isface1 = isface2 = isface3 = isface4 = 0;
for (int l = 0; l < 4; l++)
{
INDEX_3 i3(0,0,0);
switch (l)
{
case 0: i3.I1() = el.pnums[k]; i3.I1() = el.pnums[pi3]; i3.I1() = el.pnums[pi4]; break;
case 1: i3.I1() = el.pnums[j]; i3.I1() = el.pnums[pi3]; i3.I1() = el.pnums[pi4]; break;
case 2: i3.I1() = el.pnums[j]; i3.I1() = el.pnums[k]; i3.I1() = el.pnums[pi4]; break;
case 3: i3.I1() = el.pnums[j]; i3.I1() = el.pnums[k]; i3.I1() = el.pnums[pi3]; break;
}
i3.Sort();
if (faces.Used (i3))
{
int domnr = faces.Get(i3);
if (domnr == -1 || domnr == el.GetIndex())
{
switch (l)
{
case 0: isface1 = 1; break;
case 1: isface2 = 1; break;
case 2: isface3 = 1; break;
case 3: isface4 = 1; break;
}
}
}
//.........这里部分代码省略.........