replaced "if" on a condition that has to be always true with assertions

This commit is contained in:
ganovelli 2010-07-27 14:20:12 +00:00
parent 4dcb3be0b3
commit b25f303ce3
1 changed files with 29 additions and 37 deletions

View File

@ -210,61 +210,53 @@ static void Mesh(MeshLeft& ml, MeshRight& mr, const bool selected = false){
remap.vert.resize(mr.vert.size(),-1); remap.vert.resize(mr.vert.size(),-1);
VertexIteratorRight vi; VertexIteratorRight vi;
for(vi=mr.vert.begin();vi!=mr.vert.end();++vi) for(vi=mr.vert.begin();vi!=mr.vert.end();++vi)
if(!selected || (*vi).IsS()) if(!selected || (*vi).IsS()){
{
int ind=Index(mr,*vi); int ind=Index(mr,*vi);
if(remap.vert[ind]==-1){ assert(remap.vert[ind]==-1);
VertexIteratorLeft vp; VertexIteratorLeft vp;
vp=Allocator<MeshLeft>::AddVertices(ml,1); vp=Allocator<MeshLeft>::AddVertices(ml,1);
(*vp).ImportData(*(vi)); (*vp).ImportData(*(vi));
remap.vert[ind]=Index(ml,*vp); remap.vert[ind]=Index(ml,*vp);
} }
}
// edge // edge
remap.edge.resize(mr.edge.size(),-1); remap.edge.resize(mr.edge.size(),-1);
EdgeIteratorRight ei; EdgeIteratorRight ei;
for(ei=mr.edge.begin(); ei!=mr.edge.end();++ei) for(ei=mr.edge.begin(); ei!=mr.edge.end();++ei)
if(!selected || (*ei).IsS()) if(!selected || (*ei).IsS()){
{
int ind=Index(mr,*ei); int ind=Index(mr,*ei);
if(remap.edge[ind]==-1){ assert(remap.edge[ind]==-1);
EdgeIteratorLeft ep; EdgeIteratorLeft ep;
ep=Allocator<MeshLeft>::AddEdges(ml,1); ep=Allocator<MeshLeft>::AddEdges(ml,1);
(*ep).ImportData(*(ei)); (*ep).ImportData(*(ei));
remap.edge[ind]=Index(ml,*ep); remap.edge[ind]=Index(ml,*ep);
} }
}
// face // face
remap.face.resize(mr.face.size(),-1); remap.face.resize(mr.face.size(),-1);
FaceIteratorRight fi; FaceIteratorRight fi;
for(fi=mr.face.begin();fi!=mr.face.end();++fi) for(fi=mr.face.begin();fi!=mr.face.end();++fi)
if(!selected || (*fi).IsS()) if(!selected || (*fi).IsS()){
{
int ind=Index(mr,*fi); int ind=Index(mr,*fi);
if(remap.face[ind]==-1){ assert(remap.face[ind]==-1);
FaceIteratorLeft fp; FaceIteratorLeft fp;
fp=Allocator<MeshLeft>::AddFaces(ml,1); fp=Allocator<MeshLeft>::AddFaces(ml,1);
(*fp).ImportData(*(fi)); (*fp).ImportData(*(fi));
remap.face[ind]=Index(ml,*fp); remap.face[ind]=Index(ml,*fp);
} }
}
// hedge // hedge
remap.hedge.resize(mr.hedge.size(),-1); remap.hedge.resize(mr.hedge.size(),-1);
HEdgeIteratorRight hi; HEdgeIteratorRight hi;
for(hi=mr.hedge.begin();hi!=mr.hedge.end();++hi) for(hi=mr.hedge.begin();hi!=mr.hedge.end();++hi)
if(!selected || (*hi).IsS()) if(!selected || (*hi).IsS()){
{
int ind=Index(mr,*hi); int ind=Index(mr,*hi);
if(remap.hedge[ind]==-1){ assert(remap.hedge[ind]==-1);
HEdgeIteratorLeft hp; HEdgeIteratorLeft hp;
hp=Allocator<MeshLeft>::AddHEdges(ml,1); hp=Allocator<MeshLeft>::AddHEdges(ml,1);
(*hp).ImportData(*(hi)); (*hp).ImportData(*(hi));
remap.hedge[ind]=Index(ml,*hp); remap.hedge[ind]=Index(ml,*hp);
} }
}
// phase 2. // phase 2.
// copy data from ml to its corresponding elements in ml and adjacencies // copy data from ml to its corresponding elements in ml and adjacencies