Commit 8fea8b1e authored by Berenger Bramas's avatar Berenger Bramas

Ensure to reset the indexes in the loader

parent 2f160e53
......@@ -165,7 +165,7 @@ private:
*/
template<class... Types>
FSize getSavedSize_impl(std::tuple<Types*...>) const {
FSize tmp = sizeof(this->size());
FSize tmp = sizeof(FSize);
// Sum, for T in Types, of (sizeof(T) * this->size())
auto l = {(tmp += sizeof(Types) * this->size(), 0)..., 0};
(void)l;
......@@ -198,7 +198,7 @@ private:
*/
template<class BufferWriter, std::size_t ... Is>
void save_impl(BufferWriter& buffer, inria::index_sequence<Is...>) const {
buffer << this->size();
buffer << FSize(this->size());
// For each sub-array `s`, write `s` to the buffer
auto l = {
(buffer.write(std::get<Is>(this->data()), this->size()),0)...,
......
......@@ -192,6 +192,7 @@ public:
FSize sizeOfLeaf = 0;
file.read((char*)&sizeOfLeaf, sizeof(FSize));
buffer.seek(0);
buffer.reserve(sizeOfLeaf);
file.read((char*)buffer.data(), sizeOfLeaf);
......@@ -226,6 +227,7 @@ public:
FSize sizeOfCell = 0;
file.read((char*)&sizeOfCell, sizeof(FSize));
buffer.seek(0);
buffer.reserve(sizeOfCell);
file.read((char*)buffer.data(), sizeOfCell);
......
......@@ -97,7 +97,7 @@ class TestSphericalWithPrevious : public FUTester<TestSphericalWithPrevious> {
algo.execute();
// If needed save the result
//FTreeIO<FReal>::Save<OctreeClass, CellClass, LeafClass, ContainerClass >(DataFile.c_str(), testTree);
// FTreeIO<FReal>::Save<OctreeClass, CellClass, LeafClass, ContainerClass >(DataFile.c_str(), testTree);
// Load previous result
OctreeClass goodTree(NbLevels, SizeSubLevels, loader.getBoxWidth(), loader.getCenterOfBox());
......@@ -127,10 +127,10 @@ class TestSphericalWithPrevious : public FUTester<TestSphericalWithPrevious> {
const ContainerClass* goodLeaf = goodOctreeIterator.getCurrentListSrc();
for(FSize idxPart = 0 ; idxPart < testLeaf->getNbParticles() ; ++idxPart ){
uassert( IsSimilar(goodLeaf->getPotentials()[idxPart], testLeaf->getPotentials()[idxPart]) );
uassert( IsSimilar(goodLeaf->getForcesX()[idxPart], testLeaf->getForcesX()[idxPart]) );
uassert( IsSimilar(goodLeaf->getForcesY()[idxPart], testLeaf->getForcesY()[idxPart]) );
uassert( IsSimilar(goodLeaf->getForcesZ()[idxPart], testLeaf->getForcesZ()[idxPart]) );
uassert( IsSimilar(goodLeaf->getPotentials()[idxPart], testLeaf->getPotentials()[idxPart]) );
uassert( IsSimilar(goodLeaf->getForcesX()[idxPart], testLeaf->getForcesX()[idxPart]) );
uassert( IsSimilar(goodLeaf->getForcesY()[idxPart], testLeaf->getForcesY()[idxPart]) );
uassert( IsSimilar(goodLeaf->getForcesZ()[idxPart], testLeaf->getForcesZ()[idxPart]) );
}
if(!testOctreeIterator.moveRight()){
......
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