cnn_setenv;
mCNN.TemGroup = 'temlib_diff';

img = loadCNN('init_heat.bmp');

input = zeros(size(img));
mCNN.INPUT1 = input;
init_state = img;
mCNN.STATE = 1.*init_state; %init_state;
mCNN.Boundary = 2; % [-1 ... 1] --> const, 2 --> zeroflux, 3 --> periodic
mCNN.TimeStep = 0.01;
mCNN.IterNum = 3;
loadtem('HEAT2D');

% and plot the results:
figure;
subplot(1, 3, 1);
surf(input);
title('input', 'FontSize', 12, 'FontWeight', 'bold');
subplot(1, 3, 2);
surf(init_state); %init_state);
title('initial state', 'FontSize', 12, 'FontWeight', 'bold');
subplot(1, 3, 3);
for ind = 1:100
    runtem; % run the simulator
    surf(mCNN.OUTPUT);
    set(gca, 'ZLim', [-1, 1]);
    drawnow
    title(['output i=', num2str(ind)], 'FontSize', 12, 'FontWeight', 'bold');
end

