The number of rows and columns of cells in the mold is given before
each mold in the input file, with row and column dimension of 0 denoting
the end of the input file. Here are things you can count on for each mold:
Each mold contains at least one void (blank), exactly one resin source (+) and exactly one resin sink (-).
All interior void cells are connected to the sink and source cells. That is, you may reach, through horizontal or vertical movements in void cells only, from any one void cell to either the source or sink.
No mold will consist of more than 100 horizonal or 100 vertical cells.
(2) At t=0, this completely fills the source cell with resin, and there is no overflow for the next time step.
(3) For t=1 and later, things are a little more complicated:
(3.2) Each cell on the boundary is filled by an equal fraction of the injected resin, plus any overflow from the previous injection: if there are N cells on the boundary, and A amount of overflow from the previous time step, then each is filled with (1+A)/N fraction of resin (in addition to whatever resin currently resided there)
(3.3) Any cell, except the resin sink (-), which is filled to
more than capacity by this step is instead filled exactly to capacity.
Because of roundoff errors, consider "full" to be a fill ratio of greater
than 0.999999. The overflow resin is added to what will be injected on
the next time step.
subroutine move_forward_in_time determine number of boundary cells fill=(1+overflow)/number_of_boundary_cells overflow=0 loop through all (i,j) which label boundary cells: fullness(i,j)=fullness(i,j) + fill if (fullness(i,j) > 0.999999) then overflow = overflow + (fullness(i,j)-1) fullness(i,j)=1 end if end loop fullness(sink_i,sink_j)=0 end subroutineFullness(i,j) is the double precision floating point number representing the fill ratio (0 for empty, 1 for full) of the cell at row i and column j.
The output file corresponding to the example input file should contain
2
3