/** * \brief Add the total concentration of an agent on received grid * * <p>Add the total concentration of an agent on received grid * * @param aSpG Spatial grid used to sum total mass */ public void fitMassOnGrid(SpatialGrid aSpG) { if (isDead) return; double value = _totalMass / aSpG.getVoxelVolume(); if (Double.isNaN(value) | Double.isInfinite(value)) value = 0; aSpG.addValueAt(value, _location); }
/** * \brief Add the reacting concentration of an agent to the received grid * * <p>Add the reacting concentration of an agent to the received grid * * @param aSpG Spatial grid used to sum catalysing mass * @param catalystIndex Index of the compartment of the cell supporting the reaction */ public void fitMassOnGrid(SpatialGrid aSpG, int catalystIndex) { if (isDead) return; double value = particleMass[catalystIndex] / aSpG.getVoxelVolume(); if (Double.isNaN(value) | Double.isInfinite(value)) value = 0; aSpG.addValueAt(value, _location); }
/** * \brief Add the reaction/growth rate of an agent on received grid, for a specified reaction * * <p>Add the total reaction/growth rate of an agent on received grid, for a specified reaction * * @param aRateGrid Spatial grid used to store total reaction rate * @param reactionIndex Index of this declared reaction in the simulation dictionary */ public void fitReacRateOnGrid(SpatialGrid aRateGrid, int reactionIndex) { if (isDead) return; // growthRate is in [fgX.hr-1] so convert to concentration: // [fgX.um-3.hr-1 = gX.L-1.hr-1] double value = growthRate[reactionIndex] / aRateGrid.getVoxelVolume(); if (Double.isNaN(value) | Double.isInfinite(value)) value = 0; aRateGrid.addValueAt(value, _location); }
@Override public Double getWeightFromLink(Link link, Coord cellCentroid) { Cell cellOfLink = links2Cells.get(link); if (cellOfLink == null) { return 0.0; } else { Cell receivingCell = grid.getCellForCoordinate(cellCentroid); return calcDistanceFactorFromCells(cellOfLink, receivingCell); } }
private Map<Link, Cell> mapLinksToGridCells(Collection<Link> links, SpatialGrid grid) { links2Cells = new HashMap<Link, Cell>(); for (Link link : links) { Cell cCell = grid.getCellForCoordinate(link.getCoord()); if (cCell != null) links2Cells.put(link, cCell); } System.out.println("Mapped " + links2Cells.size() + " links to grid"); System.out.println((links.size() - links2Cells.size()) + " links were not mapped."); return links2Cells; }
/** * \brief Add the total volume rate of an agent on received grid * * <p>Add the total volume rate of an agent on received grid * * @param aSpG Spatial grid used to sum volume */ public void fitVolRateOnGrid(SpatialGrid aSpG) { double value; value = _netVolumeRate / aSpG.getVoxelVolume(); if (Double.isNaN(value) | Double.isInfinite(value)) value = 0; aSpG.addValueAt(value, _location); }
@Override public Double getWeightFromCoord(Coord emittingCoord, Coord receivingCoord) { Cell emittingCell = grid.getCellForCoordinate(emittingCoord); Cell receivingCell = grid.getCellForCoordinate(receivingCoord); return calcDistanceFactorFromCells(emittingCell, receivingCell); }