Commit 9e1badc7 authored by Martin Heistermann's avatar Martin Heistermann

Big cleanup: mostly make consistent use of override specifiers.

parent 6ff4e080
...@@ -32,14 +32,6 @@ ...@@ -32,14 +32,6 @@
* * * *
\*===========================================================================*/ \*===========================================================================*/
/*===========================================================================*\
* *
* $Revision$ *
* $Date$ *
* $LastChangedBy$ *
* *
\*===========================================================================*/
#ifndef GEOMETRYKERNEL_HH_ #ifndef GEOMETRYKERNEL_HH_
#define GEOMETRYKERNEL_HH_ #define GEOMETRYKERNEL_HH_
...@@ -71,7 +63,7 @@ public: ...@@ -71,7 +63,7 @@ public:
} }
/// Override of empty add_vertex function /// Override of empty add_vertex function
virtual VertexHandle add_vertex() { return add_vertex(VecT()); } VertexHandle add_vertex() override { return add_vertex(VecT()); }
/// Add a geometric point to the mesh /// Add a geometric point to the mesh
VertexHandle add_vertex(const VecT& _p) { VertexHandle add_vertex(const VecT& _p) {
...@@ -96,7 +88,7 @@ public: ...@@ -96,7 +88,7 @@ public:
return vertices_[_vh.idx()]; return vertices_[_vh.idx()];
} }
virtual VertexIter delete_vertex(const VertexHandle& _h) { VertexIter delete_vertex(const VertexHandle& _h) override {
assert(_h.idx() < (int)TopologyKernelT::n_vertices()); assert(_h.idx() < (int)TopologyKernelT::n_vertices());
VertexIter nV = TopologyKernelT::delete_vertex(_h); VertexIter nV = TopologyKernelT::delete_vertex(_h);
...@@ -111,7 +103,7 @@ public: ...@@ -111,7 +103,7 @@ public:
return nV; return nV;
} }
virtual void collect_garbage() void collect_garbage() override
{ {
if (!TopologyKernelT::needs_garbage_collection()) if (!TopologyKernelT::needs_garbage_collection())
return; return;
...@@ -130,7 +122,7 @@ public: ...@@ -130,7 +122,7 @@ public:
} }
virtual void swap_vertex_indices(VertexHandle _h1, VertexHandle _h2) void swap_vertex_indices(VertexHandle _h1, VertexHandle _h2) override
{ {
assert(_h1.idx() >= 0 && _h1.idx() < (int)vertices_.size()); assert(_h1.idx() >= 0 && _h1.idx() < (int)vertices_.size());
assert(_h2.idx() >= 0 && _h2.idx() < (int)vertices_.size()); assert(_h2.idx() >= 0 && _h2.idx() < (int)vertices_.size());
...@@ -145,7 +137,7 @@ public: ...@@ -145,7 +137,7 @@ public:
protected: protected:
virtual void delete_multiple_vertices(const std::vector<bool>& _tag) { void delete_multiple_vertices(const std::vector<bool>& _tag) override{
assert(_tag.size() == TopologyKernelT::n_vertices()); assert(_tag.size() == TopologyKernelT::n_vertices());
...@@ -171,7 +163,7 @@ protected: ...@@ -171,7 +163,7 @@ protected:
public: public:
virtual void clear(bool _clearProps = true) { void clear(bool _clearProps = true) override {
vertices_.clear(); vertices_.clear();
TopologyKernelT::clear(_clearProps); TopologyKernelT::clear(_clearProps);
......
...@@ -83,6 +83,9 @@ public: ...@@ -83,6 +83,9 @@ public:
/// Resize storage to hold n elements. /// Resize storage to hold n elements.
virtual void resize(size_t _n) = 0; virtual void resize(size_t _n) = 0;
/// Return underlying container size
virtual size_t size() const = 0;
/// Clear all elements and free memory. /// Clear all elements and free memory.
virtual void clear() = 0; virtual void clear() = 0;
......
...@@ -85,40 +85,39 @@ public: ...@@ -85,40 +85,39 @@ public:
public: public:
// inherited from OpenVolumeMeshBaseProperty // inherited from OpenVolumeMeshBaseProperty
virtual void reserve(size_t _n) { void reserve(size_t _n) override{
data_.reserve(_n); data_.reserve(_n);
} }
virtual void resize(size_t _n) { void resize(size_t _n) override {
data_.resize(_n, def_); data_.resize(_n, def_);
} }
virtual size_t size() const { size_t size() const override {
return data_.size(); return data_.size();
} }
virtual void clear() { void clear() override {
data_.clear(); data_.clear();
vector_type().swap(data_); vector_type().swap(data_);
} }
virtual void push_back() { void push_back() override {
data_.push_back(def_); data_.push_back(def_);
} }
virtual void swap(size_t _i0, size_t _i1) { void swap(size_t _i0, size_t _i1) override {
std::swap(data_[_i0], data_[_i1]); std::swap(data_[_i0], data_[_i1]);
} }
virtual void copy(size_t _src_idx, size_t _dst_idx) { virtual void copy(size_t _src_idx, size_t _dst_idx) {
data_[_dst_idx] = data_[_src_idx]; data_[_dst_idx] = data_[_src_idx];
} }
void delete_element(size_t _idx) { void delete_element(size_t _idx) override {
data_.erase(data_.begin() + _idx); data_.erase(data_.begin() + _idx);
} }
public: public:
virtual size_t n_elements() const { size_t n_elements() const override {
return data_.size(); return data_.size();
} }
virtual size_t element_size() const { size_t element_size() const override {
return sizeof(T); return sizeof(T);
} }
...@@ -131,18 +130,18 @@ public: ...@@ -131,18 +130,18 @@ public:
}; };
#endif #endif
virtual size_t size_of() const { size_t size_of() const override {
if (element_size() != OpenVolumeMeshBaseProperty::UnknownSize) if (element_size() != OpenVolumeMeshBaseProperty::UnknownSize)
return this->OpenVolumeMeshBaseProperty::size_of(n_elements()); return this->OpenVolumeMeshBaseProperty::size_of(n_elements());
return std::accumulate(data_.begin(), data_.end(), size_t(0), plus()); return std::accumulate(data_.begin(), data_.end(), size_t(0), plus());
} }
virtual size_t size_of(size_t _n_elem) const { size_t size_of(size_t _n_elem) const override {
return this->OpenVolumeMeshBaseProperty::size_of(_n_elem); return this->OpenVolumeMeshBaseProperty::size_of(_n_elem);
} }
// Function to serialize a property // Function to serialize a property
virtual void serialize(std::ostream& _ostr) const { void serialize(std::ostream& _ostr) const override {
for(typename vector_type::const_iterator it = data_.begin(); for(typename vector_type::const_iterator it = data_.begin();
it != data_.end(); ++it) { it != data_.end(); ++it) {
OpenVolumeMesh::serialize(_ostr, *it) << std::endl; OpenVolumeMesh::serialize(_ostr, *it) << std::endl;
...@@ -150,7 +149,7 @@ public: ...@@ -150,7 +149,7 @@ public:
} }
// Function to deserialize a property // Function to deserialize a property
virtual void deserialize(std::istream& _istr) { void deserialize(std::istream& _istr) override {
for(unsigned int i = 0; i < n_elements(); ++i) { for(unsigned int i = 0; i < n_elements(); ++i) {
OpenVolumeMesh::deserialize(_istr, data_[i]); OpenVolumeMesh::deserialize(_istr, data_[i]);
} }
...@@ -187,7 +186,7 @@ public: ...@@ -187,7 +186,7 @@ public:
} }
/// Make a copy of self. /// Make a copy of self.
OpenVolumeMeshPropertyT<T>* clone() const { OpenVolumeMeshPropertyT<T>* clone() const override {
OpenVolumeMeshPropertyT<T>* p = new OpenVolumeMeshPropertyT<T>(*this); OpenVolumeMeshPropertyT<T>* p = new OpenVolumeMeshPropertyT<T>(*this);
return p; return p;
} }
...@@ -203,7 +202,7 @@ public: ...@@ -203,7 +202,7 @@ public:
protected: protected:
/// Delete multiple entries in list /// Delete multiple entries in list
virtual void delete_multiple_entries(const std::vector<bool>& _tags) { void delete_multiple_entries(const std::vector<bool>& _tags) override {
assert(_tags.size() == data_.size()); assert(_tags.size() == data_.size());
vector_type new_data; vector_type new_data;
......
...@@ -90,10 +90,10 @@ public: ...@@ -90,10 +90,10 @@ public:
{} {}
using PropertyHandleT = OpenVolumeMesh::PropHandleT<Entity>; using PropertyHandleT = OpenVolumeMesh::PropHandleT<Entity>;
PropertyTT(const std::string& _name, const std::string& _internal_type_name, ResourceManager& _resMan, PropertyHandleT _handle, const T _def = T()); PropertyTT(const std::string& _name, const std::string& _internal_type_name, ResourceManager& _resMan, PropertyHandleT _handle, const T _def = T());
virtual ~PropertyTT() = default; ~PropertyTT() override = default;
virtual BaseProperty* clone(ResourceManager &_resMan, OpenVolumeMeshHandle _handle) const; BaseProperty* clone(ResourceManager &_resMan, OpenVolumeMeshHandle _handle) const override;
virtual const std::string entityType() const { return entityTypeName<Entity>(); } const std::string entityType() const override { return entityTypeName<Entity>(); }
virtual const std::string typeNameWrapper() const { return typeName<T>(); } const std::string typeNameWrapper() const override { return typeName<T>(); }
private: private:
PropertyTT(OpenVolumeMeshPropertyT<T> *_prop, ResourceManager& _resMan, PropertyHandleT _handle); PropertyTT(OpenVolumeMeshPropertyT<T> *_prop, ResourceManager& _resMan, PropertyHandleT _handle);
}; };
......
...@@ -75,23 +75,23 @@ public: ...@@ -75,23 +75,23 @@ public:
PropertyPtr(PropT* _ptr, ResourceManager& _resMan, PropHandleT<Entity> _handle); PropertyPtr(PropT* _ptr, ResourceManager& _resMan, PropHandleT<Entity> _handle);
/// Destructor /// Destructor
virtual ~PropertyPtr(); ~PropertyPtr() override;
using ptr::shared_ptr<PropT>::operator*; using ptr::shared_ptr<PropT>::operator*;
using ptr::shared_ptr<PropT>::operator->; using ptr::shared_ptr<PropT>::operator->;
using ptr::shared_ptr<PropT>::operator bool; using ptr::shared_ptr<PropT>::operator bool;
virtual const std::string& name() const; const std::string& name() const override;
virtual void delete_element(size_t _idx); void delete_element(size_t _idx) override;
virtual void swap_elements(size_t _idx0, size_t _idx1); void swap_elements(size_t _idx0, size_t _idx1) override;
virtual void copy(size_t _src_idx, size_t _dst_idx); void copy(size_t _src_idx, size_t _dst_idx) override;
const_iterator begin() const { return ptr::shared_ptr<PropT>::get()->begin(); } const_iterator begin() const { return ptr::shared_ptr<PropT>::get()->begin(); }
iterator begin() { return ptr::shared_ptr<PropT>::get()->begin(); } iterator begin() { return ptr::shared_ptr<PropT>::get()->begin(); }
size_t size() const { return ptr::shared_ptr<PropT>::get()->size(); } size_t size() const override { return ptr::shared_ptr<PropT>::get()->size(); }
const_iterator end() const { return ptr::shared_ptr<PropT>::get()->end(); } const_iterator end() const { return ptr::shared_ptr<PropT>::get()->end(); }
iterator end() { return ptr::shared_ptr<PropT>::get()->end(); } iterator end() { return ptr::shared_ptr<PropT>::get()->end(); }
...@@ -104,26 +104,26 @@ public: ...@@ -104,26 +104,26 @@ public:
reference operator[](const EntityHandleT& _h) { return (*ptr::shared_ptr<PropT>::get())[_h.idx()]; } reference operator[](const EntityHandleT& _h) { return (*ptr::shared_ptr<PropT>::get())[_h.idx()]; }
const_reference operator[](const EntityHandleT& _h) const { return (*ptr::shared_ptr<PropT>::get())[_h.uidx()]; } const_reference operator[](const EntityHandleT& _h) const { return (*ptr::shared_ptr<PropT>::get())[_h.uidx()]; }
virtual void serialize(std::ostream& _ostr) const { ptr::shared_ptr<PropT>::get()->serialize(_ostr); } void serialize(std::ostream& _ostr) const override { ptr::shared_ptr<PropT>::get()->serialize(_ostr); }
virtual void deserialize(std::istream& _istr) { ptr::shared_ptr<PropT>::get()->deserialize(_istr); } void deserialize(std::istream& _istr) override { ptr::shared_ptr<PropT>::get()->deserialize(_istr); }
virtual OpenVolumeMeshHandle handle() const; OpenVolumeMeshHandle handle() const override;
virtual bool persistent() const { return ptr::shared_ptr<PropT>::get()->persistent(); } bool persistent() const override { return ptr::shared_ptr<PropT>::get()->persistent(); }
virtual bool anonymous() const { return ptr::shared_ptr<PropT>::get()->name().empty(); } bool anonymous() const override { return ptr::shared_ptr<PropT>::get()->name().empty(); }
protected: protected:
virtual const std::string &internal_type_name() const { return ptr::shared_ptr<PropT>::get()->internal_type_name(); } const std::string &internal_type_name() const override { return ptr::shared_ptr<PropT>::get()->internal_type_name(); }
void assign_values_from(const BaseProperty *other) override; void assign_values_from(const BaseProperty *other) override;
void move_values_from(BaseProperty *other) override; void move_values_from(BaseProperty *other) override;
virtual void delete_multiple_entries(const std::vector<bool>& _tags); void delete_multiple_entries(const std::vector<bool>& _tags) override;
virtual void resize(size_t _size); void resize(size_t _size) override;
virtual void set_handle(const OpenVolumeMeshHandle& _handle); void set_handle(const OpenVolumeMeshHandle& _handle) override;
}; };
} // Namespace OpenVolumeMesh } // Namespace OpenVolumeMesh
......
...@@ -32,14 +32,6 @@ ...@@ -32,14 +32,6 @@
* * * *
\*===========================================================================*/ \*===========================================================================*/
/*===========================================================================*\
* *
* $Revision$ *
* $Date$ *
* $LastChangedBy$ *
* *
\*===========================================================================*/
#ifndef TOPOLOGYKERNEL_HH_ #ifndef TOPOLOGYKERNEL_HH_
#define TOPOLOGYKERNEL_HH_ #define TOPOLOGYKERNEL_HH_
...@@ -58,7 +50,7 @@ class TopologyKernel : public ResourceManager { ...@@ -58,7 +50,7 @@ class TopologyKernel : public ResourceManager {
public: public:
TopologyKernel() = default; TopologyKernel() = default;
virtual ~TopologyKernel() = default; ~TopologyKernel() override = default;
TopologyKernel& operator=(const TopologyKernel&) = default; TopologyKernel& operator=(const TopologyKernel&) = default;
...@@ -325,17 +317,17 @@ public: ...@@ -325,17 +317,17 @@ public:
*/ */
/// Get number of vertices in mesh /// Get number of vertices in mesh
virtual size_t n_vertices() const { return n_vertices_; } size_t n_vertices() const override { return n_vertices_; }
/// Get number of edges in mesh /// Get number of edges in mesh
virtual size_t n_edges() const { return edges_.size(); } size_t n_edges() const override { return edges_.size(); }
/// Get number of halfedges in mesh /// Get number of halfedges in mesh
virtual size_t n_halfedges() const { return edges_.size() * 2u; } size_t n_halfedges() const override { return edges_.size() * 2u; }
/// Get number of faces in mesh /// Get number of faces in mesh
virtual size_t n_faces() const { return faces_.size(); } size_t n_faces() const override { return faces_.size(); }
/// Get number of halffaces in mesh /// Get number of halffaces in mesh
virtual size_t n_halffaces() const { return faces_.size() * 2u; } size_t n_halffaces() const override { return faces_.size() * 2u; }
/// Get number of cells in mesh /// Get number of cells in mesh
virtual size_t n_cells() const { return cells_.size(); } size_t n_cells() const override { return cells_.size(); }
/// Get number of undeleted vertices in mesh /// Get number of undeleted vertices in mesh
size_t n_logical_vertices() const { return n_vertices_ - n_deleted_vertices_; } size_t n_logical_vertices() const { return n_vertices_ - n_deleted_vertices_; }
...@@ -880,17 +872,17 @@ public: ...@@ -880,17 +872,17 @@ public:
size_t n_vertices_in_cell(const CellHandle& _ch) const { size_t n_vertices_in_cell(const CellHandle& _ch) const {
assert(_ch.is_valid() && (size_t)_ch.idx() < cells_.size()); assert(_ch.is_valid() && (size_t)_ch.idx() < cells_.size());
std::set<VertexHandle> vertices; std::set<VertexHandle> vhs;
std::vector<HalfFaceHandle> hfs = cell(_ch).halffaces(); std::vector<HalfFaceHandle> hfs = cell(_ch).halffaces();
for(std::vector<HalfFaceHandle>::const_iterator hf_it = hfs.begin(); for(std::vector<HalfFaceHandle>::const_iterator hf_it = hfs.begin();
hf_it != hfs.end(); ++hf_it) { hf_it != hfs.end(); ++hf_it) {
std::vector<HalfEdgeHandle> hes = halfface(*hf_it).halfedges(); std::vector<HalfEdgeHandle> hes = halfface(*hf_it).halfedges();
for(std::vector<HalfEdgeHandle>::const_iterator he_it = hes.begin(); for(std::vector<HalfEdgeHandle>::const_iterator he_it = hes.begin();
he_it != hes.end(); ++he_it) { he_it != hes.end(); ++he_it) {
vertices.insert(halfedge(*he_it).to_vertex()); vhs.insert(halfedge(*he_it).to_vertex());
} }
} }
return vertices.size(); return vhs.size();
} }
//========================================================================= //=========================================================================
......
...@@ -106,13 +106,13 @@ public: ...@@ -106,13 +106,13 @@ public:
~HexahedralMeshTopologyKernel(); ~HexahedralMeshTopologyKernel();
// Overridden function // Overridden function
virtual FaceHandle add_face(const std::vector<HalfEdgeHandle>& _halfedges, bool _topologyCheck = false); FaceHandle add_face(const std::vector<HalfEdgeHandle>& _halfedges, bool _topologyCheck = false) override;
// Overridden function // Overridden function
virtual FaceHandle add_face(const std::vector<VertexHandle>& _vertices); FaceHandle add_face(const std::vector<VertexHandle>& _vertices) override;
/// Overridden function /// Overridden function
virtual CellHandle add_cell(const std::vector<HalfFaceHandle>& _halffaces, bool _topologyCheck = false); CellHandle add_cell(const std::vector<HalfFaceHandle>& _halffaces, bool _topologyCheck = false) override;
private: private:
......
...@@ -69,16 +69,14 @@ public: ...@@ -69,16 +69,14 @@ public:
// Destructor // Destructor
~TetrahedralMeshTopologyKernel(); ~TetrahedralMeshTopologyKernel();
// Overridden function FaceHandle add_face(const std::vector<HalfEdgeHandle>& _halfedges, bool _topologyCheck = false) override;
virtual FaceHandle add_face(const std::vector<HalfEdgeHandle>& _halfedges, bool _topologyCheck = false);
// Overridden function FaceHandle add_face(const std::vector<VertexHandle>& _vertices) override;
virtual FaceHandle add_face(const std::vector<VertexHandle>& _vertices);
// Overridden function CellHandle add_cell(const std::vector<HalfFaceHandle>& _halffaces, bool _topologyCheck = false) override;
virtual CellHandle add_cell(const std::vector<HalfFaceHandle>& _halffaces, bool _topologyCheck = false);
CellHandle add_cell(const std::vector<VertexHandle>& _vertices, bool _topologyCheck = false); CellHandle add_cell(const std::vector<VertexHandle>& _vertices, bool _topologyCheck = false);
CellHandle add_cell(VertexHandle _vh0, VertexHandle _vh1, VertexHandle _vh2, VertexHandle _vh3, bool _topologyCheck = false); CellHandle add_cell(VertexHandle _vh0, VertexHandle _vh1, VertexHandle _vh2, VertexHandle _vh3, bool _topologyCheck = false);
HalfFaceHandle add_halfface(const std::vector<HalfEdgeHandle>& _halfedges, bool _topologyCheck = false); HalfFaceHandle add_halfface(const std::vector<HalfEdgeHandle>& _halfedges, bool _topologyCheck = false);
......
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