* Tests only one corner, one outside corner and one edge region.
*/
private void testSingleHardwallBorderMap(
int myPartID, IntBox[] partitions, IntBox globalSimulation, NeighborMap neighborMap) {
IntBox myPart = partitions[myPartID];
// Test bottom-right corner
int region = BorderRegions.X_BORDER_MAX + BorderRegions.Y_BORDER_MAX;
int[] neighbors = neighborMap.getBorderNeighbors(region);
String identification = identificationString(
GeneralBoundaryType.Hardwall, myPartID, region, "border-corner");
testPotentialNeighborsCount(3, neighbors.length, identification);
if (myPart.xmax() == globalSimulation.xmax() && myPart.ymax() == globalSimulation.ymax()) {
// If the region is at global simulation corner it can not have any neighbors
for (int neighbor: neighbors) {
testForNoNeighbor(neighbor, identification);
}
}
else if (myPart.xmax() == globalSimulation.xmax() || myPart.ymax() == globalSimulation.ymax()) {
// If the region is not at global simulation corner but at its edge
// it must have exactly one neighbor
testForSingleNeighbor(neighbors, partitions.length, identification);
} else {
// If the region is inside the global simulation it must have exactly 3 neighbors
for (int neighbor: neighbors) {
testForAnyNeighbor(neighbor, partitions.length, identification);
}
}
// Test right-top outside corner
region = BorderRegions.X_BOUNDARY_MAX + BorderRegions.Y_BORDER_MIN;
neighbors = neighborMap.getBorderNeighbors(region);
identification = identificationString(
GeneralBoundaryType.Hardwall, myPartID, region, "border-outside-corner");
testPotentialNeighborsCount(1, neighbors.length, identification);
if (myPart.xmax() == globalSimulation.xmax() && myPart.ymin() != globalSimulation.ymin()) {
testForAnyNeighbor(neighbors[0], partitions.length, identification);
}
else {
testForNoNeighbor(neighbors[0], identification);
}
// Test left edge
region = BorderRegions.X_BORDER_MIN + BorderRegions.Y_CENTER;
neighbors = neighborMap.getBorderNeighbors(region);
identification = identificationString(
GeneralBoundaryType.Hardwall, myPartID, region, "border-edge");
testPotentialNeighborsCount(1, neighbors.length, identification);
if (myPart.xmin() != globalSimulation.xmin()) {
testForAnyNeighbor(neighbors[0], partitions.length, identification);
}
else {
testForNoNeighbor(neighbors[0], identification);
}