Commit d478214e authored by Sylvain Thery's avatar Sylvain Thery

profiling

parent 4c22b514
......@@ -150,7 +150,8 @@ IF(WIN32)
set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING "Only Release or Debug" FORCE)
# set(CMAKE_CONFIGURATION_TYPES "Release Debug" CACHE STRING "Only Release or Debug" FORCE)
ELSE(WIN32)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -fPIC -std=c++11")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -fPIC -std=c++11 -pg")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Woverride-init -fPIC")
# remove the 60000+ "no unused local typedefs" warnings with GCC4.8+
if(CMAKE_COMPILER_IS_GNUCXX)
......
......@@ -112,7 +112,9 @@ IF(WIN32)
set(CMAKE_CONFIGURATION_TYPES Release Debug)
set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING "Only Release or Debug" FORCE)
ELSE(WIN32)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -fPIC -std=c++11")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -fPIC -std=c++11 -pg")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg")
if(CMAKE_COMPILER_IS_GNUCXX)
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
if (GCC_VERSION VERSION_GREATER 4.8 OR GCC_VERSION VERSION_EQUAL 4.8)
......
......@@ -177,14 +177,7 @@ void foreach_cell(MAP& map, std::vector<FunctorMapThreaded<MAP>*>& funcs, bool n
boost::barrier sync1(nbth+1);
boost::barrier sync2(nbth+1);
bool finished=false;
// lauch threads
if (needMarkers)
{
unsigned int nbth_prec = map.getNbThreadMarkers();
if (nbth_prec < nbth+1)
map.addThreadMarker(nbth+1-nbth_prec);
}
// launch threads
boost::thread** threads = new boost::thread*[nbth];
ThreadFunction<MAP>** tfs = new ThreadFunction<MAP>*[nbth];
......
......@@ -128,7 +128,7 @@ public:
virtual unsigned int getNbBlocks() const = 0;
virtual void addBlocksBefore(unsigned int nbb) = 0;
// virtual void addBlocksBefore(unsigned int nbb) = 0;
virtual bool copy(const AttributeMultiVectorGen* atmvg) = 0;
......@@ -311,6 +311,7 @@ public:
} // namespace CGoGN
#include "attributeMultiVectorBool.hpp"
#include "attributeMultiVector.hpp"
#endif
This diff is collapsed.
......@@ -43,40 +43,26 @@ class CellMarkerGen
friend class GenericMap ;
protected:
Mark m_mark ;
AttributeMultiVector<Mark>* m_markVector ;
unsigned int m_thread ;
AttributeMultiVector<MarkerBool>* m_markVector ;
unsigned int m_cell ;
public:
CellMarkerGen(unsigned int cell, unsigned int thread = 0) :
m_thread(thread),
m_cell(cell)
{}
virtual ~CellMarkerGen()
{}
unsigned int getThread() { return m_thread ; }
unsigned int getCell() { return m_cell ; }
void updateMarkVector(AttributeMultiVector<Mark>* amv) { m_markVector = amv ; }
void updateMarkVector(AttributeMultiVector<MarkerBool>* amv) { m_markVector = amv ; }
protected:
// protected copy constructor to forbid its usage
CellMarkerGen(const CellMarkerGen& /*cm*/)
{}
// virtual void mark(Dart d) = 0 ;
// virtual void unmark(Dart d) = 0 ;
// virtual bool isMarked(Dart d) const = 0 ;
// virtual void mark(unsigned int em) = 0 ;
// virtual void unmark(unsigned int em) = 0 ;
// virtual bool isMarked(unsigned int em) const = 0 ;
// virtual void markAll() = 0 ;
// virtual void unmarkAll() = 0 ;
// virtual bool isAllUnmarked() = 0 ;
};
/**
......@@ -100,8 +86,7 @@ public:
{
if(!m_map.template isOrbitEmbedded<CELL>())
m_map.template addEmbedding<CELL>() ;
m_mark = m_map.template getMarkerSet<CELL>(m_thread).getNewMark() ;
m_markVector = m_map.template getMarkVector<CELL>(m_thread) ;
m_markVector = m_map.template askMarkVector<CELL>();
}
CellMarkerBase(const MAP& map, unsigned int thread = 0) :
......@@ -110,16 +95,23 @@ public:
{
if(!m_map.template isOrbitEmbedded<CELL>())
m_map.template addEmbedding<CELL>() ;
m_mark = m_map.template getMarkerSet<CELL>(m_thread).getNewMark() ;
m_markVector = m_map.template getMarkVector<CELL>(m_thread) ;
m_markVector = m_map.template askMarkVector<CELL>();
}
virtual ~CellMarkerBase()
{
if (GenericMap::alive(&m_map))
m_map.template getMarkerSet<CELL>(m_thread).releaseMark(m_mark) ;
m_map.template releaseMarkVector<CELL>(m_markVector);
}
void update()
{
if(!m_map.template isOrbitEmbedded<CELL>())
m_map.template addEmbedding<CELL>() ;
m_markVector = m_map.template askMarkVector<CELL>();
}
protected:
// protected copy constructor to forbid its usage
CellMarkerBase(const CellMarkerBase<MAP, CELL>& cm) :
......@@ -133,7 +125,6 @@ public:
*/
inline void mark(Cell<CELL> c)
{
assert(m_map.template getMarkerSet<CELL>(m_thread).testMark(m_mark));
assert(m_markVector != NULL);
unsigned int a = m_map.getEmbedding(c) ;
......@@ -141,7 +132,7 @@ public:
if (a == EMBNULL)
a = Algo::Topo::setOrbitEmbeddingOnNewCell(m_map, c) ;
(*m_markVector)[a].setMark(m_mark) ;
m_markVector->setTrue(a);
}
/**
......@@ -149,7 +140,6 @@ public:
*/
inline void unmark(Cell<CELL> c)
{
assert(m_map.template getMarkerSet<CELL>(m_thread).testMark(m_mark));
assert(m_markVector != NULL);
unsigned int a = m_map.getEmbedding(c) ;
......@@ -157,7 +147,7 @@ public:
if (a == EMBNULL)
a = Algo::Topo::setOrbitEmbeddingOnNewCell(m_map, c) ;
(*m_markVector)[a].unsetMark(m_mark) ;
m_markVector->setFalse(a);
}
/**
......@@ -165,7 +155,6 @@ public:
*/
inline bool isMarked(Cell<CELL> c) const
{
assert(m_map.template getMarkerSet<CELL>(m_thread).testMark(m_mark));
assert(m_markVector != NULL);
unsigned int a = m_map.getEmbedding(c) ;
......@@ -173,7 +162,7 @@ public:
if (a == EMBNULL)
return false ;
return (*m_markVector)[a].testMark(m_mark) ;
return m_markVector->operator[](a);
}
/**
......@@ -181,10 +170,8 @@ public:
*/
inline void mark(unsigned int em)
{
assert(m_map.template getMarkerSet<CELL>(m_thread).testMark(m_mark));
assert(m_markVector != NULL);
(*m_markVector)[em].setMark(m_mark) ;
m_markVector->setTrue(em);
}
/**
......@@ -192,10 +179,8 @@ public:
*/
inline void unmark(unsigned int em)
{
assert(m_map.template getMarkerSet<CELL>(m_thread).testMark(m_mark));
assert(m_markVector != NULL);
(*m_markVector)[em].unsetMark(m_mark) ;
m_markVector->setFalse(em);
}
/**
......@@ -203,12 +188,11 @@ public:
*/
inline bool isMarked(unsigned int em) const
{
assert(m_map.template getMarkerSet<CELL>(m_thread).testMark(m_mark));
assert(m_markVector != NULL);
if (em == EMBNULL)
return false ;
return (*m_markVector)[em].testMark(m_mark) ;
return m_markVector->operator[](em);
}
/**
......@@ -216,22 +200,17 @@ public:
*/
inline void markAll()
{
assert(m_map.template getMarkerSet<CELL>(m_thread).testMark(m_mark));
assert(m_markVector != NULL);
AttributeContainer& cont = m_map.template getAttributeContainer<CELL>() ;
for (unsigned int i = cont.begin(); i != cont.end(); cont.next(i))
(*m_markVector)[i].setMark(m_mark) ;
m_markVector->allFalse();
}
inline bool isAllUnmarked()
{
assert(m_map.template getMarkerSet<CELL>(m_thread).testMark(m_mark));
assert(m_markVector != NULL);
AttributeContainer& cont = m_map.template getAttributeContainer<CELL>() ;
for (unsigned int i = cont.begin(); i != cont.end(); cont.next(i))
if((*m_markVector)[i].testMark(m_mark))
if(m_markVector->operator[](i))
return false ;
return true ;
}
......@@ -265,12 +244,8 @@ protected:
public:
inline void unmarkAll()
{
assert(this->m_map.template getMarkerSet<CELL>(this->m_thread).testMark(this->m_mark));
assert(this->m_markVector != NULL);
AttributeContainer& cont = this->m_map.template getAttributeContainer<CELL>() ;
for (unsigned int i = cont.realBegin(); i != cont.realEnd(); cont.realNext(i))
this->m_markVector->operator[](i).unsetMark(this->m_mark) ;
this->m_markVector->allFalse();
}
};
......@@ -325,11 +300,10 @@ public:
inline void unmarkAll()
{
assert(this->m_map.template getMarkerSet<CELL>(this->m_thread).testMark(this->m_mark));
assert(this->m_markVector != NULL);
for (std::vector<unsigned int>::iterator it = m_markedCells.begin(); it != m_markedCells.end(); ++it)
this->m_markVector->operator[](*it).unsetMark(this->m_mark) ;
this->m_markVector->setFalse(*it);
}
};
......@@ -381,7 +355,6 @@ public:
inline void unmarkAll()
{
assert(this->m_map.template getMarkerSet<CELL>(this->m_thread).testMark(this->m_mark));
assert(this->m_markVector != NULL);
for (std::vector<Dart>::iterator it = m_markedDarts.begin(); it != m_markedDarts.end(); ++it)
{
......@@ -428,12 +401,8 @@ protected:
public:
inline void unmarkAll()
{
assert(this->m_map.template getMarkerSet<CELL>(this->m_thread).testMark(this->m_mark));
assert(this->m_markVector != NULL);
AttributeContainer& cont = this->m_map.template getAttributeContainer<CELL>() ;
for (unsigned int i = cont.realBegin(); i != cont.realEnd(); cont.realNext(i))
this->m_markVector->operator[](i).unsetMark(this->m_mark) ;
this->m_markVector->allFalse();
}
};
......
......@@ -43,25 +43,18 @@ class DartMarkerGen
friend class GenericMap ;
protected:
Mark m_mark ;
AttributeMultiVector<Mark>* m_markVector ;
unsigned int m_thread ;
AttributeMultiVector<MarkerBool>* m_markVector;
public:
/**
* constructor
*/
DartMarkerGen(unsigned int thread = 0) :
m_thread(thread)
DartMarkerGen(unsigned int thread=0)
{}
virtual ~DartMarkerGen()
{}
inline unsigned int getThread() { return m_thread ; }
inline void updateMarkVector(AttributeMultiVector<Mark>* amv) { m_markVector = amv ; }
protected:
// protected copy constructor to forbid its usage
DartMarkerGen(const DartMarkerGen& /*dm*/)
......@@ -84,25 +77,29 @@ public:
DartMarkerGen(thread),
m_map(map)
{
m_mark = m_map.template getMarkerSet<DART>(m_thread).getNewMark() ;
m_markVector = m_map.template getMarkVector<DART>(m_thread) ;
m_markVector = m_map.template askMarkVector<DART>();
}
DartMarkerTmpl(const MAP& map, unsigned int thread = 0) :
DartMarkerGen(thread),
m_map(const_cast<MAP&>(map))
{
m_mark = m_map.template getMarkerSet<DART>(m_thread).getNewMark() ;
m_markVector = m_map.template getMarkVector<DART>(m_thread) ;
m_markVector = m_map.template askMarkVector<DART>();
}
virtual ~DartMarkerTmpl()
{
if (GenericMap::alive(&m_map))
m_map.template getMarkerSet<DART>(m_thread).releaseMark(m_mark) ;
m_map.template releaseMarkVector<DART>(m_markVector);
}
inline void update()
{
m_markVector = m_map.template askMarkVector<DART>();
}
protected:
// protected copy constructor to forbid its usage
DartMarkerTmpl(const DartMarkerTmpl<MAP>& dm) :
......@@ -115,9 +112,9 @@ public:
*/
inline void mark(Dart d)
{
assert(m_map.template getMarkerSet<DART>(m_thread).testMark(m_mark));
assert(m_markVector != NULL);
unsigned int d_index = m_map.dartIndex(d) ;
(*m_markVector)[d_index].setMark(m_mark) ;
m_markVector->setTrue(d_index);
}
/**
......@@ -125,9 +122,9 @@ public:
*/
inline void unmark(Dart d)
{
assert(m_map.template getMarkerSet<DART>(m_thread).testMark(m_mark));
assert(m_markVector != NULL);
unsigned int d_index = m_map.dartIndex(d) ;
(*m_markVector)[d_index].unsetMark(m_mark) ;
m_markVector->setFalse(d_index);
}
/**
......@@ -135,9 +132,9 @@ public:
*/
inline bool isMarked(Dart d) const
{
assert(m_map.template getMarkerSet<DART>(m_thread).testMark(m_mark));
assert(m_markVector != NULL);
unsigned int d_index = m_map.dartIndex(d) ;
return (*m_markVector)[d_index].testMark(m_mark) ;
return (*m_markVector)[d_index];
}
/**
......@@ -146,12 +143,11 @@ public:
template <unsigned int ORBIT>
inline void markOrbit(Cell<ORBIT> c)
{
assert(m_map.template getMarkerSet<DART>(m_thread).testMark(m_mark));
assert(m_markVector != NULL);
m_map.foreach_dart_of_orbit(c, [&] (Dart d)
{
(*m_markVector)[m_map.dartIndex(d)].setMark(m_mark);
}
, m_thread) ;
m_markVector->setTrue(m_map.dartIndex(d));
}) ;
}
/**
......@@ -160,12 +156,12 @@ public:
template <unsigned int ORBIT>
inline void unmarkOrbit(Cell<ORBIT> c)
{
assert(m_map.template getMarkerSet<DART>(m_thread).testMark(m_mark));
assert(m_markVector != NULL);
m_map.foreach_dart_of_orbit(c, [&] (Dart d)
{
(*m_markVector)[m_map.dartIndex(d)].unsetMark(m_mark);
}
, m_thread) ;
m_markVector->setFalse(m_map.dartIndex(d));
}) ;
}
/**
......@@ -173,10 +169,10 @@ public:
*/
inline void markAll()
{
assert(m_map.template getMarkerSet<DART>(m_thread).testMark(m_mark));
assert(m_markVector != NULL);
AttributeContainer& cont = m_map.template getAttributeContainer<DART>() ;
for (unsigned int i = cont.begin(); i != cont.end(); cont.next(i))
(*m_markVector)[i].setMark(m_mark) ;
m_markVector->setTrue(i);
}
/**
......@@ -186,11 +182,10 @@ public:
inline bool isAllUnmarked()
{
assert(m_map.template getMarkerSet<DART>(m_thread).testMark(m_mark));
assert(m_markVector != NULL);
AttributeContainer& cont = m_map.template getAttributeContainer<DART>() ;
for (unsigned int i = cont.begin(); i != cont.end(); cont.next(i))
if ((*m_markVector)[i].testMark(m_mark))
if ((*m_markVector)[i])
return false ;
return true ;
}
......@@ -204,11 +199,11 @@ template <typename MAP>
class DartMarker : public DartMarkerTmpl<MAP>
{
public:
DartMarker(const MAP& map) :
DartMarkerTmpl<MAP>(map)
DartMarker( MAP& map, unsigned int thread=0) :
DartMarkerTmpl<MAP>(map,thread)
{}
DartMarker(const MAP& map, unsigned int thread) :
DartMarker(const MAP& map, unsigned int thread=0) :
DartMarkerTmpl<MAP>(map, thread)
{}
......@@ -225,10 +220,7 @@ protected:
public:
inline void unmarkAll()
{
assert(this->m_map.template getMarkerSet<DART>(this->m_thread).testMark(this->m_mark));
AttributeContainer& cont = this->m_map.template getAttributeContainer<DART>() ;
for (unsigned int i = cont.realBegin(); i != cont.realEnd(); cont.realNext(i))
(*this->m_markVector)[i].unsetMark(this->m_mark) ;
this->m_markVector->allFalse();
}
} ;
......@@ -244,13 +236,13 @@ protected:
std::vector<unsigned int> m_markedDarts ;
public:
DartMarkerStore(const MAP& map) :
DartMarkerTmpl<MAP>(map)
DartMarkerStore(MAP& map, unsigned int thread=0) :
DartMarkerTmpl<MAP>(map, thread)
{
m_markedDarts.reserve(128);
}
DartMarkerStore(const MAP& map, unsigned int thread) :
DartMarkerStore(const MAP& map, unsigned int thread=0) :
DartMarkerTmpl<MAP>(map, thread)
{
m_markedDarts.reserve(128);
......@@ -280,21 +272,18 @@ public:
template <unsigned int ORBIT>
inline void markOrbit(Cell<ORBIT> c)
{
assert(this->m_map.template getMarkerSet<DART>(this->m_thread).testMark(this->m_mark));
this->m_map.foreach_dart_of_orbit(c, [&] (Dart d)
{
unsigned int d_index = this->m_map.dartIndex(d);
(*this->m_markVector)[d_index].setMark(this->m_mark);
this->m_markVector->setTrue(d_index);
m_markedDarts.push_back(d_index);
}
, this->m_thread) ;
}) ;
}
inline void unmarkAll()
{
assert(this->m_map.template getMarkerSet<DART>(this->m_thread).testMark(this->m_mark));
for (std::vector<unsigned int>::iterator it = m_markedDarts.begin(); it != m_markedDarts.end(); ++it)
(*this->m_markVector)[*it].unsetMark(this->m_mark) ;
for (std::vector<unsigned int>::iterator it = m_markedDarts.begin(); it != m_markedDarts.end(); ++it)
this->m_markVector->setFalse(*it);
}
} ;
......@@ -329,10 +318,7 @@ protected:
public:
inline void unmarkAll()
{
assert(this->m_map.template getMarkerSet<DART>(this->m_thread).testMark(this->m_mark));
AttributeContainer& cont = this->m_map.template getAttributeContainer<DART>() ;
for (unsigned int i = cont.realBegin(); i != cont.realEnd(); cont.realNext(i))
this->m_markVector->operator[](i).unsetMark(this->m_mark) ;
this->m_markVector->allFalse();
}
} ;
......
......@@ -82,9 +82,9 @@ class GenericMap
template<typename T, typename MAP> friend class EdgeAutoAttribute ;
template<typename T, typename MAP> friend class FaceAutoAttribute ;
template<typename T, typename MAP> friend class VolumeAutoAttribute ;
friend class DartMarkerGen ;
friend class CellMarkerGen ;
template<typename MAP, unsigned int CELL> friend class CellMarkerBase ;
// friend class DartMarkerGen ;
// friend class CellMarkerGen ;
// template<typename MAP, unsigned int CELL> friend class CellMarkerBase ;
protected:
// protected copy constructor to prevent the copy of map
......@@ -112,32 +112,22 @@ protected:
AttributeMultiVector<NoTypeNameAttribute<std::vector<Dart> > >* m_quickLocalIncidentTraversal[NB_ORBITS][NB_ORBITS] ;
AttributeMultiVector<NoTypeNameAttribute<std::vector<Dart> > >* m_quickLocalAdjacentTraversal[NB_ORBITS][NB_ORBITS] ;
/**
* Marks manager
*/
MarkSet m_marksets[NB_ORBITS][NB_THREAD] ;
/**
* Direct access to the attributes that store Marks
*/
AttributeMultiVector<Mark>* m_markTables[NB_ORBITS][NB_THREAD] ;
// std::vector< AttributeMultiVector<MarkerBool>* > m_markVectors[NB_ORBITS] ;
std::vector< AttributeMultiVector<MarkerBool>* > m_markVectors_free[NB_ORBITS] ;
boost::mutex m_MarkerStorageMutex[NB_ORBITS];
/**
* Reserved boundary markers
*/
Mark m_boundaryMarkers[2] ; // 0 for dim 2 / 1 for dim 3
unsigned int m_nbThreadMarkers ;
AttributeMultiVector<MarkerBool>* m_boundaryMarkers[2];
/**
* Store links to created AttributeHandlers, DartMarkers and CellMarkers
* Store links to created AttributeHandlers
*/
std::multimap<AttributeMultiVectorGen*, AttributeHandlerGen*> attributeHandlers ; // TODO think of MT (AttributeHandler creation & release are not thread safe!)
boost::mutex attributeHandlersMutex;
std::vector<DartMarkerGen*> dartMarkers[NB_THREAD] ;
std::vector<CellMarkerGen*> cellMarkers[NB_THREAD] ;
// table of instancied maps for Dart/CellMarker release
static std::vector<GenericMap*> s_instances;
......@@ -172,11 +162,6 @@ public:
*/
virtual void clear(bool removeAttrib) ;
/**
* get the marker_set of an orbit and thread (used for Cell & Dart Marker)
*/
template <unsigned int ORBIT>
MarkSet& getMarkerSet(unsigned int thread = 0) { return m_marksets[ORBIT][thread]; }
/****************************************
* DARTS MANAGEMENT *
......@@ -290,10 +275,17 @@ public:
inline AttributeMultiVectorGen* getAttributeVectorGen(unsigned int orbit, const std::string& nameAttr) ;
/**
* get a multi vector of mark attribute (direct access with [i])
* @brief ask for a marker attribute
*/
template <unsigned int ORBIT>
AttributeMultiVector<MarkerBool>* askMarkVector() ;
/**
* @brief release allocated marker attribute
*/
template <unsigned int ORBIT>
AttributeMultiVector<Mark>* getMarkVector(unsigned int thread = 0) ;
void releaseMarkVector(AttributeMultiVector<MarkerBool>* amv);
/**
* return a pointer to the Dart attribute vector that store the embedding of the given orbit
......@@ -351,24 +343,24 @@ protected:
* THREAD MANAGEMENT *
****************************************/
public:
/**
* add threads (a table of Marker per orbit for each thread)
* to allow MT
* @param nb thread to add
*/
void addThreadMarker(unsigned int nb) ;
/**
* return allowed threads
* @return the number of threads (including principal)
*/
unsigned int getNbThreadMarkers() const;
/**
* Remove some added threads
* @return remaining number of threads (including principal)
*/
void removeThreadMarker(unsigned int nb) ;
// /**
// * add threads (a table of Marker per orbit for each thread)
// * to allow MT
// * @param nb thread to add
// */
// void addThreadMarker(unsigned int nb) ;
// /**
// * return allowed threads
// * @return the number of threads (including principal)
// */
// unsigned int getNbThreadMarkers() const;
// /**
// * Remove some added threads
// * @return remaining number of threads (including principal)
// */
// void removeThreadMarker(unsigned int nb) ;
/****************************************
* SAVE & LOAD *
......
......@@ -49,22 +49,13 @@ inline void GenericMap::deleteDartLine(unsigned int index)
{
m_attribs[DART].removeLine(index) ; // free the dart line
for (unsigned int t = 0; t < m_nbThreadMarkers; ++t) // clear markers of
(*m_markTables[DART][t])[index].clear() ; // the removed dart
for(unsigned int orbit = 0; orbit < NB_ORBITS; ++orbit)
{
if (m_embeddings[orbit]) // for each embedded orbit
{
unsigned int emb = (*m_embeddings[orbit])[index] ; // get the embedding of the dart
if(emb != EMBNULL)
{
if(m_attribs[orbit].unrefLine(emb)) // unref the pointed embedding line
{
for (unsigned int t = 0; t < m_nbThreadMarkers; ++t) // and clear its markers if it was
(*m_markTables[orbit][t])[emb].clear() ; // its last unref (and was thus freed)
}
}
m_attribs[orbit].unrefLine(emb); // and unref the corresponding line
}
}
}
......@@ -162,13 +153,37 @@ inline AttributeMultiVectorGen* GenericMap::getAttributeVectorGen(unsigned int o
return m_attribs[orbit].getVirtualDataVector(nameAttr) ;
}
template <unsigned int ORBIT>
AttributeMultiVector<MarkerBool>* GenericMap::askMarkVector()
{
assert(isOrbitEmbedded<ORBIT>() || !"Invalid parameter: orbit not embedded") ;
// boost::mutex::scoped_lock lockMV(m_MarkerStorageMutex[ORBIT]);
if (!m_markVectors_free[ORBIT].empty())
{
AttributeMultiVector<MarkerBool>* amv = m_markVectors_free[ORBIT].back();
m_markVectors_free[ORBIT].pop_back();
return amv;
}
//else add attribute
AttributeMultiVector<MarkerBool>* amv = m_attribs[ORBIT].addAttribute<MarkerBool>("") ;
std::cout << "ADD ATTRIBUTE"<< std::endl;
return amv;
}
template <unsigned int ORBIT>
inline AttributeMultiVector<Mark>* GenericMap::getMarkVector(unsigned int thread)
inline void GenericMap::releaseMarkVector(AttributeMultiVector<MarkerBool>* amv)
{
assert(isOrbitEmbedded<ORBIT>() || !"Invalid parameter: orbit not embedded") ;
return m_markTables[ORBIT][thread] ;
// boost::mutex::scoped_lock lockMV(m_MarkerStorageMutex[ORBIT]);
m_markVectors_free[ORBIT].push_back(amv);
}
template <unsigned int ORBIT>