/[escript]/trunk/ripley/src/Rectangle.cpp
ViewVC logotype

Diff of /trunk/ripley/src/Rectangle.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 4597 by gross, Sun Dec 15 22:36:24 2013 UTC revision 4599 by sshaw, Sun Dec 15 23:51:13 2013 UTC
# Line 4047  escript::Data Rectangle::randomFill(long Line 4047  escript::Data Rectangle::randomFill(long
4047          throw RipleyException("Radius of gaussian filter must be less than half the width/height of a rank");          throw RipleyException("Radius of gaussian filter must be less than half the width/height of a rank");
4048      }      }
4049            
4050      // size_t inset=2*radius+1;    
     // size_t Eheight=ext[1]-2*inset;   // how high the E (shared) region is  
     // size_t Swidth=ext[0]-2*inset;  
       
4051      double* src=new double[ext[0]*ext[1]];      double* src=new double[ext[0]*ext[1]];
4052      esysUtils::randomFillArray(seed, src, ext[0]*ext[1]);        esysUtils::randomFillArray(seed, src, ext[0]*ext[1]);  
4053            
4054        
4055  #ifdef ESYS_MPI      #ifdef ESYS_MPI    
4056        size_t inset=2*radius+1;
4057        size_t Eheight=ext[1]-2*inset;  // how high the E (shared) region is
4058        size_t Swidth=ext[0]-2*inset;
4059    
4060      double* SWin=new double[inset*inset];  memset(SWin, 0, inset*inset*sizeof(double));      double* SWin=new double[inset*inset];  memset(SWin, 0, inset*inset*sizeof(double));
4061      double* SEin=new double[inset*inset];  memset(SEin, 0, inset*inset*sizeof(double));      double* SEin=new double[inset*inset];  memset(SEin, 0, inset*inset*sizeof(double));
# Line 4064  escript::Data Rectangle::randomFill(long Line 4064  escript::Data Rectangle::randomFill(long
4064      double* Win=new double[inset*Eheight];  memset(Win, 0, inset*Eheight*sizeof(double));      double* Win=new double[inset*Eheight];  memset(Win, 0, inset*Eheight*sizeof(double));
4065    
4066      double* NEout=new double[inset*inset];  memset(NEout, 0, inset*inset*sizeof(double));      double* NEout=new double[inset*inset];  memset(NEout, 0, inset*inset*sizeof(double));
4067      uint base=ext[0]-inset+(ext[1]-inset)*ext[0];      unsigned int base=ext[0]-inset+(ext[1]-inset)*ext[0];
4068      for (uint i=0;i<inset;++i)      for (unsigned int i=0;i<inset;++i)
4069      {      {
4070      memcpy(NEout+inset*i, src+base, inset*sizeof(double));      memcpy(NEout+inset*i, src+base, inset*sizeof(double));
4071      base+=ext[0];      base+=ext[0];
4072      }      }
4073      double* NWout=new double[inset*inset];  memset(NWout, 0, inset*inset*sizeof(double));      double* NWout=new double[inset*inset];  memset(NWout, 0, inset*inset*sizeof(double));
4074      base=(ext[1]-inset)*ext[0];      base=(ext[1]-inset)*ext[0];
4075      for (uint i=0;i<inset;++i)      for (unsigned int i=0;i<inset;++i)
4076      {      {
4077      memcpy(NWout+inset*i, src+base, inset*sizeof(double));      memcpy(NWout+inset*i, src+base, inset*sizeof(double));
4078      base+=ext[0];      base+=ext[0];
# Line 4087  escript::Data Rectangle::randomFill(long Line 4087  escript::Data Rectangle::randomFill(long
4087      }      }
4088      double* Nout=new double[inset*Swidth];  memset(Nout, 0, inset*Swidth*sizeof(double));      double* Nout=new double[inset*Swidth];  memset(Nout, 0, inset*Swidth*sizeof(double));
4089      base=inset+(ext[1]-inset)*ext[0];      base=inset+(ext[1]-inset)*ext[0];
4090      for (uint i=0;i<inset;++i)      for (unsigned int i=0;i<inset;++i)
4091      {      {
4092      memcpy(Nout+Swidth*i, src+base, Swidth*sizeof(double));      memcpy(Nout+Swidth*i, src+base, Swidth*sizeof(double));
4093      base+=ext[0];      base+=ext[0];
# Line 4095  escript::Data Rectangle::randomFill(long Line 4095  escript::Data Rectangle::randomFill(long
4095            
4096      double* Eout=new double[inset*Eheight];  memset(Eout, 0, inset*Eheight*sizeof(double));      double* Eout=new double[inset*Eheight];  memset(Eout, 0, inset*Eheight*sizeof(double));
4097      base=ext[0]-inset+inset*ext[0];      base=ext[0]-inset+inset*ext[0];
4098      for (uint i=0;i<Eheight;++i)      for (unsigned int i=0;i<Eheight;++i)
4099      {      {
4100      memcpy(Eout+i*inset, src+base, inset*sizeof(double));      memcpy(Eout+i*inset, src+base, inset*sizeof(double));
4101      base+=ext[0];      base+=ext[0];
# Line 4208  escript::Data Rectangle::randomFill(long Line 4208  escript::Data Rectangle::randomFill(long
4208      if (swused)      if (swused)
4209      {      {
4210      base=0;      base=0;
4211      for (uint i=0;i<inset;++i)      for (unsigned int i=0;i<inset;++i)
4212      {      {
4213          memcpy(src+base, SWin+i*inset, inset*sizeof(double));          memcpy(src+base, SWin+i*inset, inset*sizeof(double));
4214          base+=ext[0];          base+=ext[0];
# Line 4217  escript::Data Rectangle::randomFill(long Line 4217  escript::Data Rectangle::randomFill(long
4217      if (seused)      if (seused)
4218      {      {
4219          base=ext[0]-inset;          base=ext[0]-inset;
4220      for (uint i=0;i<inset;++i)      for (unsigned int i=0;i<inset;++i)
4221      {      {
4222          memcpy(src+base, SEin+i*inset, inset*sizeof(double));          memcpy(src+base, SEin+i*inset, inset*sizeof(double));
4223          base+=ext[0];          base+=ext[0];
# Line 4226  escript::Data Rectangle::randomFill(long Line 4226  escript::Data Rectangle::randomFill(long
4226      if (nwused)      if (nwused)
4227      {      {
4228          base=(ext[1]-inset)*ext[0];          base=(ext[1]-inset)*ext[0];
4229      for (uint i=0;i<inset;++i)      for (unsigned int i=0;i<inset;++i)
4230      {      {
4231          memcpy(src+base, NWin+i*inset, inset*sizeof(double));          memcpy(src+base, NWin+i*inset, inset*sizeof(double));
4232          base+=ext[0];          base+=ext[0];
# Line 4235  escript::Data Rectangle::randomFill(long Line 4235  escript::Data Rectangle::randomFill(long
4235      if (sused)      if (sused)
4236      {      {
4237         base=inset;         base=inset;
4238         for (uint i=0;i<inset;++i)         for (unsigned int i=0;i<inset;++i)
4239         {         {
4240         memcpy(src+base, Sin+i*Swidth, Swidth*sizeof(double));         memcpy(src+base, Sin+i*Swidth, Swidth*sizeof(double));
4241         base+=ext[0];         base+=ext[0];
# Line 4244  escript::Data Rectangle::randomFill(long Line 4244  escript::Data Rectangle::randomFill(long
4244      if (wused)      if (wused)
4245      {      {
4246      base=inset*ext[0];      base=inset*ext[0];
4247      for (uint i=0;i<Eheight;++i)      for (unsigned int i=0;i<Eheight;++i)
4248      {      {
4249          memcpy(src+base, Win+i*inset, inset*sizeof(double));          memcpy(src+base, Win+i*inset, inset*sizeof(double));
4250          base+=ext[0];          base+=ext[0];

Legend:
Removed from v.4597  
changed lines
  Added in v.4599

  ViewVC Help
Powered by ViewVC 1.1.26