These pages are auto-generated from self-documenting comments embedded in class files.
For more information on breve and steve, refer to the breve homepage.

Abstract : PatchGrid

Class description:

PatchGrid is a class which allows you to create "patches". A Patch is a non-physical object which is associated with a specific area in the 3D world. This allows you to associate information or actions with specific areas in space, such as the presence of a chemical or nutrient at that area.

Use init-with to create a PatchGrid.

Methods:

  • decayChemicals
  • decreaseConcentration
  • diffuseChemicals
  • diffuseChemicalsPeriodically
  • disableSmoothDrawing
  • disableVolumetricDrawing
  • displayConcentrationInBlue
  • displayConcentrationInGreen
  • displayConcentrationInRed
  • enableSmoothDrawing
  • enableVolumetricDrawing
  • getConcentration
  • getGridPointer
  • getLocation
  • getPatch
  • getPatchAt
  • getPatchChemicals
  • getPatchSize
  • getPatches
  • getXCount
  • getYCount
  • getZCount
  • increaseConcentration
  • initAt
  • initWith
  • setConcentration
  • setPatchColorsToChemicalConcentrations
  • track
  • untrack
  • updateConcentrations
    decayChemicals( self )

    Updates the concentration of each PatchChemical by reducing the current concentraion by the decay rate. The decay rate is treated as either a linear or exponential rate depending on the chemical's decay type. This method is called automatically by update-concentrations.


    decreaseConcentration( self, theDiffusable, theValue, xIndex, yIndex, zIndex )

    Removes a quantify of the chemical to the patch. The quantity is divided by the patch volume to get the concentration removed. You don't normally call this directly


    diffuseChemicals( self )

    Updates the concentration of each PatchChemical being tracked in the patch grid by diffusing the chemicals according to their diffusion rates. This method is called automatically by update-concentrations.


    diffuseChemicalsPeriodically( self )

    Updates the concentration of each PatchChemical being tracked in the patch grid by diffusing the chemicals according to their diffusion rates. This method is called automatically by update-concentrations.


    disableSmoothDrawing( self )

    Disables smooth drawing for this PatchGrid. This is the default. See enable-smooth-drawing for details on smooth drawing.


    disableVolumetricDrawing( self )

    Disables volumetric drawing for this PatchGrid. The grid is drawn as individual cubes. This technique may produce better results visually, but is far slower than the volumetric rendering. See enable-volumetric-drawing for more details.


    displayConcentrationInBlue( self, theDiffusable )

    Selects the PatchChemical's concentration to use as the red channel when display-patch-chemical-concentrations is called.


    displayConcentrationInGreen( self, theDiffusable )

    Selects the PatchChemical's concentration to use as the red channel when display-patch-chemical-concentrations is called.


    displayConcentrationInRed( self, theDiffusable )

    Selects the PatchChemical's concentration to use as the red channel when display-patch-chemical-concentrations is called.


    enableSmoothDrawing( self )

    Enables smooth drawing for this PatchGrid. When smooth drawing is enabled, colors are blended smoothly between patches. Smooth drawing is disabled by default.

    Smooth drawing is desirable when a PatchGrid's colors display continuous gradients as with chemicals or temperature, but is undesirable when dealing with discrete states, as in cellular automata simulations.

    The method disable-smooth-drawing can be used to disable smooth drawing.


    enableVolumetricDrawing( self )

    Enables texture drawing for this PatchGrid. This is the default. With volumetric rendering, the grid is drawn as a series of overlapping textured planes. The rendering is fast, but the overlapping planes may leave some visual artifacts. To revert to the older style of cube rendering, see the method disable-volumetric-drawing.


    getConcentration( self, theDiffusable, xIndex, yIndex, zIndex )

    Gets the concentration of the chemical in the patch. Note that this is a normalized concentration. If you want the total concentration, multiply by the Patch size. You don't normally call this directly


    getGridPointer( self )


    getLocation( self )

    returns the center of the grid.


    getPatch( self, theLocation )

    Returns the Patch in which theLocation resides. Make sure you test for the validity of the returned object, since it is possible that there is no patch at the specified location.


    getPatchAt( self, xind, yind, zind )

    Returns the patch object associated with the specified indices. Note that this method may return a NULL object in the case that the indices given are out of bounds.


    getPatchChemicals( self )

    Returns all the chemicals currently being tracked in the patch grid.


    getPatchSize( self )

    Returns the vector size of a single patch.


    getPatches( self )

    Returns a list of all patch objects.


    getXCount( self )

    If the grid is initialized, returns the size of the grid on the X-axis.


    getYCount( self )

    If the grid is initialized, returns the size of the grid on the Y-axis.


    getZCount( self )

    If the grid is initialized, returns the size of the grid on the Z-axis.


    increaseConcentration( self, theDiffusable, theValue, xIndex, yIndex, zIndex )

    Adds a quantify of the chemical to the patch. The quantity is divided by the patch volume to get the concentration added. You don't normally call this directly


    initAt( self, x, y, z, gridCenter, pSize, patchclass )


    initWith( self, x, y, z, center, pSize, patchclass )

    Creates a PatchGrid centered at center, in which each Patch is a member of patchclass and is the size pSize and in which the total grid dimensions are x by y by z.

    Bear in mind that this will create a large number of objects: x * y * z. If you have an iterate method in your patch-class, then this can amount to a great deal of computation which can slow down your simulation.


    setConcentration( self, theDiffusable, xIndex, yIndex, zIndex, theValue )

    Sets the concentration of the chemical in the patch. Note that this is a normalized concentration. If you want to use total concentration, multiply by the Patch size first. You don't normally call this directly


    setPatchColorsToChemicalConcentrations( self )


    track( self, theDiffusable )

    Adds a new PatchChemical to the patch grid. This allows the patch grid to track the concentrations of the chemcial in each patch and allow diffusion between the patches.


    untrack( self, theDiffusable )

    Removes a PatchChemcial from the patch grid.


    updateConcentrations( self )

    Updates the concentrations of each PatchChemical being tracked in the patch grid. All chemicals with a diffusion rate greater than 0 diffuse into adjacent patches at their given rate and all chemicals with a decay rate greater than 0 decay.