Commit c41b51f0 authored by Sylvain Thery's avatar Sylvain Thery

marker names & load/save/copy ok

parent 3328e365
...@@ -35,3 +35,10 @@ add_executable( Geom_intersectionD ./Geom_intersection.cpp) ...@@ -35,3 +35,10 @@ add_executable( Geom_intersectionD ./Geom_intersection.cpp)
target_link_libraries( Geom_intersectionD target_link_libraries( Geom_intersectionD
${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS}) ${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS})
add_executable( loadSave ./loadSave.cpp)
target_link_libraries( loadSave
${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS})
add_executable( copyfrom ./copyfrom.cpp)
target_link_libraries( copyfrom
${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS})
...@@ -123,6 +123,8 @@ protected: ...@@ -123,6 +123,8 @@ protected:
std::vector< AttributeMultiVector<MarkerBool>* > m_markVectors_free[NB_ORBITS][NB_THREAD] ; std::vector< AttributeMultiVector<MarkerBool>* > m_markVectors_free[NB_ORBITS][NB_THREAD] ;
std::mutex m_MarkerStorageMutex[NB_ORBITS]; std::mutex m_MarkerStorageMutex[NB_ORBITS];
unsigned int m_nextMarkerId;
/** /**
* Reserved boundary markers * Reserved boundary markers
*/ */
...@@ -159,7 +161,7 @@ public: ...@@ -159,7 +161,7 @@ public:
protected: protected:
void init(); void init(bool addBoundaryMarkers=true);
public: public:
virtual std::string mapTypeName() const = 0 ; virtual std::string mapTypeName() const = 0 ;
......
...@@ -226,7 +226,16 @@ AttributeMultiVector<MarkerBool>* GenericMap::askMarkVector(unsigned int thread) ...@@ -226,7 +226,16 @@ AttributeMultiVector<MarkerBool>* GenericMap::askMarkVector(unsigned int thread)
else else
{ {
std::lock_guard<std::mutex> lockMV(m_MarkerStorageMutex[ORBIT]); std::lock_guard<std::mutex> lockMV(m_MarkerStorageMutex[ORBIT]);
AttributeMultiVector<MarkerBool>* amv = m_attribs[ORBIT].addAttribute<MarkerBool>("") ;
unsigned int x=m_nextMarkerId++;
std::string number("___");
number[2]= '0'+x%10;
x = x/10;
number[1]= '0'+x%10;
x = x/10;
number[0]= '0'+x%10;
AttributeMultiVector<MarkerBool>* amv = m_attribs[ORBIT].addAttribute<MarkerBool>("marker_" + orbitName(ORBIT) + number);
return amv; return amv;
} }
} }
......
...@@ -54,7 +54,8 @@ std::vector<GenericMap*>* GenericMap::s_instances=NULL; ...@@ -54,7 +54,8 @@ std::vector<GenericMap*>* GenericMap::s_instances=NULL;
GenericMap::GenericMap() GenericMap::GenericMap():
m_nextMarkerId(0)
{ {
if(m_attributes_registry_map == NULL) if(m_attributes_registry_map == NULL)
{ {
...@@ -90,6 +91,8 @@ GenericMap::GenericMap() ...@@ -90,6 +91,8 @@ GenericMap::GenericMap()
registerAttribute<Geom::Matrix33d>(Geom::Matrix33d::CGoGNnameOfType()); registerAttribute<Geom::Matrix33d>(Geom::Matrix33d::CGoGNnameOfType());
registerAttribute<Geom::Matrix44d>(Geom::Matrix44d::CGoGNnameOfType()); registerAttribute<Geom::Matrix44d>(Geom::Matrix44d::CGoGNnameOfType());
registerAttribute<MarkerBool>("MarkerBool");
} }
...@@ -163,7 +166,7 @@ GenericMap::~GenericMap() ...@@ -163,7 +166,7 @@ GenericMap::~GenericMap()
s_instances->pop_back(); s_instances->pop_back();
} }
void GenericMap::init() void GenericMap::init(bool addBoundaryMarkers)
{ {
for(unsigned int i = 0; i < NB_ORBITS; ++i) for(unsigned int i = 0; i < NB_ORBITS; ++i)
{ {
...@@ -178,8 +181,12 @@ void GenericMap::init() ...@@ -178,8 +181,12 @@ void GenericMap::init()
} }
} }
m_boundaryMarkers[0] = m_attribs[DART].addAttribute<MarkerBool>("BoundaryMark0") ; if (addBoundaryMarkers)
m_boundaryMarkers[1] = m_attribs[DART].addAttribute<MarkerBool>("BoundaryMark1") ; {
m_boundaryMarkers[0] = m_attribs[DART].addAttribute<MarkerBool>("BoundaryMark0") ;
m_boundaryMarkers[1] = m_attribs[DART].addAttribute<MarkerBool>("BoundaryMark1") ;
}
for(std::multimap<AttributeMultiVectorGen*, AttributeHandlerGen*>::iterator it = attributeHandlers.begin(); it != attributeHandlers.end(); ++it) for(std::multimap<AttributeMultiVectorGen*, AttributeHandlerGen*>::iterator it = attributeHandlers.begin(); it != attributeHandlers.end(); ++it)
(*it).second->setInvalid() ; (*it).second->setInvalid() ;
......
...@@ -136,8 +136,8 @@ bool MapMono::copyFrom(const GenericMap& map) ...@@ -136,8 +136,8 @@ bool MapMono::copyFrom(const GenericMap& map)
return false; return false;
} }
GenericMap::clear(true); // clear the map but do not insert boundary markers dart attribute
// add same thread markers than in map (1 in clear) GenericMap::init(false);
// copy attrib containers // copy attrib containers
for (unsigned int i = 0; i < NB_ORBITS; ++i) for (unsigned int i = 0; i < NB_ORBITS; ++i)
......
...@@ -323,7 +323,9 @@ bool MapMulti::copyFrom(const GenericMap& map) ...@@ -323,7 +323,9 @@ bool MapMulti::copyFrom(const GenericMap& map)
return false; return false;
} }
GenericMap::clear(true); // clear the map but do not insert boundary markers dart attribute
GenericMap::init(false);
// load attrib container // load attrib container
for (unsigned int i = 0; i < NB_ORBITS; ++i) for (unsigned int i = 0; i < NB_ORBITS; ++i)
......
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