Changeset 5e88b2f in tol


Ignore:
Timestamp:
Mar 18, 2015, 11:57:16 AM (12 years ago)
Author:
Pedro Gea <pgea@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
08c59de
Parents:
565b311
Message:

Refs #1826, #1812
Se modifica la lectura/escritura de polinomios (Polyn) en OIS.

git-svn-id: ​https://www.tol-project.org/svn/tolp/trunk@6508 be4846ae-f051-483a-831f-b64e7d08527f

Location:
tol/OIS
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • tol/OIS/oiscreator.cpp

    r565b311 r5e88b2f  
    413413  int s = x.Size();
    414414  EWrite(s, stream);
    415   BCoefDeg* buf = (BCoefDeg*)AllocAuxilarBuffer(3,sizeof(BCoefDeg)*x.Size());
     415  char* buf = (char*)AllocAuxilarBuffer(3,SIZEOF_BCoefDeg*x.Size());
    416416  for(int i=0; i<x.Size(); i++)
    417417  {
    418     buf[i].degree_      = x(i).Degree();
    419     buf[i].coefficient_ = x(i).Coef  ();
    420   }
    421   Ensure(Write(buf,sizeof(BCoefDeg),x.Size(),stream));
     418    int *degree;
     419    BDat *coefficient;
     420    degree = (int*)&buf[i*SIZEOF_BCoefDeg];
     421    coefficient = (BDat*)&buf[i*SIZEOF_BCoefDeg+sizeof(int)];
     422    *degree = x(i).Degree();
     423    *coefficient = x(i).Coef();
     424  }
     425  Ensure(Write(buf,SIZEOF_BCoefDeg,x.Size(),stream));
    422426  return(true);
    423427};
  • tol/OIS/oisloader.cpp

    r565b311 r5e88b2f  
    409409    }
    410410  }
    411   else if(control_.typeSizes_.sizeof_BCoefDeg_==sizeof(BCoefDeg))
    412   {
    413     BCoefDeg* buf = (BCoefDeg*)AllocAuxilarBuffer(1,sizeof(BCoefDeg)*s);
    414     Ensure(Read(buf,sizeof(BCoefDeg),s,stream));
     411  else if(control_.typeSizes_.sizeof_BCoefDeg_==SIZEOF_BCoefDeg)
     412  {
     413    char* buf = (char*)AllocAuxilarBuffer(1,SIZEOF_BCoefDeg*s);
     414    Ensure(Read(buf,SIZEOF_BCoefDeg,s,stream));
    415415    for(i=0; i<x.Size(); i++)
    416416    {
    417       x[i].PutDegree(buf[i].degree_);
    418       x[i].PutCoef  (buf[i].coefficient_);
     417      int *degree;
     418      BDat *coefficient;
     419      degree = (int*)&buf[i*SIZEOF_BCoefDeg];
     420      coefficient = (BDat*)&buf[i*SIZEOF_BCoefDeg+sizeof(int)];
     421      x[i].PutDegree(*degree);
     422      x[i].PutCoef(*coefficient);
    419423    }
    420424  }
  • tol/OIS/tol_ois.h

    r565b311 r5e88b2f  
    6767#define Ensure(doit) if(!(doit)) { return(0); }
    6868
     69// SIZEOF_BCoefDeg was sizeof(BCoefDeg)
     70#define SIZEOF_BCoefDeg (sizeof(int)+sizeof(BDat))
    6971
    7072//--------------------------------------------------------------------
    … …  
    195197        sizeof_double_     (sizeof(double)),
    196198        sizeof_BDat_       (sizeof(BDat)),
    197         sizeof_BCoefDeg_   (sizeof(BCoefDeg)),
     199        sizeof_BCoefDeg_   (SIZEOF_BCoefDeg),
    198200        sizeof_BGrammarId_ (sizeof(BGrammarId))
    199201      {}
Note: See TracChangeset for help on using the changeset viewer.