Skip to content

Repository files navigation

# By Kirill Aristarkhov and Brandon Katz for CS140 S22

# PDF REPORT IS INCLUDED IN THE SUBMISSION FOLDER
# WE ATTACH A LINK TO GOOGLE DRIVE FOR LARGE INPUT FILES

TO COMPILE:
        make
    or  make flood
    or  g++ -Wall -std=c++11 -o flood flood.cpp -fopenmp -lpthread

TO RUN THE EXECUTABLE:
    # NOTE: program runs on .ppm image format files with square dimensions
    GRID CREATION MODE: ./flood grid < <input_file>
    # The program takes a file (.txt) as input and parses it into parameters.
    # For the grid creation mode, the input file should be formatted as follows:
        <square_image_dimention> <number_of_traces_in_grid> <number_of_threads> <number_of_regions_to_fill>
        <y/n> # Choose whether to fill random regions <y> or select them manually <n>
        # If manual filling is chosen, the program will ask to provide points to start filling from.
        <x_coord_0> <y_coord_0>
        <x_coord_1> <y_coord_1>
        ... 
        <x_coord_n> <y_coord_n>
    
    # Example input files:
        100 10 16 20
        y
    # or
        100 10 16 2
        n
        1 1
        10 10

    PRELOADED IMAGE MODE: ./flood load < <input_file>
    # NOTE: the input .ppm files must consist of only white (255,255,255) and black (0,0,0) pixels
    # The program takes a file (.txt) as input and parses it into parameters.
    # For the preloaded image mode, the input file should be formatted as follows:
        <square_image_dimention> <number_of_threads> <input_file_name.ppm> <number_of_regions_to_fill>
        <y/n> # Choose whether to fill random regions <y> or select them manually <n>
        # If manual filling is chosen, the program will ask to provide points to start filling from.
        <x_coord_0> <y_coord_0>
        <x_coord_1> <y_coord_1>
        ... 
        <x_coord_n> <y_coord_n>
    
    # Example input files:
        1300 10
        input.ppm
        1000
        y
    # or
        1300 10
        input.ppm
        1000
        n
        1 1
        10 10
        290 23
        ... ...

TO REMOVE ALL EXECUTABLES:
    make clean

# EXAMPLE FILES TO RUN THE PROGRAM:
    # Grid creation mode:
        ./flood grid < random_grid_params.txt # Random grid
    # Preloaded image mode:
        ./flood load < eleph_params.txt # Elephant
        ./flood load < many_squares_params.txt # Static grid with many squares (On Google Drive)
        ./flood load < large_squares_params.txt # Static grid with large squares (On Google Drive)
    # Google Drive link: https://drive.google.com/drive/folders/1DMmqIbfLuwNw-UdK4zaNo7xSjmapIZAw?usp=sharing

About

Exploring multithreading as means of increasing performance of a raster flood fill algorithm on large scale.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages