Commit 9fb02d01 authored by Mike Kremer's avatar Mike Kremer

Fixed some minor warnings about comparisons involving signed and unsigned integers.

git-svn-id: http://www.openvolumemesh.org/svnrepo/OpenVolumeMesh/trunk@246 66977474-1d4b-4f09-8fe9-267525286df2
parent 7b520a61
......@@ -60,24 +60,24 @@ ResourceManager::~ResourceManager() {
clearVec(mesh_props_);
}
void ResourceManager::resize_vprops(unsigned int _nv) {
void ResourceManager::resize_vprops(size_t _nv) {
resize_props(vertex_props_, _nv);
}
void ResourceManager::resize_eprops(unsigned int _ne) {
void ResourceManager::resize_eprops(size_t _ne) {
resize_props(edge_props_, _ne);
resize_props(halfedge_props_, _ne*2u);
}
void ResourceManager::resize_fprops(unsigned int _nf) {
void ResourceManager::resize_fprops(size_t _nf) {
resize_props(face_props_, _nf);
resize_props(halfface_props_, _nf*2u);
}
void ResourceManager::resize_cprops(unsigned int _nc) {
void ResourceManager::resize_cprops(size_t _nc) {
resize_props(cell_props_, _nc);
}
......
......@@ -78,16 +78,16 @@ public:
template <class PropT, class HandleT> friend class PropertyPtr;
/// Change size of stored vertex properties
void resize_vprops(unsigned int _nv);
void resize_vprops(size_t _nv);
/// Change size of stored edge properties
void resize_eprops(unsigned int _ne);
void resize_eprops(size_t _ne);
/// Change size of stored face properties
void resize_fprops(unsigned int _nf);
void resize_fprops(size_t _nf);
/// Change size of stored cell properties
void resize_cprops(unsigned int _nc);
void resize_cprops(size_t _nc);
protected:
......@@ -116,17 +116,17 @@ public:
void clear_mesh_props() { clearVec(mesh_props_); }
/// Get number of vertices in mesh
virtual unsigned int n_vertices() const = 0;
virtual size_t n_vertices() const = 0;
/// Get number of edges in mesh
virtual unsigned int n_edges() const = 0;
virtual size_t n_edges() const = 0;
/// Get number of halfedges in mesh
virtual unsigned int n_halfedges() const = 0;
virtual size_t n_halfedges() const = 0;
/// Get number of faces in mesh
virtual unsigned int n_faces() const = 0;
virtual size_t n_faces() const = 0;
/// Get number of halffaces in mesh
virtual unsigned int n_halffaces() const = 0;
virtual size_t n_halffaces() const = 0;
/// Get number of cells in mesh
virtual unsigned int n_cells() const = 0;
virtual size_t n_cells() const = 0;
template<class T> VertexPropertyT<T> request_vertex_property(const std::string& _name = std::string(), const T _def = T());
......@@ -160,19 +160,19 @@ private:
public:
unsigned int n_vertex_props() const { return vertex_props_.size(); }
size_t n_vertex_props() const { return vertex_props_.size(); }
unsigned int n_edge_props() const { return edge_props_.size(); }
size_t n_edge_props() const { return edge_props_.size(); }
unsigned int n_halfedge_props() const { return halfedge_props_.size(); }
size_t n_halfedge_props() const { return halfedge_props_.size(); }
unsigned int n_face_props() const { return face_props_.size(); }
size_t n_face_props() const { return face_props_.size(); }
unsigned int n_halfface_props() const { return halfface_props_.size(); }
size_t n_halfface_props() const { return halfface_props_.size(); }
unsigned int n_cell_props() const { return cell_props_.size(); }
size_t n_cell_props() const { return cell_props_.size(); }
unsigned int n_mesh_props() const { return mesh_props_.size(); }
size_t n_mesh_props() const { return mesh_props_.size(); }
template<class T> void set_persistent(VertexPropertyT<T>& _prop, bool _flag = true);
......@@ -287,7 +287,7 @@ protected:
private:
template<class StdVecT>
void resize_props(StdVecT& _vec, unsigned int _n);
void resize_props(StdVecT& _vec, size_t _n);
template<class StdVecT>
void entity_deleted(StdVecT& _vec, const OpenVolumeMeshHandle& _h);
......
......@@ -180,7 +180,7 @@ void ResourceManager::remove_property(StdVecT& _vec, size_t _idx) {
}
template<class StdVecT>
void ResourceManager::resize_props(StdVecT& _vec, unsigned int _n) {
void ResourceManager::resize_props(StdVecT& _vec, size_t _n) {
for(typename StdVecT::iterator it = _vec.begin();
it != _vec.end(); ++it) {
......
......@@ -92,7 +92,7 @@ EdgeHandle TopologyKernel::add_edge(const VertexHandle& _fromVertex,
bool _allowDuplicates) {
#ifndef NDEBUG
if((unsigned int)_fromVertex.idx() >= n_vertices() || (unsigned int)_toVertex.idx() >= n_vertices()) {
if((size_t)_fromVertex.idx() >= n_vertices() || (size_t)_toVertex.idx() >= n_vertices()) {
std::cerr << "Vertex handle is out of bounds!" << std::endl;
return InvalidEdgeHandle;
}
......@@ -102,7 +102,7 @@ EdgeHandle TopologyKernel::add_edge(const VertexHandle& _fromVertex,
if(!_allowDuplicates) {
if(v_bottom_up_) {
assert(outgoing_hes_per_vertex_.size() > (unsigned int)_fromVertex.idx());
assert(outgoing_hes_per_vertex_.size() > (size_t)_fromVertex.idx());
std::vector<HalfEdgeHandle>& ohes = outgoing_hes_per_vertex_[_fromVertex.idx()];
for(std::vector<HalfEdgeHandle>::const_iterator he_it = ohes.begin(),
he_end = ohes.end(); he_it != he_end; ++he_it) {
......@@ -111,7 +111,7 @@ EdgeHandle TopologyKernel::add_edge(const VertexHandle& _fromVertex,
}
}
} else {
for(unsigned int i = 0; i < edges_.size(); ++i) {
for(size_t i = 0; i < edges_.size(); ++i) {
if(edge(EdgeHandle(i)).from_vertex() == _fromVertex && edge(EdgeHandle(i)).to_vertex() == _toVertex) {
return EdgeHandle(i);
} else if(edge(EdgeHandle(i)).from_vertex() == _toVertex && edge(EdgeHandle(i)).to_vertex() == _fromVertex) {
......@@ -134,8 +134,8 @@ EdgeHandle TopologyKernel::add_edge(const VertexHandle& _fromVertex,
// Update vertex bottom-up incidences
if(v_bottom_up_) {
assert(outgoing_hes_per_vertex_.size() > (unsigned int)_fromVertex.idx());
assert(outgoing_hes_per_vertex_.size() > (unsigned int)_toVertex.idx());
assert(outgoing_hes_per_vertex_.size() > (size_t)_fromVertex.idx());
assert(outgoing_hes_per_vertex_.size() > (size_t)_toVertex.idx());
outgoing_hes_per_vertex_[_fromVertex.idx()].push_back(halfedge_handle(eh, 0));
outgoing_hes_per_vertex_[_toVertex.idx()].push_back(halfedge_handle(eh, 1));
}
......@@ -158,7 +158,7 @@ FaceHandle TopologyKernel::add_face(const std::vector<HalfEdgeHandle>& _halfedge
// Test if all edges are valid
for(std::vector<HalfEdgeHandle>::const_iterator it = _halfedges.begin(),
end = _halfedges.end(); it != end; ++it) {
if((unsigned int)it->idx() >= edges_.size() * 2u) {
if((size_t)it->idx() >= edges_.size() * 2u) {
std::cerr << "Halfedge handle out of bounds!" << std::endl;
return InvalidFaceHandle;
}
......@@ -217,8 +217,8 @@ FaceHandle TopologyKernel::add_face(const std::vector<HalfEdgeHandle>& _halfedge
for(std::vector<HalfEdgeHandle>::const_iterator it = _halfedges.begin(),
end = _halfedges.end(); it != end; ++it) {
assert(incident_hfs_per_he_.size() > (unsigned int)it->idx());
assert(incident_hfs_per_he_.size() > (unsigned int)opposite_halfedge_handle(*it).idx());
assert(incident_hfs_per_he_.size() > (size_t)it->idx());
assert(incident_hfs_per_he_.size() > (size_t)opposite_halfedge_handle(*it).idx());
incident_hfs_per_he_[it->idx()].push_back(halfface_handle(fh, 0));
incident_hfs_per_he_[opposite_halfedge_handle(*it).idx()].push_back(halfface_handle(fh, 1));
}
......@@ -243,7 +243,7 @@ FaceHandle TopologyKernel::add_face(const std::vector<VertexHandle>& _vertices)
// Test if all vertices exist
for(std::vector<VertexHandle>::const_iterator it = _vertices.begin(),
end = _vertices.end(); it != end; ++it) {
if((unsigned int)it->idx() >= n_vertices()) {
if((size_t)it->idx() >= n_vertices()) {
std::cerr << "Vertex handle out of bounds!" << std::endl;
return InvalidFaceHandle;
}
......@@ -307,7 +307,7 @@ void TopologyKernel::reorder_incident_halffaces(const EdgeHandle& _eh) {
// Start with one incident halfface and go
// into the first direction
assert(incident_hfs_per_he_.size() > (unsigned int)cur_he.idx());
assert(incident_hfs_per_he_.size() > (size_t)cur_he.idx());
if(incident_hfs_per_he_[cur_he.idx()].size() != 0) {
......@@ -369,7 +369,7 @@ CellHandle TopologyKernel::add_cell(const std::vector<HalfFaceHandle>& _halfface
// Test if halffaces have valid indices
for(std::vector<HalfFaceHandle>::const_iterator it = _halffaces.begin(),
end = _halffaces.end(); it != end; ++it) {
if((unsigned int)it->idx() >= faces_.size() * 2u) {
if((size_t)it->idx() >= faces_.size() * 2u) {
std::cerr << "HalfFace handle is out of bounds!" << std::endl;
return InvalidCellHandle;
}
......@@ -425,7 +425,7 @@ CellHandle TopologyKernel::add_cell(const std::vector<HalfFaceHandle>& _halfface
std::set<EdgeHandle> cell_edges;
for(std::vector<HalfFaceHandle>::const_iterator it = _halffaces.begin(),
end = _halffaces.end(); it != end; ++it) {
assert(incident_cell_per_hf_.size() > (unsigned int)it->idx());
assert(incident_cell_per_hf_.size() > (size_t)it->idx());
if(_topologyCheck) {
if(incident_cell_per_hf_[it->idx()] != InvalidCellHandle) {
......@@ -885,7 +885,7 @@ VertexIter TopologyKernel::delete_vertex_core(const VertexHandle& _h) {
// 2)
if(v_bottom_up_) {
assert(outgoing_hes_per_vertex_.size() > (unsigned int)_h.idx());
assert(outgoing_hes_per_vertex_.size() > (size_t)_h.idx());
outgoing_hes_per_vertex_.erase(outgoing_hes_per_vertex_.begin() + _h.idx());
}
......@@ -929,7 +929,7 @@ EdgeIter TopologyKernel::delete_edge_core(const EdgeHandle& _h) {
VertexHandle v0 = edge(_h).from_vertex();
VertexHandle v1 = edge(_h).to_vertex();
assert(outgoing_hes_per_vertex_.size() > (unsigned int)std::max(v0.idx(), v1.idx()));
assert(outgoing_hes_per_vertex_.size() > (size_t)std::max(v0.idx(), v1.idx()));
outgoing_hes_per_vertex_[v0.idx()].erase(
std::remove(outgoing_hes_per_vertex_[v0.idx()].begin(),
......@@ -947,7 +947,7 @@ EdgeIter TopologyKernel::delete_edge_core(const EdgeHandle& _h) {
// 2)
if(e_bottom_up_) {
assert(incident_hfs_per_he_.size() > (unsigned int)halfedge_handle(_h, 0).idx());
assert(incident_hfs_per_he_.size() > (size_t)halfedge_handle(_h, 0).idx());
// Decrease all half-edge handles > he and
// delete all half-edge handles == he in face definitions
......@@ -999,7 +999,7 @@ EdgeIter TopologyKernel::delete_edge_core(const EdgeHandle& _h) {
// 3)
if(e_bottom_up_) {
assert(incident_hfs_per_he_.size() > (unsigned int)halfedge_handle(_h, 1).idx());
assert(incident_hfs_per_he_.size() > (size_t)halfedge_handle(_h, 1).idx());
incident_hfs_per_he_.erase(incident_hfs_per_he_.begin() + halfedge_handle(_h, 1).idx());
incident_hfs_per_he_.erase(incident_hfs_per_he_.begin() + halfedge_handle(_h, 0).idx());
}
......@@ -1054,7 +1054,7 @@ FaceIter TopologyKernel::delete_face_core(const FaceHandle& _h) {
for(std::vector<HalfEdgeHandle>::const_iterator he_it = hes.begin(),
he_end = hes.end(); he_it != he_end; ++he_it) {
assert(incident_hfs_per_he_.size() > (unsigned int)std::max(he_it->idx(), opposite_halfedge_handle(*he_it).idx()));
assert(incident_hfs_per_he_.size() > (size_t)std::max(he_it->idx(), opposite_halfedge_handle(*he_it).idx()));
incident_hfs_per_he_[he_it->idx()].erase(
std::remove(incident_hfs_per_he_[he_it->idx()].begin(),
......@@ -1115,7 +1115,7 @@ FaceIter TopologyKernel::delete_face_core(const FaceHandle& _h) {
// 3)
if(f_bottom_up_) {
assert(incident_cell_per_hf_.size() > (unsigned int)halfface_handle(_h, 1).idx());
assert(incident_cell_per_hf_.size() > (size_t)halfface_handle(_h, 1).idx());
incident_cell_per_hf_.erase(incident_cell_per_hf_.begin() + halfface_handle(_h, 1).idx());
incident_cell_per_hf_.erase(incident_cell_per_hf_.begin() + halfface_handle(_h, 0).idx());
}
......@@ -1164,7 +1164,7 @@ CellIter TopologyKernel::delete_cell_core(const CellHandle& _h) {
const std::vector<HalfFaceHandle>& hfs = cell(_h).halffaces();
for(std::vector<HalfFaceHandle>::const_iterator hf_it = hfs.begin(),
hf_end = hfs.end(); hf_it != hf_end; ++hf_it) {
assert(incident_cell_per_hf_.size() > (unsigned int)hf_it->idx());
assert(incident_cell_per_hf_.size() > (size_t)hf_it->idx());
incident_cell_per_hf_[hf_it->idx()] = InvalidCellHandle;
}
......@@ -1341,7 +1341,7 @@ CellIter TopologyKernel::delete_cell_range(const CellIter& _first, const CellIte
const OpenVolumeMeshEdge& TopologyKernel::edge(const EdgeHandle& _edgeHandle) const {
// Test if edge is valid
assert((unsigned int)_edgeHandle.idx() < edges_.size());
assert((size_t)_edgeHandle.idx() < edges_.size());
assert(_edgeHandle.idx() >= 0);
return edges_[_edgeHandle.idx()];
......@@ -1353,7 +1353,7 @@ const OpenVolumeMeshEdge& TopologyKernel::edge(const EdgeHandle& _edgeHandle) co
const OpenVolumeMeshFace& TopologyKernel::face(const FaceHandle& _faceHandle) const {
// Test if face is valid
assert((unsigned int)_faceHandle.idx() < faces_.size());
assert((size_t)_faceHandle.idx() < faces_.size());
assert(_faceHandle.idx() >= 0);
return faces_[_faceHandle.idx()];
......@@ -1365,7 +1365,7 @@ const OpenVolumeMeshFace& TopologyKernel::face(const FaceHandle& _faceHandle) co
const OpenVolumeMeshCell& TopologyKernel::cell(const CellHandle& _cellHandle) const {
// Test if cell is valid
assert((unsigned int)_cellHandle.idx() < cells_.size());
assert((size_t)_cellHandle.idx() < cells_.size());
assert(_cellHandle.idx() >= 0);
return cells_[_cellHandle.idx()];
......@@ -1377,7 +1377,7 @@ const OpenVolumeMeshCell& TopologyKernel::cell(const CellHandle& _cellHandle) co
OpenVolumeMeshEdge& TopologyKernel::edge(const EdgeHandle& _edgeHandle) {
// Test if edge is valid
assert((unsigned int)_edgeHandle.idx() < edges_.size());
assert((size_t)_edgeHandle.idx() < edges_.size());
assert(_edgeHandle.idx() >= 0);
return edges_[_edgeHandle.idx()];
......@@ -1389,7 +1389,7 @@ OpenVolumeMeshEdge& TopologyKernel::edge(const EdgeHandle& _edgeHandle) {
OpenVolumeMeshFace& TopologyKernel::face(const FaceHandle& _faceHandle) {
// Test if face is valid
assert((unsigned int)_faceHandle.idx() < faces_.size());
assert((size_t)_faceHandle.idx() < faces_.size());
assert(_faceHandle.idx() >= 0);
return faces_[_faceHandle.idx()];
......@@ -1401,7 +1401,7 @@ OpenVolumeMeshFace& TopologyKernel::face(const FaceHandle& _faceHandle) {
OpenVolumeMeshCell& TopologyKernel::cell(const CellHandle& _cellHandle) {
// Test if cell is valid
assert((unsigned int)_cellHandle.idx() < cells_.size());
assert((size_t)_cellHandle.idx() < cells_.size());
assert(_cellHandle.idx() >= 0);
return cells_[_cellHandle.idx()];
......@@ -1413,7 +1413,7 @@ OpenVolumeMeshCell& TopologyKernel::cell(const CellHandle& _cellHandle) {
OpenVolumeMeshEdge TopologyKernel::halfedge(const HalfEdgeHandle& _halfEdgeHandle) const {
// Is handle in range?
assert((unsigned int)_halfEdgeHandle.idx() < (edges_.size() * 2));
assert((size_t)_halfEdgeHandle.idx() < (edges_.size() * 2));
assert(_halfEdgeHandle.idx() >= 0);
// In case the handle is even, just return the corresponding edge
......@@ -1430,7 +1430,7 @@ OpenVolumeMeshEdge TopologyKernel::halfedge(const HalfEdgeHandle& _halfEdgeHandl
OpenVolumeMeshFace TopologyKernel::halfface(const HalfFaceHandle& _halfFaceHandle) const {
// Is handle in range?
assert((unsigned int)_halfFaceHandle.idx() < (faces_.size() * 2));
assert((size_t)_halfFaceHandle.idx() < (faces_.size() * 2));
assert(_halfFaceHandle.idx() >= 0);
// In case the handle is not even, just return the corresponding face
......@@ -1448,7 +1448,7 @@ OpenVolumeMeshEdge TopologyKernel::opposite_halfedge(const HalfEdgeHandle& _half
// Is handle in range?
assert(_halfEdgeHandle.idx() >= 0);
assert((unsigned int)_halfEdgeHandle.idx() < (edges_.size() * 2));
assert((size_t)_halfEdgeHandle.idx() < (edges_.size() * 2));
// In case the handle is not even, just return the corresponding edge
// Otherwise return the opposite halfedge via opposite()
......@@ -1465,7 +1465,7 @@ OpenVolumeMeshFace TopologyKernel::opposite_halfface(const HalfFaceHandle& _half
// Is handle in range?
assert(_halfFaceHandle.idx() >= 0);
assert((unsigned int)_halfFaceHandle.idx() < (faces_.size() * 2));
assert((size_t)_halfFaceHandle.idx() < (faces_.size() * 2));
// In case the handle is not even, just return the corresponding face
// Otherwise return the opposite via the first face's opposite() function
......@@ -1538,8 +1538,8 @@ HalfFaceHandle TopologyKernel::halfface(const std::vector<HalfEdgeHandle>& _hes)
HalfEdgeHandle TopologyKernel::next_halfedge_in_halfface(const HalfEdgeHandle& _heh, const HalfFaceHandle& _hfh) const {
assert((unsigned int)_hfh.idx() < faces_.size() * 2u);
assert((unsigned int)_heh.idx() < edges_.size() * 2u);
assert((size_t)_hfh.idx() < faces_.size() * 2u);
assert((size_t)_heh.idx() < edges_.size() * 2u);
std::vector<HalfEdgeHandle> hes = halfface(_hfh).halfedges();
......@@ -1558,8 +1558,8 @@ HalfEdgeHandle TopologyKernel::next_halfedge_in_halfface(const HalfEdgeHandle& _
HalfEdgeHandle TopologyKernel::prev_halfedge_in_halfface(const HalfEdgeHandle& _heh, const HalfFaceHandle& _hfh) const {
assert((unsigned int)_hfh.idx() < faces_.size() * 2u);
assert((unsigned int)_heh.idx() < edges_.size() * 2u);
assert((size_t)_hfh.idx() < faces_.size() * 2u);
assert((size_t)_heh.idx() < edges_.size() * 2u);
std::vector<HalfEdgeHandle> hes = halfface(_hfh).halfedges();
......@@ -1580,7 +1580,7 @@ HalfFaceHandle
TopologyKernel::adjacent_halfface_in_cell(const HalfFaceHandle& _halfFaceHandle, const HalfEdgeHandle& _halfEdgeHandle) const {
#ifndef NDEBUG
if((unsigned int)_halfFaceHandle.idx() >= incident_cell_per_hf_.size() || _halfFaceHandle.idx() < 0) {
if((size_t)_halfFaceHandle.idx() >= incident_cell_per_hf_.size() || _halfFaceHandle.idx() < 0) {
return InvalidHalfFaceHandle;
}
#endif
......@@ -1629,7 +1629,7 @@ CellHandle TopologyKernel::incident_cell(const HalfFaceHandle& _halfFaceHandle)
if(!has_face_bottom_up_incidences()) {
return InvalidCellHandle;
}
if((unsigned int)_halfFaceHandle.idx() >= incident_cell_per_hf_.size() || _halfFaceHandle.idx() < 0) {
if((size_t)_halfFaceHandle.idx() >= incident_cell_per_hf_.size() || _halfFaceHandle.idx() < 0) {
return InvalidCellHandle;
}
......@@ -1645,18 +1645,18 @@ void TopologyKernel::compute_vertex_bottom_up_incidences() {
outgoing_hes_per_vertex_.resize(n_vertices());
// Store outgoing halfedges per vertex
unsigned int n_edges = edges_.size();
for(unsigned int i = 0; i < n_edges; ++i) {
size_t n_edges = edges_.size();
for(size_t i = 0; i < n_edges; ++i) {
VertexHandle from = edges_[i].from_vertex();
if((unsigned int)from.idx() >= outgoing_hes_per_vertex_.size()) {
if((size_t)from.idx() >= outgoing_hes_per_vertex_.size()) {
std::cerr << "update_incidences(): Vertex handle is out of bounds!" << std::endl;
return;
}
outgoing_hes_per_vertex_[from.idx()].push_back(halfedge_handle(EdgeHandle(i), 0));
VertexHandle to = edges_[i].to_vertex();
if((unsigned int)to.idx() >= outgoing_hes_per_vertex_.size()) {
if((size_t)to.idx() >= outgoing_hes_per_vertex_.size()) {
std::cerr << "update_incidences(): Vertex handle is out of bounds!" << std::endl;
return;
}
......@@ -1674,8 +1674,8 @@ void TopologyKernel::compute_edge_bottom_up_incidences() {
incident_hfs_per_he_.resize(edges_.size() * 2u);
// Store incident halffaces per halfedge
unsigned int n_faces = faces_.size();
for(unsigned int i = 0; i < n_faces; ++i) {
size_t n_faces = faces_.size();
for(size_t i = 0; i < n_faces; ++i) {
std::vector<HalfEdgeHandle> halfedges = faces_[i].halfedges();
......@@ -1698,8 +1698,8 @@ void TopologyKernel::compute_face_bottom_up_incidences() {
incident_cell_per_hf_.clear();
incident_cell_per_hf_.resize(faces_.size() * 2u, InvalidCellHandle);
unsigned int n_cells = cells_.size();
for(unsigned int i = 0; i < n_cells; ++i) {
size_t n_cells = cells_.size();
for(size_t i = 0; i < n_cells; ++i) {
std::vector<HalfFaceHandle> halffaces = cells_[i].halffaces();
......
......@@ -214,17 +214,17 @@ public:
*/
/// Get number of vertices in mesh
virtual unsigned int n_vertices() const { return n_vertices_; }
virtual size_t n_vertices() const { return n_vertices_; }
/// Get number of edges in mesh
virtual unsigned int n_edges() const { return edges_.size(); }
virtual size_t n_edges() const { return edges_.size(); }
/// Get number of halfedges in mesh
virtual unsigned int n_halfedges() const { return edges_.size() * 2u; }
virtual size_t n_halfedges() const { return edges_.size() * 2u; }
/// Get number of faces in mesh
virtual unsigned int n_faces() const { return faces_.size(); }
virtual size_t n_faces() const { return faces_.size(); }
/// Get number of halffaces in mesh
virtual unsigned int n_halffaces() const { return faces_.size() * 2u; }
virtual size_t n_halffaces() const { return faces_.size() * 2u; }
/// Get number of cells in mesh
virtual unsigned int n_cells() const { return cells_.size(); }
virtual size_t n_cells() const { return cells_.size(); }
int genus() const {
......@@ -243,7 +243,7 @@ public:
private:
// Cache total vertex number
unsigned int n_vertices_;
size_t n_vertices_;
public:
......@@ -325,36 +325,36 @@ public:
HalfEdgeHandle prev_halfedge_in_halfface(const HalfEdgeHandle& _heh, const HalfFaceHandle& _hfh) const;
/// Get valence of vertex (number of incident edges)
inline unsigned int valence(const VertexHandle& _vh) const {
inline size_t valence(const VertexHandle& _vh) const {
if(!v_bottom_up_) {
std::cerr << "Could not get vertex valence: No bottom-up incidences for vertices available!" << std::endl;
return 0u;
}
assert((unsigned int)_vh.idx() < outgoing_hes_per_vertex_.size());
assert((size_t)_vh.idx() < outgoing_hes_per_vertex_.size());
return outgoing_hes_per_vertex_[_vh.idx()].size();
}
/// Get valence of edge (number of incident faces)
inline unsigned int valence(const EdgeHandle& _eh) const {
inline size_t valence(const EdgeHandle& _eh) const {
if(!e_bottom_up_) {
std::cerr << "Could not get edge valence: No bottom-up incidences for edges available!" << std::endl;
return 0u;
}
assert((unsigned int)halfedge_handle(_eh, 0).idx() < incident_hfs_per_he_.size());
assert((size_t)halfedge_handle(_eh, 0).idx() < incident_hfs_per_he_.size());
return incident_hfs_per_he_[halfedge_handle(_eh, 0).idx()].size();
}
/// Get valence of face (number of incident edges)
inline unsigned int valence(const FaceHandle& _fh) const {
inline size_t valence(const FaceHandle& _fh) const {
assert((unsigned int)_fh.idx() < faces_.size());
assert((size_t)_fh.idx() < faces_.size());
return face(_fh).halfedges().size();
}
/// Get valence of cell (number of incident faces)
inline unsigned int valence(const CellHandle& _ch) const {
inline size_t valence(const CellHandle& _ch) const {
assert((unsigned int)_ch.idx() < cells_.size());
assert((size_t)_ch.idx() < cells_.size());
return cell(_ch).halffaces().size();
}
......@@ -622,7 +622,7 @@ public:
CellHandle incident_cell(const HalfFaceHandle& _halfFaceHandle) const;
bool is_boundary(const HalfFaceHandle& _halfFaceHandle) const {
return _halfFaceHandle.idx() >= 0 && (unsigned int)_halfFaceHandle.idx() < incident_cell_per_hf_.size() &&
return _halfFaceHandle.idx() >= 0 && (size_t)_halfFaceHandle.idx() < incident_cell_per_hf_.size() &&
incident_cell_per_hf_[_halfFaceHandle.idx()] == InvalidCellHandle;
}
......@@ -670,7 +670,7 @@ public:
return false;
}
unsigned int n_vertices_in_cell(const CellHandle& _ch) const {
size_t n_vertices_in_cell(const CellHandle& _ch) const {
std::set<VertexHandle> vertices;
std::vector<HalfFaceHandle> hfs = cell(_ch).halffaces();
......
......@@ -821,7 +821,7 @@ TEST_F(PolyhedralMeshBase, DeleteFaceBUTest1) {
for(size_t i = 0; i < 4; ++i) {
for(std::vector<HalfFaceHandle>::const_iterator hf_it = ihfs[i].begin(),
hf_end = ihfs[i].end(); hf_it != hf_end; ++hf_it) {
EXPECT_GT(nihfs[i].count(*hf_it), 0);
EXPECT_GT(nihfs[i].count(*hf_it), 0u);
}
}
}
......@@ -862,12 +862,12 @@ TEST_F(PolyhedralMeshBase, DeleteEdgeBUTest1) {
for(std::vector<HalfEdgeHandle>::const_iterator he_it = hes0.begin(),
he_end = hes0.end(); he_it != he_end; ++he_it) {
EXPECT_GT(nhes0.count(*he_it), 0);
EXPECT_GT(nhes0.count(*he_it), 0u);
}
for(std::vector<HalfEdgeHandle>::const_iterator he_it = hes1.begin(),
he_end = hes1.end(); he_it != he_end; ++he_it) {
EXPECT_GT(nhes1.count(*he_it), 0);
EXPECT_GT(nhes1.count(*he_it), 0u);
}
}
......@@ -950,7 +950,7 @@ TEST_F(PolyhedralMeshBase, DeleteFaceBUTest1noBU) {
for(size_t i = 0; i < 4; ++i) {
for(std::vector<HalfFaceHandle>::const_iterator hf_it = ihfs[i].begin(),
hf_end = ihfs[i].end(); hf_it != hf_end; ++hf_it) {
EXPECT_GT(nihfs[i].count(*hf_it), 0);
EXPECT_GT(nihfs[i].count(*hf_it), 0u);
}
}
}
......@@ -1005,12 +1005,12 @@ TEST_F(PolyhedralMeshBase, DeleteEdgeBUTest1noBU) {
for(std::vector<HalfEdgeHandle>::const_iterator he_it = hes0.begin(),
he_end = hes0.end(); he_it != he_end; ++he_it) {
EXPECT_GT(nhes0.count(*he_it), 0);
EXPECT_GT(nhes0.count(*he_it), 0u);
}
for(std::vector<HalfEdgeHandle>::const_iterator he_it = hes1.begin(),
he_end = hes1.end(); he_it != he_end; ++he_it) {
EXPECT_GT(nhes1.count(*he_it), 0);
EXPECT_GT(nhes1.count(*he_it), 0u);
}
}
......@@ -1487,7 +1487,7 @@ TEST_F(HexahedralMeshBase, GarbageCollectionTestTrackVertexHandles) {
std::vector<CellHandle*> ch_empty;
OpenVolumeMesh::VertexIter v_it = mesh_.vertices_begin();
for (v_it; v_it != mesh_.vertices_end(); ++v_it)
for (; v_it != mesh_.vertices_end(); ++v_it)
vhs.push_back(*v_it);
for (std::vector<VertexHandle>::iterator it = vhs.begin(); it != vhs.end(); ++it)
......@@ -1496,7 +1496,7 @@ TEST_F(HexahedralMeshBase, GarbageCollectionTestTrackVertexHandles) {
status.garbage_collection(track_vhs, hh_empty, hfh_empty, ch_empty, false);
EXPECT_EQ(vhs[0], -1);
EXPECT_EQ(vhs[11], 10u);
EXPECT_EQ(vhs[11], 10);
EXPECT_EQ(1u, mesh_.n_cells());
EXPECT_EQ(11u, mesh_.n_vertices());
......@@ -1519,7 +1519,7 @@ TEST_F(HexahedralMeshBase, GarbageCollectionTestTrackHalfedgeHandles) {
std::vector<CellHandle*> ch_empty;
OpenVolumeMesh::HalfEdgeIter hh_it = mesh_.halfedges_begin();
for (hh_it; hh_it != mesh_.halfedges_end(); ++hh_it)
for (; hh_it != mesh_.halfedges_end(); ++hh_it)
hhs.push_back(*hh_it);
for (std::vector<HalfEdgeHandle>::iterator it = hhs.begin(); it != hhs.end(); ++it)
......@@ -1527,11 +1527,11 @@ TEST_F(HexahedralMeshBase, GarbageCollectionTestTrackHalfedgeHandles) {
status.garbage_collection(vh_empty, track_hh, hfh_empty, ch_empty, false);
EXPECT_EQ(hhs[9], 9u);
EXPECT_EQ(hhs[9], 9);
EXPECT_EQ(hhs[10], -1);
EXPECT_EQ(hhs[11], -1);
EXPECT_EQ(hhs[12], 10u);
EXPECT_EQ(hhs[39], 37u);
EXPECT_EQ(hhs[12], 10);
EXPECT_EQ(hhs[39], 37);
EXPECT_EQ(0u, mesh_.n_cells());
EXPECT_EQ(8u, mesh_.n_faces());
......@@ -1564,7 +1564,7 @@ TEST_F(HexahedralMeshBase, GarbageCollectionTestTrackHalffaceHandles) {
std::vector<CellHandle*> ch_empty;
OpenVolumeMesh::HalfFaceIter hfh_it = mesh_.halffaces_begin();
for (hfh_it; hfh_it != mesh_.halffaces_end(); ++hfh_it)
for (; hfh_it != mesh_.halffaces_end(); ++hfh_it)
hfhs.push_back(*hfh_it);
for (std::vector<HalfFaceHandle>::iterator it = hfhs.begin(); it != hfhs.end(); ++it)
......@@ -1574,9 +1574,9 @@ TEST_F(HexahedralMeshBase, GarbageCollectionTestTrackHalffaceHandles) {
EXPECT_EQ(hfhs[0], -1);
EXPECT_EQ(hfhs[1], -1);
EXPECT_EQ(hfhs[2], 0u);
EXPECT_EQ(hfhs[3], 1u);
EXPECT_EQ(hfhs[21], 11u);
EXPECT_EQ(hfhs[2], 0);
EXPECT_EQ(hfhs[3], 1);
EXPECT_EQ(hfhs[21], 11);
EXPECT_EQ(1u, mesh_.n_cells());
......@@ -1600,7 +1600,7 @@ TEST_F(HexahedralMeshBase, GarbageCollectionTestTrackCellHandles) {
std::vector<CellHandle*> track_ch;
OpenVolumeMesh::CellIter c_it = mesh_.cells_begin();
for (c_it; c_it != mesh_.cells_end(); ++c_it)
for (; c_it != mesh_.cells_end(); ++c_it)
chs.push_back(*c_it);
for (std::vector<CellHandle>::iterator it = chs.begin(); it != chs.end(); ++it)
......@@ -1609,7 +1609,7 @@ TEST_F(HexahedralMeshBase, GarbageCollectionTestTrackCellHandles) {
status.garbage_collection(vh_empty, hh_empty, hfh_empty, track_ch, true);
EXPECT_EQ(chs[0], -1);
EXPECT_EQ(chs[1], 0u);
EXPECT_EQ(chs[1], 0);
EXPECT_EQ(1u, mesh_.n_cells());
EXPECT_EQ(6u, mesh_.n_faces());
......@@ -1663,17 +1663,17 @@ TEST_F(HexahedralMeshBase, GarbageCollectionTestProps1) {
fprops_i.insert(fprop[f_it->idx()]);
}
EXPECT_EQ(0, fprops_i.count(11));
EXPECT_EQ(1, fprops_i.count(10));
EXPECT_EQ(1, fprops_i.count(9));
EXPECT_EQ(0, fprops_i.count(8));
EXPECT_EQ(0, fprops_i.count(7));
EXPECT_EQ(1, fprops_i.count(6));
EXPECT_EQ(1, fprops_i.count(5));
EXPECT_EQ(1, fprops_i.count(4));
EXPECT_EQ(1, fprops_i.count(3));
EXPECT_EQ(1, fprops_i.count(2));
EXPECT_EQ(1, fprops_i.count(1));
EXPECT_EQ(0u, fprops_i.count(11));
EXPECT_EQ(1u, fprops_i.count(10));
EXPECT_EQ(1u, fprops_i.count(9));
EXPECT_EQ(0u, fprops_i.count(8));
EXPECT_EQ(0u, fprops_i.count(7));
EXPECT_EQ(1u, fprops_i.count(6));
EXPECT_EQ(1u, fprops_i.count(5));
EXPECT_EQ(1u, fprops_i.count(4));
EXPECT_EQ(1u, fprops_i.count(3));
EXPECT_EQ(1u, fprops_i.count(2));
EXPECT_EQ(1u, fprops_i.count(1));
}
TEST_F(HexahedralMeshBase, GarbageCollectionTestProps2) {
......@@ -1722,17 +1722,17 @@ TEST_F(HexahedralMeshBase, GarbageCollectionTestProps2) {