Commit df7aef97 authored by Sylvain Thery's avatar Sylvain Thery

Ajout de CGoGN_ASSERT (static_assert.h)

assert execute uniquement si cmake -DASSERTON=true

Ajout du define TOPO_MAP dans EmbededMap
Petite modif dans importTet
parent f2d8b081
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
*******************************************************************************/ *******************************************************************************/
#include "stage_shader.h" #include "stage_shader.h"
#include "Utils/static_assert.h"
/******************************************************************************* /*******************************************************************************
* SLOTS * SLOTS
...@@ -292,7 +293,7 @@ void StageShader::cb_mousePress(int button, int x, int y) ...@@ -292,7 +293,7 @@ void StageShader::cb_mousePress(int button, int x, int y)
} }
/********************************************************************************************** /**********************************************************************************************
* MAIN FUNCTION * * MAIN FUNCTION *
**********************************************************************************************/ **********************************************************************************************/
int main(int argc, char** argv) int main(int argc, char** argv)
......
...@@ -13,6 +13,14 @@ find_package(OpenGL REQUIRED) ...@@ -13,6 +13,14 @@ find_package(OpenGL REQUIRED)
find_package(Qt4 REQUIRED) find_package(Qt4 REQUIRED)
find_package(GLUT) find_package(GLUT)
IF (DEFINED ASSERTON)
add_definitions(-DCGOGN_ASSERT_BOOL=${ASSERTON})
ELSE (DEFINED ASSERTON)
add_definitions(-DCGOGN_ASSERT_BOOL=false)
ENDIF (DEFINED ASSERTON)
add_definitions(-DSHADERPATH="${CGoGN_ROOT_DIR}/lib/Shaders/")
# qq definition specifiques pour mac # qq definition specifiques pour mac
IF(APPLE) IF(APPLE)
# attention a changer pour chercher la bonne version automatiquement # attention a changer pour chercher la bonne version automatiquement
......
...@@ -78,8 +78,6 @@ add_library( ...@@ -78,8 +78,6 @@ add_library(
# ${files_geometry} # ${files_geometry}
#) #)
add_definitions(-DSHADERPATH="${CGoGN_ROOT_DIR}/lib/Shaders/")
add_definitions(-DDBG_MAX_LEVEL=5)
file( file(
GLOB_RECURSE GLOB_RECURSE
......
...@@ -80,8 +80,6 @@ add_library( ...@@ -80,8 +80,6 @@ add_library(
# ${files_geometry} # ${files_geometry}
#) #)
add_definitions(-DSHADERPATH="${CGoGN_ROOT_DIR}/lib/Shaders/")
add_definitions(-DDBG_MAX_LEVEL=0)
file( file(
GLOB_RECURSE GLOB_RECURSE
......
...@@ -32,6 +32,7 @@ namespace Algo ...@@ -32,6 +32,7 @@ namespace Algo
namespace Import namespace Import
{ {
template <typename PFP> template <typename PFP>
bool importTet(typename PFP::MAP& map, const std::string& filename, std::vector<std::string>& attrNames, float scaleFactor) bool importTet(typename PFP::MAP& map, const std::string& filename, std::vector<std::string>& attrNames, float scaleFactor)
{ {
...@@ -177,19 +178,18 @@ bool importTet(typename PFP::MAP& map, const std::string& filename, std::vector< ...@@ -177,19 +178,18 @@ bool importTet(typename PFP::MAP& map, const std::string& filename, std::vector<
//Association des phi3 //Association des phi3
for (Dart d = map.begin(); d != map.end(); map.next(d)) for (Dart d = map.begin(); d != map.end(); map.next(d))
{ {
std::vector<Dart>& vec = vecDartsPerVertex[d]; const std::vector<Dart>& vec = vecDartsPerVertex[d];
for(typename std::vector<Dart>::const_iterator it = vec.begin(); it!=vec.end(); ++it)
for(typename std::vector<Dart>::iterator it = vec.begin(); it!=vec.end(); ++it)
{ {
if(map.phi3(*it) == *it) if(map.phi3(*it) == *it)
{ {
bool sewn = false; bool sewn = false;
for(typename std::vector<Dart>::iterator itnext = it+1; itnext != vec.end() && !sewn; ++itnext) for(typename std::vector<Dart>::const_iterator itnext = it+1; itnext != vec.end() && !sewn; ++itnext)
{ {
if(map.getEmbedding(VERTEX,map.phi1(*it))==map.getEmbedding(VERTEX,map.phi_1(*itnext)) if(map.getEmbedding(VERTEX,map.phi1(*it))==map.getEmbedding(VERTEX,map.phi_1(*itnext))
&& map.getEmbedding(VERTEX,map.phi_1(*it))==map.getEmbedding(VERTEX,map.phi1(*itnext))) && map.getEmbedding(VERTEX,map.phi_1(*it))==map.getEmbedding(VERTEX,map.phi1(*itnext)))
{ {
map.sewVolumes(*it, map.phi_1(*itnext)); map.PFP::MAP::TOPO_MAP::sewVolumes(*it, map.phi_1(*itnext));
sewn = true; sewn = true;
} }
} }
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "Topology/generic/attribmap.h" #include "Topology/generic/attribmap.h"
#include "Topology/generic/functor.h" #include "Topology/generic/functor.h"
#include "Utils/static_assert.h"
namespace CGoGN namespace CGoGN
{ {
...@@ -196,10 +197,12 @@ public: ...@@ -196,10 +197,12 @@ public:
CellMarkerStore(AttribMap& map, unsigned int cell, unsigned int thread = 0) : CellMarkerGen(map, cell, thread) CellMarkerStore(AttribMap& map, unsigned int cell, unsigned int thread = 0) : CellMarkerGen(map, cell, thread)
{} {}
virtual ~CellMarkerStore() virtual ~CellMarkerStore()
{ {
unmarkAll() ; unmarkAll() ;
assert(isAllUnmarked()) ; // assert(isAllUnmarked);
CGoGN_ASSERT(isAllUnmarked())
} }
protected: protected:
...@@ -239,7 +242,8 @@ public: ...@@ -239,7 +242,8 @@ public:
virtual ~CellMarkerNoUnmark() virtual ~CellMarkerNoUnmark()
{ {
assert(isAllUnmarked()) ; // assert(isAllUnmarked()) ;
CGoGN_ASSERT(isAllUnmarked())
} }
protected: protected:
......
...@@ -38,6 +38,7 @@ template <typename MAP2> ...@@ -38,6 +38,7 @@ template <typename MAP2>
class EmbeddedMap2 : public MAP2 class EmbeddedMap2 : public MAP2
{ {
public: public:
typedef MAP2 TOPO_MAP;
/** /**
* The attributes attached to the old vertex are duplicated on both resulting vertices * The attributes attached to the old vertex are duplicated on both resulting vertices
* No attribute is attached to the new edge * No attribute is attached to the new edge
......
...@@ -38,7 +38,7 @@ template <typename MAP3> ...@@ -38,7 +38,7 @@ template <typename MAP3>
class EmbeddedMap3 : public MAP3 class EmbeddedMap3 : public MAP3
{ {
public: public:
typedef MAP3 TOPO_MAP;
//! //!
/*! /*!
......
...@@ -25,10 +25,6 @@ ...@@ -25,10 +25,6 @@
#ifndef _CGOGNSTREAM_H_ #ifndef _CGOGNSTREAM_H_
#define _CGOGNSTREAM_H_ #define _CGOGNSTREAM_H_
// pb of compilation ??
#ifndef DBG_MAX_LEVEL
#define DBG_MAX_LEVEL 5
#endif
#include <string> #include <string>
#include <iostream> #include <iostream>
......
...@@ -34,5 +34,8 @@ namespace CGoGN ...@@ -34,5 +34,8 @@ namespace CGoGN
#define CGoGN_STATIC_ASSERT(expr, msg) \ #define CGoGN_STATIC_ASSERT(expr, msg) \
{ CGoGN::CompileTimeError<((expr) != 0)> STATIC_ASSERT_ERROR_##msg; (void)STATIC_ASSERT_ERROR_##msg; } { CGoGN::CompileTimeError<((expr) != 0)> STATIC_ASSERT_ERROR_##msg; (void)STATIC_ASSERT_ERROR_##msg; }
#define CGoGN_ASSERT(expr) if (CGOGN_ASSERT_BOOL) assert(expr);
#endif #endif
...@@ -764,7 +764,6 @@ bool Map3::foreach_dart_of_vertex(Dart d, FunctorType& f, unsigned int thread) ...@@ -764,7 +764,6 @@ bool Map3::foreach_dart_of_vertex(Dart d, FunctorType& f, unsigned int thread)
bool found = false; // Last functor return value bool found = false; // Last functor return value
std::list<Dart> darts_list; //Darts that are traversed std::list<Dart> darts_list; //Darts that are traversed
darts_list.push_back(d); //Start with the dart d darts_list.push_back(d); //Start with the dart d
mv.mark(d); mv.mark(d);
......
...@@ -60,7 +60,6 @@ VBO::VBO(const VBO& vbo) : ...@@ -60,7 +60,6 @@ VBO::VBO(const VBO& vbo) :
VBO::~VBO() VBO::~VBO()
{ {
std::cout << "VBO delete"<< std::endl;
if (m_lock) if (m_lock)
releasePtr(); releasePtr();
glDeleteBuffers(1, &m_id); glDeleteBuffers(1, &m_id);
......
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