Simple Code not working

Here is a simple function:

void shapeInfo(TopoDS_Shape shape){
TopTools_IndexedMapOfShape faceMap;
TopTools_IndexedMapOfShape edgeMap;
TopTools_IndexedMapOfShape vertexMap;

faceMap.Clear();
edgeMap.Clear();
vertexMap.Clear();

TopExp::MapShapes(shape,TopAbs_FACE,faceMap);
TopExp::MapShapes(shape,TopAbs_EDGE,edgeMap);
TopExp::MapShapes(shape,TopAbs_VERTEX,vertexMap);

std::cout std::cout

return;
}

What I get when I run this is:
Map Info
Faces -1217923936 Edges -1082058032 Vertices 134521265

Aris Karagiannidis's picture

However when I process my shape using the following functions:
int numberOfEntities(TopoDS_Shape shape, TopAbs_ShapeEnum type){
TopExp_Explorer *explorer = new TopExp_Explorer(shape, type);
int nu_entities = 0;
uncheckEntities(shape,type);
while (explorer->More()){
TopoDS_Shape entity = explorer->Current();
if(!entity.Checked()){
nu_entities++;
entity.Checked(true);
}
explorer->Next();
}

uncheckEntities(shape,type);
std::cout << "Faces " << nu_entities << std::endl;
return nu_entities;
}

void uncheckEntities(TopoDS_Shape shape, TopAbs_ShapeEnum type){
TopExp_Explorer *explorer = new TopExp_Explorer(shape, type);
while (explorer->More()) {
TopoDS_Shape entity = explorer->Current();
entity.Checked(false);
explorer->Next();
}
}

I get good results. Has anyone come across this problem before?