Dear Tim,
First of all thank you so much for your fast reply and interest in my
request. I'm not really experienced in C++ language even if it seems
to be similar than Processing one. Here it is the program I was
working on in Processing basing on the paper I mentioned in my
previous message, what is wrong?
int N = 300;
//System parameters
float diffU;
float diffV;
float paramA;
float paramB;
float paramE;
boolean rndInitCondition;
float[][] U = new float[N][N];
float[][] V = new float[N][N];
float[][] dU = new float[N][N];
float[][] dV = new float[N][N];
int[][] offset = new int[N][2];
void generateInitialState() {
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < N; j++) {
        U[i][j] = 1.0;
        V[i][j] = 0.0;
      }
    }
      for (int i = N/2-2; i < N/2+2; i++) {
            for (int j = N/2-2; j < N/2+2; j++) {
               U[i][j] = 0.5;
               V[i][j] = 0.25;
          }
        }
    }
void setup() {
   size(N,N, P2D);
   frameRate(25);
   smooth();
   colorMode(RGB,1.0);
   //Set default parameters;
   diffU = 0.01;
   diffV = 0.1;
   float A = 0.18;
   float B = 0.14;
   float E = 0.025;
   rndInitCondition = true;
   //Populate U and V with initial data
   generateInitialState();
    //Set up offsets
    for (int i = 1; i < N-1; i++) {
      offset[i][0] = (i-1);
      offset[i][1] = (i+1);
    }
    offset[0][0] = N-1;
    offset[0][1] = 1;
    offset[N-1][0] = N-2;
    offset[N-1][1] = 0;
}
void timestep(float paramA, float paramB, float paramE, float diffU,
float diffV) {
      for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
          float u = U[i][j];
          float v = V[i][j];
          int left = offset[i][0];
          int right = offset[i][1];
          int up = offset[j][0];
          int down = offset[j][1];
          float lapU = (U[left][j] + U[right][j] + U[i][up] + U[i]
[down] - 4*u);
          float lapV = (V[left][j] + V[right][j] + V[i][up] + V[i]
[down] - 4*v);
          dU[i][j] = diffU*lapU  +(paramA-u)*(u-1)*u -v;
          dV[i][j] = diffV*lapV + paramE*(paramB*u-v);
        }
      }
    for (int i= 0; i < N; i++) {
      for (int j = 0; j < N; j++){
          U[i][j] += dU[i][j];
          V[i][j] += dV[i][j];
      }
    }
}
void draw(){
    for (int k = 0; k < 10; k++) {
       timestep(A, B, E, diffU, diffV);
    }
    // Draw points
    loadPixels();
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < N; j++) {
        pixels[N*j+i] = color((1-U[i][j]),0,0);
      }
    }
    updatePixels();
}
Thank you for your help!
Pier
> Here's a very simple implementation of FHN:
https://code.google.com/p/reaction-diffusion/source/browse/trunk/Fitz...
> (in C++ but don't let that put you off, it's almost the same as Processing)
>
> Here's the equivalent Gray-Scott:
https://code.google.com/p/reaction-diffusion/source/browse/trunk/Gray...
>
> The only other difference between the two systems is that the initial
> conditions are a bit differerent, but you can see that in the two cpp
> files linked above.
>
> If this doesn't help then show us your Processing implementation, I'm
> sure we can get it working for you.
>
> RD patterns and Architecture are a great combination.
>
> On 22 April 2012 12:29, Pier <
pier1...@gmail.com> wrote:
>
> > Hello everyone,
>
> > I am a student of Architecture and I have to program a FitzHugh Nagumo
> > model simulation of pattern formation using Processing. I reached to
> > program the Gray Scott model, which is similar than the FitzHugh
> > Nagumo, but then I can't build the other one. I was basing on this
> > paperhttp://
www.sid.ir/en/VEWSSID/J_pdf/84320115715.pdfbut I can't
> > achieve the pattern result. Can anyone please help me? I would like to
> > obtain a 2D simulation like thishttps://
www.youtube.com/watch?v=tZHOGFA1KZE
> > and then a 3D one like thishttps://
www.youtube.com/watch?v=oWgAtjDrc14.