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 @@ ...@@ -40,6 +40,9 @@
* * * *
\*===========================================================================*/ \*===========================================================================*/
#include <istream>
#include <ostream>
#include "OpenVolumeMeshStatus.hh" #include "OpenVolumeMeshStatus.hh"
namespace OpenVolumeMesh { namespace OpenVolumeMesh {
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
#ifndef STATUS_HH_ #ifndef STATUS_HH_
#define STATUS_HH_ #define STATUS_HH_
#include <iostream> #include <iosfwd>
namespace OpenVolumeMesh { namespace OpenVolumeMesh {
......
...@@ -40,6 +40,10 @@ ...@@ -40,6 +40,10 @@
* * * *
\*===========================================================================*/ \*===========================================================================*/
#ifndef NDEBUG
#include <iostream>
#endif
#include "StatusAttrib.hh" #include "StatusAttrib.hh"
#include "../Core/TopologyKernel.hh" #include "../Core/TopologyKernel.hh"
...@@ -462,8 +466,10 @@ void StatusAttrib::garbage_collection(std_API_Container_VHandlePointer &vh_to_up ...@@ -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); garbage_collection(vh_to_update, hh_to_update, hfh_to_update, ch_to_update, false);
} else { } else {
#ifndef NDEBUG
std::cerr << "Preservation of three-manifoldness in garbage_collection() " std::cerr << "Preservation of three-manifoldness in garbage_collection() "
<< "requires bottom-up incidences!" << std::endl; << "requires bottom-up incidences!" << std::endl;
#endif
return; return;
} }
} }
......
...@@ -40,7 +40,8 @@ ...@@ -40,7 +40,8 @@
* * * *
\*===========================================================================*/ \*===========================================================================*/
#include <iostream> #include <istream>
#include <ostream>
#include "BaseEntities.hh" #include "BaseEntities.hh"
......
...@@ -40,9 +40,11 @@ ...@@ -40,9 +40,11 @@
* * * *
\*===========================================================================*/ \*===========================================================================*/
#include <algorithm>
#ifndef NDEBUG
#include <iostream> #include <iostream>
#endif
#include <set> #include <set>
#include <algorithm>
#include "Iterators.hh" #include "Iterators.hh"
#include "TopologyKernel.hh" #include "TopologyKernel.hh"
...@@ -61,7 +63,9 @@ BaseIter(_mesh, _ref_h), ...@@ -61,7 +63,9 @@ BaseIter(_mesh, _ref_h),
cur_index_(0) { cur_index_(0) {
if(!_mesh->has_vertex_bottom_up_incidences()) { if(!_mesh->has_vertex_bottom_up_incidences()) {
#ifndef NDEBUG
std::cerr << "This iterator needs bottom-up incidences!" << std::endl; std::cerr << "This iterator needs bottom-up incidences!" << std::endl;
#endif
BaseIter::valid(false); BaseIter::valid(false);
return; return;
} }
...@@ -123,7 +127,9 @@ BaseIter(_mesh, _ref_h), ...@@ -123,7 +127,9 @@ BaseIter(_mesh, _ref_h),
cur_index_(0) { cur_index_(0) {
if(!_mesh->has_edge_bottom_up_incidences()) { if(!_mesh->has_edge_bottom_up_incidences()) {
#ifndef NDEBUG
std::cerr << "This iterator needs bottom-up incidences!" << std::endl; std::cerr << "This iterator needs bottom-up incidences!" << std::endl;
#endif
BaseIter::valid(false); BaseIter::valid(false);
return; return;
} }
...@@ -184,7 +190,9 @@ VertexCellIter::VertexCellIter(const VertexHandle& _ref_h, ...@@ -184,7 +190,9 @@ VertexCellIter::VertexCellIter(const VertexHandle& _ref_h,
BaseIter(_mesh, _ref_h) { BaseIter(_mesh, _ref_h) {
if(!_mesh->has_full_bottom_up_incidences()) { if(!_mesh->has_full_bottom_up_incidences()) {
#ifndef NDEBUG
std::cerr << "This iterator needs bottom-up incidences!" << std::endl; std::cerr << "This iterator needs bottom-up incidences!" << std::endl;
#endif
BaseIter::valid(false); BaseIter::valid(false);
return; return;
} }
...@@ -252,7 +260,9 @@ BaseIter(_mesh, _ref_h), ...@@ -252,7 +260,9 @@ BaseIter(_mesh, _ref_h),
cur_index_(0) { cur_index_(0) {
if(!_mesh->has_edge_bottom_up_incidences() || !_mesh->has_face_bottom_up_incidences()) { 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; std::cerr << "This iterator needs bottom-up incidences!" << std::endl;
#endif
BaseIter::valid(false); BaseIter::valid(false);
return; return;
} }
...@@ -373,7 +383,9 @@ CellCellIter::CellCellIter(const CellHandle& _ref_h, ...@@ -373,7 +383,9 @@ CellCellIter::CellCellIter(const CellHandle& _ref_h,
BaseIter(_mesh, _ref_h) { BaseIter(_mesh, _ref_h) {
if(!_mesh->has_face_bottom_up_incidences()) { if(!_mesh->has_face_bottom_up_incidences()) {
#ifndef NDEBUG
std::cerr << "This iterator needs bottom-up incidences!" << std::endl; std::cerr << "This iterator needs bottom-up incidences!" << std::endl;
#endif
BaseIter::valid(false); BaseIter::valid(false);
return; return;
} }
...@@ -477,7 +489,9 @@ BoundaryHalfFaceHalfFaceIter::BoundaryHalfFaceHalfFaceIter(const HalfFaceHandle& ...@@ -477,7 +489,9 @@ BoundaryHalfFaceHalfFaceIter::BoundaryHalfFaceHalfFaceIter(const HalfFaceHandle&
BaseIter(_mesh, _ref_h) { BaseIter(_mesh, _ref_h) {
if(!_mesh->has_face_bottom_up_incidences()) { if(!_mesh->has_face_bottom_up_incidences()) {
#ifndef NDEBUG
std::cerr << "This iterator needs bottom-up incidences!" << std::endl; std::cerr << "This iterator needs bottom-up incidences!" << std::endl;
#endif
BaseIter::valid(false); BaseIter::valid(false);
return; return;
} }
...@@ -540,7 +554,9 @@ BaseIter(_mesh, TopologyKernel::InvalidFaceHandle), ...@@ -540,7 +554,9 @@ BaseIter(_mesh, TopologyKernel::InvalidFaceHandle),
bf_it_(_mesh->faces_begin()) { bf_it_(_mesh->faces_begin()) {
if(!_mesh->has_face_bottom_up_incidences()) { if(!_mesh->has_face_bottom_up_incidences()) {
#ifndef NDEBUG
std::cerr << "This iterator needs bottom-up incidences!" << std::endl; std::cerr << "This iterator needs bottom-up incidences!" << std::endl;
#endif
BaseIter::valid(false); BaseIter::valid(false);
return; return;
} }
......
...@@ -43,9 +43,9 @@ ...@@ -43,9 +43,9 @@
#ifndef ITERATORS_HH_ #ifndef ITERATORS_HH_
#define ITERATORS_HH_ #define ITERATORS_HH_
#include <iterator>
#include <set> #include <set>
#include <vector> #include <vector>
#include <iterator>
#include "OpenVolumeMeshHandle.hh" #include "OpenVolumeMeshHandle.hh"
......
...@@ -40,6 +40,8 @@ ...@@ -40,6 +40,8 @@
* * * *
\*===========================================================================*/ \*===========================================================================*/
#include <limits>
#include "OpenVolumeMeshBaseProperty.hh" #include "OpenVolumeMeshBaseProperty.hh"
namespace OpenVolumeMesh { namespace OpenVolumeMesh {
......
...@@ -44,9 +44,8 @@ ...@@ -44,9 +44,8 @@
#ifndef OPENVOLUMEMESHBASEPROPERTY_HH #ifndef OPENVOLUMEMESHBASEPROPERTY_HH
#define OPENVOLUMEMESHBASEPROPERTY_HH #define OPENVOLUMEMESHBASEPROPERTY_HH
#include <limits> #include <iosfwd>
#include <string> #include <string>
#include <iostream>
#include <vector> #include <vector>
#include "OpenVolumeMeshHandle.hh" #include "OpenVolumeMeshHandle.hh"
......
...@@ -40,6 +40,9 @@ ...@@ -40,6 +40,9 @@
* * * *
\*===========================================================================*/ \*===========================================================================*/
#include <istream>
#include <ostream>
#include "OpenVolumeMeshHandle.hh" #include "OpenVolumeMeshHandle.hh"
namespace OpenVolumeMesh { namespace OpenVolumeMesh {
......
...@@ -43,10 +43,11 @@ ...@@ -43,10 +43,11 @@
#ifndef OPENVOLUMEMESHHANDLE_HH_ #ifndef OPENVOLUMEMESHHANDLE_HH_
#define OPENVOLUMEMESHHANDLE_HH_ #define OPENVOLUMEMESHHANDLE_HH_
#include <iostream>
#include <vector>
#include <OpenVolumeMesh/System/FunctionalInclude.hh>
#include <algorithm> #include <algorithm>
#include <iosfwd>
#include <vector>
#include "../System/FunctionalInclude.hh"
namespace OpenVolumeMesh { namespace OpenVolumeMesh {
......
...@@ -45,15 +45,14 @@ ...@@ -45,15 +45,14 @@
//== INCLUDES ================================================================= //== INCLUDES =================================================================
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cassert> #include <cassert>
#include <istream>
#include <ostream>
#include <numeric>
#include <string>
#include <vector>
#include "OpenVolumeMeshBaseProperty.hh" #include "OpenVolumeMeshBaseProperty.hh"
#include "OpenVolumeMeshHandle.hh"
namespace OpenVolumeMesh { namespace OpenVolumeMesh {
......
...@@ -42,8 +42,6 @@ ...@@ -42,8 +42,6 @@
#include "PropertyDefines.hh" #include "PropertyDefines.hh"
#include "../Geometry/VectorT.hh"
namespace OpenVolumeMesh { namespace OpenVolumeMesh {
template <> const std::string typeName<int>() { return "int"; } template <> const std::string typeName<int>() { return "int"; }
......
...@@ -43,11 +43,11 @@ ...@@ -43,11 +43,11 @@
#ifndef PROPERTYDEFINES_HH_ #ifndef PROPERTYDEFINES_HH_
#define PROPERTYDEFINES_HH_ #define PROPERTYDEFINES_HH_
#include <iostream> #include <iosfwd>
#include <typeinfo>
#include <stdexcept> #include <stdexcept>
#include <string>
#include <typeinfo>
#include "BaseProperty.hh"
#include "PropertyHandles.hh" #include "PropertyHandles.hh"
#include "PropertyPtr.hh" #include "PropertyPtr.hh"
...@@ -55,8 +55,6 @@ namespace OpenVolumeMesh { ...@@ -55,8 +55,6 @@ namespace OpenVolumeMesh {
template <class T> template <class T>
class OpenVolumeMeshPropertyT; class OpenVolumeMeshPropertyT;
template <class PropT, class HandleT>
class PropertyPtr;
class ResourceManager; class ResourceManager;
......
...@@ -42,8 +42,10 @@ ...@@ -42,8 +42,10 @@
#define PROPERTYDEFINEST_CC #define PROPERTYDEFINEST_CC
#include <istream>
#include <ostream>
#include "PropertyDefines.hh" #include "PropertyDefines.hh"
#include "PropertyPtr.hh"
namespace OpenVolumeMesh { namespace OpenVolumeMesh {
......
...@@ -43,13 +43,10 @@ ...@@ -43,13 +43,10 @@
#ifndef PROPERTYPTR_HH_ #ifndef PROPERTYPTR_HH_
#define PROPERTYPTR_HH_ #define PROPERTYPTR_HH_
#include <iostream>
#include <string> #include <string>
#include <cassert>
#include "BaseProperty.hh" #include "BaseProperty.hh"
#include "PropertyHandles.hh" #include "OpenVolumeMeshHandle.hh"
#include "../System/MemoryInclude.hh" #include "../System/MemoryInclude.hh"
namespace OpenVolumeMesh { namespace OpenVolumeMesh {
......
...@@ -43,6 +43,9 @@ ...@@ -43,6 +43,9 @@
#ifndef RESOURCEMANAGER_HH_ #ifndef RESOURCEMANAGER_HH_
#define RESOURCEMANAGER_HH_ #define RESOURCEMANAGER_HH_
#ifndef NDEBUG
#include <iostream>
#endif
#include <string> #include <string>
#include <vector> #include <vector>
...@@ -223,8 +226,11 @@ private: ...@@ -223,8 +226,11 @@ private:
template <class FullPropT, class PropIterT> template <class FullPropT, class PropIterT>
bool property_exists(const PropIterT& _begin, const PropIterT& _end, const std::string& _name) const { bool property_exists(const PropIterT& _begin, const PropIterT& _end, const std::string& _name) const {
if(_name.length() == 0) { if(_name.empty()) {
std::cerr << "Checking for the existence of anonymous properties is ambiguous!" << std::endl; #ifndef NDEBUG
std::cerr << "property_exists(): Checking for the existence of anonymous properties is" << std::endl;
std::cerr << "ambiguous!" << std::endl;
#endif
return false; return false;
} }
......
...@@ -43,11 +43,8 @@ ...@@ -43,11 +43,8 @@
#define RESOURCEMANAGERT_CC #define RESOURCEMANAGERT_CC
#include "ResourceManager.hh" #include "ResourceManager.hh"
#include "PropertyDefines.hh" #include "PropertyDefines.hh"
#include "PropertyPtr.hh"
namespace OpenVolumeMesh { namespace OpenVolumeMesh {
template<class T> template<class T>
......
This diff is collapsed.
This diff is collapsed.
...@@ -59,10 +59,11 @@ ...@@ -59,10 +59,11 @@
//== INCLUDES ================================================================= //== INCLUDES =================================================================
#include <iostream> #include <istream>
#include <assert.h> #include <ostream>
#include <math.h> #include <cassert>
#include <string.h> #include <cmath>
#include <string>
#if defined(__GNUC__) && defined(__SSE__) #if defined(__GNUC__) && defined(__SSE__)
#include <xmmintrin.h> #include <xmmintrin.h>
......
...@@ -58,7 +58,9 @@ CellSheetCellIter::CellSheetCellIter(const CellHandle& _ref_h, ...@@ -58,7 +58,9 @@ CellSheetCellIter::CellSheetCellIter(const CellHandle& _ref_h,
BaseIter(_mesh, _ref_h) { BaseIter(_mesh, _ref_h) {
if(!_mesh->has_face_bottom_up_incidences()) { if(!_mesh->has_face_bottom_up_incidences()) {
#ifndef NDEBUG
std::cerr << "This iterator needs bottom-up incidences!" << std::endl; std::cerr << "This iterator needs bottom-up incidences!" << std::endl;
#endif
BaseIter::valid(false); BaseIter::valid(false);
return; return;
} }
...@@ -118,7 +120,9 @@ HalfFaceSheetHalfFaceIter::HalfFaceSheetHalfFaceIter(const HalfFaceHandle& _ref_ ...@@ -118,7 +120,9 @@ HalfFaceSheetHalfFaceIter::HalfFaceSheetHalfFaceIter(const HalfFaceHandle& _ref_
BaseIter(_mesh, _ref_h) { BaseIter(_mesh, _ref_h) {
if(!_mesh->has_face_bottom_up_incidences()) { if(!_mesh->has_face_bottom_up_incidences()) {
#ifndef NDEBUG
std::cerr << "This iterator needs bottom-up incidences!" << std::endl; std::cerr << "This iterator needs bottom-up incidences!" << std::endl;
#endif
BaseIter::valid(false); BaseIter::valid(false);
return; return;
} }
...@@ -135,7 +139,9 @@ BaseIter(_mesh, _ref_h) { ...@@ -135,7 +139,9 @@ BaseIter(_mesh, _ref_h) {
*/ */
if(_mesh->is_boundary(_ref_h)) { if(_mesh->is_boundary(_ref_h)) {
#ifndef NDEBUG
std::cerr << "HalfFaceSheetHalfFaceIter: HalfFace is boundary!" << std::endl; std::cerr << "HalfFaceSheetHalfFaceIter: HalfFace is boundary!" << std::endl;
#endif
BaseIter::valid(false); BaseIter::valid(false);
return; return;
} }
......
...@@ -62,7 +62,10 @@ HexahedralMeshTopologyKernel::~HexahedralMeshTopologyKernel() { ...@@ -62,7 +62,10 @@ HexahedralMeshTopologyKernel::~HexahedralMeshTopologyKernel() {
FaceHandle HexahedralMeshTopologyKernel::add_face(const std::vector<HalfEdgeHandle>& _halfedges, bool _topologyCheck) { FaceHandle HexahedralMeshTopologyKernel::add_face(const std::vector<HalfEdgeHandle>& _halfedges, bool _topologyCheck) {
if(_halfedges.size() != 4) { 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; return TopologyKernel::InvalidFaceHandle;
} }
...@@ -76,7 +79,10 @@ FaceHandle ...@@ -76,7 +79,10 @@ FaceHandle
HexahedralMeshTopologyKernel::add_face(const std::vector<VertexHandle>& _vertices) { HexahedralMeshTopologyKernel::add_face(const std::vector<VertexHandle>& _vertices) {
if(_vertices.size() != 4) { 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; return TopologyKernel::InvalidFaceHandle;
} }
...@@ -89,19 +95,22 @@ HexahedralMeshTopologyKernel::add_face(const std::vector<VertexHandle>& _vertice ...@@ -89,19 +95,22 @@ HexahedralMeshTopologyKernel::add_face(const std::vector<VertexHandle>& _vertice
CellHandle CellHandle
HexahedralMeshTopologyKernel::add_cell(const std::vector<HalfFaceHandle>& _halffaces, bool _topologyCheck) { HexahedralMeshTopologyKernel::add_cell(const std::vector<HalfFaceHandle>& _halffaces, bool _topologyCheck) {
#ifndef NDEBUG
if(_halffaces.size() != 6) { if(_halffaces.size() != 6) {
// To make this consistent with add_face
#ifndef NDEBUG
std::cerr << "Cell valence is not six! Aborting." << std::endl; std::cerr << "Cell valence is not six! Aborting." << std::endl;
#endif
return TopologyKernel::InvalidCellHandle; return TopologyKernel::InvalidCellHandle;
} }
for(std::vector<HalfFaceHandle>::const_iterator it = _halffaces.begin(); for(std::vector<HalfFaceHandle>::const_iterator it = _halffaces.begin();
it != _halffaces.end(); ++it) { it != _halffaces.end(); ++it) {
if(TopologyKernel::halfface(*it).halfedges().size() != 4) { if(TopologyKernel::halfface(*it).halfedges().size() != 4) {
#ifndef NDEBUG
std::cerr << "Incident face does not have valence four! Aborting." << std::endl; std::cerr << "Incident face does not have valence four! Aborting." << std::endl;
#endif
return TopologyKernel::InvalidCellHandle; return TopologyKernel::InvalidCellHandle;
} }
} }
#endif
// Create new halffaces vector // Create new halffaces vector
std::vector<HalfFaceHandle> ordered_halffaces; std::vector<HalfFaceHandle> ordered_halffaces;
...@@ -114,7 +123,9 @@ HexahedralMeshTopologyKernel::add_cell(const std::vector<HalfFaceHandle>& _halff ...@@ -114,7 +123,9 @@ HexahedralMeshTopologyKernel::add_cell(const std::vector<HalfFaceHandle>& _halff
if(!ordered) { if(!ordered) {
#ifndef NDEBUG
std::cerr << "The specified half-faces are not in correct order. Trying automatic re-ordering." << std::endl; std::cerr << "The specified half-faces are not in correct order. Trying automatic re-ordering." << std::endl;
#endif
// Ordering array (see below for details) // Ordering array (see below for details)
const int orderTop[] = {2, 4, 3, 5}; const int orderTop[] = {2, 4, 3, 5};
...@@ -133,7 +144,9 @@ HexahedralMeshTopologyKernel::add_cell(const std::vector<HalfFaceHandle>& _halff ...@@ -133,7 +144,9 @@ HexahedralMeshTopologyKernel::add_cell(const std::vector<HalfFaceHandle>& _halff
HalfFaceHandle ahfh = get_adjacent_halfface(ordered_halffaces[0], *he_it, _halffaces); HalfFaceHandle ahfh = get_adjacent_halfface(ordered_halffaces[0], *he_it, _halffaces);
if(ahfh == TopologyKernel::InvalidHalfFaceHandle) { if(ahfh == TopologyKernel::InvalidHalfFaceHandle) {
#ifndef NDEBUG
std::cerr << "The current halfface is invalid!" << std::endl; std::cerr << "The current halfface is invalid!" << std::endl;
#endif
continue; continue;