Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expose calculateWeightFunction(), simplify implementation #483

Merged
merged 273 commits into from
Sep 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
273 commits
Select commit Hold shift + click to select a range
130e3cd
fix bad merge
Sep 16, 2020
f121bad
ignore CMake-generated files
Sep 16, 2020
ce51201
std::auto_ptr -> std::unique_ptr
Sep 16, 2020
c95e858
need std::auto_ptr<> overloads for pre-generated Python wrapper code
Sep 16, 2020
914710c
provide std::auto_ptr "overloads" so that existing Python wrapper cod…
Sep 19, 2020
916f62a
impelement std::auto_ptr "overrides"
Sep 19, 2020
8cd8a70
latest from nitro:main
Sep 22, 2020
533878c
Merge pull request #349 from ngageoint/develop/main
Sep 22, 2020
d0d9f24
update externals/nitro
Oct 5, 2020
a85c00b
update coda-oss
Oct 5, 2020
75868bb
Merge pull request #354 from ngageoint/develop/main
Oct 5, 2020
4388277
Create codeql-analysis.yml
Oct 6, 2020
3f13025
Merge commit 'd216783a2d5ae168a34bc41da70c5c0004648c4a' into main
Oct 6, 2020
d13fd97
update coda-oss with latest from "main"
Oct 13, 2020
7b79bdf
Merge branch 'main' into develop/jdsmith
Oct 13, 2020
1fc1444
update nitro with latest from "main"
Oct 13, 2020
b6617ec
Merge pull request #356 from ngageoint/develop/jdsmith
Oct 13, 2020
571196e
Revert "Create codeql-analysis.yml"
Oct 13, 2020
8730781
fix nitf::Field to get rid of compiler errors
Oct 13, 2020
790ab26
build externals/coda-oss by itself
Oct 13, 2020
7e99996
Merge pull request #357 from ngageoint/develop/jdsmith
Oct 13, 2020
54b2d6f
build with Visual Studio 2019 (#358)
Oct 14, 2020
2de012c
put common #includes for PCH in a single file
Oct 14, 2020
9df2be8
build check_valid_six
Oct 14, 2020
b69f670
use EXIT_* rather than 0/1
Oct 14, 2020
7e12ff7
getting rid of std::auto_ptr<> because it's gone in C++17
Oct 17, 2020
20e02c3
build all projects with C++17
Oct 17, 2020
1befc01
Merge branch 'develop/use_c++11' into develop/jdsmith
Oct 17, 2020
165fb1d
use c++11 (#359)
Oct 17, 2020
2d308c0
use <filesystem> to remove hard-coded paths
Oct 17, 2020
20d1386
Merge branch 'main' into develop/jdsmith
Oct 17, 2020
ba48438
in Visual Studio, run check_valid_six with a pre-defined path
Oct 17, 2020
cd59a8c
tweak plugin dir
Oct 17, 2020
67ee284
get rid of hard-coded paths with <filesystem> (#360)
Oct 17, 2020
8faaf8f
can't have "check_valid_six" as a directory for *ix build
Oct 17, 2020
bb1dbe6
can't have "check_valid_six" as a directory for *ix build
Oct 17, 2020
e8636f4
build crop_sicd
Oct 17, 2020
5af8dcd
build crop_sicd
Oct 17, 2020
0fdf5ea
Merge branch 'main' into develop/jdsmith
Oct 17, 2020
52207d7
build crop_sicd in Visual Studio (#361)
Oct 17, 2020
12f4500
turn on /Wall, fix some warnings
Oct 17, 2020
0ab9c64
C++17 generates more warnings that I don't want to fix right now
Oct 19, 2020
dfc9c3c
removed some compiler warnings from third-party code
Oct 19, 2020
7a49683
comment-out use of C++17's <filesystem>
Oct 19, 2020
d16b60d
Merge branch 'main' of github.com:ngageoint/six-library into main
Oct 20, 2020
495d74a
update coda-oss with latest from "main"
Oct 20, 2020
92af349
update coda-oss with latest from "main" (#362)
Oct 20, 2020
c7ff931
coda-oss updates to make TextEncoding part of the OutputStream
Oct 21, 2020
2be4824
updates from coda-oss to make TextEncoding part of the OutputStream
Oct 21, 2020
97ecde9
fix StringStream() .ctor()
Oct 21, 2020
39344b1
Merge branch 'main' into develop/update_externals
Oct 21, 2020
cdb0893
one more coda-oss update
Oct 21, 2020
fe9dfff
latest from coda-oss "main" (#364)
Oct 21, 2020
1edffff
latest from "main" on coda-oss: xml.lite updates for UTF-8
Oct 26, 2020
f996fa8
Merge branch 'main' into develop/update_externals
Oct 26, 2020
8ff2451
restore changes lost in merge
Oct 26, 2020
21a550c
update coda-oss (#365)
Oct 26, 2020
18613b5
Merge branch 'main' into develop/update_externals
Oct 26, 2020
d3423b3
latest from coda-oss
Oct 26, 2020
404dadc
another update to coda-oss (#366)
Oct 26, 2020
f71c7ed
Merge branch 'main' into develop/update_externals
Oct 26, 2020
313a601
latest from coda-oss
Oct 26, 2020
5c48090
Develop/update externals (#367)
Oct 26, 2020
f332607
latest from coda-oss
Nov 2, 2020
3a042b6
latest from coda-oss (#368)
Nov 2, 2020
70d253c
Merge branch 'main' into develop/update_externals
Nov 3, 2020
29d743f
latest from "main" on coda-oss
Nov 3, 2020
950668d
latest from coda-oss (#369)
Nov 3, 2020
f014cf4
use Filesystem.h from coda-oss instead of <filesystem>
Nov 3, 2020
90e42da
use sys::Filesystem
Nov 4, 2020
5c4bfb6
Merge branch 'develop/update_externals' into main
Nov 4, 2020
3c07e72
update "nitro" and "coda-oss" (#370)
Nov 9, 2020
f9283e8
preserve utf8 in XML text (#363)
Nov 9, 2020
ce28071
use .tar, not .tar.gz
Nov 9, 2020
002570b
Merge branch 'main' into develop/jdsmith
Nov 18, 2020
76d2864
tweak project settings for consistency
Nov 18, 2020
ddfbbbb
unit-test for createFakeComplexData()
Nov 30, 2020
d5ea465
turn on compiler warnings
Nov 30, 2020
2dc56fe
Merge branch 'main' into develop/use_c++11
Nov 30, 2020
040ff00
crank-up warning level
Nov 30, 2020
79aa44f
add another unit-test (#371)
Nov 30, 2020
ad16e22
Merge branch 'main' into develop/use_c++11
Nov 30, 2020
04c59e2
enable "Warnings as errors"
Nov 30, 2020
aab4141
turn on all warnings (many #pragma'd away)
Nov 30, 2020
0bdf867
get rid of more warnings
Nov 30, 2020
df79799
adjust more #pragma's
Nov 30, 2020
4538574
remove some compiler warnings (#372)
Dec 1, 2020
0eae36f
update "nitro"
Dec 1, 2020
4ac10f9
update coda-oss and fix compiler errors
Dec 1, 2020
caf3c47
Merge branch 'main' into develop/jdsmith
Dec 1, 2020
84cc186
Merge branch 'develop/use_c++11' into develop/jdsmith
Dec 1, 2020
9ecb63d
update "nitro"
Dec 1, 2020
58af94a
update coda-oss and fix compiler errors
Dec 1, 2020
42b6c34
use "externals" from top-level "install"
Dec 1, 2020
0e60d32
use int64_t, etc. instead of sys::Int64_T
Dec 1, 2020
3414db4
Merge branch 'develop/use_c++11' into develop/jdsmith
Dec 1, 2020
2c86f4e
mem::SharedPtr -> std::shared_ptr
Dec 1, 2020
3bbe325
Merge branch 'develop/use_c++11' into develop/jdsmith
Dec 1, 2020
a0f9185
update coda-oss and nitro with less use of sys::
Dec 1, 2020
d9e7b59
Merge branch 'develop/update_externals' into develop/use_c++11
Dec 1, 2020
8024c15
Merge branch 'develop/update_externals' into develop/jdsmith
Dec 1, 2020
73bf598
Merge branch 'develop/use_c++11' into develop/jdsmith
Dec 1, 2020
b445329
unit-test paths are wrong for "externals"
Dec 1, 2020
a84f4fe
Merge branch 'develop/update_externals' into develop/jdsmith
Dec 1, 2020
f1b6d22
update externals (#373)
Dec 1, 2020
a1636f7
Merge branch 'main' into develop/jdsmith
Dec 1, 2020
acb882d
Merge branch 'main' into develop/use_c++11
Dec 1, 2020
472cd0b
update "nitro" to get SegmentMemorySource overloads
Dec 2, 2020
403b5a2
Merge branch 'develop/update_externals' into develop/use_c++11
Dec 2, 2020
8f4d60b
Merge branch 'develop/update_externals' into develop/jdsmith
Dec 2, 2020
0c03ce7
Merge branch 'develop/use_c++11' into develop/jdsmith
Dec 2, 2020
b03c979
use c++11 features (#374)
Dec 2, 2020
9ab0004
Merge branch 'main' into develop/jdsmith
Dec 2, 2020
400ab90
use std::unique_ptr<[]> instead of mem::ScopedArray
Dec 2, 2020
af69121
Merge branch 'develop/use_c++11' into develop/jdsmith
Dec 2, 2020
7b88491
use int32_t et. al. instead of sys::Int32_T
Dec 2, 2020
abcd762
Merge branch 'develop/use_c++11' into develop/jdsmith
Dec 2, 2020
af38657
use std::byte (not quite working yet, but need to move code to a fast…
Dec 2, 2020
715fc67
Merge branch 'develop/use_c++11' into develop/jdsmith
Dec 2, 2020
36535d9
Merge branch 'main' into develop/use_c++11
Dec 2, 2020
5d3b4bc
build with std::byte
Dec 2, 2020
0bf2404
Merge branch 'develop/use_c++11' into develop/jdsmith
Dec 2, 2020
81ec509
build with simplified "externals" scheme
Dec 2, 2020
d6f5c99
Merge branch 'main' into develop/update_externals
Dec 5, 2020
aac0768
latest from "nitro"
Dec 5, 2020
b4f9f63
match nitro -> nitf change
Dec 5, 2020
ed3956e
Merge branch 'develop/update_externals' into develop/jdsmith
Dec 5, 2020
bdd4e1a
make_span()
Dec 5, 2020
0124753
Merge branch 'develop/update_externals' into develop/jdsmith
Dec 5, 2020
48deaeb
latest "nitro" (#375)
Dec 5, 2020
d7bd790
Merge branch 'main' into develop/use_c++11
Dec 5, 2020
d9d32c4
Merge branch 'main' into develop/jdsmith
Dec 5, 2020
4a46f6c
use std::thread::hardware_concurrency() instead of sys::OS().getNumCP…
Dec 5, 2020
aa22a37
sys::Off_T -> ptrdiff_t
Dec 5, 2020
651274d
Merge branch 'develop/use_c++11' into develop/jdsmith
Dec 5, 2020
66ae8fa
fix compiler errors from previous merge; mostly #include <thread>
Dec 5, 2020
42a4e29
Revert "sys::Off_T -> ptrdiff_t"
Dec 5, 2020
1ba1665
sys::Off_T -> int64_t; sys::SSize_T -> ptrdiff_t
Dec 5, 2020
b694e5b
Merge branch 'develop/use_c++11' into develop/jdsmith
Dec 5, 2020
4392aed
Merge branch 'main' into develop/update_externals
Dec 5, 2020
5066a2f
latest from "coda-oss"
Dec 5, 2020
16e404b
Merge branch 'develop/update_externals' into develop/jdsmith
Dec 5, 2020
10df67a
latest from "coda-oss" (#376)
Dec 5, 2020
d038e0e
more use of C++11 (#377)
Dec 5, 2020
5a7da19
Merge branch 'main' into develop/jdsmith
Dec 5, 2020
ef45d66
fix build errors from recent changes (#378)
Dec 5, 2020
e8f8bd1
use filesystem::path and std::endian
Dec 5, 2020
5e3a928
Merge branch 'develop/use_c++11' into develop/jdsmith
Dec 5, 2020
690ed8f
Merge branch 'main' into develop/use_c++11
Dec 5, 2020
7f2b692
Merge branch 'main' into develop/jdsmith
Dec 5, 2020
f2b89b2
Merge branch 'develop/use_c++11' into develop/jdsmith
Dec 5, 2020
5728c96
Merge branch 'main' into develop/update_externals
Dec 5, 2020
d6419c1
more filesystem from coda-oss
Dec 5, 2020
a7057ee
Merge branch 'develop/update_externals' into develop/jdsmith
Dec 5, 2020
6e673a4
less use of sys::
Dec 5, 2020
f71124e
Merge branch 'develop/use_c++11' into develop/jdsmith
Dec 5, 2020
9c6b41d
NULL -> nullptr
Dec 5, 2020
37f1620
NULL -> nullptr (#379)
Dec 5, 2020
2522ba2
Merge branch 'main' into develop/jdsmith
Dec 5, 2020
41c2ec5
Merge branch 'develop/use_c++11' into develop/jdsmith
Dec 5, 2020
e2084e8
latest from coda-oss (#381)
Dec 5, 2020
aa58ed9
Merge branch 'main' into develop/jdsmith
Dec 5, 2020
40df640
use .data() rather than &d[0]
Dec 5, 2020
81e6921
mem::BufferView -> std::span
Dec 5, 2020
ea33c95
const std::span<>& doesn't make much sense
Dec 5, 2020
295218e
need make_span() overload for pointer+size
Dec 5, 2020
12f6f27
latest from develop/jdsmith (#382)
Dec 5, 2020
49b29b7
Merge branch 'main' into develop/jdsmith
Dec 5, 2020
277c89c
Merge branch 'main' into develop/update_externals
Dec 5, 2020
b3a0061
latest from "nitro"
Dec 5, 2020
e908bba
Merge branch 'develop/update_externals' into develop/jdsmith
Dec 5, 2020
a2d5396
latest from "nitro" (#383)
Dec 5, 2020
776688b
Merge branch 'main' into develop/jdsmith
Dec 5, 2020
22a8ec3
Merge branch 'main' into develop/update_externals
Dec 7, 2020
ebaa7f3
std::endian
Dec 7, 2020
092c8dd
Merge branch 'develop/update_externals' into develop/jdsmith
Dec 7, 2020
a062f58
coda-oss now gives us std::endian
Dec 7, 2020
fb92dd5
sys::Filesystem -> std::filesystem
Dec 8, 2020
075af6f
don't need to explicitly call fs::path::string() in most cases
Dec 8, 2020
fddd45e
sys::Filesystem -> std::filesystem
Dec 8, 2020
39ad09c
fix build errors when using C++17
Dec 8, 2020
514403d
latest from develop/jdsmith (#385)
Dec 8, 2020
1eecb10
Merge branch 'main' into develop/jdsmith
Dec 8, 2020
a020af3
simplify access to some ImageSubheader values
Dec 8, 2020
bf8ba69
newReadControl() returns a std::unique_ptr<> rather than a raw pointer
Dec 8, 2020
f5ee40c
a singleton is much easier in C++11
Dec 8, 2020
1d63f32
don't need to do manual locking in C++11
Dec 8, 2020
90c4425
use a template and some macros to dramatically simplify Enums
Dec 9, 2020
8167c5a
adjust macros for GCC, provide operators for SWIG
Dec 12, 2020
7835d5a
got the map entries wrong
Dec 12, 2020
2df4972
make getIndices() a bit more robust
Dec 12, 2020
32944e3
store a std::unique_ptr<> instead of a raw poniter
Dec 12, 2020
5a53a88
throw exceptions in getIndices() rather than assuming
Dec 12, 2020
25fcb35
use Enum<T>.toString() where possible rather than duplicating code
Dec 12, 2020
bd4b35d
remove duplicate code converting from a string to Enum<T>
Dec 12, 2020
f08e89f
don't explicilty check for "SIDD" as that's already part of getDataTy…
Dec 12, 2020
e9d98fa
use std::string instead of char[]
Dec 12, 2020
9c50cf5
reduce use of "delete[]"
Dec 12, 2020
8f8eff8
less use of "SICD" and "SIDD", use six::DataType instead
Dec 14, 2020
379007d
simplify Region buffer management
Dec 14, 2020
70b460a
reduce some explicit use of std::shared_ptr<> with std::make_shared a…
Dec 14, 2020
3827232
more reduction in explicit use of std::shared_ptr
Dec 14, 2020
3de5a43
Merge branch 'main' into develop/update_externals
Dec 16, 2020
53fe4ee
latest from "nitro"
Dec 16, 2020
378043a
Merge branch 'develop/update_externals' into develop/jdsmith
Dec 16, 2020
6c662d7
simplify use of six::Region
Dec 16, 2020
7f9a169
reduce use of explicit .toString()
Dec 16, 2020
c5fcdf3
further reduction in explicit use of toString()
Dec 16, 2020
a0547e4
template specialiaton can't be inline with G++
Dec 16, 2020
24f080d
simplify cphd enum creation
Dec 16, 2020
873a5eb
reduce use of toString() with setAttribute()
Dec 16, 2020
f990e77
latest from "nitro" (#387)
Dec 19, 2020
cdfa584
Merge branch 'main' into develop/jdsmith
Dec 19, 2020
6ba3ffd
latest changes from develop/jdsmith (#386)
Dec 19, 2020
3bce21d
Merge branch 'main' into develop/update_externals
Dec 19, 2020
dd8bbfa
latest from "nitro" and "coda-oss"
Dec 19, 2020
b78e981
Merge branch 'main' into develop/jdsmith
Dec 19, 2020
37799fd
Merge branch 'develop/update_externals' into develop/jdsmith
Dec 19, 2020
f217f23
update externals (#388)
Dec 19, 2020
4cd04e5
don't need catch(excep::Exception) ex.toString() as std::exception::w…
Dec 19, 2020
74548eb
Merge branch 'main' into develop/jdsmith
Dec 19, 2020
0327083
really only have two calls to setAttribute(): std::string and size_t
Dec 19, 2020
2cc2c96
use macros to generate SIDD Enums
Dec 19, 2020
d07e65f
add operator<< for Enum<T> to avoid some explicit .toString() calls
Dec 19, 2020
19572f3
add operator==(std::string) overload to redue need for .toString()
Dec 19, 2020
0fb7669
add operator<<() to redue need for .toString()
Dec 19, 2020
bcb57b3
don't implmeent a bunch of six::toString() routines; they sholdn't be…
Dec 19, 2020
ebb983c
further reduction in use of toString()
Dec 21, 2020
40ece99
eliminate six::toString() template; just provide a few overloads instead
Dec 21, 2020
a617548
createSixString() which calls six::toString(t) instead of t.toString()
Dec 21, 2020
94d0de0
createSixString() overload with URI parameter
Dec 21, 2020
0deab46
allow different strings (e.g., "1" and "+1") to map to the same value
Dec 21, 2020
a54012f
put "Enum" support code in a separate file
Dec 22, 2020
4a51fa8
there is now just one NOT_SET_VALUE
Dec 22, 2020
433e819
reduce use of toString() (#389)
Dec 22, 2020
016b9a7
Merge branch 'main' into develop/update_externals
Dec 23, 2020
265d71d
latest from coda-oss
Dec 23, 2020
b52bd07
Merge branch 'main' into develop/jdsmith
Dec 23, 2020
e8a20c2
Merge branch 'develop/update_externals' into develop/jdsmith
Dec 23, 2020
99abb7a
xml,lite is a bit easier to use
Dec 23, 2020
1a84465
fix DownsamplingMethod enum
Jan 9, 2021
3e5591a
slam in latest from "master"
Mar 6, 2021
4ac0070
add build and cmake directories
Mar 6, 2021
38a8324
Merge branch 'master' into develop/jdsmith
Mar 6, 2021
069e06a
Merge branch 'master' into develop/jdsmith
Mar 8, 2021
a463ab2
Merge branch 'master' into develop/jdsmith
Mar 8, 2021
bbd7a76
Merge branch 'develop/jdsmith' of github.com:ngageoint/six-library in…
Sep 9, 2021
7054a0a
Merge branch 'master' into develop/jdsmith
Sep 9, 2021
a35ac2b
expose calculateWeightFunction(), simplify implementation
Sep 9, 2021
b0c82aa
don't check-in CMakeSettings.json
Sep 9, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,4 @@ six/projects/csm/external/csm-master/
# Giant test files
regression_files/
six/modules/c++/cphd/tests/sample_cphd/

10 changes: 5 additions & 5 deletions six/modules/c++/six.sicd/include/six/sicd/Grid.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
* see <http://www.gnu.org/licenses/>.
*
*/
#ifndef __SIX_GRID_H__
#define __SIX_GRID_H__
#ifndef SIX_six_sicd_Grid_h_INCLUDED_
#define SIX_six_sicd_Grid_h_INCLUDED_
#pragma once

#include <logging/Logger.h>
#include <mem/ScopedCopyablePtr.h>
Expand Down Expand Up @@ -147,9 +148,9 @@ struct DirectionParameters
void fillDerivedFields(const ImageData& imageData);
void fillDerivedFields(const RgAzComp& rgAzComp, double offset = 0);

private:
std::unique_ptr<Functor> calculateWeightFunction() const;

private:
bool validateWeights(const Functor& weightFunction,
logging::Logger& log) const;

Expand Down Expand Up @@ -278,5 +279,4 @@ struct Grid

}
}
#endif

#endif // SIX_six_sicd_Grid_h_INCLUDED_
65 changes: 34 additions & 31 deletions six/modules/c++/six.sicd/source/Grid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@
* see <http://www.gnu.org/licenses/>.
*
*/
#include "six/sicd/GeoData.h"
#include "six/sicd/Grid.h"

#include <std/memory>

#include "six/sicd/GeoData.h"
#include "six/sicd/ImageData.h"
#include "six/sicd/PFA.h"
#include "six/sicd/SCPCOA.h"
Expand Down Expand Up @@ -125,45 +128,45 @@ std::pair<double, double> DirectionParameters::calculateDeltaKs(
std::unique_ptr<Functor>
DirectionParameters::calculateWeightFunction() const
{
std::unique_ptr<Functor> weightFunction;

if (weightType.get() != nullptr)
if (weightType.get() == nullptr)
{
std::string windowName(weightType->windowName);
str::upper(windowName);
return nullptr;
}

if (windowName == "UNIFORM")
{
weightFunction.reset(new Identity());
}
else if (windowName == "HAMMING")
{
double coef = 0.0;
if (weightType->parameters.empty() || weightType->parameters[0].str().empty())
{
//A Hamming window is defined in many places as a raised cosine of weight .54,
//so this is the default. However, some data use a generalized raised cosine and
//call it HAMMING, so we allow for both uses.
coef = .54;
}
else
{
coef = weightType->parameters[0];
}
std::string windowName(weightType->windowName);
str::upper(windowName);

weightFunction.reset(new RaisedCos(coef));
}
else if (windowName == "HANNING")
if (windowName == "UNIFORM")
{
return std::make_unique<Identity>();
}
if (windowName == "HAMMING")
{
double coef = 0.0;
if (weightType->parameters.empty() || weightType->parameters[0].str().empty())
{
weightFunction.reset(new RaisedCos(0.50));
//A Hamming window is defined in many places as a raised cosine of weight .54,
//so this is the default. However, some data use a generalized raised cosine and
//call it HAMMING, so we allow for both uses.
coef = .54;
}
else if (windowName == "KAISER")
else
{
weightFunction.reset(new Kaiser(double(weightType->parameters[0])));
coef = weightType->parameters[0];
}

return std::make_unique<RaisedCos>(coef);
}
if (windowName == "HANNING")
{
return std::make_unique<RaisedCos>(0.50);
}
if (windowName == "KAISER")
{
return std::make_unique<Kaiser>(double(weightType->parameters[0]));
}

return weightFunction;
return nullptr;
}

std::vector<RowColInt>
Expand Down