Commit 4ced4fb2 authored by CGoGN GIT Supervisor's avatar CGoGN GIT Supervisor

Merge branch 'master' of /home/thery/CGoGN

* 'master' of /home/thery/CGoGN:
  bug visual pb avec objet en static -> registred... en ptr log2 et isnan n standard sous windows
  pb log2 n'existe pas sous windows uint ... pas sous windows
  Bug getContainer a faire apres Handler sinon assert orbit not embedded
  correction bug exportPLYPTM
  on enleve le bug ...
  essai de modification pour test conflit
parents 684efc08 41e15d17
...@@ -295,7 +295,7 @@ bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename P ...@@ -295,7 +295,7 @@ bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename P
{ {
if (!markV.isMarked(e)) if (!markV.isMarked(e))
{ {
vertices.push_back(lab); vertices.push_back(map.getEmbedding(e, VERTEX_ORBIT));
tableVertLab[e] = lab++; tableVertLab[e] = lab++;
markV.mark(e); markV.mark(e);
...@@ -416,7 +416,7 @@ bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename P ...@@ -416,7 +416,7 @@ bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename P
{ {
if (!markV.isMarked(e)) if (!markV.isMarked(e))
{ {
vertices.push_back(lab); vertices.push_back(map.getEmbedding(e, VERTEX_ORBIT));
tableVertLab[e] = lab++; tableVertLab[e] = lab++;
markV.mark(e); markV.mark(e);
......
...@@ -39,7 +39,7 @@ void computeLaplacianVertices( ...@@ -39,7 +39,7 @@ void computeLaplacianVertices(
LaplacianType type, LaplacianType type,
const typename PFP::TVEC3& position, const typename PFP::TVEC3& position,
typename PFP::TVEC3& laplacian, typename PFP::TVEC3& laplacian,
const FunctorSelect& select = SelectorTrue()) const FunctorSelect& select)
{ {
CellMarker marker(map, VERTEX_CELL); CellMarker marker(map, VERTEX_CELL);
for(Dart d = map.begin(); d != map.end(); map.next(d)) for(Dart d = map.begin(); d != map.end(); map.next(d))
......
...@@ -64,7 +64,8 @@ typename PFP::VEC3 faceNormal(typename PFP::MAP& map, Dart d, const typename PFP ...@@ -64,7 +64,8 @@ typename PFP::VEC3 faceNormal(typename PFP::MAP& map, Dart d, const typename PFP
do do
{ {
VEC3 n = triangleNormal<PFP>(map, it, position) ; VEC3 n = triangleNormal<PFP>(map, it, position) ;
if(!std::isnan(n[0])) //if(!std::isnan(n[0]))
if (n[0] == n[0])
N += n ; N += n ;
it = map.phi1(it) ; it = map.phi1(it) ;
} while (it != d) ; } while (it != d) ;
......
...@@ -116,10 +116,11 @@ bool MeshTablesSurface<PFP>::importMesh(const std::string& filename, std::vector ...@@ -116,10 +116,11 @@ bool MeshTablesSurface<PFP>::importMesh(const std::string& filename, std::vector
template<typename PFP> template<typename PFP>
bool MeshTablesSurface<PFP>::importTrian(const std::string& filename, std::vector<std::string>& attrNames) bool MeshTablesSurface<PFP>::importTrian(const std::string& filename, std::vector<std::string>& attrNames)
{ {
AttribContainer& container = m_map.getAttributeContainer(VERTEX_CELL) ;
AttributeHandler<typename PFP::VEC3> positions = m_map.template addAttribute<typename PFP::VEC3>(VERTEX_ORBIT, "position") ; AttributeHandler<typename PFP::VEC3> positions = m_map.template addAttribute<typename PFP::VEC3>(VERTEX_ORBIT, "position") ;
attrNames.push_back(positions.name()) ; attrNames.push_back(positions.name()) ;
AttribContainer& container = m_map.getAttributeContainer(VERTEX_CELL) ;
// open file // open file
std::ifstream fp(filename.c_str(), std::ios::in); std::ifstream fp(filename.c_str(), std::ios::in);
if (!fp.good()) if (!fp.good())
...@@ -178,10 +179,11 @@ bool MeshTablesSurface<PFP>::importTrian(const std::string& filename, std::vecto ...@@ -178,10 +179,11 @@ bool MeshTablesSurface<PFP>::importTrian(const std::string& filename, std::vecto
template<typename PFP> template<typename PFP>
bool MeshTablesSurface<PFP>::importTrianBinGz(const std::string& filename, std::vector<std::string>& attrNames) bool MeshTablesSurface<PFP>::importTrianBinGz(const std::string& filename, std::vector<std::string>& attrNames)
{ {
AttribContainer& container = m_map.getAttributeContainer(VERTEX_CELL) ;
AttributeHandler<typename PFP::VEC3> positions = m_map.template addAttribute<typename PFP::VEC3>(VERTEX_ORBIT, "position") ; AttributeHandler<typename PFP::VEC3> positions = m_map.template addAttribute<typename PFP::VEC3>(VERTEX_ORBIT, "position") ;
attrNames.push_back(positions.name()) ; attrNames.push_back(positions.name()) ;
AttribContainer& container = m_map.getAttributeContainer(VERTEX_CELL) ;
// open file // open file
igzstream fs(filename.c_str(), std::ios::in|std::ios::binary); igzstream fs(filename.c_str(), std::ios::in|std::ios::binary);
...@@ -243,10 +245,11 @@ bool MeshTablesSurface<PFP>::importTrianBinGz(const std::string& filename, std:: ...@@ -243,10 +245,11 @@ bool MeshTablesSurface<PFP>::importTrianBinGz(const std::string& filename, std::
template<typename PFP> template<typename PFP>
bool MeshTablesSurface<PFP>::importOff(const std::string& filename, std::vector<std::string>& attrNames) bool MeshTablesSurface<PFP>::importOff(const std::string& filename, std::vector<std::string>& attrNames)
{ {
AttribContainer& container = m_map.getAttributeContainer(VERTEX_CELL) ;
AttributeHandler<typename PFP::VEC3> positions = m_map.template addAttribute<typename PFP::VEC3>(VERTEX_ORBIT, "position") ; AttributeHandler<typename PFP::VEC3> positions = m_map.template addAttribute<typename PFP::VEC3>(VERTEX_ORBIT, "position") ;
attrNames.push_back(positions.name()) ; attrNames.push_back(positions.name()) ;
AttribContainer& container = m_map.getAttributeContainer(VERTEX_CELL) ;
// open file // open file
std::ifstream fp(filename.c_str(), std::ios::in); std::ifstream fp(filename.c_str(), std::ios::in);
if (!fp.good()) if (!fp.good())
...@@ -337,10 +340,11 @@ bool MeshTablesSurface<PFP>::importOff(const std::string& filename, std::vector< ...@@ -337,10 +340,11 @@ bool MeshTablesSurface<PFP>::importOff(const std::string& filename, std::vector<
template <typename PFP> template <typename PFP>
bool MeshTablesSurface<PFP>::importObj(const std::string& filename, std::vector<std::string>& attrNames) bool MeshTablesSurface<PFP>::importObj(const std::string& filename, std::vector<std::string>& attrNames)
{ {
AttribContainer& container = m_map.getAttributeContainer(VERTEX_CELL) ;
AttributeHandler<typename PFP::VEC3> positions = m_map.template addAttribute<typename PFP::VEC3>(VERTEX_ORBIT, "position") ; AttributeHandler<typename PFP::VEC3> positions = m_map.template addAttribute<typename PFP::VEC3>(VERTEX_ORBIT, "position") ;
attrNames.push_back(positions.name()) ; attrNames.push_back(positions.name()) ;
AttribContainer& container = m_map.getAttributeContainer(VERTEX_CELL) ;
// open file // open file
std::ifstream fp(filename.c_str(), std::ios::binary); std::ifstream fp(filename.c_str(), std::ios::binary);
if (!fp.good()) if (!fp.good())
...@@ -455,10 +459,11 @@ bool MeshTablesSurface<PFP>::importObj(const std::string& filename, std::vector< ...@@ -455,10 +459,11 @@ bool MeshTablesSurface<PFP>::importObj(const std::string& filename, std::vector<
template<typename PFP> template<typename PFP>
bool MeshTablesSurface<PFP>::importPly(const std::string& filename, std::vector<std::string>& attrNames) bool MeshTablesSurface<PFP>::importPly(const std::string& filename, std::vector<std::string>& attrNames)
{ {
AttribContainer& container = m_map.getAttributeContainer(VERTEX_CELL) ;
AttributeHandler<typename PFP::VEC3> positions = m_map.template addAttribute<typename PFP::VEC3>(VERTEX_ORBIT, "position") ; AttributeHandler<typename PFP::VEC3> positions = m_map.template addAttribute<typename PFP::VEC3>(VERTEX_ORBIT, "position") ;
attrNames.push_back(positions.name()) ; attrNames.push_back(positions.name()) ;
AttribContainer& container = m_map.getAttributeContainer(VERTEX_CELL) ;
PlyImportData pid; PlyImportData pid;
if (! pid.read_file(filename) ) if (! pid.read_file(filename) )
...@@ -505,7 +510,6 @@ bool MeshTablesSurface<PFP>::importPly(const std::string& filename, std::vector< ...@@ -505,7 +510,6 @@ bool MeshTablesSurface<PFP>::importPly(const std::string& filename, std::vector<
template <typename PFP> template <typename PFP>
bool MeshTablesSurface<PFP>::importPlyPTM(const std::string& filename, std::vector<std::string>& attrNames) bool MeshTablesSurface<PFP>::importPlyPTM(const std::string& filename, std::vector<std::string>& attrNames)
{ {
AttribContainer& container = m_map.getAttributeContainer(VERTEX_CELL) ;
AttributeHandler<typename PFP::VEC3> positions = m_map.template addAttribute<typename PFP::VEC3>(VERTEX_ORBIT, "position") ; AttributeHandler<typename PFP::VEC3> positions = m_map.template addAttribute<typename PFP::VEC3>(VERTEX_ORBIT, "position") ;
attrNames.push_back(positions.name()) ; attrNames.push_back(positions.name()) ;
AttributeHandler<typename PFP::MATRIX33> Frame = m_map.template addAttribute<typename PFP::MATRIX33>(VERTEX_ORBIT, "Frame") ; AttributeHandler<typename PFP::MATRIX33> Frame = m_map.template addAttribute<typename PFP::MATRIX33>(VERTEX_ORBIT, "Frame") ;
...@@ -513,6 +517,8 @@ bool MeshTablesSurface<PFP>::importPlyPTM(const std::string& filename, std::vect ...@@ -513,6 +517,8 @@ bool MeshTablesSurface<PFP>::importPlyPTM(const std::string& filename, std::vect
AttributeHandler<typename PFP::MATRIX36> RGBfunctions = m_map.template addAttribute<typename PFP::MATRIX36>(VERTEX_ORBIT, "RGBfunctions") ; AttributeHandler<typename PFP::MATRIX36> RGBfunctions = m_map.template addAttribute<typename PFP::MATRIX36>(VERTEX_ORBIT, "RGBfunctions") ;
attrNames.push_back(RGBfunctions.name()) ; attrNames.push_back(RGBfunctions.name()) ;
AttribContainer& container = m_map.getAttributeContainer(VERTEX_CELL) ;
std::ifstream fp(filename.c_str(), std::ios::binary); std::ifstream fp(filename.c_str(), std::ios::binary);
if (!fp.good()) if (!fp.good())
{ {
...@@ -612,10 +618,11 @@ bool MeshTablesSurface<PFP>::importPlyPTM(const std::string& filename, std::vect ...@@ -612,10 +618,11 @@ bool MeshTablesSurface<PFP>::importPlyPTM(const std::string& filename, std::vect
template <typename PFP> template <typename PFP>
bool MeshTablesSurface<PFP>::importCTM(const std::string& filename, std::vector<std::string>& attrNames) bool MeshTablesSurface<PFP>::importCTM(const std::string& filename, std::vector<std::string>& attrNames)
{ {
AttribContainer& container = m_map.getAttributeContainer(VERTEX_CELL) ;
AttributeHandler<typename PFP::VEC3> positions = m_map.template addAttribute<typename PFP::VEC3>(VERTEX_ORBIT, "position") ; AttributeHandler<typename PFP::VEC3> positions = m_map.template addAttribute<typename PFP::VEC3>(VERTEX_ORBIT, "position") ;
attrNames.push_back(positions.name()) ; attrNames.push_back(positions.name()) ;
AttribContainer& container = m_map.getAttributeContainer(VERTEX_CELL) ;
// Load the file using the OpenCTM API // Load the file using the OpenCTM API
CTMimporter ctm; CTMimporter ctm;
// Load the file // Load the file
......
...@@ -211,7 +211,7 @@ void AttribMultiVect<T>::addBlocksBefore(unsigned int nbb) ...@@ -211,7 +211,7 @@ void AttribMultiVect<T>::addBlocksBefore(unsigned int nbb)
std::vector< T* > tempo; std::vector< T* > tempo;
tempo.reserve(1024); tempo.reserve(1024);
for (uint i= 0; i <nbb; ++i) for (unsigned int i= 0; i <nbb; ++i)
{ {
T* ptr = new T[_BLOCKSIZE_]; T* ptr = new T[_BLOCKSIZE_];
tempo.push_back( ptr ); tempo.push_back( ptr );
...@@ -277,7 +277,7 @@ void AttribMultiVect<T>::saveBin(CGoGNostream& fs, unsigned int id) ...@@ -277,7 +277,7 @@ void AttribMultiVect<T>::saveBin(CGoGNostream& fs, unsigned int id)
fs.write(reinterpret_cast<const char*>(nbs),2*sizeof(unsigned int)); fs.write(reinterpret_cast<const char*>(nbs),2*sizeof(unsigned int));
// store data blocks // store data blocks
for(uint i=0; i<nbs[0]; ++i) for(unsigned int i=0; i<nbs[0]; ++i)
{ {
fs.write(reinterpret_cast<const char*>(m_tableData[i]),_BLOCKSIZE_*sizeof(T)); fs.write(reinterpret_cast<const char*>(m_tableData[i]),_BLOCKSIZE_*sizeof(T));
} }
...@@ -311,7 +311,7 @@ bool AttribMultiVect<T>::loadBin(CGoGNistream& fs) ...@@ -311,7 +311,7 @@ bool AttribMultiVect<T>::loadBin(CGoGNistream& fs)
// load data blocks // load data blocks
m_tableData.resize(nb); m_tableData.resize(nb);
for(uint i=0; i<nb; ++i) for(unsigned int i=0; i<nb; ++i)
{ {
T* ptr = new T[_BLOCKSIZE_]; T* ptr = new T[_BLOCKSIZE_];
fs.read(reinterpret_cast<char*>(ptr),_BLOCKSIZE_*sizeof(T)); fs.read(reinterpret_cast<char*>(ptr),_BLOCKSIZE_*sizeof(T));
......
...@@ -87,7 +87,7 @@ protected: ...@@ -87,7 +87,7 @@ protected:
*/ */
AttribContainer m_attribs[NB_ORBITS] ; AttribContainer m_attribs[NB_ORBITS] ;
static std::map< std::string, RegisteredBaseAttribute* > m_attributes_registry_map ; static std::map< std::string, RegisteredBaseAttribute* >* m_attributes_registry_map ;
/** /**
* Direct access to the Dart attributes that store the orbits embeddings * Direct access to the Dart attributes that store the orbits embeddings
......
...@@ -107,8 +107,8 @@ unsigned int ImplicitHierarchicalMap::faceLevel(Dart d) ...@@ -107,8 +107,8 @@ unsigned int ImplicitHierarchicalMap::faceLevel(Dart d)
++nbSubd ; // is treated here ++nbSubd ; // is treated here
it = phi1(it) ; it = phi1(it) ;
} while(m_edgeId[it] == eId) ; } while(m_edgeId[it] == eId) ;
fLevel -= (unsigned int)(log2(nbSubd)) ; //fLevel -= (unsigned int)(log2(nbSubd)) ; PB WINDOWS log2 n'existe pas sous Visual 2010 !!
fLevel -= (unsigned int)(log((double)nbSubd)/log(2.0)) ;
m_curLevel = cur ; m_curLevel = cur ;
return fLevel ; return fLevel ;
......
...@@ -106,7 +106,7 @@ void AttribContainer::merge(AttribContainer& cont) ...@@ -106,7 +106,7 @@ void AttribContainer::merge(AttribContainer& cont)
newId.resize(m_tableAttribs.size() + cont.m_tableAttribs.size()); newId.resize(m_tableAttribs.size() + cont.m_tableAttribs.size());
uint nbb = m_holesBlocks.size(); unsigned int nbb = m_holesBlocks.size();
// parcours des attributs de cont pour les ajouter dans this et stocker la correspondance // parcours des attributs de cont pour les ajouter dans this et stocker la correspondance
for (MapNameId::iterator it = cont.m_attribNameMap.begin(); it != cont.m_attribNameMap.end(); ++it) for (MapNameId::iterator it = cont.m_attribNameMap.begin(); it != cont.m_attribNameMap.end(); ++it)
...@@ -426,7 +426,7 @@ void AttribContainer::saveBin(CGoGNostream& fs, unsigned int id) ...@@ -426,7 +426,7 @@ void AttribContainer::saveBin(CGoGNostream& fs, unsigned int id)
(*it)->saveBin(fs); (*it)->saveBin(fs);
// les indices des blocks libres // les indices des blocks libres
fs.write(reinterpret_cast<const char*>(&m_tableBlocksWithFree[0]), m_tableBlocksWithFree.size() * sizeof(uint)); fs.write(reinterpret_cast<const char*>(&m_tableBlocksWithFree[0]), m_tableBlocksWithFree.size() * sizeof(unsigned int));
} }
unsigned int AttribContainer::loadBinId(CGoGNistream& fs) unsigned int AttribContainer::loadBinId(CGoGNistream& fs)
...@@ -497,7 +497,7 @@ bool AttribContainer::loadBin(CGoGNistream& fs) ...@@ -497,7 +497,7 @@ bool AttribContainer::loadBin(CGoGNistream& fs)
// les indices des blocks libres // les indices des blocks libres
m_tableBlocksWithFree.resize(szBWF); m_tableBlocksWithFree.resize(szBWF);
fs.read(reinterpret_cast<char*>(&(m_tableBlocksWithFree[0])), szBWF*sizeof(uint)); fs.read(reinterpret_cast<char*>(&(m_tableBlocksWithFree[0])), szBWF*sizeof(unsigned int));
return true; return true;
} }
......
...@@ -146,30 +146,30 @@ void HoleBlockRef::saveBin(CGoGNostream& fs) ...@@ -146,30 +146,30 @@ void HoleBlockRef::saveBin(CGoGNostream& fs)
// std::cout << "save bf "<< m_nb<< " / "<< m_nbref<< " / "<< m_nbfree << std::endl; // std::cout << "save bf "<< m_nb<< " / "<< m_nbref<< " / "<< m_nbfree << std::endl;
// on sauve les trois nombres; // on sauve les trois nombres;
uint numbers[3]; unsigned int numbers[3];
numbers[0] = m_nb; numbers[0] = m_nb;
numbers[1] = m_nbref; numbers[1] = m_nbref;
numbers[2] = m_nbfree; numbers[2] = m_nbfree;
fs.write(reinterpret_cast<const char*>(numbers), 3*sizeof(uint) ); fs.write(reinterpret_cast<const char*>(numbers), 3*sizeof(unsigned int) );
// sauve les ref count // sauve les ref count
fs.write(reinterpret_cast<const char*>(m_refCount), _BLOCKSIZE_*sizeof(uint)); fs.write(reinterpret_cast<const char*>(m_refCount), _BLOCKSIZE_*sizeof(unsigned int));
// sauve les free lines // sauve les free lines
fs.write(reinterpret_cast<const char*>(m_tableFree), m_nbfree*sizeof(uint)); fs.write(reinterpret_cast<const char*>(m_tableFree), m_nbfree*sizeof(unsigned int));
} }
bool HoleBlockRef::loadBin(CGoGNistream& fs) bool HoleBlockRef::loadBin(CGoGNistream& fs)
{ {
unsigned int numbers[3]; unsigned int numbers[3];
fs.read(reinterpret_cast<char*>(numbers), 3*sizeof(uint)); fs.read(reinterpret_cast<char*>(numbers), 3*sizeof(unsigned int));
m_nb = numbers[0]; m_nb = numbers[0];
m_nbref = numbers[1]; m_nbref = numbers[1];
m_nbfree = numbers[2]; m_nbfree = numbers[2];
fs.read(reinterpret_cast<char*>(m_refCount), _BLOCKSIZE_*sizeof(uint)); fs.read(reinterpret_cast<char*>(m_refCount), _BLOCKSIZE_*sizeof(unsigned int));
fs.read(reinterpret_cast<char*>(m_tableFree), m_nbfree*sizeof(uint)); fs.read(reinterpret_cast<char*>(m_tableFree), m_nbfree*sizeof(unsigned int));
return true; return true;
} }
......
...@@ -30,11 +30,12 @@ ...@@ -30,11 +30,12 @@
namespace CGoGN namespace CGoGN
{ {
std::map< std::string, RegisteredBaseAttribute* >* GenericMap::m_attributes_registry_map = NULL;
std::map< std::string, RegisteredBaseAttribute* > GenericMap::m_attributes_registry_map = std::map< std::string, RegisteredBaseAttribute* >();
GenericMap::GenericMap() GenericMap::GenericMap()
{ {
m_attributes_registry_map = new std::map< std::string, RegisteredBaseAttribute* >;
// register all known types // register all known types
registerAttribute<Dart>("Dart"); registerAttribute<Dart>("Dart");
registerAttribute<Mark>("Mark"); registerAttribute<Mark>("Mark");
...@@ -65,7 +66,7 @@ GenericMap::GenericMap() ...@@ -65,7 +66,7 @@ GenericMap::GenericMap()
for (unsigned int i = 0; i < NB_ORBITS; ++i) for (unsigned int i = 0; i < NB_ORBITS; ++i)
{ {
m_attribs[i].setRegistry(&m_attributes_registry_map) ; m_attribs[i].setRegistry(m_attributes_registry_map) ;
m_embeddings[i] = NULL ; m_embeddings[i] = NULL ;
m_markerTables[i] = NULL ; m_markerTables[i] = NULL ;
} }
...@@ -80,6 +81,8 @@ GenericMap::~GenericMap() ...@@ -80,6 +81,8 @@ GenericMap::~GenericMap()
m_attribs[i].clear(true) ; m_attribs[i].clear(true) ;
} }
} }
if (m_attributes_registry_map)
delete m_attributes_registry_map;
} }
/**************************************** /****************************************
...@@ -136,7 +139,7 @@ bool GenericMap::registerAttribute(const std::string &nameType) ...@@ -136,7 +139,7 @@ bool GenericMap::registerAttribute(const std::string &nameType)
ra->setTypeName(nameType); ra->setTypeName(nameType);
m_attributes_registry_map.insert(std::pair<std::string, RegisteredBaseAttribute*>(nameType,ra)); m_attributes_registry_map->insert(std::pair<std::string, RegisteredBaseAttribute*>(nameType,ra));
return true; return true;
} }
......
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