Skip to content

Commit

Permalink
Merge branch 'main' into develop/sync_externals
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Smith authored and Dan Smith committed Dec 14, 2022
2 parents 83f33ca + 2d5aed0 commit 80a4174
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 95 deletions.
7 changes: 7 additions & 0 deletions externals/coda-oss/modules/c++/avx/include/avx/extractf.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
#define CODA_OSS_avx_extractf_h_INCLUDED_
#pragma once

// Not supported on GCC < 7.1; see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80322 (also 80323-80325)
#if ((__GNUC__) && (GCC_VERSION < 70100))
#pragma warning Disabling CODA AVX m256 support due to gcc compiler bug.
#else

#include <config/compiler_extensions.h>

#ifndef CODA_OSS_mm256_extractf_DEFINED_
Expand Down Expand Up @@ -54,4 +59,6 @@

#endif

#endif // gcc version checking

#endif // CODA_OSS_avx_extractf_h_INCLUDED_
20 changes: 11 additions & 9 deletions six/modules/c++/scene/source/ProjectionModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -459,22 +459,24 @@ math::linear::MatrixMxN<2, 2> ProjectionModel::slantToImagePartials(
mTimeCOAPoly(imageGridPoint.row, imageGridPoint.col);
const Vector3 rARP = mARPPoly(timeCOA);
const Vector3 vARP = mARPVelPoly(timeCOA);
const Vector3 imageGridPointECEF = imageGridToECEF(imageGridPoint);
Vector3 slantRange = imageGridPointECEF - rARP;
Vector3 slantRange = mSCP - rARP;
slantRange.normalize();
Vector3 slantNormal = math::linear::cross(slantRange, vARP);
Vector3 slantNormal = math::linear::cross(vARP, slantRange) * mLookDir;
slantNormal.normalize();
Vector3 slantAzimuth = math::linear::cross(slantNormal, slantRange);
slantAzimuth.normalize();

// Second, map image grid point to the slant plane and compute finite differences
const Vector3 refPoint = imageToScene(imageGridPoint, mSCP, slantNormal);
const types::RowCol<double> rangePerturb =
sceneToImage(imageGridPointECEF + delta * slantRange);
sceneToImage(refPoint + delta * slantRange);
const types::RowCol<double> azimuthPerturb =
sceneToImage(imageGridPointECEF + delta * slantAzimuth);
sceneToImage(refPoint + delta * slantAzimuth);
math::linear::MatrixMxN<2, 2> partials(0.0);
partials[0][0] = (imageGridPoint.row - rangePerturb.row) / delta;
partials[0][1] = (imageGridPoint.row - azimuthPerturb.row) / delta;
partials[1][0] = (imageGridPoint.col - rangePerturb.col) / delta;
partials[1][1] = (imageGridPoint.col - azimuthPerturb.col) / delta;
partials[0][0] = (rangePerturb.row - imageGridPoint.row) / delta;
partials[0][1] = (azimuthPerturb.row - imageGridPoint.row) / delta;
partials[1][0] = (rangePerturb.col - imageGridPoint.col) / delta;
partials[1][1] = (azimuthPerturb.col - imageGridPoint.col) / delta;
return partials;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,39 +11,12 @@
#include "six/sicd/ComplexData.h"
#include "six/sicd/Utilities.h"

std::filesystem::path findSixHome(const std::filesystem::path& exePath)
{
std::filesystem::path sixHome = exePath;
do
{
const auto croppedNitfs = sixHome / "croppedNitfs";
if (is_directory(absolute(croppedNitfs)))
{
return sixHome;
}
sixHome = sixHome.parent_path();
} while (absolute(sixHome) != absolute(sixHome.parent_path()));
return "";
}

std::unique_ptr<scene::ProjectionPolynomialFitter>
loadPolynomialFitter(const std::filesystem::path& exePath)
loadPolynomialFitter()
{
const auto sixHome = findSixHome(exePath);
if (sixHome.empty())
{
std::ostringstream oss;
oss << "Environment error: Cannot determine source tree root";
throw except::Exception(Ctxt(oss.str()));
}

const auto sicdPathname = absolute(sixHome / "croppedNitfs" / "SICD"/ "cropped_sicd_110.nitf");
if (!is_regular_file(sicdPathname))
{
std::ostringstream oss;
oss << "Environment error: Cannot find SICD file: " << sicdPathname;
throw except::Exception(Ctxt(oss.str()));
}
static const auto modulePath = std::filesystem::path("croppedNitfs") / "SICD";
static const auto sicdPathname = six::testing::getModuleFile(modulePath, "cropped_sicd_110.nitf");
std::clog << sicdPathname << "\n";

std::vector<std::string> schemaPaths;
std::unique_ptr<six::sicd::ComplexData> complexData;
Expand Down Expand Up @@ -90,18 +63,11 @@ inline const double* output_plane_points(size_t i)
return OUTPUT_PLANE_POINTS[i];
}

static std::filesystem::path argv0()
{
static const sys::OS os;
static const std::filesystem::path retval = os.getSpecialEnv("0");
return retval;
}

TEST_CASE(testProjectOutputToSlant)
{
if (globalFitter == nullptr)
{
globalFitter = loadPolynomialFitter(six::testing::buildRootDir(argv0()));
globalFitter = loadPolynomialFitter();
}

math::poly::TwoD<double> outputToSlantRow;
Expand Down Expand Up @@ -132,7 +98,7 @@ TEST_CASE(testProjectSlantToOutput)
{
if (globalFitter == nullptr)
{
globalFitter = loadPolynomialFitter(six::testing::buildRootDir(argv0()));
globalFitter = loadPolynomialFitter();
}

math::poly::TwoD<double> slantToOutputRow;
Expand Down
8 changes: 5 additions & 3 deletions six/modules/c++/six.sicd/unittests/test_valid_sixsicd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@

#include "TestCase.h"

namespace fs = std::filesystem;

static std::unique_ptr<six::sicd::ComplexData> test_assert_round_trip(const std::string& testName,
const six::sicd::ComplexData& complexData, const std::vector<std::filesystem::path>* pSchemaPaths)
const six::sicd::ComplexData& complexData, const std::vector<fs::path>* pSchemaPaths)
{
auto strXML = six::sicd::Utilities::toXMLString(complexData, pSchemaPaths);
TEST_ASSERT_FALSE(strXML.empty());
Expand Down Expand Up @@ -114,9 +116,9 @@ static void test_assert(const std::string& testName, const six::sicd::ComplexDat
TEST_ASSERT_EQ(strTxRcvPolarizationProc,"OTHER_TxRcvPolarizationProc:OTHER_TxRcvPolarizationProc");
}

static void test_read_sicd_xml(const std::string& testName, const std::filesystem::path& path)
static void test_read_sicd_xml(const std::string& testName, const fs::path& path)
{
const auto pathname = six::testing::getSampleXmlPath("six.sicd", path);
const auto pathname = six::testing::getSampleXmlPath(fs::path("six.sicd") / "tests" / "sample_xml", path);

// NULL schemaPaths, no validation
auto pComplexData = six::sicd::Utilities::parseDataFromFile(pathname, nullptr /*pSchemaPaths*/);
Expand Down
13 changes: 5 additions & 8 deletions six/modules/c++/six.sidd/unittests/test_valid_sixsidd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,25 +52,22 @@ static inline std::filesystem::path six_sidd_relative_path()
{
return std::filesystem::path("six") / "modules" / "c++" / "six.sidd";
}
static std::filesystem::path sample_xml_relative_path(const std::filesystem::path& filename)
{
return six_sidd_relative_path() / "tests" / "sample_xml" / filename;
}
static std::filesystem::path schema_relative_path()
{
return six_sidd_relative_path() / "conf" / "schema";
}

static std::filesystem::path get_sample_xml_path(const std::filesystem::path& filename)
{
const auto root_dir = six::testing::buildRootDir(argv0());
return root_dir / sample_xml_relative_path(filename);
static const auto modulePath = six_sidd_relative_path() / "tests" / "sample_xml";
return sys::test::findGITModuleFile("six", modulePath, filename);
}

static std::vector<std::filesystem::path> getSchemaPaths()
{
const auto root_dir = six::testing::buildRootDir(argv0());
return std::vector<std::filesystem::path> { (root_dir / schema_relative_path()) };
static const auto filename = sys::test::findGITModuleFile("six", schema_relative_path(), "SIDD_schema_V3.0.0.xsd");
static const auto schemaPath = filename.parent_path();
return std::vector<std::filesystem::path> { schemaPath };
}

static std::unique_ptr<six::sidd::DerivedData> test_assert_round_trip(const std::string& testName,
Expand Down
1 change: 1 addition & 0 deletions six/modules/c++/six/include/six/Utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ namespace testing
std::filesystem::path getNitroPath(const std::filesystem::path& filename);

std::vector<std::filesystem::path> getSchemaPaths();
std::filesystem::path getModuleFile(const std::filesystem::path& modulePath, const std::filesystem::path& filename);
std::filesystem::path getSampleXmlPath(const std::filesystem::path& module /*"six.sicd"*/, const std::filesystem::path& filename);
}

Expand Down
48 changes: 13 additions & 35 deletions six/modules/c++/six/source/Utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -891,55 +891,33 @@ std::filesystem::path six::testing::buildRootDir(const std::filesystem::path& ar
return six::testing::findRootDir(argv0);
}

static std::filesystem::path buildRootDir_()
std::filesystem::path six::testing::getNitroPath(const std::filesystem::path& filename)
{
static const sys::OS os;
static const std::filesystem::path argv0 = os.getSpecialEnv("0");
static const auto retval = six::testing::buildRootDir(argv0);
return retval;
}

static std::filesystem::path getPath_(const std::filesystem::path& subdir, const std::filesystem::path& filename)
{
static const auto root_dir = buildRootDir_();
const auto startDir = root_dir / subdir;
auto retval = startDir / filename;
// Try to avoid searching
if (!is_regular_file(retval))
{
const auto foundDir = sys::findFirstDirectory(startDir, subdir);
retval = foundDir / subdir / filename;
}

return retval;
static const auto unittests = std::filesystem::path("modules") / "c++" / "nitf" / "unittests";
return sys::test::findGITModuleFile("nitro", unittests, filename);
}

std::filesystem::path six::testing::getNitroPath(const std::filesystem::path& filename)
std::filesystem::path six::testing::getModuleFile(const std::filesystem::path& modulePath, const std::filesystem::path& filename)
{
static const auto nitf_unittests = std::filesystem::path("nitro") / "modules" / "c++" / "nitf" / "unittests";
return getPath_(nitf_unittests, filename);
return sys::test::findGITModuleFile("six", modulePath, filename);
}

std::filesystem::path six::testing::getNitfPath(const std::filesystem::path& filename)
{
static const auto tests_nitf = std::filesystem::path("six") / "modules" / "c++" / "six" / "tests" / "nitf";
return getPath_(tests_nitf, filename);
}

static auto six_relative_path(const std::filesystem::path& module)
{
return std::filesystem::path("six") / "modules" / "c++" / module;
return getModuleFile(tests_nitf, filename);
}

std::vector<std::filesystem::path> six::testing::getSchemaPaths()
{
static const auto root_dir = buildRootDir_();
const auto schemaPath = root_dir / six_relative_path("six.sicd") / "conf" / "schema";
{
static const auto modulePath = std::filesystem::path("six") / "modules" / "c++" / "six.sicd" / "conf" / "schema";
static const auto filename = getModuleFile(modulePath, "SICD_schema_V1.3.0.xsd");
static const auto schemaPath = filename.parent_path();
return std::vector<std::filesystem::path> { schemaPath };
}

std::filesystem::path six::testing::getSampleXmlPath(const std::filesystem::path& module, const std::filesystem::path& filename)
std::filesystem::path six::testing::getSampleXmlPath(const std::filesystem::path& moduleName, const std::filesystem::path& filename)
{
const auto subdir = six_relative_path(module) / "tests" / "sample_xml";
return getPath_(subdir, filename);
const auto modulePath = std::filesystem::path("six") / "modules" / "c++" / moduleName;
return getModuleFile(modulePath, filename);
}

0 comments on commit 80a4174

Please sign in to comment.