Commit 65d0be26 authored by Mike Kremer's avatar Mike Kremer

Renamed adjacencies to incidences in order to introduce semantic correctness. :)

git-svn-id: http://www.openvolumemesh.org/svnrepo/OpenVolumeMesh/trunk@197 66977474-1d4b-4f09-8fe9-267525286df2
parent 0c060762
......@@ -66,8 +66,8 @@ NormalAttrib<GeomKernelT>::~NormalAttrib() {
template <class GeomKernelT>
void NormalAttrib<GeomKernelT>::update_vertex_normals() {
if(!kernel_.has_face_bottom_up_adjacencies()) {
std::cerr << "Error: update_vertex_normals() needs bottom-up adjacencies!" << std::endl;
if(!kernel_.has_face_bottom_up_incidences()) {
std::cerr << "Error: update_vertex_normals() needs bottom-up incidences!" << std::endl;
return;
}
......@@ -82,8 +82,8 @@ void NormalAttrib<GeomKernelT>::update_vertex_normals() {
template <class GeomKernelT>
void NormalAttrib<GeomKernelT>::update_face_normals() {
if(!kernel_.has_face_bottom_up_adjacencies()) {
std::cerr << "Error: update_normals() needs bottom-up adjacencies!" << std::endl;
if(!kernel_.has_face_bottom_up_incidences()) {
std::cerr << "Error: update_normals() needs bottom-up incidences!" << std::endl;
return;
}
......
......@@ -114,7 +114,7 @@ void StatusAttrib::garbage_collection(bool _preserveManifoldness) {
// Step 6
if(_preserveManifoldness) {
if(kernel_.has_full_bottom_up_adjacencies()) {
if(kernel_.has_full_bottom_up_incidences()) {
// Go over all faces and find those
// that are not incident to any cell
......@@ -174,7 +174,7 @@ void StatusAttrib::garbage_collection(bool _preserveManifoldness) {
} else {
std::cerr << "Preservation of three-manifoldness in garbage_collection() "
<< "requires bottom-up adjacencies!" << std::endl;
<< "requires bottom-up incidences!" << std::endl;
return;
}
}
......
......@@ -221,7 +221,7 @@ public:
* This step proceeds as follows: Delete all n-dimensional entities
* (starting with n = 2), that are not incident to at least one
* entity of dimension n + 1. Note that the second pass requires bottom-up
* adjacencies to be available. Compute them by calling update_adjacencies().
* incidences to be available. Compute them by calling update_incidences().
*
* @param _preserveManifoldness Pass true if the mesh is required to stay three-manifold
*/
......
......@@ -60,8 +60,8 @@ VertexOHalfEdgeIter::VertexOHalfEdgeIter(const VertexHandle& _ref_h,
BaseIter(_mesh, _ref_h),
cur_index_(0) {
if(!_mesh->has_vertex_bottom_up_adjacencies()) {
std::cerr << "This iterator needs bottom-up adjacencies!" << std::endl;
if(!_mesh->has_vertex_bottom_up_incidences()) {
std::cerr << "This iterator needs bottom-up incidences!" << std::endl;
BaseIter::valid(false);
return;
}
......@@ -122,8 +122,8 @@ HalfEdgeHalfFaceIter::HalfEdgeHalfFaceIter(const HalfEdgeHandle& _ref_h,
BaseIter(_mesh, _ref_h),
cur_index_(0) {
if(!_mesh->has_edge_bottom_up_adjacencies()) {
std::cerr << "This iterator needs bottom-up adjacencies!" << std::endl;
if(!_mesh->has_edge_bottom_up_incidences()) {
std::cerr << "This iterator needs bottom-up incidences!" << std::endl;
BaseIter::valid(false);
return;
}
......@@ -183,8 +183,8 @@ VertexCellIter::VertexCellIter(const VertexHandle& _ref_h,
const TopologyKernel* _mesh) :
BaseIter(_mesh, _ref_h) {
if(!_mesh->has_full_bottom_up_adjacencies()) {
std::cerr << "This iterator needs bottom-up adjacencies!" << std::endl;
if(!_mesh->has_full_bottom_up_incidences()) {
std::cerr << "This iterator needs bottom-up incidences!" << std::endl;
BaseIter::valid(false);
return;
}
......@@ -251,8 +251,8 @@ HalfEdgeCellIter::HalfEdgeCellIter(const HalfEdgeHandle& _ref_h,
BaseIter(_mesh, _ref_h),
cur_index_(0) {
if(!_mesh->has_edge_bottom_up_adjacencies() || !_mesh->has_face_bottom_up_adjacencies()) {
std::cerr << "This iterator needs bottom-up adjacencies!" << std::endl;
if(!_mesh->has_edge_bottom_up_incidences() || !_mesh->has_face_bottom_up_incidences()) {
std::cerr << "This iterator needs bottom-up incidences!" << std::endl;
BaseIter::valid(false);
return;
}
......@@ -372,8 +372,8 @@ CellCellIter::CellCellIter(const CellHandle& _ref_h,
const TopologyKernel* _mesh) :
BaseIter(_mesh, _ref_h) {
if(!_mesh->has_face_bottom_up_adjacencies()) {
std::cerr << "This iterator needs bottom-up adjacencies!" << std::endl;
if(!_mesh->has_face_bottom_up_incidences()) {
std::cerr << "This iterator needs bottom-up incidences!" << std::endl;
BaseIter::valid(false);
return;
}
......@@ -477,8 +477,8 @@ BoundaryFaceIter::BoundaryFaceIter(const TopologyKernel* _mesh) :
BaseIter(_mesh, TopologyKernel::InvalidFaceHandle),
bf_it_(_mesh->faces_begin()) {
if(!_mesh->has_face_bottom_up_adjacencies()) {
std::cerr << "This iterator needs bottom-up adjacencies!" << std::endl;
if(!_mesh->has_face_bottom_up_incidences()) {
std::cerr << "This iterator needs bottom-up incidences!" << std::endl;
BaseIter::valid(false);
return;
}
......
......@@ -72,7 +72,7 @@ VertexHandle TopologyKernel::add_vertex() {
++n_vertices_;
// Create item for vertex bottom-up adjacencies
// Create item for vertex bottom-up incidences
if(v_bottom_up_) {
outgoing_hes_per_vertex_.resize(n_vertices_);
}
......@@ -132,7 +132,7 @@ EdgeHandle TopologyKernel::add_edge(const VertexHandle& _fromVertex,
EdgeHandle eh((int)edges_.size()-1);
// Update vertex bottom-up adjacencies
// 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());
......@@ -140,7 +140,7 @@ EdgeHandle TopologyKernel::add_edge(const VertexHandle& _fromVertex,
outgoing_hes_per_vertex_[_toVertex.idx()].push_back(halfedge_handle(eh, 1));
}
// Create item for edge bottom-up adjacencies
// Create item for edge bottom-up incidences
if(e_bottom_up_) {
incident_hfs_per_he_.resize(n_halfedges());
}
......@@ -212,7 +212,7 @@ FaceHandle TopologyKernel::add_face(const std::vector<HalfEdgeHandle>& _halfedge
// Resize props
resize_fprops(n_faces());
// Update edge bottom-up adjacencies
// Update edge bottom-up incidences
if(e_bottom_up_) {
for(std::vector<HalfEdgeHandle>::const_iterator it = _halfedges.begin(),
......@@ -224,7 +224,7 @@ FaceHandle TopologyKernel::add_face(const std::vector<HalfEdgeHandle>& _halfedge
}
}
// Create item for face bottom-up adjacencies
// Create item for face bottom-up incidences
if(f_bottom_up_) {
incident_cell_per_hf_.resize(n_halffaces(), InvalidCellHandle);
}
......@@ -419,7 +419,7 @@ CellHandle TopologyKernel::add_cell(const std::vector<HalfFaceHandle>& _halfface
CellHandle ch((int)cells_.size()-1);
// Update face bottom-up adjacencies
// Update face bottom-up incidences
if(f_bottom_up_) {
std::set<EdgeHandle> cell_edges;
......@@ -902,10 +902,10 @@ CellIter TopologyKernel::delete_cell_range(const CellIter& _first, const CellIte
std::vector<Cell>::iterator it = cells_.erase(cells_.begin() + _first->idx(), cells_.begin() + _last->idx());
// Re-compute face bottom-up adjacencies if necessary
// Re-compute face bottom-up incidences if necessary
if(f_bottom_up_) {
f_bottom_up_ = false;
enable_face_bottom_up_adjacencies(true);
enable_face_bottom_up_incidences(true);
}
return CellIter(this, CellHandle(it - cells_.begin()));
......@@ -1160,8 +1160,8 @@ TopologyKernel::adjacent_halfface_in_cell(const HalfFaceHandle& _halfFaceHandle,
return InvalidHalfFaceHandle;
}
#endif
if(!has_face_bottom_up_adjacencies()) {
std::cerr << "Error: Function adjacent_halfface_in_cell() needs face bottom-up adjacencies!" << std::endl;
if(!has_face_bottom_up_incidences()) {
std::cerr << "Error: Function adjacent_halfface_in_cell() needs face bottom-up incidences!" << std::endl;
return InvalidHalfFaceHandle;
}
if(incident_cell_per_hf_[_halfFaceHandle.idx()] == InvalidCellHandle) {
......@@ -1202,7 +1202,7 @@ TopologyKernel::adjacent_halfface_in_cell(const HalfFaceHandle& _halfFaceHandle,
CellHandle TopologyKernel::incident_cell(const HalfFaceHandle& _halfFaceHandle) const {
if(!has_face_bottom_up_adjacencies()) {
if(!has_face_bottom_up_incidences()) {
return InvalidCellHandle;
}
if((unsigned int)_halfFaceHandle.idx() >= incident_cell_per_hf_.size() || _halfFaceHandle.idx() < 0) {
......@@ -1214,9 +1214,9 @@ CellHandle TopologyKernel::incident_cell(const HalfFaceHandle& _halfFaceHandle)
//========================================================================================
void TopologyKernel::compute_vertex_bottom_up_adjacencies() {
void TopologyKernel::compute_vertex_bottom_up_incidences() {
// Clear adjacencies
// Clear incidences
outgoing_hes_per_vertex_.clear();
outgoing_hes_per_vertex_.resize(n_vertices());
......@@ -1226,14 +1226,14 @@ void TopologyKernel::compute_vertex_bottom_up_adjacencies() {
VertexHandle from = edges_[i].from_vertex();
if((unsigned int)from.idx() >= outgoing_hes_per_vertex_.size()) {
std::cerr << "update_adjacencies(): Vertex handle is out of bounds!" << std::endl;
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()) {
std::cerr << "update_adjacencies(): Vertex handle is out of bounds!" << std::endl;
std::cerr << "update_incidences(): Vertex handle is out of bounds!" << std::endl;
return;
}
// Store opposite halfedge handle
......@@ -1243,7 +1243,7 @@ void TopologyKernel::compute_vertex_bottom_up_adjacencies() {
//========================================================================================
void TopologyKernel::compute_edge_bottom_up_adjacencies() {
void TopologyKernel::compute_edge_bottom_up_incidences() {
// Clear
incident_hfs_per_he_.clear();
......@@ -1268,7 +1268,7 @@ void TopologyKernel::compute_edge_bottom_up_adjacencies() {
//========================================================================================
void TopologyKernel::compute_face_bottom_up_adjacencies() {
void TopologyKernel::compute_face_bottom_up_incidences() {
// Clear
incident_cell_per_hf_.clear();
......
......@@ -294,7 +294,7 @@ public:
/// Get valence of vertex (number of incident edges)
inline unsigned int valence(const VertexHandle& _vh) const {
if(!v_bottom_up_) {
std::cerr << "Could not get vertex valence: No bottom-up adjacencies for vertices available!" << std::endl;
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());
......@@ -304,7 +304,7 @@ public:
/// Get valence of edge (number of incident faces)
inline unsigned int valence(const EdgeHandle& _eh) const {
if(!e_bottom_up_) {
std::cerr << "Could not get edge valence: No bottom-up adjacencies for edges available!" << std::endl;
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());
......@@ -383,24 +383,24 @@ public:
}
//=====================================================================
// Bottom-up Adjacencies
// Bottom-up Incidences
//=====================================================================
public:
void enable_bottom_up_adjacencies(bool _enable = true) {
void enable_bottom_up_incidences(bool _enable = true) {
enable_vertex_bottom_up_adjacencies(_enable);
enable_edge_bottom_up_adjacencies(_enable);
enable_face_bottom_up_adjacencies(_enable);
enable_vertex_bottom_up_incidences(_enable);
enable_edge_bottom_up_incidences(_enable);
enable_face_bottom_up_incidences(_enable);
}
void enable_vertex_bottom_up_adjacencies(bool _enable = true) {
void enable_vertex_bottom_up_incidences(bool _enable = true) {
if(_enable && !v_bottom_up_) {
// Vertex bottom-up adjacencies have to be
// Vertex bottom-up incidences have to be
// recomputed for the whole mesh
compute_vertex_bottom_up_adjacencies();
compute_vertex_bottom_up_incidences();
}
if(!_enable) {
......@@ -410,12 +410,12 @@ public:
v_bottom_up_ = _enable;
}
void enable_edge_bottom_up_adjacencies(bool _enable = true) {
void enable_edge_bottom_up_incidences(bool _enable = true) {
if(_enable && !e_bottom_up_) {
// Edge bottom-up adjacencies have to be
// Edge bottom-up incidences have to be
// recomputed for the whole mesh
compute_edge_bottom_up_adjacencies();
compute_edge_bottom_up_incidences();
if(f_bottom_up_) {
std::for_each(edges_begin(), edges_end(),
......@@ -430,13 +430,13 @@ public:
e_bottom_up_ = _enable;
}
void enable_face_bottom_up_adjacencies(bool _enable = true) {
void enable_face_bottom_up_incidences(bool _enable = true) {
bool updateOrder = false;
if(_enable && !f_bottom_up_) {
// Face bottom-up adjacencies have to be
// Face bottom-up incidences have to be
// recomputed for the whole mesh
compute_face_bottom_up_adjacencies();
compute_face_bottom_up_incidences();
updateOrder = true;
}
......@@ -455,25 +455,25 @@ public:
}
}
bool has_full_bottom_up_adjacencies() const {
return (has_vertex_bottom_up_adjacencies() &&
has_edge_bottom_up_adjacencies() &&
has_face_bottom_up_adjacencies());
bool has_full_bottom_up_incidences() const {
return (has_vertex_bottom_up_incidences() &&
has_edge_bottom_up_incidences() &&
has_face_bottom_up_incidences());
}
bool has_vertex_bottom_up_adjacencies() const { return v_bottom_up_; }
bool has_vertex_bottom_up_incidences() const { return v_bottom_up_; }
bool has_edge_bottom_up_adjacencies() const { return e_bottom_up_; }
bool has_edge_bottom_up_incidences() const { return e_bottom_up_; }
bool has_face_bottom_up_adjacencies() const { return f_bottom_up_; }
bool has_face_bottom_up_incidences() const { return f_bottom_up_; }
private:
void compute_vertex_bottom_up_adjacencies();
void compute_vertex_bottom_up_incidences();
void compute_edge_bottom_up_adjacencies();
void compute_edge_bottom_up_incidences();
void compute_face_bottom_up_adjacencies();
void compute_face_bottom_up_incidences();
void reorder_incident_halffaces(const EdgeHandle& _eh);
......@@ -516,7 +516,7 @@ public:
bool is_boundary(const EdgeHandle& _edgeHandle) const {
if(!e_bottom_up_) {
std::cerr << "Error: Function is_boundary() needs bottom-up adjacencies for edges!" << std::endl;
std::cerr << "Error: Function is_boundary() needs bottom-up incidences for edges!" << std::endl;
return false;
}
for(HalfEdgeHalfFaceIter hehf_it = hehf_iter(halfedge_handle(_edgeHandle, 0));
......@@ -530,7 +530,7 @@ public:
bool is_boundary(const HalfEdgeHandle& _halfedgeHandle) const {
if(!e_bottom_up_) {
std::cerr << "Error: Function is_boundary() needs bottom-up adjacencies for edges!" << std::endl;
std::cerr << "Error: Function is_boundary() needs bottom-up incidences for edges!" << std::endl;
return false;
}
for(HalfEdgeHalfFaceIter hehf_it = hehf_iter(_halfedgeHandle);
......@@ -544,7 +544,7 @@ public:
bool is_boundary(const VertexHandle& _vertexHandle) const {
if(!v_bottom_up_) {
std::cerr << "Error: Function is_boundary() needs bottom-up adjacencies for vertices!" << std::endl;
std::cerr << "Error: Function is_boundary() needs bottom-up incidences for vertices!" << std::endl;
return false;
}
for(VertexOHalfEdgeIter voh_it = voh_iter(_vertexHandle); voh_it.valid(); ++voh_it) {
......
......@@ -77,15 +77,15 @@ public:
* @param _mesh A reference to an OpenVolumeMesh instance
* @param _topologyCheck Pass true if you want to perform a topology check
* each time an entity is added (slower performance)
* @param _computeBottomUpAdjacencies Pass true if you want the file manager
* to directly compute the bottom-up adjacencies
* @param _computeBottomUpIncidences Pass true if you want the file manager
* to directly compute the bottom-up incidences
* for the mesh. (Note: These are needed for
* some iterators to work, see documentation)
*/
template <class MeshT>
bool readFile(const std::string& _filename, MeshT& _mesh,
bool _topologyCheck = true,
bool _computeBottomUpAdjacencies = true) const;
bool _computeBottomUpIncidences = true) const;
/**
* \brief Write a mesh to a file
......
......@@ -62,7 +62,7 @@ namespace IO {
template <class MeshT>
bool FileManager::readFile(const std::string& _filename, MeshT& _mesh,
bool _topologyCheck, bool _computeBottomUpAdjacencies) const {
bool _topologyCheck, bool _computeBottomUpIncidences) const {
std::ifstream iff(_filename.c_str(), std::ios::in);
......@@ -84,7 +84,7 @@ bool FileManager::readFile(const std::string& _filename, MeshT& _mesh,
// Temporarily disable bottom-up incidences
// since it's way faster to first add all the
// geometry and compute them in one pass afterwards
_mesh.enable_bottom_up_adjacencies(false);
_mesh.enable_bottom_up_incidences(false);
/*
* Header
......@@ -282,9 +282,9 @@ bool FileManager::readFile(const std::string& _filename, MeshT& _mesh,
iff.close();
if(_computeBottomUpAdjacencies) {
if(_computeBottomUpIncidences) {
// Compute bottom-up incidences
_mesh.enable_bottom_up_adjacencies(true);
_mesh.enable_bottom_up_incidences(true);
}
std::cerr << "######## openvolumemesh info #########" << std::endl;
......
......@@ -57,8 +57,8 @@ CellSheetCellIter::CellSheetCellIter(const CellHandle& _ref_h,
const unsigned char _orthDir, const HexahedralMeshTopologyKernel* _mesh) :
BaseIter(_mesh, _ref_h) {
if(!_mesh->has_face_bottom_up_adjacencies()) {
std::cerr << "This iterator needs bottom-up adjacencies!" << std::endl;
if(!_mesh->has_face_bottom_up_incidences()) {
std::cerr << "This iterator needs bottom-up incidences!" << std::endl;
BaseIter::valid(false);
return;
}
......@@ -117,8 +117,8 @@ HalfFaceSheetHalfFaceIter::HalfFaceSheetHalfFaceIter(const HalfFaceHandle& _ref_
const HexahedralMeshTopologyKernel* _mesh) :
BaseIter(_mesh, _ref_h) {
if(!_mesh->has_face_bottom_up_adjacencies()) {
std::cerr << "This iterator needs bottom-up adjacencies!" << std::endl;
if(!_mesh->has_face_bottom_up_incidences()) {
std::cerr << "This iterator needs bottom-up incidences!" << std::endl;
BaseIter::valid(false);
return;
}
......@@ -210,8 +210,8 @@ OutsideNeighborHalfFaceIter::OutsideNeighborHalfFaceIter(const HalfFaceHandle& _
const HexahedralMeshTopologyKernel* _mesh) :
BaseIter(_mesh, _ref_h) {
if(!_mesh->has_face_bottom_up_adjacencies()) {
std::cerr << "This iterator needs bottom-up adjacencies!" << std::endl;
if(!_mesh->has_face_bottom_up_incidences()) {
std::cerr << "This iterator needs bottom-up incidences!" << std::endl;
BaseIter::valid(false);
return;
}
......
......@@ -268,8 +268,8 @@ HexahedralMeshTopologyKernel::add_cell(const std::vector<VertexHandle>& _vertice
assert(_vertices.size() == 8);
if(!TopologyKernel::has_full_bottom_up_adjacencies()) {
std::cerr << "Error: This function needs bottom-up adjacencies to be enabled!" << std::endl;
if(!TopologyKernel::has_full_bottom_up_incidences()) {
std::cerr << "Error: This function needs bottom-up incidences to be enabled!" << std::endl;
return CellHandle(-1);
}
......
......@@ -282,8 +282,8 @@ public:
HalfFaceHandle adjacent_halfface_on_sheet(const HalfFaceHandle& _hfh, const HalfEdgeHandle& _heh) const {
if(!TopologyKernel::has_face_bottom_up_adjacencies()) {
std::cerr << "No bottom-up adjacencies computed so far, could not get adjacent halfface on sheet!" << std::endl;
if(!TopologyKernel::has_face_bottom_up_incidences()) {
std::cerr << "No bottom-up incidences computed so far, could not get adjacent halfface on sheet!" << std::endl;
return TopologyKernel::InvalidHalfFaceHandle;
}
......@@ -339,8 +339,8 @@ public:
HalfFaceHandle neighboring_outside_halfface(const HalfFaceHandle& _hfh, const HalfEdgeHandle& _heh) const {
if(!TopologyKernel::has_face_bottom_up_adjacencies()) {
std::cerr << "No bottom-up adjacencies computed so far, could not get neighboring outside halfface!" << std::endl;
if(!TopologyKernel::has_face_bottom_up_incidences()) {
std::cerr << "No bottom-up incidences computed so far, could not get neighboring outside halfface!" << std::endl;
return TopologyKernel::InvalidHalfFaceHandle;
}
......
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