Commit 749ae1d0 authored by Mike Kremer's avatar Mike Kremer

Removed a lot of unnecessary include directives and also keep the use of...

Removed a lot of unnecessary include directives and also keep the use of asserts consistent throughout the entire code. Fixed a bug when deleting ranges of cells. 

This patch was entirely written by Vladimir Chalupecky. Thanks Vladimir. I really appreciate your help.

git-svn-id: http://www.openvolumemesh.org/svnrepo/OpenVolumeMesh/trunk@257 66977474-1d4b-4f09-8fe9-267525286df2
parent b02d35a7
......@@ -40,6 +40,9 @@
* *
\*===========================================================================*/
#include <istream>
#include <ostream>
#include "OpenVolumeMeshStatus.hh"
namespace OpenVolumeMesh {
......
......@@ -43,7 +43,7 @@
#ifndef STATUS_HH_
#define STATUS_HH_
#include <iostream>
#include <iosfwd>
namespace OpenVolumeMesh {
......
......@@ -40,6 +40,10 @@
* *
\*===========================================================================*/
#ifndef NDEBUG
#include <iostream>
#endif
#include "StatusAttrib.hh"
#include "../Core/TopologyKernel.hh"
......@@ -462,8 +466,10 @@ void StatusAttrib::garbage_collection(std_API_Container_VHandlePointer &vh_to_up
garbage_collection(vh_to_update, hh_to_update, hfh_to_update, ch_to_update, false);
} else {
#ifndef NDEBUG
std::cerr << "Preservation of three-manifoldness in garbage_collection() "
<< "requires bottom-up incidences!" << std::endl;
#endif
return;
}
}
......
......@@ -40,7 +40,8 @@
* *
\*===========================================================================*/
#include <iostream>
#include <istream>
#include <ostream>
#include "BaseEntities.hh"
......
......@@ -40,9 +40,11 @@
* *
\*===========================================================================*/
#include <algorithm>
#ifndef NDEBUG
#include <iostream>
#endif
#include <set>
#include <algorithm>
#include "Iterators.hh"
#include "TopologyKernel.hh"
......@@ -61,7 +63,9 @@ BaseIter(_mesh, _ref_h),
cur_index_(0) {
if(!_mesh->has_vertex_bottom_up_incidences()) {
#ifndef NDEBUG
std::cerr << "This iterator needs bottom-up incidences!" << std::endl;
#endif
BaseIter::valid(false);
return;
}
......@@ -123,7 +127,9 @@ BaseIter(_mesh, _ref_h),
cur_index_(0) {
if(!_mesh->has_edge_bottom_up_incidences()) {
#ifndef NDEBUG
std::cerr << "This iterator needs bottom-up incidences!" << std::endl;
#endif
BaseIter::valid(false);
return;
}
......@@ -184,7 +190,9 @@ VertexCellIter::VertexCellIter(const VertexHandle& _ref_h,
BaseIter(_mesh, _ref_h) {
if(!_mesh->has_full_bottom_up_incidences()) {
#ifndef NDEBUG
std::cerr << "This iterator needs bottom-up incidences!" << std::endl;
#endif
BaseIter::valid(false);
return;
}
......@@ -252,7 +260,9 @@ BaseIter(_mesh, _ref_h),
cur_index_(0) {
if(!_mesh->has_edge_bottom_up_incidences() || !_mesh->has_face_bottom_up_incidences()) {
#ifndef NDEBUG
std::cerr << "This iterator needs bottom-up incidences!" << std::endl;
#endif
BaseIter::valid(false);
return;
}
......@@ -373,7 +383,9 @@ CellCellIter::CellCellIter(const CellHandle& _ref_h,
BaseIter(_mesh, _ref_h) {
if(!_mesh->has_face_bottom_up_incidences()) {
#ifndef NDEBUG
std::cerr << "This iterator needs bottom-up incidences!" << std::endl;
#endif
BaseIter::valid(false);
return;
}
......@@ -477,7 +489,9 @@ BoundaryHalfFaceHalfFaceIter::BoundaryHalfFaceHalfFaceIter(const HalfFaceHandle&
BaseIter(_mesh, _ref_h) {
if(!_mesh->has_face_bottom_up_incidences()) {
#ifndef NDEBUG
std::cerr << "This iterator needs bottom-up incidences!" << std::endl;
#endif
BaseIter::valid(false);
return;
}
......@@ -540,7 +554,9 @@ BaseIter(_mesh, TopologyKernel::InvalidFaceHandle),
bf_it_(_mesh->faces_begin()) {
if(!_mesh->has_face_bottom_up_incidences()) {
#ifndef NDEBUG
std::cerr << "This iterator needs bottom-up incidences!" << std::endl;
#endif
BaseIter::valid(false);
return;
}
......
......@@ -43,9 +43,9 @@
#ifndef ITERATORS_HH_
#define ITERATORS_HH_
#include <iterator>
#include <set>
#include <vector>
#include <iterator>
#include "OpenVolumeMeshHandle.hh"
......
......@@ -40,6 +40,8 @@
* *
\*===========================================================================*/
#include <limits>
#include "OpenVolumeMeshBaseProperty.hh"
namespace OpenVolumeMesh {
......
......@@ -44,9 +44,8 @@
#ifndef OPENVOLUMEMESHBASEPROPERTY_HH
#define OPENVOLUMEMESHBASEPROPERTY_HH
#include <limits>
#include <iosfwd>
#include <string>
#include <iostream>
#include <vector>
#include "OpenVolumeMeshHandle.hh"
......
......@@ -40,6 +40,9 @@
* *
\*===========================================================================*/
#include <istream>
#include <ostream>
#include "OpenVolumeMeshHandle.hh"
namespace OpenVolumeMesh {
......
......@@ -43,10 +43,11 @@
#ifndef OPENVOLUMEMESHHANDLE_HH_
#define OPENVOLUMEMESHHANDLE_HH_
#include <iostream>
#include <vector>
#include <OpenVolumeMesh/System/FunctionalInclude.hh>
#include <algorithm>
#include <iosfwd>
#include <vector>
#include "../System/FunctionalInclude.hh"
namespace OpenVolumeMesh {
......
......@@ -45,15 +45,14 @@
//== INCLUDES =================================================================
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <istream>
#include <ostream>
#include <numeric>
#include <string>
#include <vector>
#include "OpenVolumeMeshBaseProperty.hh"
#include "OpenVolumeMeshHandle.hh"
namespace OpenVolumeMesh {
......
......@@ -42,8 +42,6 @@
#include "PropertyDefines.hh"
#include "../Geometry/VectorT.hh"
namespace OpenVolumeMesh {
template <> const std::string typeName<int>() { return "int"; }
......
......@@ -43,11 +43,11 @@
#ifndef PROPERTYDEFINES_HH_
#define PROPERTYDEFINES_HH_
#include <iostream>
#include <typeinfo>
#include <iosfwd>
#include <stdexcept>
#include <string>
#include <typeinfo>
#include "BaseProperty.hh"
#include "PropertyHandles.hh"
#include "PropertyPtr.hh"
......@@ -55,8 +55,6 @@ namespace OpenVolumeMesh {
template <class T>
class OpenVolumeMeshPropertyT;
template <class PropT, class HandleT>
class PropertyPtr;
class ResourceManager;
......
......@@ -42,8 +42,10 @@
#define PROPERTYDEFINEST_CC
#include <istream>
#include <ostream>
#include "PropertyDefines.hh"
#include "PropertyPtr.hh"
namespace OpenVolumeMesh {
......
......@@ -43,13 +43,10 @@
#ifndef PROPERTYPTR_HH_
#define PROPERTYPTR_HH_
#include <iostream>
#include <string>
#include <cassert>
#include "BaseProperty.hh"
#include "PropertyHandles.hh"
#include "OpenVolumeMeshHandle.hh"
#include "../System/MemoryInclude.hh"
namespace OpenVolumeMesh {
......
......@@ -43,6 +43,9 @@
#ifndef RESOURCEMANAGER_HH_
#define RESOURCEMANAGER_HH_
#ifndef NDEBUG
#include <iostream>
#endif
#include <string>
#include <vector>
......@@ -223,8 +226,11 @@ private:
template <class FullPropT, class PropIterT>
bool property_exists(const PropIterT& _begin, const PropIterT& _end, const std::string& _name) const {
if(_name.length() == 0) {
std::cerr << "Checking for the existence of anonymous properties is ambiguous!" << std::endl;
if(_name.empty()) {
#ifndef NDEBUG
std::cerr << "property_exists(): Checking for the existence of anonymous properties is" << std::endl;
std::cerr << "ambiguous!" << std::endl;
#endif
return false;
}
......
......@@ -43,11 +43,8 @@
#define RESOURCEMANAGERT_CC
#include "ResourceManager.hh"
#include "PropertyDefines.hh"
#include "PropertyPtr.hh"
namespace OpenVolumeMesh {
template<class T>
......
This diff is collapsed.
This diff is collapsed.
......@@ -59,10 +59,11 @@
//== INCLUDES =================================================================
#include <iostream>
#include <assert.h>
#include <math.h>
#include <string.h>
#include <istream>
#include <ostream>
#include <cassert>
#include <cmath>
#include <string>
#if defined(__GNUC__) && defined(__SSE__)
#include <xmmintrin.h>
......
......@@ -58,7 +58,9 @@ CellSheetCellIter::CellSheetCellIter(const CellHandle& _ref_h,
BaseIter(_mesh, _ref_h) {
if(!_mesh->has_face_bottom_up_incidences()) {
#ifndef NDEBUG
std::cerr << "This iterator needs bottom-up incidences!" << std::endl;
#endif
BaseIter::valid(false);
return;
}
......@@ -118,7 +120,9 @@ HalfFaceSheetHalfFaceIter::HalfFaceSheetHalfFaceIter(const HalfFaceHandle& _ref_
BaseIter(_mesh, _ref_h) {
if(!_mesh->has_face_bottom_up_incidences()) {
#ifndef NDEBUG
std::cerr << "This iterator needs bottom-up incidences!" << std::endl;
#endif
BaseIter::valid(false);
return;
}
......@@ -135,7 +139,9 @@ BaseIter(_mesh, _ref_h) {
*/
if(_mesh->is_boundary(_ref_h)) {
#ifndef NDEBUG
std::cerr << "HalfFaceSheetHalfFaceIter: HalfFace is boundary!" << std::endl;
#endif
BaseIter::valid(false);
return;
}
......
......@@ -62,7 +62,10 @@ HexahedralMeshTopologyKernel::~HexahedralMeshTopologyKernel() {
FaceHandle HexahedralMeshTopologyKernel::add_face(const std::vector<HalfEdgeHandle>& _halfedges, bool _topologyCheck) {
if(_halfedges.size() != 4) {
std::cerr << "Face valence is not four! Aborting." << std::endl;
#ifndef NDEBUG
std::cerr << "HexahedralMeshTopologyKernel::add_face(): Face valence is not four! Returning" << std::endl;
std::cerr << "invalid handle." << std::endl;
#endif
return TopologyKernel::InvalidFaceHandle;
}
......@@ -76,7 +79,10 @@ FaceHandle
HexahedralMeshTopologyKernel::add_face(const std::vector<VertexHandle>& _vertices) {
if(_vertices.size() != 4) {
std::cerr << "Face valence is not four! Aborting." << std::endl;
#ifndef NDEBUG
std::cerr << "HexahedralMeshTopologyKernel::add_face(): Face valence is not four! Returning" << std::endl;
std::cerr << "invalid handle." << std::endl;
#endif
return TopologyKernel::InvalidFaceHandle;
}
......@@ -89,19 +95,22 @@ HexahedralMeshTopologyKernel::add_face(const std::vector<VertexHandle>& _vertice
CellHandle
HexahedralMeshTopologyKernel::add_cell(const std::vector<HalfFaceHandle>& _halffaces, bool _topologyCheck) {
#ifndef NDEBUG
if(_halffaces.size() != 6) {
// To make this consistent with add_face
#ifndef NDEBUG
std::cerr << "Cell valence is not six! Aborting." << std::endl;
#endif
return TopologyKernel::InvalidCellHandle;
}
for(std::vector<HalfFaceHandle>::const_iterator it = _halffaces.begin();
it != _halffaces.end(); ++it) {
if(TopologyKernel::halfface(*it).halfedges().size() != 4) {
#ifndef NDEBUG
std::cerr << "Incident face does not have valence four! Aborting." << std::endl;
#endif
return TopologyKernel::InvalidCellHandle;
}
}
#endif
// Create new halffaces vector
std::vector<HalfFaceHandle> ordered_halffaces;
......@@ -114,7 +123,9 @@ HexahedralMeshTopologyKernel::add_cell(const std::vector<HalfFaceHandle>& _halff
if(!ordered) {
#ifndef NDEBUG
std::cerr << "The specified half-faces are not in correct order. Trying automatic re-ordering." << std::endl;
#endif
// Ordering array (see below for details)
const int orderTop[] = {2, 4, 3, 5};
......@@ -133,7 +144,9 @@ HexahedralMeshTopologyKernel::add_cell(const std::vector<HalfFaceHandle>& _halff
HalfFaceHandle ahfh = get_adjacent_halfface(ordered_halffaces[0], *he_it, _halffaces);
if(ahfh == TopologyKernel::InvalidHalfFaceHandle) {
#ifndef NDEBUG
std::cerr << "The current halfface is invalid!" << std::endl;
#endif
continue;
}
ordered_halffaces[orderTop[idx]] = ahfh;
......@@ -152,7 +165,9 @@ HexahedralMeshTopologyKernel::add_cell(const std::vector<HalfFaceHandle>& _halff
if(cur_hf != TopologyKernel::InvalidHalfFaceHandle) {
ordered_halffaces[1] = cur_hf;
} else {
#ifndef NDEBUG
std::cerr << "The current halfface is invalid!" << std::endl;
#endif
return TopologyKernel::InvalidCellHandle;
}
......@@ -222,14 +237,18 @@ bool HexahedralMeshTopologyKernel::check_halfface_ordering(const std::vector<Hal
} else {
offsetTop = (offsetTop + 1) % 4;
if(ahfh != _hfs[orderTop[offsetTop]]) {
#ifndef NDEBUG
std::cerr << "Faces not in right order!" << std::endl;
#endif
return false;
}
}
}
if(offsetTop == -1) {
#ifndef NDEBUG
std::cerr << "Faces not in right order!" << std::endl;
#endif
return false;
}
......@@ -247,14 +266,18 @@ bool HexahedralMeshTopologyKernel::check_halfface_ordering(const std::vector<Hal
} else {
offsetBot = (offsetBot + 1) % 4;
if(ahfh != _hfs[orderBot[offsetBot]]) {
#ifndef NDEBUG
std::cerr << "Faces not in right order!" << std::endl;
#endif
return false;
}
}
}
if(offsetBot == -1) {
#ifndef NDEBUG
std::cerr << "Faces not in right order!" << std::endl;
#endif
return false;
}
......@@ -266,15 +289,16 @@ bool HexahedralMeshTopologyKernel::check_halfface_ordering(const std::vector<Hal
CellHandle
HexahedralMeshTopologyKernel::add_cell(const std::vector<VertexHandle>& _vertices, bool _topologyCheck) {
// debug mode checks
assert(TopologyKernel::has_full_bottom_up_incidences());
assert(_vertices.size() == 8);
// release mode checks
if(!TopologyKernel::has_full_bottom_up_incidences()) {
std::cerr << "Error: This function needs bottom-up incidences to be enabled!" << std::endl;
return CellHandle(-1);
}
if(_vertices.size() != 8) {
std::cerr << "The number of vertices is not eight!" << std::endl;
return CellHandle(-1);
}
......@@ -404,7 +428,9 @@ HexahedralMeshTopologyKernel::add_cell(const std::vector<VertexHandle>& _vertice
}
if(incidentHalfedges.size() != (incidentEdges.size() * 2u)) {
#ifndef NDEBUG
std::cerr << "The specified halffaces are not connected!" << std::endl;
#endif
return InvalidCellHandle;
}
// The halffaces are now guaranteed to form a two-manifold
......@@ -414,7 +440,9 @@ HexahedralMeshTopologyKernel::add_cell(const std::vector<VertexHandle>& _vertice
for(std::vector<HalfFaceHandle>::const_iterator it = hfs.begin(),
end = hfs.end(); it != end; ++it) {
if(incident_cell(*it) != InvalidCellHandle) {
#ifndef NDEBUG
std::cerr << "Warning: One of the specified half-faces is already incident to another cell!" << std::endl;
#endif
return InvalidCellHandle;
}
}
......
......@@ -43,6 +43,9 @@
#ifndef HEXAHEDRALMESHTOPOLOGYKERNEL_HH
#define HEXAHEDRALMESHTOPOLOGYKERNEL_HH
#ifndef NDEBUG
#include <iostream>
#endif
#include <set>
#include "../Core/TopologyKernel.hh"
......@@ -278,7 +281,9 @@ public:
HalfFaceHandle adjacent_halfface_on_sheet(const HalfFaceHandle& _hfh, const HalfEdgeHandle& _heh) const {
if(!TopologyKernel::has_face_bottom_up_incidences()) {
#ifndef NDEBUG
std::cerr << "No bottom-up incidences computed so far, could not get adjacent halfface on sheet!" << std::endl;
#endif
return TopologyKernel::InvalidHalfFaceHandle;
}
......@@ -335,7 +340,9 @@ public:
HalfFaceHandle neighboring_outside_halfface(const HalfFaceHandle& _hfh, const HalfEdgeHandle& _heh) const {
if(!TopologyKernel::has_face_bottom_up_incidences()) {
#ifndef NDEBUG
std::cerr << "No bottom-up incidences computed so far, could not get neighboring outside halfface!" << std::endl;
#endif
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