diff --git a/include/distances.c b/include/distances.c index bb126e9..30fce84 100644 --- a/include/distances.c +++ b/include/distances.c @@ -24,11 +24,11 @@ void HaversineDouble(const double* rrmStart, double mRadiusSphere, double* mDistance) { - int iPoint, iPointEnd, iPointStart; + int iPoint; #pragma omp parallel for if (nPoints > omp_get_num_procs() * THREADING_CORES_MULTIPLIER) for (iPoint = 0; iPoint < nPoints; ++iPoint) { - iPointEnd = iPoint * NCOORDSINPOINT; - iPointStart = iPointEnd * isArraysSizeEqual; + int iPointEnd = iPoint * NCOORDSINPOINT; + int iPointStart = iPointEnd * isArraysSizeEqual; mDistance[iPoint] = 2.0 * mRadiusSphere * asin(sqrt((1.0 - cos(rrmEnd[iPointEnd] - rrmStart[iPointStart]) + cos(rrmStart[iPointStart]) * cos(rrmEnd[iPointEnd]) * (1.0 - cos(rrmEnd[iPointEnd + 1] - rrmStart[iPointStart + 1]))) / 2.0)); } } @@ -53,11 +53,11 @@ void HaversineFloat(const float* rrmStart, float mRadiusSphere, float* mDistance) { - int iPoint, iPointEnd, iPointStart; + int iPoint; #pragma omp parallel for if (nPoints > omp_get_num_procs() * THREADING_CORES_MULTIPLIER) for (iPoint = 0; iPoint < nPoints; ++iPoint) { - iPointEnd = iPoint * NCOORDSINPOINT; - iPointStart = iPointEnd * isArraysSizeEqual; + int iPointEnd = iPoint * NCOORDSINPOINT; + int iPointStart = iPointEnd * isArraysSizeEqual; mDistance[iPoint] = (float)(2.0) * mRadiusSphere * asinf(sqrtf(((float)(1.0) - cosf(rrmEnd[iPointEnd] - rrmStart[iPointStart]) + cosf(rrmStart[iPointStart]) * cosf(rrmEnd[iPointEnd]) * ((float)(1.0) - cosf(rrmEnd[iPointEnd + 1] - rrmStart[iPointStart + 1]))) / (float)(2.0))); } } diff --git a/include/helpers.c b/include/helpers.c index 4dc82a0..be4a736 100644 --- a/include/helpers.c +++ b/include/helpers.c @@ -126,10 +126,10 @@ void XXM2YYMDouble(const double* rrmPoint, const double transform, double* ddmPoint) { - int iPoint, i; + int iPoint; #pragma omp parallel for if (nPoints > omp_get_num_procs() * THREADING_CORES_MULTIPLIER) for (iPoint = 0; iPoint < nPoints; ++iPoint) { - i = iPoint * NCOORDSINPOINT; + int i = iPoint * NCOORDSINPOINT; ddmPoint[i + 0] = rrmPoint[i + 0] * transform; ddmPoint[i + 1] = rrmPoint[i + 1] * transform; ddmPoint[i + 2] = rrmPoint[i + 2]; @@ -148,10 +148,10 @@ void XXM2YYMFloat(const float* rrmPoint, const float transform, float* ddmPoint) { - int iPoint, i; + int iPoint; #pragma omp parallel for if (nPoints > omp_get_num_procs() * THREADING_CORES_MULTIPLIER) for (iPoint = 0; iPoint < nPoints; ++iPoint) { - i = iPoint * NCOORDSINPOINT; + int i = iPoint * NCOORDSINPOINT; ddmPoint[i + 0] = rrmPoint[i + 0] * transform; ddmPoint[i + 1] = rrmPoint[i + 1] * transform; ddmPoint[i + 2] = rrmPoint[i + 2]; @@ -167,8 +167,9 @@ void WrapsFloat3(const float* val, int nPoints, float* boundedVal) { + int iPoint; #pragma omp parallel for if (nPoints > omp_get_num_procs() * THREADING_CORES_MULTIPLIER) - for (int iPoint = 0; iPoint < nPoints; ++iPoint) { + for (iPoint = 0; iPoint < nPoints; ++iPoint) { boundedVal[iPoint] = fmodf(val[iPoint] - minVal[iPoint], maxVal[iPoint] - minVal[iPoint]) + minVal[iPoint]; if (boundedVal[iPoint] < minVal[iPoint]) boundedVal[iPoint] += maxVal[iPoint] - minVal[iPoint]; @@ -184,8 +185,9 @@ void WrapsDouble3(const double* val, int nPoints, double* boundedVal) { + int iPoint; #pragma omp parallel for if (nPoints > omp_get_num_procs() * THREADING_CORES_MULTIPLIER) - for (int iPoint = 0; iPoint < nPoints; ++iPoint) { + for (iPoint = 0; iPoint < nPoints; ++iPoint) { boundedVal[iPoint] = fmod(val[iPoint] - minVal[iPoint], maxVal[iPoint] - minVal[iPoint]) + minVal[iPoint]; if (boundedVal[iPoint] < minVal[iPoint]) boundedVal[iPoint] += maxVal[iPoint] - minVal[iPoint]; @@ -201,8 +203,9 @@ void WrapsFloat1(const float* val, int nPoints, float* boundedVal) { + int iPoint; #pragma omp parallel for if (nPoints > omp_get_num_procs() * THREADING_CORES_MULTIPLIER) - for (int iPoint = 0; iPoint < nPoints; ++iPoint) { + for (iPoint = 0; iPoint < nPoints; ++iPoint) { boundedVal[iPoint] = fmodf(val[iPoint] - minVal, maxVal - minVal) + minVal; if (boundedVal[iPoint] < minVal) boundedVal[iPoint] += maxVal - minVal; @@ -218,8 +221,9 @@ void WrapsDouble1(const double* val, int nPoints, double* boundedVal) { + int iPoint; #pragma omp parallel for if (nPoints > omp_get_num_procs() * THREADING_CORES_MULTIPLIER) - for (int iPoint = 0; iPoint < nPoints; ++iPoint) { + for (iPoint = 0; iPoint < nPoints; ++iPoint) { boundedVal[iPoint] = fmod(val[iPoint] - minVal, maxVal - minVal) + minVal; if (boundedVal[iPoint] < minVal) boundedVal[iPoint] += maxVal - minVal; diff --git a/include/transforms.c b/include/transforms.c index f9a4eed..72811d8 100644 --- a/include/transforms.c +++ b/include/transforms.c @@ -24,12 +24,11 @@ void geodetic2ECEFFloat(const float* rrmLLA, float* mmmXYZ) { float e2 = 1 - (b * b) / (a * a); - int iPoint, i; - float N; + int iPoint; #pragma omp parallel for if (nPoints > omp_get_num_procs() * THREADING_CORES_MULTIPLIER) for (iPoint = 0; iPoint < nPoints; ++iPoint) { - i = iPoint * NCOORDSINPOINT; - N = a / sqrtf(1 - e2 * (sinf(rrmLLA[i + 0]) * sinf(rrmLLA[i + 0]))); + int i = iPoint * NCOORDSINPOINT; + float N = a / sqrtf(1 - e2 * (sinf(rrmLLA[i + 0]) * sinf(rrmLLA[i + 0]))); mmmXYZ[i + 0] = (N + rrmLLA[i + 2]) * cosf(rrmLLA[i + 0]) * cosf(rrmLLA[i + 1]); mmmXYZ[i + 1] = (N + rrmLLA[i + 2]) * cosf(rrmLLA[i + 0]) * sinf(rrmLLA[i + 1]); mmmXYZ[i + 2] = ((1 - e2) * N + rrmLLA[i + 2]) * sinf(rrmLLA[i + 0]); @@ -54,12 +53,11 @@ void geodetic2ECEFDouble(const double* rrmLLA, double* mmmXYZ) { double e2 = 1 - (b * b) / (a * a); - int iPoint, i; - double N; + int iPoint; #pragma omp parallel for if (nPoints > omp_get_num_procs() * THREADING_CORES_MULTIPLIER) for (iPoint = 0; iPoint < nPoints; ++iPoint) { - i = iPoint * NCOORDSINPOINT; - N = a / sqrt(1 - e2 * sin(rrmLLA[i + 0]) * sin(rrmLLA[i + 0])); + int i = iPoint * NCOORDSINPOINT; + double N = a / sqrt(1 - e2 * sin(rrmLLA[i + 0]) * sin(rrmLLA[i + 0])); mmmXYZ[i + 0] = (N + rrmLLA[i + 2]) * cos(rrmLLA[i + 0]) * cos(rrmLLA[i + 1]); mmmXYZ[i + 1] = (N + rrmLLA[i + 2]) * cos(rrmLLA[i + 0]) * sin(rrmLLA[i + 1]); mmmXYZ[i + 2] = ((1 - e2) * N + rrmLLA[i + 2]) * sin(rrmLLA[i + 0]); @@ -83,26 +81,25 @@ void ECEF2geodeticFloat(const float* mmmXYZ, float b, float* rrmLLA) { - int iPoint, i; - float p, F, G, c, s, k, P, Q, r0, U, V, z0, e2, ed2, half; - half = 0.5; - e2 = ((a * a) - (b * b)) / (a * a); - ed2 = ((a * a) - (b * b)) / (b * b); + int iPoint; + float half = 0.5; + float e2 = ((a * a) - (b * b)) / (a * a); + float ed2 = ((a * a) - (b * b)) / (b * b); #pragma omp parallel for if (nPoints > omp_get_num_procs() * THREADING_CORES_MULTIPLIER) for (iPoint = 0; iPoint < nPoints; ++iPoint) { - i = iPoint * NCOORDSINPOINT; - p = sqrtf(mmmXYZ[i + 0] * mmmXYZ[i + 0] + mmmXYZ[i + 1] * mmmXYZ[i + 1]); - F = 54 * b * b * mmmXYZ[i + 2] * mmmXYZ[i + 2]; - G = p * p + (1 - e2) * mmmXYZ[i + 2] * mmmXYZ[i + 2] - e2 * (a * a - b * b); - c = e2 * e2 * F * p * p / (G * G * G); - s = cbrtf(1 + c + sqrtf(c * c + 2 * c)); - k = s + 1 + 1 / s; - P = F / (3 * k * k * G * G); - Q = sqrtf(1 + 2 * e2 * e2 * P); - r0 = -P * e2 * p / (1 + Q) + sqrtf(half * a * a * (1 + 1 / Q) - P * (1 - e2) * mmmXYZ[i + 2] * mmmXYZ[i + 2] / (Q * (1 + Q)) - half * P * p * p); - U = sqrtf((p - e2 * r0) * (p - e2 * r0) + mmmXYZ[i + 2] * mmmXYZ[i + 2]); - V = sqrtf((p - e2 * r0) * (p - e2 * r0) + (1 - e2) * mmmXYZ[i + 2] * mmmXYZ[i + 2]); - z0 = b * b * mmmXYZ[i + 2] / (a * V); + int i = iPoint * NCOORDSINPOINT; + float p = sqrtf(mmmXYZ[i + 0] * mmmXYZ[i + 0] + mmmXYZ[i + 1] * mmmXYZ[i + 1]); + float F = 54 * b * b * mmmXYZ[i + 2] * mmmXYZ[i + 2]; + float G = p * p + (1 - e2) * mmmXYZ[i + 2] * mmmXYZ[i + 2] - e2 * (a * a - b * b); + float c = e2 * e2 * F * p * p / (G * G * G); + float s = cbrtf(1 + c + sqrtf(c * c + 2 * c)); + float k = s + 1 + 1 / s; + float P = F / (3 * k * k * G * G); + float Q = sqrtf(1 + 2 * e2 * e2 * P); + float r0 = -P * e2 * p / (1 + Q) + sqrtf(half * a * a * (1 + 1 / Q) - P * (1 - e2) * mmmXYZ[i + 2] * mmmXYZ[i + 2] / (Q * (1 + Q)) - half * P * p * p); + float U = sqrtf((p - e2 * r0) * (p - e2 * r0) + mmmXYZ[i + 2] * mmmXYZ[i + 2]); + float V = sqrtf((p - e2 * r0) * (p - e2 * r0) + (1 - e2) * mmmXYZ[i + 2] * mmmXYZ[i + 2]); + float z0 = b * b * mmmXYZ[i + 2] / (a * V); rrmLLA[i + 0] = atanf((mmmXYZ[i + 2] + ed2 * z0) / p); rrmLLA[i + 1] = atan2f(mmmXYZ[i + 1], mmmXYZ[i + 0]); rrmLLA[i + 2] = U * (1 - b * b / (a * V)); @@ -128,10 +125,10 @@ void ECEF2geodeticDouble(const double* mmmXYZ, { double e2 = ((a * a) - (b * b)) / (a * a); double ed2 = ((a * a) - (b * b)) / (b * b); - int iPoint, i; + int iPoint; #pragma omp parallel for if (nPoints > omp_get_num_procs() * THREADING_CORES_MULTIPLIER) for (iPoint = 0; iPoint < nPoints; ++iPoint) { - i = iPoint * NCOORDSINPOINT; + int i = iPoint * NCOORDSINPOINT; double p = sqrt(mmmXYZ[i + 0] * mmmXYZ[i + 0] + mmmXYZ[i + 1] * mmmXYZ[i + 1]); double F = 54 * b * b * mmmXYZ[i + 2] * mmmXYZ[i + 2]; double G = p * p + (1 - e2) * mmmXYZ[i + 2] * mmmXYZ[i + 2] - e2 * (a * a - b * b); @@ -173,15 +170,14 @@ void ECEF2ENUFloat(const float* rrmLLALocalOrigin, int nOriginPoints = (nTargets - 1) * isOriginSizeOfTargets + 1; float* mmmXYZLocalOrigin = (float*)malloc(nOriginPoints * NCOORDSINPOINT * sizeof(float)); geodetic2ECEFFloat(rrmLLALocalOrigin, nOriginPoints, (float)(a), (float)(b), mmmXYZLocalOrigin); - float DeltaX, DeltaY, DeltaZ; - int iPoint, iTarget, iOrigin; + int iPoint; #pragma omp parallel for if (nTargets > omp_get_num_procs() * THREADING_CORES_MULTIPLIER) for (iPoint = 0; iPoint < nTargets; ++iPoint) { - iTarget = iPoint * NCOORDSINPOINT; - iOrigin = iTarget * isOriginSizeOfTargets; - DeltaX = mmmXYZTarget[iTarget + 0] - mmmXYZLocalOrigin[iOrigin + 0]; - DeltaY = mmmXYZTarget[iTarget + 1] - mmmXYZLocalOrigin[iOrigin + 1]; - DeltaZ = mmmXYZTarget[iTarget + 2] - mmmXYZLocalOrigin[iOrigin + 2]; + int iTarget = iPoint * NCOORDSINPOINT; + int iOrigin = iTarget * isOriginSizeOfTargets; + float DeltaX = mmmXYZTarget[iTarget + 0] - mmmXYZLocalOrigin[iOrigin + 0]; + float DeltaY = mmmXYZTarget[iTarget + 1] - mmmXYZLocalOrigin[iOrigin + 1]; + float DeltaZ = mmmXYZTarget[iTarget + 2] - mmmXYZLocalOrigin[iOrigin + 2]; mmmLocal[iTarget + 0] = -sinf(rrmLLALocalOrigin[iOrigin + 1]) * DeltaX + cosf(rrmLLALocalOrigin[iOrigin + 1]) * DeltaY; mmmLocal[iTarget + 1] = -sinf(rrmLLALocalOrigin[iOrigin + 0]) * cosf(rrmLLALocalOrigin[iOrigin + 1]) * DeltaX + -sinf(rrmLLALocalOrigin[iOrigin + 0]) * sinf(rrmLLALocalOrigin[iOrigin + 1]) * DeltaY + cosf(rrmLLALocalOrigin[iOrigin + 0]) * DeltaZ; mmmLocal[iTarget + 2] = cosf(rrmLLALocalOrigin[iOrigin + 0]) * cosf(rrmLLALocalOrigin[iOrigin + 1]) * DeltaX + cosf(rrmLLALocalOrigin[iOrigin + 0]) * sinf(rrmLLALocalOrigin[iOrigin + 1]) * DeltaY + sinf(rrmLLALocalOrigin[iOrigin + 0]) * DeltaZ; @@ -213,15 +209,14 @@ void ECEF2ENUDouble(const double* rrmLLALocalOrigin, double* mmmXYZLocalOrigin = (double*)malloc(nOriginPoints * NCOORDSINPOINT * sizeof(double)); geodetic2ECEFDouble( rrmLLALocalOrigin, nOriginPoints, a, b, mmmXYZLocalOrigin); - double DeltaX, DeltaY, DeltaZ; - int iPoint, iTarget, iOrigin; + int iPoint; #pragma omp parallel for if (nTargets > omp_get_num_procs() * THREADING_CORES_MULTIPLIER) for (iPoint = 0; iPoint < nTargets; ++iPoint) { - iTarget = iPoint * NCOORDSINPOINT; - iOrigin = iTarget * isOriginSizeOfTargets; - DeltaX = mmmXYZTarget[iTarget + 0] - mmmXYZLocalOrigin[iOrigin + 0]; - DeltaY = mmmXYZTarget[iTarget + 1] - mmmXYZLocalOrigin[iOrigin + 1]; - DeltaZ = mmmXYZTarget[iTarget + 2] - mmmXYZLocalOrigin[iOrigin + 2]; + int iTarget = iPoint * NCOORDSINPOINT; + int iOrigin = iTarget * isOriginSizeOfTargets; + double DeltaX = mmmXYZTarget[iTarget + 0] - mmmXYZLocalOrigin[iOrigin + 0]; + double DeltaY = mmmXYZTarget[iTarget + 1] - mmmXYZLocalOrigin[iOrigin + 1]; + double DeltaZ = mmmXYZTarget[iTarget + 2] - mmmXYZLocalOrigin[iOrigin + 2]; mmmLocal[iTarget + 0] = -sin(rrmLLALocalOrigin[iOrigin + 1]) * DeltaX + cos(rrmLLALocalOrigin[iOrigin + 1]) * DeltaY; mmmLocal[iTarget + 1] = -sin(rrmLLALocalOrigin[iOrigin + 0]) * cos(rrmLLALocalOrigin[iOrigin + 1]) * DeltaX + -sin(rrmLLALocalOrigin[iOrigin + 0]) * sin(rrmLLALocalOrigin[iOrigin + 1]) * DeltaY + cos(rrmLLALocalOrigin[iOrigin + 0]) * DeltaZ; mmmLocal[iTarget + 2] = cos(rrmLLALocalOrigin[iOrigin + 0]) * cos(rrmLLALocalOrigin[iOrigin + 1]) * DeltaX + cos(rrmLLALocalOrigin[iOrigin + 0]) * sin(rrmLLALocalOrigin[iOrigin + 1]) * DeltaY + sin(rrmLLALocalOrigin[iOrigin + 0]) * DeltaZ; @@ -241,15 +236,14 @@ void ECEF2NEDFloat(const float* rrmLLALocalOrigin, float* mmmXYZLocalOrigin = (float*)malloc(nOriginPoints * NCOORDSINPOINT * sizeof(float)); geodetic2ECEFFloat( rrmLLALocalOrigin, nOriginPoints, a, b, mmmXYZLocalOrigin); - float DeltaX, DeltaY, DeltaZ; - int iPoint, iTarget, iOrigin; + int iPoint; #pragma omp parallel for if (nTargets > omp_get_num_procs() * THREADING_CORES_MULTIPLIER) for (iPoint = 0; iPoint < nTargets; ++iPoint) { - iTarget = iPoint * NCOORDSINPOINT; - iOrigin = iTarget * isOriginSizeOfTargets; - DeltaX = mmmXYZTarget[iTarget + 0] - mmmXYZLocalOrigin[iOrigin + 0]; - DeltaY = mmmXYZTarget[iTarget + 1] - mmmXYZLocalOrigin[iOrigin + 1]; - DeltaZ = mmmXYZTarget[iTarget + 2] - mmmXYZLocalOrigin[iOrigin + 2]; + int iTarget = iPoint * NCOORDSINPOINT; + int iOrigin = iTarget * isOriginSizeOfTargets; + float DeltaX = mmmXYZTarget[iTarget + 0] - mmmXYZLocalOrigin[iOrigin + 0]; + float DeltaY = mmmXYZTarget[iTarget + 1] - mmmXYZLocalOrigin[iOrigin + 1]; + float DeltaZ = mmmXYZTarget[iTarget + 2] - mmmXYZLocalOrigin[iOrigin + 2]; mmmLocal[iTarget + 0] = -sinf(rrmLLALocalOrigin[iOrigin + 0]) * cosf(rrmLLALocalOrigin[iOrigin + 1]) * DeltaX + -sinf(rrmLLALocalOrigin[iOrigin + 0]) * sinf(rrmLLALocalOrigin[iOrigin + 1]) * DeltaY + cosf(rrmLLALocalOrigin[iOrigin + 0]) * DeltaZ; mmmLocal[iTarget + 1] = -sinf(rrmLLALocalOrigin[iOrigin + 1]) * DeltaX + cosf(rrmLLALocalOrigin[iOrigin + 1]) * DeltaY; mmmLocal[iTarget + 2] = -cosf(rrmLLALocalOrigin[iOrigin + 0]) * cosf(rrmLLALocalOrigin[iOrigin + 1]) * DeltaX + -cosf(rrmLLALocalOrigin[iOrigin + 0]) * sinf(rrmLLALocalOrigin[iOrigin + 1]) * DeltaY + -sinf(rrmLLALocalOrigin[iOrigin + 0]) * DeltaZ; @@ -269,15 +263,14 @@ void ECEF2NEDDouble(const double* rrmLLALocalOrigin, double* mmmXYZLocalOrigin = (double*)malloc(nOriginPoints * NCOORDSINPOINT * sizeof(double)); geodetic2ECEFDouble( rrmLLALocalOrigin, nOriginPoints, a, b, mmmXYZLocalOrigin); - double DeltaX, DeltaY, DeltaZ; - int iPoint, iTarget, iOrigin; + int iPoint; #pragma omp parallel for if (nTargets > omp_get_num_procs() * THREADING_CORES_MULTIPLIER) for (iPoint = 0; iPoint < nTargets; ++iPoint) { - iTarget = iPoint * NCOORDSINPOINT; - iOrigin = iTarget * isOriginSizeOfTargets; - DeltaX = mmmXYZTarget[iTarget + 0] - mmmXYZLocalOrigin[iOrigin + 0]; - DeltaY = mmmXYZTarget[iTarget + 1] - mmmXYZLocalOrigin[iOrigin + 1]; - DeltaZ = mmmXYZTarget[iTarget + 2] - mmmXYZLocalOrigin[iOrigin + 2]; + int iTarget = iPoint * NCOORDSINPOINT; + int iOrigin = iTarget * isOriginSizeOfTargets; + double DeltaX = mmmXYZTarget[iTarget + 0] - mmmXYZLocalOrigin[iOrigin + 0]; + double DeltaY = mmmXYZTarget[iTarget + 1] - mmmXYZLocalOrigin[iOrigin + 1]; + double DeltaZ = mmmXYZTarget[iTarget + 2] - mmmXYZLocalOrigin[iOrigin + 2]; mmmLocal[iTarget + 0] = -sin(rrmLLALocalOrigin[iOrigin + 0]) * cos(rrmLLALocalOrigin[iOrigin + 1]) * DeltaX + -sin(rrmLLALocalOrigin[iOrigin + 0]) * sin(rrmLLALocalOrigin[iOrigin + 1]) * DeltaY + cos(rrmLLALocalOrigin[iOrigin + 0]) * DeltaZ; mmmLocal[iTarget + 1] = -sin(rrmLLALocalOrigin[iOrigin + 1]) * DeltaX + cos(rrmLLALocalOrigin[iOrigin + 1]) * DeltaY; mmmLocal[iTarget + 2] = -cos(rrmLLALocalOrigin[iOrigin + 0]) * cos(rrmLLALocalOrigin[iOrigin + 1]) * DeltaX + -cos(rrmLLALocalOrigin[iOrigin + 0]) * sin(rrmLLALocalOrigin[iOrigin + 1]) * DeltaY + -sin(rrmLLALocalOrigin[iOrigin + 0]) * DeltaZ; @@ -291,11 +284,11 @@ void ECEF2NEDvFloat(const float* rrmLLALocalOrigin, int isOriginSizeOfTargets, float* mmmLocal) { - int iPoint, iTarget, iOrigin; + int iPoint; #pragma omp parallel for if (nTargets > omp_get_num_procs() * THREADING_CORES_MULTIPLIER) for (iPoint = 0; iPoint < nTargets; ++iPoint) { - iTarget = iPoint * NCOORDSINPOINT; - iOrigin = iTarget * isOriginSizeOfTargets; + int iTarget = iPoint * NCOORDSINPOINT; + int iOrigin = iTarget * isOriginSizeOfTargets; mmmLocal[iTarget + 0] = -sinf(rrmLLALocalOrigin[iOrigin + 0]) * cosf(rrmLLALocalOrigin[iOrigin + 1]) * mmmXYZTarget[iTarget + 0] + -sinf(rrmLLALocalOrigin[iOrigin + 0]) * sinf(rrmLLALocalOrigin[iOrigin + 1]) * mmmXYZTarget[iTarget + 1] + cosf(rrmLLALocalOrigin[iOrigin + 0]) * mmmXYZTarget[iTarget + 2]; mmmLocal[iTarget + 1] = -sinf(rrmLLALocalOrigin[iOrigin + 1]) * mmmXYZTarget[iTarget + 0] + cosf(rrmLLALocalOrigin[iOrigin + 1]) * mmmXYZTarget[iTarget + 1]; mmmLocal[iTarget + 2] = -cosf(rrmLLALocalOrigin[iOrigin + 0]) * cosf(rrmLLALocalOrigin[iOrigin + 1]) * mmmXYZTarget[iTarget + 0] + -cosf(rrmLLALocalOrigin[iOrigin + 0]) * sinf(rrmLLALocalOrigin[iOrigin + 1]) * mmmXYZTarget[iTarget + 1] + -sinf(rrmLLALocalOrigin[iOrigin + 0]) * mmmXYZTarget[iTarget + 2]; @@ -308,11 +301,11 @@ void ECEF2NEDvDouble(const double* rrmLLALocalOrigin, int isOriginSizeOfTargets, double* mmmLocal) { - int iPoint, iTarget, iOrigin; + int iPoint; #pragma omp parallel for if (nTargets > omp_get_num_procs() * THREADING_CORES_MULTIPLIER) for (iPoint = 0; iPoint < nTargets; ++iPoint) { - iTarget = iPoint * NCOORDSINPOINT; - iOrigin = iTarget * isOriginSizeOfTargets; + int iTarget = iPoint * NCOORDSINPOINT; + int iOrigin = iTarget * isOriginSizeOfTargets; mmmLocal[iTarget + 0] = -sin(rrmLLALocalOrigin[iOrigin + 0]) * cos(rrmLLALocalOrigin[iOrigin + 1]) * mmmXYZTarget[iTarget + 0] + -sin(rrmLLALocalOrigin[iOrigin + 0]) * sin(rrmLLALocalOrigin[iOrigin + 1]) * mmmXYZTarget[iTarget + 1] + cos(rrmLLALocalOrigin[iOrigin + 0]) * mmmXYZTarget[iTarget + 2]; mmmLocal[iTarget + 1] = -sin(rrmLLALocalOrigin[iOrigin + 1]) * mmmXYZTarget[iTarget + 0] + cos(rrmLLALocalOrigin[iOrigin + 1]) * mmmXYZTarget[iTarget + 1]; mmmLocal[iTarget + 2] = -cos(rrmLLALocalOrigin[iOrigin + 0]) * cos(rrmLLALocalOrigin[iOrigin + 1]) * mmmXYZTarget[iTarget + 0] + -cos(rrmLLALocalOrigin[iOrigin + 0]) * sin(rrmLLALocalOrigin[iOrigin + 1]) * mmmXYZTarget[iTarget + 1] + -sin(rrmLLALocalOrigin[iOrigin + 0]) * mmmXYZTarget[iTarget + 2]; @@ -325,11 +318,11 @@ void ECEF2ENUvFloat(const float* rrmLLALocalOrigin, int isOriginSizeOfTargets, float* mmmLocal) { - int iPoint, iTarget, iOrigin; + int iPoint; #pragma omp parallel for if (nTargets > omp_get_num_procs() * THREADING_CORES_MULTIPLIER) for (iPoint = 0; iPoint < nTargets; ++iPoint) { - iTarget = iPoint * NCOORDSINPOINT; - iOrigin = iTarget * isOriginSizeOfTargets; + int iTarget = iPoint * NCOORDSINPOINT; + int iOrigin = iTarget * isOriginSizeOfTargets; mmmLocal[iTarget + 0] = -sinf(rrmLLALocalOrigin[iOrigin + 1]) * mmmXYZTarget[iTarget + 0] + cosf(rrmLLALocalOrigin[iOrigin + 1]) * mmmXYZTarget[iTarget + 1]; mmmLocal[iTarget + 1] = -sinf(rrmLLALocalOrigin[iOrigin + 0]) * cosf(rrmLLALocalOrigin[iOrigin + 1]) * mmmXYZTarget[iTarget + 0] + -sinf(rrmLLALocalOrigin[iOrigin + 0]) * sinf(rrmLLALocalOrigin[iOrigin + 1]) * mmmXYZTarget[iTarget + 1] + cosf(rrmLLALocalOrigin[iOrigin + 0]) * mmmXYZTarget[iTarget + 2]; mmmLocal[iTarget + 2] = cosf(rrmLLALocalOrigin[iOrigin + 0]) * cosf(rrmLLALocalOrigin[iOrigin + 1]) * mmmXYZTarget[iTarget + 0] + cosf(rrmLLALocalOrigin[iOrigin + 0]) * sinf(rrmLLALocalOrigin[iOrigin + 1]) * mmmXYZTarget[iTarget + 1] + sinf(rrmLLALocalOrigin[iOrigin + 0]) * mmmXYZTarget[iTarget + 2]; @@ -342,11 +335,11 @@ void ECEF2ENUvDouble(const double* rrmLLALocalOrigin, int isOriginSizeOfTargets, double* mmmLocal) { - int iPoint, iTarget, iOrigin; + int iPoint; #pragma omp parallel for if (nTargets > omp_get_num_procs() * THREADING_CORES_MULTIPLIER) for (iPoint = 0; iPoint < nTargets; ++iPoint) { - iTarget = iPoint * NCOORDSINPOINT; - iOrigin = iTarget * isOriginSizeOfTargets; + int iTarget = iPoint * NCOORDSINPOINT; + int iOrigin = iTarget * isOriginSizeOfTargets; mmmLocal[iTarget + 0] = -sin(rrmLLALocalOrigin[iOrigin + 1]) * mmmXYZTarget[iTarget + 0] + cos(rrmLLALocalOrigin[iOrigin + 1]) * mmmXYZTarget[iTarget + 1]; mmmLocal[iTarget + 1] = -sin(rrmLLALocalOrigin[iOrigin + 0]) * cos(rrmLLALocalOrigin[iOrigin + 1]) * mmmXYZTarget[iTarget + 0] + -sin(rrmLLALocalOrigin[iOrigin + 0]) * sin(rrmLLALocalOrigin[iOrigin + 1]) * mmmXYZTarget[iTarget + 1] + cos(rrmLLALocalOrigin[iOrigin + 0]) * mmmXYZTarget[iTarget + 2]; mmmLocal[iTarget + 2] = cos(rrmLLALocalOrigin[iOrigin + 0]) * cos(rrmLLALocalOrigin[iOrigin + 1]) * mmmXYZTarget[iTarget + 0] + cos(rrmLLALocalOrigin[iOrigin + 0]) * sin(rrmLLALocalOrigin[iOrigin + 1]) * mmmXYZTarget[iTarget + 1] + sin(rrmLLALocalOrigin[iOrigin + 0]) * mmmXYZTarget[iTarget + 2]; @@ -359,11 +352,11 @@ void ENU2ECEFvFloat(const float* rrmLLALocalOrigin, int isOriginSizeOfTargets, float* mmmXYZTarget) { - int iPoint, iTarget, iOrigin; + int iPoint; #pragma omp parallel for if (nTargets > omp_get_num_procs() * THREADING_CORES_MULTIPLIER) for (iPoint = 0; iPoint < nTargets; ++iPoint) { - iTarget = iPoint * NCOORDSINPOINT; - iOrigin = iTarget * isOriginSizeOfTargets; + int iTarget = iPoint * NCOORDSINPOINT; + int iOrigin = iTarget * isOriginSizeOfTargets; mmmXYZTarget[iTarget + 0] = -sinf(rrmLLALocalOrigin[iOrigin + 1]) * mmmTargetLocal[iTarget + 0] + -sinf(rrmLLALocalOrigin[iOrigin + 0]) * cosf(rrmLLALocalOrigin[iOrigin + 1]) * mmmTargetLocal[iTarget + 1] + cosf(rrmLLALocalOrigin[iOrigin + 0]) * cosf(rrmLLALocalOrigin[iOrigin + 1]) * mmmTargetLocal[iTarget + 2]; mmmXYZTarget[iTarget + 1] = cosf(rrmLLALocalOrigin[iOrigin + 1]) * mmmTargetLocal[iTarget + 0] + -sinf(rrmLLALocalOrigin[iOrigin + 0]) * sinf(rrmLLALocalOrigin[iOrigin + 1]) * mmmTargetLocal[iTarget + 1] + cosf(rrmLLALocalOrigin[iOrigin + 0]) * sinf(rrmLLALocalOrigin[iOrigin + 1]) * mmmTargetLocal[iTarget + 2]; mmmXYZTarget[iTarget + 2] = cosf(rrmLLALocalOrigin[iOrigin + 0]) * mmmTargetLocal[iTarget + 1] + sinf(rrmLLALocalOrigin[iOrigin + 0]) * mmmTargetLocal[iTarget + 2]; @@ -376,11 +369,11 @@ void NED2ECEFvFloat(const float* rrmLLALocalOrigin, int isOriginSizeOfTargets, float* mmmXYZTarget) { - int iPoint, iTarget, iOrigin; + int iPoint; #pragma omp parallel for if (nTargets > omp_get_num_procs() * THREADING_CORES_MULTIPLIER) for (iPoint = 0; iPoint < nTargets; ++iPoint) { - iTarget = iPoint * NCOORDSINPOINT; - iOrigin = iTarget * isOriginSizeOfTargets; + int iTarget = iPoint * NCOORDSINPOINT; + int iOrigin = iTarget * isOriginSizeOfTargets; mmmXYZTarget[iTarget + 0] = -sinf(rrmLLALocalOrigin[iOrigin + 0]) * cosf(rrmLLALocalOrigin[iOrigin + 1]) * mmmTargetLocal[iTarget + 0] + -sinf(rrmLLALocalOrigin[iOrigin + 1]) * mmmTargetLocal[iTarget + 1] + -cosf(rrmLLALocalOrigin[iOrigin + 0]) * cosf(rrmLLALocalOrigin[iOrigin + 1]) * mmmTargetLocal[iTarget + 2]; mmmXYZTarget[iTarget + 1] = -sinf(rrmLLALocalOrigin[iOrigin + 0]) * sinf(rrmLLALocalOrigin[iOrigin + 1]) * mmmTargetLocal[iTarget + 0] + cosf(rrmLLALocalOrigin[iOrigin + 1]) * mmmTargetLocal[iTarget + 1] + -cosf(rrmLLALocalOrigin[iOrigin + 0]) * sinf(rrmLLALocalOrigin[iOrigin + 1]) * mmmTargetLocal[iTarget + 2]; mmmXYZTarget[iTarget + 2] = cosf(rrmLLALocalOrigin[iOrigin + 0]) * mmmTargetLocal[iTarget + 0] + -sinf(rrmLLALocalOrigin[iOrigin + 0]) * mmmTargetLocal[iTarget + 2]; @@ -393,11 +386,11 @@ void NED2ECEFvDouble(const double* rrmLLALocalOrigin, int isOriginSizeOfTargets, double* mmmXYZTarget) { - int iPoint, iTarget, iOrigin; + int iPoint; #pragma omp parallel for if (nTargets > omp_get_num_procs() * THREADING_CORES_MULTIPLIER) for (iPoint = 0; iPoint < nTargets; ++iPoint) { - iTarget = iPoint * NCOORDSINPOINT; - iOrigin = iTarget * isOriginSizeOfTargets; + int iTarget = iPoint * NCOORDSINPOINT; + int iOrigin = iTarget * isOriginSizeOfTargets; mmmXYZTarget[iTarget + 0] = -sin(rrmLLALocalOrigin[iOrigin + 0]) * cos(rrmLLALocalOrigin[iOrigin + 1]) * mmmTargetLocal[iTarget + 0] + -sin(rrmLLALocalOrigin[iOrigin + 1]) * mmmTargetLocal[iTarget + 1] + -cos(rrmLLALocalOrigin[iOrigin + 0]) * cos(rrmLLALocalOrigin[iOrigin + 1]) * mmmTargetLocal[iTarget + 2]; mmmXYZTarget[iTarget + 1] = -sin(rrmLLALocalOrigin[iOrigin + 0]) * sin(rrmLLALocalOrigin[iOrigin + 1]) * mmmTargetLocal[iTarget + 0] + cos(rrmLLALocalOrigin[iOrigin + 1]) * mmmTargetLocal[iTarget + 1] + -cos(rrmLLALocalOrigin[iOrigin + 0]) * sin(rrmLLALocalOrigin[iOrigin + 1]) * mmmTargetLocal[iTarget + 2]; mmmXYZTarget[iTarget + 2] = cos(rrmLLALocalOrigin[iOrigin + 0]) * mmmTargetLocal[iTarget + 0] + -sin(rrmLLALocalOrigin[iOrigin + 0]) * mmmTargetLocal[iTarget + 2]; @@ -410,11 +403,11 @@ void ENU2ECEFvDouble(const double* rrmLLALocalOrigin, int isOriginSizeOfTargets, double* mmmXYZTarget) { - int iPoint, iTarget, iOrigin; + int iPoint; #pragma omp parallel for if (nTargets > omp_get_num_procs() * THREADING_CORES_MULTIPLIER) for (iPoint = 0; iPoint < nTargets; ++iPoint) { - iTarget = iPoint * NCOORDSINPOINT; - iOrigin = iTarget * isOriginSizeOfTargets; + int iTarget = iPoint * NCOORDSINPOINT; + int iOrigin = iTarget * isOriginSizeOfTargets; mmmXYZTarget[iTarget + 0] = -sin(rrmLLALocalOrigin[iOrigin + 1]) * mmmTargetLocal[iTarget + 0] + -sin(rrmLLALocalOrigin[iOrigin + 0]) * cos(rrmLLALocalOrigin[iOrigin + 1]) * mmmTargetLocal[iTarget + 1] + cos(rrmLLALocalOrigin[iOrigin + 0]) * cos(rrmLLALocalOrigin[iOrigin + 1]) * mmmTargetLocal[iTarget + 2]; mmmXYZTarget[iTarget + 1] = cos(rrmLLALocalOrigin[iOrigin + 1]) * mmmTargetLocal[iTarget + 0] + -sin(rrmLLALocalOrigin[iOrigin + 0]) * sin(rrmLLALocalOrigin[iOrigin + 1]) * mmmTargetLocal[iTarget + 1] + cos(rrmLLALocalOrigin[iOrigin + 0]) * sin(rrmLLALocalOrigin[iOrigin + 1]) * mmmTargetLocal[iTarget + 2]; mmmXYZTarget[iTarget + 2] = cos(rrmLLALocalOrigin[iOrigin + 0]) * mmmTargetLocal[iTarget + 1] + sin(rrmLLALocalOrigin[iOrigin + 0]) * mmmTargetLocal[iTarget + 2]; @@ -445,11 +438,11 @@ void NED2ECEFFloat(const float* rrmLLALocalOrigin, int nOriginPoints = (nTargets - 1) * isOriginSizeOfTargets + 1; float* mmmXYZLocalOrigin = (float*)malloc(nOriginPoints * NCOORDSINPOINT * sizeof(float)); geodetic2ECEFFloat(rrmLLALocalOrigin, nOriginPoints, a, b, mmmXYZLocalOrigin); - int iPoint, iTarget, iOrigin; + int iPoint; #pragma omp parallel for if (nTargets > omp_get_num_procs() * THREADING_CORES_MULTIPLIER) for (iPoint = 0; iPoint < nTargets; ++iPoint) { - iTarget = iPoint * NCOORDSINPOINT; - iOrigin = iTarget * isOriginSizeOfTargets; + int iTarget = iPoint * NCOORDSINPOINT; + int iOrigin = iTarget * isOriginSizeOfTargets; mmmXYZTarget[iTarget + 0] = -sinf(rrmLLALocalOrigin[iOrigin + 0]) * cosf(rrmLLALocalOrigin[iOrigin + 1]) * mmmTargetLocal[iTarget + 0] + -sinf(rrmLLALocalOrigin[iOrigin + 1]) * mmmTargetLocal[iTarget + 1] + -cosf(rrmLLALocalOrigin[iOrigin + 0]) * cosf(rrmLLALocalOrigin[iOrigin + 1]) * mmmTargetLocal[iTarget + 2] + mmmXYZLocalOrigin[iOrigin + 0]; mmmXYZTarget[iTarget + 1] = -sinf(rrmLLALocalOrigin[iOrigin + 0]) * sinf(rrmLLALocalOrigin[iOrigin + 1]) * mmmTargetLocal[iTarget + 0] + cosf(rrmLLALocalOrigin[iOrigin + 1]) * mmmTargetLocal[iTarget + 1] + -cosf(rrmLLALocalOrigin[iOrigin + 0]) * sinf(rrmLLALocalOrigin[iOrigin + 1]) * mmmTargetLocal[iTarget + 2] + mmmXYZLocalOrigin[iOrigin + 1]; mmmXYZTarget[iTarget + 2] = cosf(rrmLLALocalOrigin[iOrigin + 0]) * mmmTargetLocal[iTarget + 0] + -sinf(rrmLLALocalOrigin[iOrigin + 0]) * mmmTargetLocal[iTarget + 2] + mmmXYZLocalOrigin[iOrigin + 2]; @@ -481,11 +474,11 @@ void NED2ECEFDouble(const double* rrmLLALocalOrigin, int nOriginPoints = (nTargets - 1) * isOriginSizeOfTargets + 1; double* mmmXYZLocalOrigin = (double*)malloc(nOriginPoints * NCOORDSINPOINT * sizeof(double)); geodetic2ECEFDouble(rrmLLALocalOrigin, nOriginPoints, a, b, mmmXYZLocalOrigin); - int iPoint, iTarget, iOrigin; + int iPoint; #pragma omp parallel for if (nTargets > omp_get_num_procs() * THREADING_CORES_MULTIPLIER) for (iPoint = 0; iPoint < nTargets; ++iPoint) { - iTarget = iPoint * NCOORDSINPOINT; - iOrigin = iTarget * isOriginSizeOfTargets; + int iTarget = iPoint * NCOORDSINPOINT; + int iOrigin = iTarget * isOriginSizeOfTargets; mmmXYZTarget[iTarget + 0] = -sin(rrmLLALocalOrigin[iOrigin + 0]) * cos(rrmLLALocalOrigin[iOrigin + 1]) * mmmTargetLocal[iTarget + 0] + -sin(rrmLLALocalOrigin[iOrigin + 1]) * mmmTargetLocal[iTarget + 1] + -cos(rrmLLALocalOrigin[iOrigin + 0]) * cos(rrmLLALocalOrigin[iOrigin + 1]) * mmmTargetLocal[iTarget + 2] + mmmXYZLocalOrigin[iOrigin + 0]; mmmXYZTarget[iTarget + 1] = -sin(rrmLLALocalOrigin[iOrigin + 0]) * sin(rrmLLALocalOrigin[iOrigin + 1]) * mmmTargetLocal[iTarget + 0] + cos(rrmLLALocalOrigin[iOrigin + 1]) * mmmTargetLocal[iTarget + 1] + -cos(rrmLLALocalOrigin[iOrigin + 0]) * sin(rrmLLALocalOrigin[iOrigin + 1]) * mmmTargetLocal[iTarget + 2] + mmmXYZLocalOrigin[iOrigin + 1]; mmmXYZTarget[iTarget + 2] = cos(rrmLLALocalOrigin[iOrigin + 0]) * mmmTargetLocal[iTarget + 0] + -sin(rrmLLALocalOrigin[iOrigin + 0]) * mmmTargetLocal[iTarget + 2] + mmmXYZLocalOrigin[iOrigin + 2]; @@ -517,11 +510,11 @@ void ENU2ECEFFloat(const float* rrmLLALocalOrigin, int nOriginPoints = (nTargets - 1) * isOriginSizeOfTargets + 1; float* mmmXYZLocalOrigin = (float*)malloc(nOriginPoints * NCOORDSINPOINT * sizeof(float)); geodetic2ECEFFloat(rrmLLALocalOrigin, nOriginPoints, a, b, mmmXYZLocalOrigin); - int iPoint, iTarget, iOrigin; + int iPoint; #pragma omp parallel for if (nTargets > omp_get_num_procs() * THREADING_CORES_MULTIPLIER) for (iPoint = 0; iPoint < nTargets; ++iPoint) { - iTarget = iPoint * NCOORDSINPOINT; - iOrigin = iTarget * isOriginSizeOfTargets; + int iTarget = iPoint * NCOORDSINPOINT; + int iOrigin = iTarget * isOriginSizeOfTargets; mmmXYZTarget[iTarget + 0] = -sinf(rrmLLALocalOrigin[iOrigin + 1]) * mmmTargetLocal[iTarget + 0] + -sinf(rrmLLALocalOrigin[iOrigin + 0]) * cosf(rrmLLALocalOrigin[iOrigin + 1]) * mmmTargetLocal[iTarget + 1] + cosf(rrmLLALocalOrigin[iOrigin + 0]) * cosf(rrmLLALocalOrigin[iOrigin + 1]) * mmmTargetLocal[iTarget + 2] + mmmXYZLocalOrigin[iOrigin + 0]; mmmXYZTarget[iTarget + 1] = cosf(rrmLLALocalOrigin[iOrigin + 1]) * mmmTargetLocal[iTarget + 0] + -sinf(rrmLLALocalOrigin[iOrigin + 0]) * sinf(rrmLLALocalOrigin[iOrigin + 1]) * mmmTargetLocal[iTarget + 1] + cosf(rrmLLALocalOrigin[iOrigin + 0]) * sinf(rrmLLALocalOrigin[iOrigin + 1]) * mmmTargetLocal[iTarget + 2] + mmmXYZLocalOrigin[iOrigin + 1]; mmmXYZTarget[iTarget + 2] = cosf(rrmLLALocalOrigin[iOrigin + 0]) * mmmTargetLocal[iTarget + 1] + sinf(rrmLLALocalOrigin[iOrigin + 0]) * mmmTargetLocal[iTarget + 2] + mmmXYZLocalOrigin[iOrigin + 2]; @@ -554,11 +547,11 @@ void ENU2ECEFDouble(const double* rrmLLALocalOrigin, double* mmmXYZLocalOrigin = (double*)malloc(nOriginPoints * NCOORDSINPOINT * sizeof(double)); geodetic2ECEFDouble( rrmLLALocalOrigin, nOriginPoints, a, b, mmmXYZLocalOrigin); - int iPoint, iTarget, iOrigin; + int iPoint; #pragma omp parallel for if (nTargets > omp_get_num_procs() * THREADING_CORES_MULTIPLIER) for (iPoint = 0; iPoint < nTargets; ++iPoint) { - iTarget = iPoint * NCOORDSINPOINT; - iOrigin = iTarget * isOriginSizeOfTargets; + int iTarget = iPoint * NCOORDSINPOINT; + int iOrigin = iTarget * isOriginSizeOfTargets; // mmmXYZTarget[iTarget + 0] = -sin(rrmLLALocalOrigin[iOrigin + 1]) * mmmTargetLocal[iTarget + 0] + cos(rrmLLALocalOrigin[iOrigin + 1]) * mmmTargetLocal[iTarget + 1] + mmmXYZLocalOrigin[iOrigin + 0]; // mmmXYZTarget[iTarget + 1] = -sin(rrmLLALocalOrigin[iOrigin + 0]) * cos(rrmLLALocalOrigin[iOrigin + 1]) * mmmTargetLocal[iTarget + 0] + -sin(rrmLLALocalOrigin[iOrigin + 0]) * sin(rrmLLALocalOrigin[iOrigin + 1]) * mmmTargetLocal[iTarget + 1] + cos(rrmLLALocalOrigin[iOrigin + 0]) * mmmTargetLocal[iTarget + 2] + mmmXYZLocalOrigin[iOrigin + 1]; // mmmXYZTarget[iTarget + 2] = cos(rrmLLALocalOrigin[iOrigin + 0]) * cos(rrmLLALocalOrigin[iOrigin + 1]) * mmmTargetLocal[iTarget + 0] + cos(rrmLLALocalOrigin[iOrigin + 0]) * sin(rrmLLALocalOrigin[iOrigin + 1]) * mmmTargetLocal[iTarget + 1] + sin(rrmLLALocalOrigin[iOrigin + 0]) * mmmTargetLocal[iTarget + 2] + mmmXYZLocalOrigin[iOrigin + 2]; @@ -582,10 +575,10 @@ range [rad, rad, m] */ void NED2AERFloat(const float* mmmENU, int nPoints, float* rrmAER) { - int iPoint, i; + int iPoint; #pragma omp parallel for if (nPoints > omp_get_num_procs() * THREADING_CORES_MULTIPLIER) for (iPoint = 0; iPoint < nPoints; ++iPoint) { - i = iPoint * NCOORDSINPOINT; + int i = iPoint * NCOORDSINPOINT; rrmAER[i + 0] = atan2f(mmmENU[i + 1], mmmENU[i + 0]); if (rrmAER[i + 0] < 0) rrmAER[i + 0] = rrmAER[i + 0] + (2.0f * PIf); @@ -607,10 +600,10 @@ range [rad, rad, m] */ void NED2AERDouble(const double* mmmNED, int nPoints, double* rrmAER) { - int iPoint, i; + int iPoint; #pragma omp parallel for if (nPoints > omp_get_num_procs() * THREADING_CORES_MULTIPLIER) for (iPoint = 0; iPoint < nPoints; ++iPoint) { - i = iPoint * NCOORDSINPOINT; + int i = iPoint * NCOORDSINPOINT; rrmAER[i + 0] = atan2(mmmNED[i + 1], mmmNED[i + 0]); if (rrmAER[i + 0] < 0) rrmAER[i + 0] = rrmAER[i + 0] + 2.0 * PI; @@ -632,10 +625,10 @@ range [rad, rad, m] */ void ENU2AERFloat(const float* mmmNED, int nPoints, float* rrmAER) { - int iPoint, i; + int iPoint; #pragma omp parallel for if (nPoints > omp_get_num_procs() * THREADING_CORES_MULTIPLIER) for (iPoint = 0; iPoint < nPoints; ++iPoint) { - i = iPoint * NCOORDSINPOINT; + int i = iPoint * NCOORDSINPOINT; rrmAER[i + 0] = atan2f(mmmNED[i + 0], mmmNED[i + 1]); if (rrmAER[i + 0] < 0) rrmAER[i + 0] = rrmAER[i + 0] + (2.0f * PIf); @@ -656,10 +649,10 @@ range [rad, rad, m] */ void ENU2AERDouble(const double* mmmENU, int nPoints, double* rrmAER) { - int iPoint, i; + int iPoint; #pragma omp parallel for if (nPoints > omp_get_num_procs() * THREADING_CORES_MULTIPLIER) for (iPoint = 0; iPoint < nPoints; ++iPoint) { - i = iPoint * NCOORDSINPOINT; + int i = iPoint * NCOORDSINPOINT; rrmAER[i + 0] = atan2(mmmENU[i + 0], mmmENU[i + 1]); if (rrmAER[i + 0] < 0) rrmAER[i + 0] = rrmAER[i + 0] + 2.0 * PI; @@ -679,10 +672,10 @@ range [rad, rad, m] */ void AER2NEDFloat(const float* rrmAER, int nPoints, float* mmmNED) { - int iPoint, i; + int iPoint; #pragma omp parallel for if (nPoints > omp_get_num_procs() * THREADING_CORES_MULTIPLIER) for (iPoint = 0; iPoint < nPoints; ++iPoint) { - i = iPoint * NCOORDSINPOINT; + int i = iPoint * NCOORDSINPOINT; mmmNED[i + 0] = cosf(rrmAER[i + 1]) * cosf(rrmAER[i + 0]) * rrmAER[i + 2]; mmmNED[i + 1] = cosf(rrmAER[i + 1]) * sinf(rrmAER[i + 0]) * rrmAER[i + 2]; mmmNED[i + 2] = -sinf(rrmAER[i + 1]) * rrmAER[i + 2]; @@ -700,10 +693,10 @@ range [rad, rad, m] */ void AER2NEDDouble(const double* rrmAER, int nPoints, double* mmmNED) { - int iPoint, i; + int iPoint; #pragma omp parallel for if (nPoints > omp_get_num_procs() * THREADING_CORES_MULTIPLIER) for (iPoint = 0; iPoint < nPoints; ++iPoint) { - i = iPoint * NCOORDSINPOINT; + int i = iPoint * NCOORDSINPOINT; mmmNED[i + 0] = cos(rrmAER[i + 1]) * cos(rrmAER[i + 0]) * rrmAER[i + 2]; mmmNED[i + 1] = cos(rrmAER[i + 1]) * sin(rrmAER[i + 0]) * rrmAER[i + 2]; mmmNED[i + 2] = -sin(rrmAER[i + 1]) * rrmAER[i + 2]; @@ -721,10 +714,10 @@ range [rad, rad, m] */ void AER2ENUFloat(const float* rrmAER, int nPoints, float* mmmENU) { - int iPoint, i; + int iPoint; #pragma omp parallel for if (nPoints > omp_get_num_procs() * THREADING_CORES_MULTIPLIER) for (iPoint = 0; iPoint < nPoints; ++iPoint) { - i = iPoint * NCOORDSINPOINT; + int i = iPoint * NCOORDSINPOINT; mmmENU[i + 0] = cosf(rrmAER[i + 1]) * sinf(rrmAER[i + 0]) * rrmAER[i + 2]; mmmENU[i + 1] = cosf(rrmAER[i + 1]) * cosf(rrmAER[i + 0]) * rrmAER[i + 2]; mmmENU[i + 2] = sinf(rrmAER[i + 1]) * rrmAER[i + 2]; @@ -742,10 +735,10 @@ range [rad, rad, m] */ void AER2ENUDouble(const double* rrmAER, int nPoints, double* mmmENU) { - int iPoint, i; + int iPoint; #pragma omp parallel for if (nPoints > omp_get_num_procs() * THREADING_CORES_MULTIPLIER) for (iPoint = 0; iPoint < nPoints; ++iPoint) { - i = iPoint * NCOORDSINPOINT; + int i = iPoint * NCOORDSINPOINT; mmmENU[i + 0] = cos(rrmAER[i + 1]) * sin(rrmAER[i + 0]) * rrmAER[i + 2]; mmmENU[i + 1] = cos(rrmAER[i + 1]) * cos(rrmAER[i + 0]) * rrmAER[i + 2]; mmmENU[i + 2] = sin(rrmAER[i + 1]) * rrmAER[i + 2]; diff --git a/src/transforms84/__init__.py b/src/transforms84/__init__.py index 986b7d8..8cc5775 100644 --- a/src/transforms84/__init__.py +++ b/src/transforms84/__init__.py @@ -3,4 +3,4 @@ commit_hash = os.getenv("COMMIT_HASH", "") if commit_hash: # pragma: no cover commit_hash = f"+{commit_hash}" -__version__ = f"0.3.1{commit_hash}" +__version__ = f"0.3.2{commit_hash}" diff --git a/tests/test_AER2ENU.py b/tests/test_AER2ENU.py index d9f5a55..3fd0589 100644 --- a/tests/test_AER2ENU.py +++ b/tests/test_AER2ENU.py @@ -51,6 +51,21 @@ def test_AER2ENU_points(dtype): ) +@pytest.mark.parametrize("dtype", [np.float64, np.float32]) +def test_AER2ENU_points_parellel(dtype): + AER = np.ascontiguousarray( + np.tile( + np.array([[34.1160], [4.1931], [15.1070]], dtype=dtype), 1000 + ).T.reshape((-1, 3, 1)) + ) + assert np.all( + np.isclose( + AER2ENU(DDM2RRM(AER)), + np.array([[8.4504], [12.4737], [1.1046]], dtype=dtype), + ), + ) + + @pytest.mark.skip(reason="Get check data") @pytest.mark.parametrize("dtype", [np.int16, np.int32, np.int64]) def test_AER2ENU_points_int(dtype): diff --git a/tests/test_AER2NED.py b/tests/test_AER2NED.py index fa64b3a..b6d4cdd 100644 --- a/tests/test_AER2NED.py +++ b/tests/test_AER2NED.py @@ -59,6 +59,24 @@ def test_AER2NED_points(dtype, tol): ) +@pytest.mark.parametrize( + "dtype,tol", [(np.float64, tol_double_atol), (np.float32, tol_float_atol)] +) +def test_AER2NED_paralllel(dtype, tol): + AER = np.ascontiguousarray( + np.tile( + np.array([[155.427], [-23.161], [10.885]], dtype=dtype), 1000 + ).T.reshape((-1, 3, 1)) + ) + assert np.all( + np.isclose( + AER2NED(DDM2RRM(AER)), + np.array([[-9.1013], [4.1617], [4.2812]], dtype=dtype), + atol=tol, + ), + ) + + @pytest.mark.skip(reason="Get check data") @pytest.mark.parametrize("dtype", [np.int16, np.int32, np.int64]) def test_AER2NED_points_int(dtype): diff --git a/tests/test_ECEF2ENU.py b/tests/test_ECEF2ENU.py index 1a20da1..c799669 100644 --- a/tests/test_ECEF2ENU.py +++ b/tests/test_ECEF2ENU.py @@ -177,3 +177,24 @@ def test_ECEF2ENU_one2many(dtype): rrm_local, geodetic2ECEF(rrm_targets, WGS84.a, WGS84.b), WGS84.a, WGS84.b ) ) + + +@pytest.mark.parametrize("dtype", [np.float64, np.float32]) +def test_ECEF2ENU_parllel(dtype): + rrm_target = DDM2RRM(np.array([[31], [32], [0]], dtype=dtype)) + num_repeats = 1000 + rrm_targets = np.ascontiguousarray( + np.tile(rrm_target, num_repeats).T.reshape((-1, 3, 1)) + ) + rrm_local = DDM2RRM(np.array([[30], [31], [0]], dtype=dtype)) + rrm_locals = np.ascontiguousarray( + np.tile(rrm_local, rrm_targets.shape[0]).T.reshape((-1, 3, 1)) + ) + assert np.all( + ECEF2ENU( + rrm_locals, geodetic2ECEF(rrm_targets, WGS84.a, WGS84.b), WGS84.a, WGS84.b + ) + == ECEF2ENU( + rrm_local, geodetic2ECEF(rrm_targets, WGS84.a, WGS84.b), WGS84.a, WGS84.b + ) + ) diff --git a/tests/test_ECEF2ENUv.py b/tests/test_ECEF2ENUv.py index 3aac685..64eef12 100644 --- a/tests/test_ECEF2ENUv.py +++ b/tests/test_ECEF2ENUv.py @@ -22,6 +22,29 @@ def test_ECEF2ENUv(dtype, tol): ) +@pytest.mark.parametrize( + "dtype,tol", [(np.float64, tol_double_atol), (np.float32, tol_float_atol)] +) +def test_ECEF2ENUv_parallel(dtype, tol): + rrm_local = np.ascontiguousarray( + np.tile( + DDM2RRM(np.array([[17.4114], [78.2700], [0]], dtype=dtype)), 1000 + ).T.reshape((-1, 3, 1)) + ) + uvw = np.ascontiguousarray( + np.tile( + np.array([[27.9799], [-1.0990], [-15.7723]], dtype=dtype), 1000 + ).T.reshape((-1, 3, 1)) + ) + assert np.all( + np.isclose( + ECEF2ENUv(rrm_local, uvw), + np.array([[-27.6190], [-16.4298], [-0.3186]]), + atol=tol, + ) + ) + + @pytest.mark.parametrize( "dtype0,dtype1,tol", [ diff --git a/tests/test_ECEF2NED.py b/tests/test_ECEF2NED.py index 8dc3b22..a91ba68 100644 --- a/tests/test_ECEF2NED.py +++ b/tests/test_ECEF2NED.py @@ -236,3 +236,24 @@ def test_ECEF2NED_one2many(dtype): rrm_local, geodetic2ECEF(rrm_targets, WGS84.a, WGS84.b), WGS84.a, WGS84.b ) ) + + +@pytest.mark.parametrize("dtype", [np.float64, np.float32]) +def test_ECEF2NED_parallel(dtype): + rrm_target = DDM2RRM(np.array([[31], [32], [0]], dtype=dtype)) + num_repeats = 1000 + rrm_targets = np.ascontiguousarray( + np.tile(rrm_target, num_repeats).T.reshape((-1, 3, 1)) + ) + rrm_local = DDM2RRM(np.array([[30], [31], [0]], dtype=dtype)) + rrm_locals = np.ascontiguousarray( + np.tile(rrm_local, rrm_targets.shape[0]).T.reshape((-1, 3, 1)) + ) + assert np.all( + ECEF2NED( + rrm_locals, geodetic2ECEF(rrm_targets, WGS84.a, WGS84.b), WGS84.a, WGS84.b + ) + == ECEF2NED( + rrm_local, geodetic2ECEF(rrm_targets, WGS84.a, WGS84.b), WGS84.a, WGS84.b + ) + ) diff --git a/tests/test_ECEF2NEDv.py b/tests/test_ECEF2NEDv.py index da3e7d2..ba85530 100644 --- a/tests/test_ECEF2NEDv.py +++ b/tests/test_ECEF2NEDv.py @@ -10,7 +10,7 @@ @pytest.mark.parametrize( "dtype,tol", [(np.float64, tol_double_atol), (np.float32, tol_float_atol)] ) -def test_ECEF2NEDv_float(dtype, tol): +def test_ECEF2NEDv(dtype, tol): rrm_local = DDM2RRM(np.array([[61.64], [30.70], [0]], dtype=dtype)) uvw = np.array([[530.2445], [492.1283], [396.3459]], dtype=dtype) assert np.all( @@ -22,6 +22,29 @@ def test_ECEF2NEDv_float(dtype, tol): ) +@pytest.mark.parametrize( + "dtype,tol", [(np.float64, tol_double_atol), (np.float32, tol_float_atol)] +) +def test_ECEF2NEDv_parallel(dtype, tol): + rrm_local = np.ascontiguousarray( + np.tile( + DDM2RRM(np.array([[61.64], [30.70], [0]], dtype=dtype)), 1000 + ).T.reshape((-1, 3, 1)) + ) + uvw = np.ascontiguousarray( + np.tile( + np.array([[530.2445], [492.1283], [396.3459]], dtype=dtype), 1000 + ).T.reshape((-1, 3, 1)) + ) + assert np.all( + np.isclose( + ECEF2NEDv(rrm_local, uvw), + np.array([[-434.0403], [152.4451], [-684.6964]]), + atol=tol, + ) + ) + + @pytest.mark.parametrize( "dtype0,dtype1,tol", [ diff --git a/tests/test_ECEF2geodetic.py b/tests/test_ECEF2geodetic.py index 24e487e..aac15aa 100644 --- a/tests/test_ECEF2geodetic.py +++ b/tests/test_ECEF2geodetic.py @@ -105,3 +105,18 @@ def test_ECEF2geodetic_points(dtype, tol): assert np.all(np.isclose(out[:, 0, 0], np.deg2rad(30))) assert np.all(np.isclose(out[:, 1, 0], np.deg2rad(25))) assert np.all(np.isclose(out[:, 2, 0], 5, atol=tol)) + + +@pytest.mark.parametrize( + "dtype,tol", [(np.float64, tol_double_atol), (np.float32, tol_float_atol)] +) +def test_ECEF2geodetic_parallel(dtype, tol): + in_arr = np.ascontiguousarray( + np.tile( + np.array([[5010306], [2336344], [3170376.2]], dtype=dtype), 1000 + ).T.reshape((-1, 3, 1)) + ) + out = ECEF2geodetic(in_arr, WGS84.a, WGS84.b) + assert np.all(np.isclose(out[:, 0, 0], np.deg2rad(30))) + assert np.all(np.isclose(out[:, 1, 0], np.deg2rad(25))) + assert np.all(np.isclose(out[:, 2, 0], 5, atol=tol)) diff --git a/tests/test_ENU2AER.py b/tests/test_ENU2AER.py index 266cc3b..b68dae5 100644 --- a/tests/test_ENU2AER.py +++ b/tests/test_ENU2AER.py @@ -47,6 +47,24 @@ def test_ENU2AER_points(dtype, tol): ) +@pytest.mark.parametrize( + "dtype,tol", [(np.float64, tol_double_atol), (np.float32, tol_float_atol)] +) +def test_ENU2AER_parallel(dtype, tol): + ENU = np.ascontiguousarray( + np.tile(np.array([[8.4504], [12.4737], [1.1046]], dtype=dtype), 1000).T.reshape( + (-1, 3, 1) + ) + ) + assert np.all( + np.isclose( + ENU2AER(ENU), + DDM2RRM(np.array([[34.1160], [4.1931], [15.1070]], dtype=dtype)), + atol=tol, + ), + ) + + @pytest.mark.skip(reason="Get check data") @pytest.mark.parametrize( "dtype,tol", [(np.int64, tol_double_atol), (np.int32, tol_float_atol)] diff --git a/tests/test_ENU2ECEF.py b/tests/test_ENU2ECEF.py index aa29cdb..6a85794 100644 --- a/tests/test_ENU2ECEF.py +++ b/tests/test_ENU2ECEF.py @@ -120,6 +120,29 @@ def test_ENU2ECEF_points(dtype, tol): assert np.all(np.isclose(out[:, 2, 0], 1519.47079847, atol=tol)) +@pytest.mark.parametrize( + "dtype,tol", [(np.float64, tol_double_atol), (np.float32, tol_float_atol)] +) +def test_ENU2ECEF_parallel(dtype, tol): + XYZ = np.ascontiguousarray( + np.tile( + np.array( + [[1901.5690521235], [5316.9485968901], [-6378422.76482545]], dtype=dtype + ), + 1000, + ).T.reshape((-1, 3, 1000)) + ) + ref_point = np.ascontiguousarray( + np.tile(np.array([[0.1], [0.2], [5000]], dtype=dtype), 1000).T.reshape( + (-1, 3, 1000) + ) + ) + out = ENU2ECEF(ref_point, XYZ, WGS84.a, WGS84.b) + assert np.all(np.isclose(out[:, 0, 0], 3906.67536618, atol=tol)) + assert np.all(np.isclose(out[:, 1, 0], 2732.16708, atol=tol)) + assert np.all(np.isclose(out[:, 2, 0], 1519.47079847, atol=tol)) + + @pytest.mark.parametrize( "dtype0,dtype1,tol", [ diff --git a/tests/test_ENU2ECEFv.py b/tests/test_ENU2ECEFv.py index c943d40..d807606 100644 --- a/tests/test_ENU2ECEFv.py +++ b/tests/test_ENU2ECEFv.py @@ -43,6 +43,29 @@ def test_ENU2ECEFv(dtype, tol): ) +@pytest.mark.parametrize( + "dtype,tol", [(np.float64, tol_double_atol), (np.float32, tol_float_atol)] +) +def test_ENU2ECEFv_parallel(dtype, tol): + rrm_local = np.ascontiguousarray( + np.tile( + DDM2RRM(np.array([[17.41], [78.27], [0]], dtype=dtype)), 1000 + ).T.reshape((-1, 3, 1)) + ) + uvw = np.ascontiguousarray( + np.tile( + np.array([[-27.6190], [-16.4298], [-0.3186]], dtype=dtype), 1000 + ).T.reshape((-1, 3, 1)) + ) + assert np.all( + np.isclose( + ENU2ECEFv(rrm_local, uvw), + np.array([[27.9798], [-1.0993], [-15.7724]], dtype=np.float32), + atol=tol, + ) + ) + + @pytest.mark.skip(reason="Get check data") @pytest.mark.parametrize( "dtype,tol", [(np.int64, tol_double_atol), (np.int32, tol_float_atol)] diff --git a/tests/test_NED2AER.py b/tests/test_NED2AER.py index 598b9ec..dbed633 100644 --- a/tests/test_NED2AER.py +++ b/tests/test_NED2AER.py @@ -81,3 +81,21 @@ def test_NED2AER_points(dtype, tol): atol=tol, ), ) + + +@pytest.mark.parametrize( + "dtype,tol", [(np.float64, tol_double_atol), (np.float32, tol_float_atol)] +) +def test_NED2AER_parallel(dtype, tol): + NED = np.ascontiguousarray( + np.tile(np.array([[-9.1013], [4.1617], [4.2812]], dtype=dtype), 1000).T.reshape( + (-1, 3, 1) + ) + ) + assert np.all( + np.isclose( + NED2AER(NED), + DDM2RRM(np.array([[155.4271], [-23.1609], [10.8849]], dtype=dtype)), + atol=tol, + ), + ) diff --git a/tests/test_NED2ECEF.py b/tests/test_NED2ECEF.py index add91cd..36f7548 100644 --- a/tests/test_NED2ECEF.py +++ b/tests/test_NED2ECEF.py @@ -130,6 +130,26 @@ def test_NED2ECEF_points(dtype, tol): assert np.all(np.isclose(out[:, 2, 0], 4.4523e06, rtol=tol)) +@pytest.mark.parametrize( + "dtype,tol", [(np.float64, tol_double_rtol), (np.float32, tol_float_rtol)] +) +def test_NED2ECEF_parallel(dtype, tol): + XYZ = np.ascontiguousarray( + np.tile(np.array([[1334.3], [-2544.4], [360.0]], dtype=dtype), 1000).T.reshape( + (-1, 3, 1) + ) + ) + ref_point = np.ascontiguousarray( + np.tile( + DDM2RRM(np.array([[44.532], [-72.782], [1.699]], dtype=dtype)), 1000 + ).T.reshape((-1, 3, 1)) + ) + out = NED2ECEF(ref_point, XYZ, WGS84.a, WGS84.b) + assert np.all(np.isclose(out[:, 0, 0], 1.3457e06, rtol=tol)) + assert np.all(np.isclose(out[:, 1, 0], -4.3509e06, rtol=tol)) + assert np.all(np.isclose(out[:, 2, 0], 4.4523e06, rtol=tol)) + + @pytest.mark.parametrize("dtype", [np.float64, np.float32]) def test_NED2ECEF_one2many_float(dtype): num_repeats = 3 diff --git a/tests/test_NED2ECEFv.py b/tests/test_NED2ECEFv.py index edaaf44..743335d 100644 --- a/tests/test_NED2ECEFv.py +++ b/tests/test_NED2ECEFv.py @@ -31,7 +31,7 @@ def test_NED2ECEFv_different_dtypes(dtype0, dtype1, tol): @pytest.mark.parametrize( "dtype,tol", [(np.float64, tol_double_atol), (np.float32, tol_float_atol)] ) -def test_NED2ECEFv_float(dtype, tol): +def test_NED2ECEFv(dtype, tol): rrm_local = DDM2RRM(np.array([[61.64], [30.70], [0]], dtype=dtype)) uvw = np.array([[-434.0403], [152.4451], [-684.6964]], dtype=dtype) assert np.all( @@ -43,6 +43,29 @@ def test_NED2ECEFv_float(dtype, tol): ) +@pytest.mark.parametrize( + "dtype,tol", [(np.float64, tol_double_atol), (np.float32, tol_float_atol)] +) +def test_NED2ECEFv_parallel(dtype, tol): + rrm_local = np.ascontiguousarray( + np.tile( + DDM2RRM(np.array([[61.64], [30.70], [0]], dtype=dtype)), 1000 + ).T.reshape((-1, 3, 1)) + ) + uvw = np.ascontiguousarray( + np.tile( + np.array([[-434.0403], [152.4451], [-684.6964]], dtype=dtype), 1000 + ).T.reshape((-1, 3, 1)) + ) + assert np.all( + np.isclose( + NED2ECEFv(rrm_local, uvw), + np.array([[530.2445], [492.1283], [396.3459]], dtype=dtype), + atol=tol, + ) + ) + + @pytest.mark.skip(reason="Get check data") @pytest.mark.parametrize( "dtype,tol", [(np.int64, tol_double_atol), (np.int32, tol_float_atol)] diff --git a/tests/test_distances.py b/tests/test_distances.py index 06e880c..95766b0 100644 --- a/tests/test_distances.py +++ b/tests/test_distances.py @@ -132,6 +132,26 @@ def test_Haversine(dtype): ) +@pytest.mark.parametrize("dtype", [np.float64, np.float32]) +def test_Haversine_parallel(dtype): + rrm_start = np.ascontiguousarray( + np.tile( + np.array([[np.deg2rad(33)], [np.deg2rad(34)], [0]], dtype=dtype), 1000 + ).T.reshape((-1, 3, 1)) + ) + rrm_end = np.ascontiguousarray( + np.tile( + np.array([[np.deg2rad(32)], [np.deg2rad(38)], [0]], dtype=dtype), 1000 + ).T.reshape((-1, 3, 1)) + ) + assert np.all( + np.isclose(Haversine(rrm_start, rrm_end, WGS84.mean_radius), 391225.574516907) + ) + assert np.all( + np.isclose(Haversine(rrm_end, rrm_start, WGS84.mean_radius), 391225.574516907) + ) + + @pytest.mark.parametrize( "dtype0,dtype1", [(np.float64, np.float32), (np.float32, np.float64)] ) diff --git a/tests/test_geodetic2ECEF.py b/tests/test_geodetic2ECEF.py index 34e90e6..1b7b403 100644 --- a/tests/test_geodetic2ECEF.py +++ b/tests/test_geodetic2ECEF.py @@ -63,3 +63,16 @@ def test_geodetic2ECEF_points(dtype): assert np.all(np.isclose(out[:, 0, 0], 5010302.11)) assert np.all(np.isclose(out[:, 1, 0], 2336342.24)) assert np.all(np.isclose(out[:, 2, 0], 3170373.78)) + + +@pytest.mark.parametrize("dtype", [np.float64, np.float32]) +def test_geodetic2ECEF_parallel(dtype): + in_arr = np.ascontiguousarray( + np.tile( + np.array([[np.deg2rad(30)], [np.deg2rad(25)], [5]], dtype=dtype), 1000 + ).T.reshape((-1, 3, 1)) + ) + out = geodetic2ECEF(in_arr, WGS84.a, WGS84.b) + assert np.all(np.isclose(out[:, 0, 0], 5010302.11)) + assert np.all(np.isclose(out[:, 1, 0], 2336342.24)) + assert np.all(np.isclose(out[:, 2, 0], 3170373.78))