Commit 1cbfc891 authored by Mike Kremer's avatar Mike Kremer

It finally compiles

git-svn-id: http://www.openvolumemesh.org/svnrepo/OpenVolumeMesh/trunk@23 66977474-1d4b-4f09-8fe9-267525286df2
parent 618c870f
# Locate and configure the Google Test libraries.
#
# Defines the following variable:
#
# GTEST_FOUND - Found the Google Test libraries
# GTEST_INCLUDE_DIRS - The directories needed on the include paths
# GTEST_LIBRARIES - The libraries to link to test executables
# GTEST_MAIN_LIBRARIES - The libraries to link for automatic main() provision
#
# Copyright 2008 Chandler Carruth
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy
# of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
if(GTEST_INCLUDE_DIRS AND GTEST_LIBRARIES AND GTEST_MAIN_LIBRARIES)
set(GTEST_FOUND true)
else(GTEST_INCLUDE_DIRS AND GTEST_LIBRARIES AND GTEST_MAIN_LIBRARIES)
set(GTEST_PREFIX "" CACHE PATH "Installation prefix for Google Test")
if(GTEST_PREFIX)
find_path(_GTEST_INCLUDE_DIR "gtest/gtest.h"
PATHS "${GTEST_PREFIX}/include"
NO_DEFAULT_PATH)
find_library(_GTEST_LIBRARY gtest
PATHS "${GTEST_PREFIX}/lib"
NO_DEFAULT_PATH)
find_library(_GTEST_MAIN_LIBRARY gtest_main
PATHS "${GTEST_PREFIX}/lib"
NO_DEFAULT_PATH)
else(GTEST_PREFIX)
find_path(_GTEST_INCLUDE_DIR "gtest/gtest.h"
PATHS
~/sw/gtest/include
/opt/local/include
/usr/local/include
"C:/libs/win32/gtest/include")
find_library(_GTEST_LIBRARY gtest
PATHS
~/sw/gtest/lib
/opt/local/lib
/usr/local/lib
"C:/libs/win32/gtest/lib")
find_library(_GTEST_MAIN_LIBRARY gtest_main
PATHS
~/sw/gtest/lib
/opt/local/lib
/usr/local/lib
"C:/libs/win32/gtest/lib")
if ( _GTEST_LIBRARY )
get_filename_component(_GTEST_LIBRARY_DIR ${_GTEST_LIBRARY} PATH CACHE )
endif()
endif(GTEST_PREFIX)
if(_GTEST_INCLUDE_DIR AND _GTEST_LIBRARY AND _GTEST_MAIN_LIBRARY)
set(GTEST_FOUND true)
set(GTEST_INCLUDE_DIRS ${_GTEST_INCLUDE_DIR} CACHE PATH
"Include directories for Google Test framework")
if ( NOT WIN32 )
set(GTEST_LIBRARIES ${_GTEST_LIBRARY} CACHE FILEPATH
"Libraries to link for Google Test framework")
set(GTEST_MAIN_LIBRARIES ${_GTEST_MAIN_LIBRARY} CACHE FILEPATH
"Libraries to link for Google Test automatic main() definition")
else()
set(GTEST_LIBRARIES "optimized;gtest;debug;gtestd" CACHE FILEPATH
"Libraries to link for Google Test framework")
set(GTEST_MAIN_LIBRARIES "optimized;gtest_main;debug;gtest_maind" CACHE FILEPATH
"Libraries to link for Google Test automatic main() definition")
endif()
set(GTEST_LIBRARY_DIR ${_GTEST_LIBRARY_DIR} CACHE FILEPATH
"Library dir containing Google Test libraries")
mark_as_advanced(GTEST_INCLUDE_DIRS GTEST_LIBRARIES GTEST_MAIN_LIBRARIES GTEST_LIBRARY_DIR )
if(NOT GoogleTest_FIND_QUIETLY)
message(STATUS "Found Google Test: ${GTEST_LIBRARIES}")
endif(NOT GoogleTest_FIND_QUIETLY)
else(_GTEST_INCLUDE_DIR AND _GTEST_LIBRARY AND _GTEST_MAIN_LIBRARY)
if(GoogleTest_FIND_REQUIRED)
message(FATAL_ERROR "Could not find the Google Test framework")
endif(GoogleTest_FIND_REQUIRED)
endif(_GTEST_INCLUDE_DIR AND _GTEST_LIBRARY AND _GTEST_MAIN_LIBRARY)
endif(GTEST_INCLUDE_DIRS AND GTEST_LIBRARIES AND GTEST_MAIN_LIBRARIES)
......@@ -14,9 +14,11 @@ set (directories
OpenVolumeMesh/PolyhedralMesh/Utils
OpenVolumeMesh/HexahedralMesh
OpenVolumeMesh/HexahedralMesh/Utils
Unittests
)
# Add unittests target
add_subdirectory(Unittests)
# collect all header and source files
acg_append_files (headers "*.hh" ${directories})
acg_append_files (sources "*.cc" ${directories})
......
/*===========================================================================*\
* *
* OpenVolumeMesh *
* Copyright (C) 2011 by Computer Graphics Group, RWTH Aachen *
* www.openmesh.org *
* *
*---------------------------------------------------------------------------*
* This file is part of OpenVolumeMesh. *
* *
* OpenVolumeMesh is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation, either version 3 of *
* the License, or (at your option) any later version with the *
* following exceptions: *
* *
* If other files instantiate templates or use macros *
* or inline functions from this file, or you compile this file and *
* link it with other files to produce an executable, this file does *
* not by itself cause the resulting executable to be covered by the *
* GNU Lesser General Public License. This exception does not however *
* invalidate any other reasons why the executable file might be *
* covered by the GNU Lesser General Public License. *
* *
* OpenVolumeMesh is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU LesserGeneral Public *
* License along with OpenVolumeMesh. If not, *
* see <http://www.gnu.org/licenses/>. *
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision: 22 $ *
* $Date: 2012-01-10 10:10:39 +0100 (Tue, 10 Jan 2012) $ *
* $LastChangedBy: kremer $ *
* *
\*===========================================================================*/
#include "OpenVolumeMeshBaseProperty.hh"
namespace OpenVolumeMesh {
// Initialize constant
const size_t OpenVolumeMeshBaseProperty::UnknownSize = std::numeric_limits<size_t>::max();
} // Namespace OpenVolumeMesh
......@@ -46,6 +46,7 @@
#include <limits>
#include <string>
#include <iostream>
//== CLASS DEFINITION =========================================================
......@@ -148,9 +149,6 @@ private:
bool persistent_;
};
// Initialize constant
const size_t OpenVolumeMeshBaseProperty::UnknownSize = std::numeric_limits<size_t>::max();
} // Namespace OpenVolumeMesh
#endif //OPENVOLUMEMESHBASEPROPERTY_HH
......
......@@ -106,7 +106,7 @@ public:
friend class HalfFaceSheetHalfFaceIter<VecT>;
friend class OutsideNeighborHalfFaceIter<VecT>;
typedef class CellSheetCellIter<VecT> CellSheetCellIter;
typedef class CellSheetCellIter<VecT> CellSheetCellIter;
typedef class HalfFaceSheetHalfFaceIter<VecT> HalfFaceSheetHalfFaceIter;
typedef class OutsideNeighborHalfFaceIter<VecT> OutsideNeighborHalfFaceIter;
......
......@@ -40,7 +40,7 @@
* *
\*===========================================================================*/
#define OPENHEXMESHT_CC
#define HEXAHEDRALMESHT_CC
#include "HexahedralMesh.hh"
......@@ -66,10 +66,10 @@ HexahedralMesh<VecT>::add_face(const std::vector<HalfEdgeHandle>& _halfedges, bo
if(_halfedges.size() != 4) {
std::cerr << "Face valence is not four! Aborting." << std::endl;
return OpenVolumeMesh<VecT>::InvalidFaceHandle;
return PolyhedralMesh<VecT>::InvalidFaceHandle;
}
return OpenVolumeMesh<VecT>::add_face(_halfedges, _topologyCheck);
return PolyhedralMesh<VecT>::add_face(_halfedges, _topologyCheck);
}
//========================================================================================
......@@ -80,10 +80,10 @@ HexahedralMesh<VecT>::add_face(const std::vector<VertexHandle>& _vertices) {
if(_vertices.size() != 4) {
std::cerr << "Face valence is not four! Aborting." << std::endl;
return OpenVolumeMesh<VecT>::InvalidFaceHandle;
return PolyhedralMesh<VecT>::InvalidFaceHandle;
}
return OpenVolumeMesh<VecT>::add_face(_vertices);
return PolyhedralMesh<VecT>::add_face(_vertices);
}
//========================================================================================
......@@ -94,13 +94,13 @@ HexahedralMesh<VecT>::add_cell(const std::vector<HalfFaceHandle>& _halffaces, bo
if(_halffaces.size() != 6) {
std::cerr << "Cell valence is not six! Aborting." << std::endl;
return OpenVolumeMesh<VecT>::InvalidCellHandle;
return PolyhedralMesh<VecT>::InvalidCellHandle;
}
for(typename std::vector<HalfFaceHandle>::const_iterator it = _halffaces.begin();
it != _halffaces.end(); ++it) {
if(halfface(*it).halfedges().size() != 4) {
std::cerr << "Incident face does not have valence four! Aborting." << std::endl;
return OpenVolumeMesh<VecT>::InvalidCellHandle;
return PolyhedralMesh<VecT>::InvalidCellHandle;
}
}
......@@ -114,7 +114,7 @@ HexahedralMesh<VecT>::add_cell(const std::vector<HalfFaceHandle>& _halffaces, bo
// The user wants the faces to be reordered
if(_reorderFaces) {
ordered_halffaces.resize(6, OpenVolumeMesh<VecT>::InvalidHalfFaceHandle);
ordered_halffaces.resize(6, PolyhedralMesh<VecT>::InvalidHalfFaceHandle);
// Create top side
ordered_halffaces[0] = _halffaces[0];
......@@ -126,7 +126,7 @@ HexahedralMesh<VecT>::add_cell(const std::vector<HalfFaceHandle>& _halffaces, bo
he_it != hes.end(); ++he_it) {
HalfFaceHandle ahfh = get_adjacent_halfface(ordered_halffaces[0], *he_it, _halffaces);
if(ahfh == OpenVolumeMesh<VecT>::InvalidHalfFaceHandle) {
if(ahfh == PolyhedralMesh<VecT>::InvalidHalfFaceHandle) {
std::cerr << "The current halfface is invalid!" << std::endl;
continue;
}
......@@ -143,7 +143,7 @@ HexahedralMesh<VecT>::add_cell(const std::vector<HalfFaceHandle>& _halffaces, bo
cur_he = next_halfedge_in_halfface(cur_he, cur_hf);
cur_hf = get_adjacent_halfface(cur_hf, cur_he, _halffaces);
if(cur_hf != OpenVolumeMesh<VecT>::InvalidHalfFaceHandle) {
if(cur_hf != PolyhedralMesh<VecT>::InvalidHalfFaceHandle) {
ordered_halffaces[1] = cur_hf;
} else {
std::cerr << "The current halfface is invalid!" << std::endl;
......@@ -202,14 +202,14 @@ HexahedralMesh<VecT>::add_cell(const std::vector<HalfFaceHandle>& _halffaces, bo
offsetTop = (offsetTop + 1) % 4;
if(ahfh != ordered_halffaces[orderTop[offsetTop]]) {
std::cerr << "Faces not in right order!" << std::endl;
return OpenVolumeMesh<VecT>::InvalidCellHandle;
return PolyhedralMesh<VecT>::InvalidCellHandle;
}
}
}
if(offsetTop == -1) {
std::cerr << "Faces not in right order!" << std::endl;
return OpenVolumeMesh<VecT>::InvalidCellHandle;
return PolyhedralMesh<VecT>::InvalidCellHandle;
}
// Traverse halfedges bottom
......@@ -227,17 +227,17 @@ HexahedralMesh<VecT>::add_cell(const std::vector<HalfFaceHandle>& _halffaces, bo
offsetBot = (offsetBot + 1) % 4;
if(ahfh != ordered_halffaces[orderBot[offsetBot]]) {
std::cerr << "Faces not in right order!" << std::endl;
return OpenVolumeMesh<VecT>::InvalidCellHandle;
return PolyhedralMesh<VecT>::InvalidCellHandle;
}
}
}
if(offsetBot == -1) {
std::cerr << "Faces not in right order!" << std::endl;
return OpenVolumeMesh<VecT>::InvalidCellHandle;
return PolyhedralMesh<VecT>::InvalidCellHandle;
}
return OpenVolumeMesh<VecT>::add_cell(ordered_halffaces, _topologyCheck);
return PolyhedralMesh<VecT>::add_cell(ordered_halffaces, _topologyCheck);
}
//========================================================================================
......@@ -261,7 +261,7 @@ HexahedralMesh<VecT>::get_adjacent_halfface(const HalfFaceHandle& _hfh, const Ha
}
}
return OpenVolumeMesh<VecT>::InvalidHalfFaceHandle;
return PolyhedralMesh<VecT>::InvalidHalfFaceHandle;
}
} // Namespace OpenVolumeMesh
......@@ -43,23 +43,23 @@
#ifndef HEXAHEDRALMESHITERATORS_HH
#define HEXAHEDRALMESHITERATORS_HH
#include "../../PolyhedralMesh/Utils/Iterators.hh"
namespace OpenVolumeMesh {
template <class VecT>
class HexahedralMesh;
#include "../../PolyhedralMesh/Utils/Iterators.hh"
template <class VecT>
class CellSheetCellIter : public BaseIterator<VecT,
typename OpenVolumeMesh<VecT>::CellHandle,
typename OpenVolumeMesh<VecT>::CellHandle> {
typename PolyhedralMesh<VecT>::CellHandle,
typename PolyhedralMesh<VecT>::CellHandle> {
private:
typedef BaseIterator<VecT,
typename OpenVolumeMesh<VecT>::CellHandle,
typename OpenVolumeMesh<VecT>::CellHandle> BaseIter;
typedef typename OpenVolumeMesh<VecT>::CellHandle CellHandle;
typedef typename OpenVolumeMesh<VecT>::HalfFaceHandle HalfFaceHandle;
typename PolyhedralMesh<VecT>::CellHandle,
typename PolyhedralMesh<VecT>::CellHandle> BaseIter;
typedef typename PolyhedralMesh<VecT>::CellHandle CellHandle;
typedef typename PolyhedralMesh<VecT>::HalfFaceHandle HalfFaceHandle;
public:
CellSheetCellIter(const CellHandle& _ref_h, const unsigned char _orthDir,
const HexahedralMesh<VecT>* _mesh);
......@@ -119,15 +119,15 @@ private:
template <class VecT>
class HalfFaceSheetHalfFaceIter : public BaseIterator<VecT,
typename OpenVolumeMesh<VecT>::HalfFaceHandle,
typename OpenVolumeMesh<VecT>::HalfFaceHandle> {
typename PolyhedralMesh<VecT>::HalfFaceHandle,
typename PolyhedralMesh<VecT>::HalfFaceHandle> {
private:
typedef BaseIterator<VecT,
typename OpenVolumeMesh<VecT>::HalfFaceHandle,
typename OpenVolumeMesh<VecT>::HalfFaceHandle> BaseIter;
typedef typename OpenVolumeMesh<VecT>::HalfFaceHandle HalfFaceHandle;
typedef typename OpenVolumeMesh<VecT>::HalfEdgeHandle HalfEdgeHandle;
typedef typename OpenVolumeMesh<VecT>::EdgeHandle EdgeHandle;
typename PolyhedralMesh<VecT>::HalfFaceHandle,
typename PolyhedralMesh<VecT>::HalfFaceHandle> BaseIter;
typedef typename PolyhedralMesh<VecT>::HalfFaceHandle HalfFaceHandle;
typedef typename PolyhedralMesh<VecT>::HalfEdgeHandle HalfEdgeHandle;
typedef typename PolyhedralMesh<VecT>::EdgeHandle EdgeHandle;
public:
HalfFaceSheetHalfFaceIter(const HalfFaceHandle& _ref_h,
const HexahedralMesh<VecT>* _mesh);
......@@ -190,15 +190,15 @@ private:
template <class VecT>
class OutsideNeighborHalfFaceIter : public BaseIterator<VecT,
typename OpenVolumeMesh<VecT>::HalfFaceHandle,
typename OpenVolumeMesh<VecT>::HalfFaceHandle> {
typename PolyhedralMesh<VecT>::HalfFaceHandle,
typename PolyhedralMesh<VecT>::HalfFaceHandle> {
private:
typedef BaseIterator<VecT,
typename OpenVolumeMesh<VecT>::HalfFaceHandle,
typename OpenVolumeMesh<VecT>::HalfFaceHandle> BaseIter;
typedef typename OpenVolumeMesh<VecT>::HalfFaceHandle HalfFaceHandle;
typedef typename OpenVolumeMesh<VecT>::HalfEdgeHandle HalfEdgeHandle;
typedef typename OpenVolumeMesh<VecT>::EdgeHandle EdgeHandle;
typename PolyhedralMesh<VecT>::HalfFaceHandle,
typename PolyhedralMesh<VecT>::HalfFaceHandle> BaseIter;
typedef typename PolyhedralMesh<VecT>::HalfFaceHandle HalfFaceHandle;
typedef typename PolyhedralMesh<VecT>::HalfEdgeHandle HalfEdgeHandle;
typedef typename PolyhedralMesh<VecT>::EdgeHandle EdgeHandle;
public:
OutsideNeighborHalfFaceIter(const HalfFaceHandle& _ref_h,
const HexahedralMesh<VecT>* _mesh);
......@@ -259,10 +259,10 @@ private:
typename std::vector<EdgeHandle>::const_iterator edge_it_;
};
} // Namespace OpenVolumeMesh
#if defined(INCLUDE_TEMPLATES) && !defined(HEXAHEDRALMESHITERATORST_CC)
#include "IteratorsT.cc"
#endif
} // Namespace OpenVolumeMesh
#endif /* HEXAHEDRALMESHITERATORS_HH */
......@@ -71,7 +71,7 @@ BaseIter(_mesh, _ref_h) {
if(_mesh->orientation(*hf_it, _ref_h) != _orthDir &&
_mesh->orientation(*hf_it, _ref_h) != HexahedralMesh<VecT>::opposite_orientation(_orthDir)) {
CellHandle ch = _mesh->incident_cell_per_hf_[_mesh->opposite_halfface_handle(*hf_it)];
if(ch != OpenVolumeMesh<VecT>::InvalidCellHandle) {
if(ch != PolyhedralMesh<VecT>::InvalidCellHandle) {
neighb_sheet_cell_hs_.insert(ch);
}
}
......@@ -222,7 +222,7 @@ BaseIter(_mesh, _ref_h) {
he_it != halfedges.end(); ++he_it) {
// Get outside halffaces
typename OpenVolumeMesh<VecT>::HalfEdgeHalfFaceIter hehf_it = _mesh->hehf_iter(_mesh->opposite_halfedge_handle(*he_it));
typename PolyhedralMesh<VecT>::HalfEdgeHalfFaceIter hehf_it = _mesh->hehf_iter(_mesh->opposite_halfedge_handle(*he_it));
for(; hehf_it.valid(); ++hehf_it) {
if(_mesh->is_boundary(*hehf_it)) {
......
......@@ -823,25 +823,25 @@ std::ostream& operator<<(std::ostream& _os, const OpenVolumeMeshVertex<VecT>& _v
template <typename VecT>
class OpenVolumeMeshEdge {
public:
OpenVolumeMeshEdge(const typename OpenVolumeMesh<VecT>::VertexHandle& _fromVertex,
const typename OpenVolumeMesh<VecT>::VertexHandle& _toVertex) :
OpenVolumeMeshEdge(const typename PolyhedralMesh<VecT>::VertexHandle& _fromVertex,
const typename PolyhedralMesh<VecT>::VertexHandle& _toVertex) :
fromVertex_(_fromVertex),
toVertex_(_toVertex) {}
virtual ~OpenVolumeMeshEdge() {}
typename OpenVolumeMesh<VecT>::VertexHandle from_vertex() const { return fromVertex_; }
typename OpenVolumeMesh<VecT>::VertexHandle to_vertex() const { return toVertex_; }
typename PolyhedralMesh<VecT>::VertexHandle from_vertex() const { return fromVertex_; }
typename PolyhedralMesh<VecT>::VertexHandle to_vertex() const { return toVertex_; }
void set_from_vertex(const typename OpenVolumeMesh<VecT>::VertexHandle& _vertex) { fromVertex_ = _vertex; }
void set_to_vertex(const typename OpenVolumeMesh<VecT>::VertexHandle& _vertex) { toVertex_ = _vertex; }
void set_from_vertex(const typename PolyhedralMesh<VecT>::VertexHandle& _vertex) { fromVertex_ = _vertex; }
void set_to_vertex(const typename PolyhedralMesh<VecT>::VertexHandle& _vertex) { toVertex_ = _vertex; }
const OpenVolumeMeshEdge<VecT> opposite() const {
return OpenVolumeMeshEdge<VecT>(toVertex_, fromVertex_);
}
private:
typename OpenVolumeMesh<VecT>::VertexHandle fromVertex_;
typename OpenVolumeMesh<VecT>::VertexHandle toVertex_;
typename PolyhedralMesh<VecT>::VertexHandle fromVertex_;
typename PolyhedralMesh<VecT>::VertexHandle toVertex_;
};
// Stream operator for edges
......@@ -855,21 +855,21 @@ std::ostream& operator<<(std::ostream& _os, const OpenVolumeMeshEdge<VecT>& _edg
template <typename VecT>
class OpenVolumeMeshFace {
public:
OpenVolumeMeshFace(const std::vector<typename OpenVolumeMesh<VecT>::HalfEdgeHandle>& _halfedges) :
OpenVolumeMeshFace(const std::vector<typename PolyhedralMesh<VecT>::HalfEdgeHandle>& _halfedges) :
halfedges_(_halfedges) {
compute_opposite_halfedges();
}
virtual ~OpenVolumeMeshFace() {}
const std::vector<typename OpenVolumeMesh<VecT>::HalfEdgeHandle>& halfedges() const { return halfedges_; }
const std::vector<typename PolyhedralMesh<VecT>::HalfEdgeHandle>& halfedges() const { return halfedges_; }
void set_halfedges(const std::vector<typename OpenVolumeMesh<VecT>::HalfEdgeHandle>& _halfedges) {
void set_halfedges(const std::vector<typename PolyhedralMesh<VecT>::HalfEdgeHandle>& _halfedges) {
halfedges_ = _halfedges;
opp_halfedges_.clear();
for(typename std::vector<typename OpenVolumeMesh<VecT>::HalfEdgeHandle>::const_iterator it = halfedges_.begin();
for(typename std::vector<typename PolyhedralMesh<VecT>::HalfEdgeHandle>::const_iterator it = halfedges_.begin();
it != halfedges_.end(); ++it) {
opp_halfedges_.insert(opp_halfedges_.begin(), OpenVolumeMesh<VecT>::opposite_halfedge_handle(*it));
opp_halfedges_.insert(opp_halfedges_.begin(), PolyhedralMesh<VecT>::opposite_halfedge_handle(*it));
}
}
......@@ -879,22 +879,22 @@ public:
void compute_opposite_halfedges() {
opp_halfedges_.clear();
for(typename std::vector<typename OpenVolumeMesh<VecT>::HalfEdgeHandle>::const_iterator it = halfedges_.begin();
for(typename std::vector<typename PolyhedralMesh<VecT>::HalfEdgeHandle>::const_iterator it = halfedges_.begin();
it != halfedges_.end(); ++it) {
opp_halfedges_.insert(opp_halfedges_.begin(), OpenVolumeMesh<VecT>::opposite_halfedge_handle(*it));
opp_halfedges_.insert(opp_halfedges_.begin(), PolyhedralMesh<VecT>::opposite_halfedge_handle(*it));
}
}
private:
std::vector<typename OpenVolumeMesh<VecT>::HalfEdgeHandle> halfedges_;
std::vector<typename OpenVolumeMesh<VecT>::HalfEdgeHandle> opp_halfedges_;
std::vector<typename PolyhedralMesh<VecT>::HalfEdgeHandle> halfedges_;
std::vector<typename PolyhedralMesh<VecT>::HalfEdgeHandle> opp_halfedges_;
};
// Stream operator for faces
template <typename VecT>
std::ostream& operator<<(std::ostream& _os, const OpenVolumeMeshFace<VecT>& _face) {
_os << "(";
for(typename std::vector<typename OpenVolumeMesh<VecT>::HalfEdgeHandle>::const_iterator it = _face.halfedges().begin();
for(typename std::vector<typename PolyhedralMesh<VecT>::HalfEdgeHandle>::const_iterator it = _face.halfedges().begin();
it < _face.halfedges().end(); ++it) {
_os << *it;
if(it+1 < _face.halfedges().end())
......@@ -909,24 +909,24 @@ std::ostream& operator<<(std::ostream& _os, const OpenVolumeMeshFace<VecT>& _fac
template <typename VecT>
class OpenVolumeMeshCell {
public:
OpenVolumeMeshCell(const std::vector<typename OpenVolumeMesh<VecT>::HalfFaceHandle>& _halffaces) :
OpenVolumeMeshCell(const std::vector<typename PolyhedralMesh<VecT>::HalfFaceHandle>& _halffaces) :
halffaces_(_halffaces) {}
virtual ~OpenVolumeMeshCell() {}
const std::vector<typename OpenVolumeMesh<VecT>::HalfFaceHandle>& halffaces() const { return halffaces_; }
const std::vector<typename PolyhedralMesh<VecT>::HalfFaceHandle>& halffaces() const { return halffaces_; }
void set_halffaces(const std::vector<typename OpenVolumeMesh<VecT>::HalfFaceHandle>& _halffaces) { halffaces_ = _halffaces; }
void set_halffaces(const std::vector<typename PolyhedralMesh<VecT>::HalfFaceHandle>& _halffaces) { halffaces_ = _halffaces; }
private:
std::vector<typename OpenVolumeMesh<VecT>::HalfFaceHandle> halffaces_;
std::vector<typename PolyhedralMesh<VecT>::HalfFaceHandle> halffaces_;
};
// Stream operator for cells
template <typename VecT>
std::ostream& operator<<(std::ostream& _os, const OpenVolumeMeshCell<VecT>& _cell) {
_os << "(";
for(typename std::vector<typename OpenVolumeMesh<VecT>::HalfFaceHandle>::const_iterator it = _cell.halffaces().begin();
for(typename std::vector<typename PolyhedralMesh<VecT>::HalfFaceHandle>::const_iterator it = _cell.halffaces().begin();
it < _cell.halffaces().end(); ++it) {
_os << *it;
if(it+1 < _cell.halffaces().end())
......
include (ACGCommon)
include_directories (
..
${CMAKE_CURRENT_SOURCE_DIR}
)
# Search for gtest headers and libraries
find_package(GoogleTest)
if(GTEST_FOUND)
# Set correct include paths so that the compiler can find the headers
include_directories(${GTEST_INCLUDE_DIRS})
# set additional link directories
link_directories(${GTEST_LIBRARY_DIR} )
# Create new target named unittests_hexmeshing
add_executable(unittests EXCLUDE_FROM_ALL unittests.cc)
if ( NOT WIN32)
# Link against all necessary libraries
target_link_libraries(unittests OpenVolumeMesh ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES} pthread)
# Set output directory to ${BINARY_DIR}/Unittests
set_target_properties(unittests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Unittests)
else()
# Link against all necessary libraries
target_link_libraries(unittests OpenVolumeMesh ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES})
endif()
if ( NOT WIN32 )
# Set compiler flags
set_target_properties(unittests PROPERTIES COMPILE_FLAGS "-Wall -Wuninitialized -Wunused -g -pedantic -ansi -Wno-long-long")
else()
# Set compiler flags
set_target_properties(unittests PROPERTIES COMPILE_FLAGS "" )
# copy exe file to "Build" directory
# Visual studio will create this file in a subdirectory so we can't use
# RUNTIME_OUTPUT_DIRECTORY directly here
add_custom_command (TARGET unittests POST_BUILD
COMMAND ${CMAKE_COMMAND} -E
copy_if_different
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/unittests.exe
${CMAKE_BINARY_DIR}/Unittests/unittests.exe)
endif()
acg_copy_after_build(unittests ${CMAKE_CURRENT_SOURCE_DIR}/TestFiles ${CMAKE_BINARY_DIR}/Unittests/)
else(GTEST_FOUND)
message("Google testing framework was not found!")
endif(GTEST_FOUND)
#ifndef INCLUDE_UNITTESTS_COMMON_HH
#define INCLUDE_UNITTESTS_COMMON_HH
#include <gtest/gtest.h>
#include <OpenMesh/Core/IO/MeshIO.hh>
#include <OpenMesh/Core/Mesh/TriMesh_ArrayKernelT.hh>
struct CustomTraits : public OpenMesh::DefaultTraits {
};
typedef OpenMesh::TriMesh_ArrayKernelT<CustomTraits> Mesh;
/*
* Simple test setting.
*/
class OpenMeshBase : public testing::Test {
protected:
// This function is called before each test is run
virtual void SetUp() {
// Do some initial stuff with the member data here...
}
// This function is called after all tests are through
virtual void TearDown() {
// Do some final stuff with the member data here...
}
// This member will be accessible in all tests
Mesh mesh_;
};
#endif // INCLUDE GUARD
#ifndef INCLUDE_UNITTESTS_DECIMATER_HH
#define INCLUDE_UNITTESTS_DECIMATER_HH
#include <gtest/gtest.h>
#include <Unittests/unittests_common.hh>
#include <OpenMesh/Tools/Decimater/DecimaterT.hh>
#include <OpenMesh/Tools/Decimater/ModQuadricT.hh>
#include <OpenMesh/Tools/Decimater/ModNormalFlippingT.hh>
class OpenMeshDecimater : public OpenMeshBase {
protected:
// This function is called before each test is run
virtual void SetUp() {
// Do some initial stuff with the member data here...
}
// This function is called after all tests are through
virtual void TearDown() {
// Do some final stuff with the member data here...
}
// Member already defined in OpenMeshBase
//Mesh mesh_;
};
/*
* ====================================================================
* Define tests below
* ====================================================================
*/
/*
*/
TEST_F(OpenMeshDecimater, DecimateMesh) {
bool ok = OpenMesh::IO::read_mesh(mesh_, "cube1.off");
ASSERT_TRUE(ok);
typedef OpenMesh::Decimater::DecimaterT< Mesh > Decimater;
typedef OpenMesh::Decimater::ModQuadricT< Decimater >::Handle HModQuadric;
typedef OpenMesh::Decimater::ModNormalFlippingT< Decimater >::Handle HModNormal;
Decimater decimaterDBG(mesh_);
HModQuadric hModQuadricDBG;
decimaterDBG.add( hModQuadricDBG );
decimaterDBG.initialize();
int removedVertices = 0;
removedVertices = decimaterDBG.decimate_to(5000);
decimaterDBG.mesh().garbage_collection();
EXPECT_EQ(2526, removedVertices) << "The number of remove vertices is not correct!";
EXPECT_EQ(5000, mesh_.n_vertices()) << "The number of vertices after decimation is not correct!";
EXPECT_EQ(14994, mesh_.n_edges()) << "The number of edges after decimation is not correct!";
EXPECT_EQ(9996, mesh_.n_faces()) << "The number of faces after decimation is not correct!";
}
#endif // INCLUDE GUARD
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