private ParticleBoundaries createParticleBoundaries(SharedDataManager sharedDataManager) { DoubleBox simulationAreaInParticleDimensions = new DoubleBox( 0, localSettings.getSimulationWidth(), 0, localSettings.getSimulationHeight()); DoubleBox innerSimulationArea = new DoubleBox( 0, localSettings.getSimulationWidth() - localSettings.getCellWidth(), 0, localSettings.getSimulationHeight() - localSettings.getCellHeight()); return new DistributedParticleBoundaries( simulationAreaInParticleDimensions, innerSimulationArea, localSettings.getParticleBoundary(), sharedDataManager); }
/** * Determines the border cells and the indices of the corresponding ghost cells at remote nodes. * Since the corresponding border and ghost cells must have the same order, the ghost cells are * registered once the ghost cell indices (border cells map) is exchanged. */ private void setUpBorderCells(Cell[][] myCells) { DoubleBox simAreaDouble = new DoubleBox(0, settings.getSimulationWidth(), 0, settings.getSimulationHeight()); DoubleBox innerSimAreaDouble = new DoubleBox( settings.getCellWidth(), settings.getSimulationWidth() - settings.getCellWidth(), settings.getCellHeight(), settings.getSimulationHeight() - settings.getCellHeight()); BorderRegions borders = new BorderRegions(simAreaDouble, innerSimAreaDouble); int xmin = -Grid.INTERPOLATION_RADIUS; int xmax = myPartGlobal.xsize() + Grid.INTERPOLATION_RADIUS - 1; int ymin = -Grid.INTERPOLATION_RADIUS; int ymax = myPartGlobal.ysize() + Grid.INTERPOLATION_RADIUS - 1; for (int x = xmin; x <= xmax; x++) { for (int y = ymin; y <= ymax; y++) { double simX = x * settings.getCellWidth() + settings.getCellWidth() / 2; double simY = y * settings.getCellHeight() + settings.getCellHeight() / 2; int region = borders.getRegion(simX, simY); List<SharedData> sharedDatas = sharedDataManager.getBorderSharedData(region); List<Point> directions = sharedDataManager.getBorderDirections(region); assert sharedDatas.size() == directions.size(); for (int i = 0; i < sharedDatas.size(); ++i) { Point remoteGhostCellIndex = getRemoteGhostCellIndex(x, y, directions.get(i)); sharedDatas .get(i) .registerBorderCell(myCells[realIndex(x)][realIndex(y)], remoteGhostCellIndex); } } } }
private Interpolation createInterpolationIterator(SharedDataManager sharedDataManager) { DoubleBox zoneOfLocalInfluence = new DoubleBox( (Grid.INTERPOLATION_RADIUS - 1) * localSettings.getCellWidth(), localSettings.getSimulationWidth() - Grid.INTERPOLATION_RADIUS * localSettings.getCellWidth(), (Grid.INTERPOLATION_RADIUS - 1) * localSettings.getCellHeight(), localSettings.getSimulationHeight() - Grid.INTERPOLATION_RADIUS * localSettings.getCellHeight()); return new DistributedInterpolation( localSettings.getInterpolator(), sharedDataManager, zoneOfLocalInfluence, localSettings.getParticleIterator()); }