bug fix table archive

This commit is contained in:
Joachim Schöberl 2018-04-28 10:34:46 +02:00
parent bda771f86f
commit 0b0616eee8
4 changed files with 38 additions and 39 deletions

View File

@ -225,6 +225,11 @@ namespace netgen
{
ar & data[i].size;
ar.Do ((unsigned char*)data[i].col, data[i].size*elemsize);
/*
for (size_t j = 0; j < data[i].size*elemsize; j++)
ar & ((unsigned char*) data[i].col)[j];
cout << "write " << data[i].size*elemsize << " chars" << endl;
*/
}
}
else
@ -233,14 +238,14 @@ namespace netgen
ar & size & entries;
data.SetSize(size);
oneblock = new char [entries*elemsize];
char * ptr = oneblock;
for (size_t i = 0; i < data.Size(); i++)
size_t cnt = 0;
for (size_t i = 0; i < size; i++)
{
ar & data[i].size;
data[i].col = ptr;
data[i].col = oneblock+cnt;
data[i].maxsize = data[i].size;
ar.Do ((unsigned char*)data[i].col, data[i].size*elemsize);
ptr += size*elemsize;
ar.Do ((unsigned char*)(oneblock+cnt), data[i].size*elemsize);
cnt += data[i].size*elemsize;
}
}
return ar;

View File

@ -1313,13 +1313,7 @@ namespace netgen
archive & facedecoding;
archive & materials & bcnames & cd2names;
if (archive.Output())
archive & *ident;
else
{
// ident = new Identifications(*this);
archive & *ident;
}
archive & *ident;
if (archive.Input())
{

View File

@ -2461,6 +2461,32 @@ namespace netgen
maxidentnr = 0;
}
ngstd::Archive & Identifications :: DoArchive (ngstd::Archive & ar)
{
ar & maxidentnr;
ar & identifiedpoints & identifiedpoints_nr;
ar & idpoints_table;
if (ar.Output())
{
size_t s = type.Size();
ar & s;
for (auto & t : type)
ar & (unsigned char&)(t);
}
else
{
size_t s;
ar & s;
type.SetSize(s);
for (auto & t : type)
ar & (unsigned char&)(t);
}
return ar;
}
void Identifications :: Add (PointIndex pi1, PointIndex pi2, int identnr)
{
// (*testout) << "Identification::Add, pi1 = " << pi1 << ", pi2 = " << pi2 << ", identnr = " << identnr << endl;

View File

@ -1532,33 +1532,7 @@ namespace netgen
DLL_HEADER void Print (ostream & ost) const;
ngstd::Archive & DoArchive (ngstd::Archive & ar)
{
ar & maxidentnr;
ar & identifiedpoints & identifiedpoints_nr;
ar & idpoints_table;
if (ar.Output())
{
size_t s = type.Size();
ar & s;
for (auto & t : type)
ar & (unsigned char&)(t);
}
else
{
size_t s;
ar & s;
type.SetSize(s);
for (auto & t : type)
ar & (unsigned char&)(t);
}
cout << "identifiedpoints = " << identifiedpoints << endl;
cout << "identifiedpoints_nr = " << identifiedpoints_nr << endl;
cout << "idpoints_table = " << idpoints_table << endl;
cout << "type = " << type << endl;
return ar;
}
ngstd::Archive & DoArchive (ngstd::Archive & ar);
};
inline ngstd::Archive & operator & (ngstd::Archive & archive, Identifications & mp)