Commit 785f2c31 authored by Sylvain Thery's avatar Sylvain Thery

update tests load/save & copyFrom

parent 654ecb23
......@@ -33,7 +33,7 @@ IF (WITH_QT)
ENDIF (NOT DONOT_COMPILE_SANDBOX)
ENDIF (WITH_QT)
add_subdirectory(Examples/Tests)
add_subdirectory(Tests)
add_subdirectory(Benches)
......
......@@ -64,18 +64,37 @@ int main()
color[w] = position[w.dart] + VEC3(0.5,0.5,0.5);
});
MAP myMap2;
CGoGNout.toStd(false);
CGoGNout.toFile("map1.csv");
CGoGNout.toFile("cf_map1.csv");
myMap.dumpCSV();
std::cout << "MAP 1 dumped in cf_map1.csv"<< std::endl;
MAP myMap2;
VertexAttribute<VEC3, MAP> position2 = myMap2.addAttribute<VEC3, VERTEX, MAP>("position");
DartMarker<MAP> dm(myMap2);
myMap2.copyFrom(myMap);
CGoGNout.toFile("map2.csv");
CGoGNout.toFile("cf_map2.csv");
myMap2.dumpCSV();
std::cout << "MAP 2 dumped in cf_map2.csv"<< std::endl;
// DartMarker and CellMarker must be updated after copy
dm.update();
dm.markOrbit<FACE>(myMap2.begin());
if (!position2.isValid())
{
std::cout << "Attribute handlers are invalid after load or copy, get it agins"<< std::endl;
// get it again (here attribute created in load)
position2 = myMap2.getAttribute<VEC3, VERTEX, MAP>("position");
}
CGoGNout.toFile("cf_map3.csv");
myMap2.dumpCSV();
std::cout << "MAP 2 dumped in cf_map3.csv"<< std::endl;
std::cout << " Volume Total =" << Algo::Geometry::totalVolume<PFP>(myMap2, position)<< std::endl;
std::cout << " Volume Total =" << Algo::Geometry::totalVolume<PFP>(myMap2, position2)<< std::endl;
return 0;
}
......@@ -66,20 +66,35 @@ int main()
});
CGoGNout.toStd(false);
CGoGNout.toFile("map1.csv");
CGoGNout.toFile("ls_map1.csv");
myMap.dumpCSV();
std::cout << "MAP 1 dumped in ls_map1.csv"<< std::endl;
myMap.saveMapBin("pipo.map");
myMap.saveMapBin("ls_pipo.map");
MAP myMap2;
VertexAttribute<VEC3, MAP> position2 = myMap2.addAttribute<VEC3, VERTEX, MAP>("position");
CellMarker<MAP,VERTEX> cm(myMap2);
myMap2.loadMapBin("pipo.map");
myMap2.loadMapBin("ls_pipo.map");
CGoGNout.toFile("map2.csv");
if (!position2.isValid())
{
std::cout << "Attribute handlers are invalid after load or copy, get it agin"<< std::endl;
// get it again (here attribute created in load)
position2 = myMap2.getAttribute<VEC3, VERTEX, MAP>("position");
}
CGoGNout.toFile("ls_map2.csv");
myMap2.dumpCSV();
std::cout << "MAP 2 dumped in ls_map2.csv"<< std::endl;
std::cout << " Volume Total =" << Algo::Geometry::totalVolume<PFP>(myMap2, position)<< std::endl;
cm.update();
if (cm.isMarked(myMap2.begin()))
std::cout << "MARKED"<< std::endl;
std::cout << " Volume Total =" << Algo::Geometry::totalVolume<PFP>(myMap2, position2)<< std::endl;
return 0;
}
......@@ -57,8 +57,6 @@ public:
unsigned int getCell() { return m_cell ; }
void updateMarkVector(AttributeMultiVector<MarkerBool>* amv) { m_markVector = amv ; }
protected:
// protected copy constructor to forbid its usage
CellMarkerGen(const CellMarkerGen& /*cm*/)
......
......@@ -179,8 +179,12 @@ void GenericMap::init(bool addBoundaryMarkers)
m_quickLocalIncidentTraversal[i][j] = NULL ;
m_quickLocalAdjacentTraversal[i][j] = NULL ;
}
for(unsigned int j = 0; j < NB_THREAD; ++j)
m_markVectors_free[i][j].clear();
}
if (addBoundaryMarkers)
{
m_boundaryMarkers[0] = m_attribs[DART].addAttribute<MarkerBool>("BoundaryMark0") ;
......
......@@ -128,14 +128,14 @@ bool MapMono::loadMapBin(const std::string& filename)
bool MapMono::copyFrom(const GenericMap& map)
{
const MapMono& mapM = reinterpret_cast<const MapMono&>(map);
if (mapTypeName() != map.mapTypeName())
{
CGoGNerr << "try to copy from incompatible type map" << CGoGNendl;
return false;
}
const MapMono& mapM = reinterpret_cast<const MapMono&>(map);
// clear the map but do not insert boundary markers dart attribute
GenericMap::init(false);
......
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