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) {
......
This diff is collapsed.
......@@ -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) {
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(1, fprops_i.count(8));
EXPECT_EQ(1, 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(1u, fprops_i.count(8));
EXPECT_EQ(1u, 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, HalfEdgeFetchFunction1) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment