From c84d1d5d867123fb59ef102bc42f88098691f73e Mon Sep 17 00:00:00 2001 From: Joris van Zwieten <zwieten@astron.nl> Date: Tue, 25 Jul 2006 09:47:56 +0000 Subject: [PATCH] BugID: 825 - special case where the entire output domain lies 'to the left' of the first sample in the input domain, or 'to the right' of the last sample of the input domain now handled properly. --- CEP/BB/BBS/src/MNS/MeqTabular.cc | 6 ++++-- CEP/BB/BBSKernel/src/MNS/MeqTabular.cc | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CEP/BB/BBS/src/MNS/MeqTabular.cc b/CEP/BB/BBS/src/MNS/MeqTabular.cc index 74b0cd567cc..bccfa4676dc 100644 --- a/CEP/BB/BBS/src/MNS/MeqTabular.cc +++ b/CEP/BB/BBS/src/MNS/MeqTabular.cc @@ -29,6 +29,8 @@ #include <BBS/MNS/MeqMatrixTmp.h> #include <Common/LofarLogger.h> +#define MIN(__a, __b) __a <= __b ? __a : __b; + using namespace std; using namespace casa; @@ -132,7 +134,7 @@ namespace LOFAR // first input cell. if(outCenter < inCenter) { - leftBoundaryCells = (int) ceil((inCenter - outCenter) / outScale.first); + leftBoundaryCells = MIN((int) ceil((inCenter - outCenter) / outScale.first), outCount.first); } // Compute the number of boundary cells on the right. This is the number of @@ -140,7 +142,7 @@ namespace LOFAR // last input cell. if((outDomain.endX() - 0.5 * outScale.first) > (inDomain.endX() - 0.5 * inScale.first)) { - rightBoundaryCells = (int) ceil(((outDomain.endX() - 0.5 * outScale.first) - (inDomain.endX() - 0.5 * inScale.first)) / outScale.first); + rightBoundaryCells = MIN((int) ceil(((outDomain.endX() - 0.5 * outScale.first) - (inDomain.endX() - 0.5 * inScale.first)) / outScale.first), outCount.first); } // Compute the values of the left boundary cells. A choice has to be made diff --git a/CEP/BB/BBSKernel/src/MNS/MeqTabular.cc b/CEP/BB/BBSKernel/src/MNS/MeqTabular.cc index 74b0cd567cc..bccfa4676dc 100644 --- a/CEP/BB/BBSKernel/src/MNS/MeqTabular.cc +++ b/CEP/BB/BBSKernel/src/MNS/MeqTabular.cc @@ -29,6 +29,8 @@ #include <BBS/MNS/MeqMatrixTmp.h> #include <Common/LofarLogger.h> +#define MIN(__a, __b) __a <= __b ? __a : __b; + using namespace std; using namespace casa; @@ -132,7 +134,7 @@ namespace LOFAR // first input cell. if(outCenter < inCenter) { - leftBoundaryCells = (int) ceil((inCenter - outCenter) / outScale.first); + leftBoundaryCells = MIN((int) ceil((inCenter - outCenter) / outScale.first), outCount.first); } // Compute the number of boundary cells on the right. This is the number of @@ -140,7 +142,7 @@ namespace LOFAR // last input cell. if((outDomain.endX() - 0.5 * outScale.first) > (inDomain.endX() - 0.5 * inScale.first)) { - rightBoundaryCells = (int) ceil(((outDomain.endX() - 0.5 * outScale.first) - (inDomain.endX() - 0.5 * inScale.first)) / outScale.first); + rightBoundaryCells = MIN((int) ceil(((outDomain.endX() - 0.5 * outScale.first) - (inDomain.endX() - 0.5 * inScale.first)) / outScale.first), outCount.first); } // Compute the values of the left boundary cells. A choice has to be made -- GitLab