Skip to content

Commit 9cbcf2c

Browse files
authored
Merge pull request #183 from icsm-au/1.2.6
Version 1.2.6 (Code enhancements)
2 parents 4f1acf7 + 809b8c7 commit 9cbcf2c

File tree

18 files changed

+245
-66
lines changed

18 files changed

+245
-66
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,8 @@ dynadjust/bin/
2424
/.idea/
2525
.vscode/*
2626

27+
# Visual Studio 2015/2017 cache/options directory
28+
.vs/
29+
2730
# readme and other files not requiring external contribution
2831
README.md

dynadjust/CMakeLists.txt

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ cmake_minimum_required (VERSION 3.15)
22

33
project (dynadjust)
44

5-
set (DYNADJUST_VERSION "1.2.5")
5+
set (DYNADJUST_VERSION "1.2.6")
66

77
if (BUILD_TESTING)
88
enable_testing()
@@ -106,30 +106,40 @@ else()
106106
endif()
107107

108108
if( NOT IOMP5_LIB )
109-
set(DNA_BUILD_ERROR 1)
110-
set (IOMP5_FIND_ERROR 1)
111-
message(SEND_ERROR "Cannot find iomp5 library")
109+
set(DNA_BUILD_ERROR 1)
110+
set (IOMP5_FIND_ERROR 1)
111+
message(SEND_ERROR "Cannot find iomp5 library")
112112
endif()
113113

114114
if( NOT MKL_INTEL_ILP64 )
115-
set(DNA_BUILD_ERROR 1)
116-
set (MKL_INTEL_ILP64_FIND_ERROR 1)
117-
message(SEND_ERROR "Cannot find mkl_intel_ilp64 library")
115+
set(DNA_BUILD_ERROR 1)
116+
set (MKL_INTEL_ILP64_FIND_ERROR 1)
117+
message(SEND_ERROR "Cannot find mkl_intel_ilp64 library")
118118
endif()
119119

120120
if( NOT MKL_INTEL_THREAD )
121-
set(DNA_BUILD_ERROR 1)
122-
set (MKL_INTEL_THREAD_FIND_ERROR 1)
123-
message(SEND_ERROR "Cannot find mkl_intel_thread library")
121+
set(DNA_BUILD_ERROR 1)
122+
set (MKL_INTEL_THREAD_FIND_ERROR 1)
123+
message(SEND_ERROR "Cannot find mkl_intel_thread library")
124124
endif()
125125

126126
if( NOT MKL_INTEL_CORE )
127-
set(DNA_BUILD_ERROR 1)
128-
set (MKL_INTEL_CORE_FIND_ERROR 1)
129-
message(SEND_ERROR "Cannot find mkl_intel_core library")
127+
set(DNA_BUILD_ERROR 1)
128+
set (MKL_INTEL_CORE_FIND_ERROR 1)
129+
message(SEND_ERROR "Cannot find mkl_intel_core library")
130130
endif()
131131

132-
set (DNA_LIBRARIES ${Boost_LIBRARIES} ${XERCESC_LIBRARY} ${MKL_INTEL_ILP64} ${MKL_INTEL_THREAD} ${MKL_INTEL_CORE} ${IOMP5_LIB})
132+
find_package(OpenMP)
133+
134+
if (OpenMP_CXX_FOUND)
135+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
136+
else()
137+
set(DNA_BUILD_ERROR 1)
138+
set (OPENMP_CORE_FIND_ERROR 1)
139+
message(SEND_ERROR "Cannot find openmp library")
140+
endif()
141+
142+
set (DNA_LIBRARIES ${Boost_LIBRARIES} ${XERCESC_LIBRARY} ${MKL_INTEL_ILP64} ${MKL_INTEL_THREAD} ${MKL_INTEL_CORE} ${IOMP5_LIB} OpenMP::OpenMP_CXX)
133143

134144
message (STATUS "DynAdjust library dependencies:")
135145
message (STATUS ${DNA_LIBRARIES})

dynadjust/dynadjust.rc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
2525
//
2626

2727
VS_VERSION_INFO VERSIONINFO
28-
FILEVERSION 1,2,5,0
29-
PRODUCTVERSION 1,2,5,0
28+
FILEVERSION 1,2,6,0
29+
PRODUCTVERSION 1,2,6,0
3030
FILEFLAGSMASK 0x3fL
3131
#ifdef _DEBUG
3232
FILEFLAGS 0x1L
@@ -42,12 +42,12 @@ BEGIN
4242
BLOCK "040904b0"
4343
BEGIN
4444
VALUE "FileDescription", "DynAdjust is a rigorous, high performance least squares adjustment application."
45-
VALUE "FileVersion", "1.2.5.0"
45+
VALUE "FileVersion", "1.2.6.0"
4646
VALUE "InternalName", "DynAdjust"
4747
VALUE "LegalCopyright", "Copyright 2022 Geoscience Australia"
4848
VALUE "OriginalFilename", "DynAdjust"
4949
VALUE "ProductName", "DynAdjust"
50-
VALUE "ProductVersion", "1.2.5.0"
50+
VALUE "ProductVersion", "1.2.6.0"
5151
END
5252
END
5353
BLOCK "VarFileInfo"

dynadjust/dynadjust/dnaadjustwrapper/dnaadjustwrapper.cpp

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ extern bool running;
2727
extern boost::mutex cout_mutex;
2828

2929
using namespace dynadjust;
30+
using namespace dynadjust::epsg;
3031

3132
void PrintSummaryMessage(dna_adjust* netAdjust, const project_settings* p, milliseconds *elapsed_time)
3233
{
@@ -470,14 +471,25 @@ int ParseCommandLineOptions(const int& argc, char* argv[], const variables_map&
470471
// do nothing
471472
}
472473

473-
// update geoid file name from dnaproj file (blank if geoid was not run)
474+
// update geoid file name from dnaproj file (blank if geoid was not executed)
474475
try {
475476
CDnaProjectFile projectFile(p.g.project_file, geoidSetting);
476477
p.n = projectFile.GetSettings().n;
477478
}
478479
catch (...) {
479480
// do nothing
480-
}
481+
}
482+
483+
// update reftran settings from dnaproj file
484+
// Note, if reftran was not executed, reference frame and epoch will be set to
485+
// the frame and epoch captured on import.
486+
try {
487+
CDnaProjectFile projectFile(p.g.project_file, reftranSetting);
488+
p.r = projectFile.GetSettings().r;
489+
}
490+
catch (...) {
491+
// do nothing
492+
}
481493
}
482494

483495
// binary station file location (output)
@@ -1042,8 +1054,8 @@ int main(int argc, char* argv[])
10421054
bool bst_meta_import, bms_meta_import;
10431055
LoadBinaryMeta(bst_meta, bms_meta, p, bst_meta_import, bms_meta_import);
10441056

1045-
// Capture datum set within binary files
1046-
CDnaDatum datum(bst_meta.epsgCode, bst_meta.epoch);
1057+
// Capture datum set within project file
1058+
CDnaDatum datum(epsgStringFromName<string>(p.r.reference_frame), p.r.epoch);
10471059

10481060
if (vm.count(QUIET))
10491061
p.g.quiet = 1;

dynadjust/dynadjust/dnaimport/dnainterop.cpp

Lines changed: 45 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ MsrTally g_parsemsr_tally;
3636
StnTally g_parsestn_tally;
3737
UINT32 g_fileOrder;
3838

39+
//boost::random::mt19937 rng;
40+
//boost::random::uniform_real_distribution<double> stdev(0.0, 3.0);
41+
//boost::random::uniform_real_distribution<double> pertu(0.0, 1.0);
42+
3943
//int compare_chararray(const void *a, const void *b)
4044
//{
4145
// const char* a1 = *(const char**)a;
@@ -650,7 +654,7 @@ void dna_import::ParseXML(const string& fileName, vdnaStnPtr* vStations, PUINT32
650654
return;
651655
}
652656
stringstream ss;
653-
ss << "ParseInputFile(): An ios_base failure was encountered while parsing " << fileName << "." << endl << " " << f.what();
657+
ss << "ParseXML(): An ios_base failure was encountered while parsing " << fileName << "." << endl << " " << f.what();
654658
SignalExceptionParse(static_cast<string>(ss.str()), 0);
655659
}
656660
catch (const std::system_error& e)
@@ -668,13 +672,13 @@ void dna_import::ParseXML(const string& fileName, vdnaStnPtr* vStations, PUINT32
668672
return;
669673
}
670674
stringstream ss;
671-
ss << "ParseInputFile(): An ios_base failure was encountered while parsing " << fileName << "." << endl << " " << e.what();
675+
ss << "ParseXML(): An ios_base failure was encountered while parsing " << fileName << "." << endl << " " << e.what();
672676
SignalExceptionParse(static_cast<string>(ss.str()), 0);
673677
}
674678
catch (const XMLInteropException& e)
675679
{
676680
stringstream ss;
677-
ss << "ParseInputFile(): An exception was encountered while parsing " << fileName << "." << endl << " " << e.what();
681+
ss << "ParseXML(): An exception was encountered while parsing " << fileName << "." << endl << " " << e.what();
678682
SignalExceptionParse(static_cast<string>(ss.str()), 0);
679683
}
680684
catch (const ::xml_schema::parsing& e)
@@ -696,13 +700,13 @@ void dna_import::ParseXML(const string& fileName, vdnaStnPtr* vStations, PUINT32
696700
catch (const ::xml_schema::exception& e)
697701
{
698702
stringstream ss;
699-
ss << "ParseInputFile(): An xml_schema exception was encountered while parsing " << fileName << "." << endl << " " << e.what();
703+
ss << "ParseXML(): An xml_schema exception was encountered while parsing " << fileName << "." << endl << " " << e.what();
700704
SignalExceptionParse(static_cast<string>(ss.str()), 0);
701705
}
702706
catch (...)
703707
{
704708
stringstream ss;
705-
ss << "ParseInputFile(): An unknown error was encountered while parsing " << fileName << "." << endl;
709+
ss << "ParseXML(): An unknown error was encountered while parsing " << fileName << "." << endl;
706710
SignalExceptionParse(ss.str(), 0);
707711
}
708712

@@ -1204,6 +1208,7 @@ void dna_import::ParseDNA(const string& fileName, vdnaStnPtr* vStations, PUINT32
12041208
import_file_mutex.unlock();
12051209
}
12061210
catch (const runtime_error& e) {
1211+
import_file_mutex.unlock();
12071212
throw XMLInteropException(e.what(), 0);
12081213
}
12091214

@@ -1231,12 +1236,14 @@ void dna_import::ParseDNA(const string& fileName, vdnaStnPtr* vStations, PUINT32
12311236
ss << "ParseDNA(): An ios_base failure was encountered when attempting to read stations file " << fileName << "." << endl << " " << f.what();
12321237
throw XMLInteropException(ss.str(), 0);
12331238
}
1234-
catch (const XMLInteropException& f) {
1239+
catch (const XMLInteropException& f)
1240+
{
12351241
stringstream ss;
1242+
ss << "ParseInputFile(): An exception was encountered while parsing " << fileName << "." << endl;
12361243
ss << " - line " << m_lineNo;
1237-
ss << ", column " << m_columnNo << endl;
1244+
ss << ", column " << m_columnNo << endl;
12381245
ss << " - " << f.what();
1239-
throw XMLInteropException(ss.str(), 0);
1246+
SignalExceptionParse(static_cast<string>(ss.str()), 0);
12401247
}
12411248
catch (...) {
12421249
if (ifsInputFILE_->eof())
@@ -1273,12 +1280,14 @@ void dna_import::ParseDNA(const string& fileName, vdnaStnPtr* vStations, PUINT32
12731280
ss << "ParseDNA(): An ios_base failure was encountered when attempting to read measurements file " << fileName << "." << endl << " " << f.what();
12741281
throw XMLInteropException(ss.str(), 0);
12751282
}
1276-
catch (const XMLInteropException& f) {
1283+
catch (const XMLInteropException& f)
1284+
{
12771285
stringstream ss;
1278-
ss << endl << " - line " << m_lineNo;
1279-
ss << ", column " << m_columnNo << endl;
1286+
ss << "ParseInputFile(): An exception was encountered while parsing " << fileName << "." << endl;
1287+
ss << " - line " << m_lineNo;
1288+
ss << ", column " << m_columnNo << endl;
12801289
ss << " - " << f.what();
1281-
throw XMLInteropException(ss.str(), 0);
1290+
SignalExceptionParse(static_cast<string>(ss.str()), 0);
12821291
}
12831292
catch (...) {
12841293
if (ifsInputFILE_->eof())
@@ -2858,7 +2867,7 @@ void dna_import::ParseDNAMSRDirections(string& sBuf, dnaMsrPtr& msr_ptr, bool ig
28582867
msr_ptr->SetTarget(ParseTargetValue(sBuf, "ParseDNAMSRDirections"));
28592868

28602869
// Number of directions
2861-
UINT32 dirnCount;
2870+
UINT32 dirnCount, dirnCountLessIgnored;
28622871
msr_ptr->SetTotal(ParseMsrCountValue(sBuf, dirnCount, "ParseDNAMSRDirections"));
28632872
msr_ptr->GetDirections_ptr()->reserve(dirnCount);
28642873

@@ -2889,19 +2898,37 @@ void dna_import::ParseDNAMSRDirections(string& sBuf, dnaMsrPtr& msr_ptr, bool ig
28892898
dirnTmp.SetClusterID(msr_ptr->GetClusterID());
28902899
}
28912900

2901+
bool subignoreMsr;
2902+
dirnCountLessIgnored = dirnCount;
2903+
2904+
if (dirnCount == 0)
2905+
throw XMLInteropException("Zero direction count.", m_lineNo);
2906+
28922907
for (UINT32 dirn=0; dirn<dirnCount; ++dirn)
28932908
{
2894-
dirnTmp.SetFirst(msr_ptr->GetFirst());
2895-
dirnTmp.SetIgnore(ignoreMsr);
2896-
g_parsemsr_tally.D++;
2897-
28982909
m_lineNo++;
28992910
// Obtain exclusive use of the input file pointer
29002911
import_file_mutex.lock();
29012912
getline((*ifsInputFILE_), sBuf);
29022913
// release file pointer mutex
29032914
import_file_mutex.unlock();
29042915

2916+
// get ignore flag for sub direction and remove accordingly
2917+
subignoreMsr = iequals("*", sBuf.substr(dml_.msr_ignore, dmw_.msr_ignore));
2918+
2919+
if (subignoreMsr)
2920+
{
2921+
dirnCountLessIgnored--;
2922+
if (dirnCountLessIgnored == 0)
2923+
throw XMLInteropException("There aren't any non-ignored directions in the set.", m_lineNo);
2924+
msr_ptr->SetTotal(dirnCountLessIgnored);
2925+
continue;
2926+
}
2927+
2928+
dirnTmp.SetFirst(msr_ptr->GetFirst());
2929+
dirnTmp.SetIgnore(ignoreMsr);
2930+
g_parsemsr_tally.D++;
2931+
29052932
// Second target station
29062933
dirnTmp.SetTarget(ParseTarget2Value(sBuf, "ParseDNAMSRDirections"));
29072934

@@ -5585,7 +5612,7 @@ void dna_import::MapMeasurementStations(vdnaMsrPtr* vMeasurements, pvASLPtr vAss
55855612
if (_it_msr->get()->GetIgnore())
55865613
vIgnoredMsrs->push_back(static_cast<UINT32>(std::distance(vMeasurements->begin(), _it_msr)));
55875614

5588-
// 1. Handle nested type measurements (D, G, X, Y) separately
5615+
// 1. Handle nested type measurements (G, X, Y) separately
55895616
switch (_it_msr->get()->GetTypeC())
55905617
{
55915618
case 'G': // GPS Baseline (treat as single-baseline cluster)

0 commit comments

Comments
 (0)