fix Save() and Load()

This commit is contained in:
eap 2010-02-16 09:32:14 +00:00
parent 97a2f52e50
commit ae8e36cc4a

View File

@ -123,13 +123,13 @@ ostream & StdMeshers_FixedPoints1D::SaveTo(ostream & save)
} }
listSize = _nbsegs.size(); listSize = _nbsegs.size();
save << listSize; save << " " << listSize;
if ( listSize > 0 ) { if ( listSize > 0 ) {
for ( int i = 0; i < listSize; i++) save << " " << _nbsegs[i]; for ( int i = 0; i < listSize; i++) save << " " << _nbsegs[i];
} }
listSize = _edgeIDs.size(); listSize = _edgeIDs.size();
save << listSize; save << " " << listSize;
if ( listSize > 0 ) { if ( listSize > 0 ) {
for ( int i = 0; i < listSize; i++) for ( int i = 0; i < listSize; i++)
save << " " << _edgeIDs[i]; save << " " << _edgeIDs[i];
@ -154,6 +154,7 @@ istream & StdMeshers_FixedPoints1D::LoadFrom(istream & load)
isOK = (load >> intVal); isOK = (load >> intVal);
if (isOK && intVal > 0) { if (isOK && intVal > 0) {
_params.clear();
_params.reserve( intVal ); _params.reserve( intVal );
for (int i = 0; i < _params.capacity() && isOK; i++) { for (int i = 0; i < _params.capacity() && isOK; i++) {
isOK = (load >> dblVal); isOK = (load >> dblVal);
@ -163,6 +164,7 @@ istream & StdMeshers_FixedPoints1D::LoadFrom(istream & load)
isOK = (load >> intVal); isOK = (load >> intVal);
if (isOK && intVal > 0) { if (isOK && intVal > 0) {
_nbsegs.clear();
_nbsegs.reserve( intVal ); _nbsegs.reserve( intVal );
for (int i = 0; i < _nbsegs.capacity() && isOK; i++) { for (int i = 0; i < _nbsegs.capacity() && isOK; i++) {
isOK = (load >> intVal); isOK = (load >> intVal);
@ -172,6 +174,7 @@ istream & StdMeshers_FixedPoints1D::LoadFrom(istream & load)
isOK = (load >> intVal); isOK = (load >> intVal);
if (isOK && intVal > 0) { if (isOK && intVal > 0) {
_edgeIDs.clear();
_edgeIDs.reserve( intVal ); _edgeIDs.reserve( intVal );
for (int i = 0; i < _edgeIDs.capacity() && isOK; i++) { for (int i = 0; i < _edgeIDs.capacity() && isOK; i++) {
isOK = (load >> intVal); isOK = (load >> intVal);