Skip to content

Commit 720574b

Browse files
authored
Merge pull request #162 from rogerfraser/master
Fix issues discovered in beta release v1.2.0
2 parents dacfbae + 213ed3e commit 720574b

File tree

5 files changed

+105
-120
lines changed

5 files changed

+105
-120
lines changed

dynadjust/FindXercesC.cmake

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,20 @@ IF (CMAKE_SYSTEM_NAME MATCHES "Darwin")
2828

2929
ELSEIF (UNIX)
3030
SET(XERCESC_ROOT_DIR ${PKG_MGR_PATH_INCLUDE}/xercesc)
31+
SET(XERCESC_ROOT_DIR_OPT /opt/xerces-c/3.1.4)
3132
# Various options...
32-
IF (EXISTS ${PKG_MGR_PATH_LIB}/x86_64-linux-gnu)
33+
IF (EXISTS ${PKG_MGR_PATH_LIB}/x86_64-linux-gnu AND EXISTS ${PKG_MGR_PATH_INCLUDE}/xercesc)
3334
# Modern Ubuntu
3435
SET (XERCESC_LIBRARY_DIR /usr/lib/x86_64-linux-gnu)
3536
SET (XERCESC_INCLUDE_DIR ${PKG_MGR_PATH_INCLUDE}/xercesc)
36-
ELSEIF (EXISTS ${PKG_MGR_PATH_LIB}64)
37+
ELSEIF (EXISTS ${PKG_MGR_PATH_LIB}64 AND EXISTS ${PKG_MGR_PATH_INCLUDE}/xercesc)
3738
# Fedora, RHEL, CentOS and early Ubuntu
3839
SET (XERCESC_LIBRARY_DIR ${PKG_MGR_PATH_LIB}64)
3940
SET (XERCESC_INCLUDE_DIR ${PKG_MGR_PATH_INCLUDE}/xercesc)
40-
ELSE ()
41+
ELSEIF (EXISTS ${XERCESC_ROOT_DIR_OPT}/lib AND EXISTS ${XERCESC_ROOT_DIR_OPT}/include)
4142
# Manual installation
42-
SET (XERCESC_ROOT_DIR /opt/xerces-c/3.1.4)
43-
SET (XERCESC_LIBRARY_DIR ${XERCESC_ROOT_DIR}/lib)
44-
SET (XERCESC_INCLUDE_DIR ${XERCESC_ROOT_DIR}/include)
43+
SET (XERCESC_LIBRARY_DIR ${XERCESC_ROOT_DIR_OPT}/lib)
44+
SET (XERCESC_INCLUDE_DIR ${XERCESC_ROOT_DIR_OPT}/include)
4545
ENDIF ()
4646

4747
ELSE ()

dynadjust/dynadjust/dnaadjust/dnaadjust.cpp

Lines changed: 57 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1599,7 +1599,7 @@ void dna_adjust::UpdateNormals(const UINT32& block, bool MT_ReverseOrCombine)
15991599
case 'L': // Level difference
16001600
case 'M': // MSL arc
16011601
case 'S': // Slope distance
1602-
case 'V': // Zenith angle
1602+
case 'V': // Zenith distance
16031603
case 'Z': // Vertical angle
16041604
stn2 = GetBlkMatrixElemStn2(block, &_it_msr);
16051605
UpdateNormals_BCEKLMSVZ(block, stn1, stn2, design_row, normals, design, AtVinv);
@@ -2413,8 +2413,8 @@ void dna_adjust::PrintAdjustedNetworkStations()
24132413
switch (projectSettings_.a.adjust_mode)
24142414
{
24152415
case SimultaneousMode:
2416-
PrintAdjStations(adj_file, 0, &v_estimatedStations_.at(0), &v_normals_.at(0), false, true, true, printHeader);
2417-
PrintAdjStations(xyz_file, 0, &v_estimatedStations_.at(0), &v_normals_.at(0), false, false, false, printHeader);
2416+
PrintAdjStations(adj_file, 0, &v_estimatedStations_.at(0), &v_rigorousVariances_.at(0), false, true, true, printHeader);
2417+
PrintAdjStations(xyz_file, 0, &v_estimatedStations_.at(0), &v_rigorousVariances_.at(0), false, false, false, printHeader);
24182418
break;
24192419
case PhasedMode:
24202420
case Phased_Block_1Mode:
@@ -3181,7 +3181,7 @@ void dna_adjust::FormUniqueMsrList()
31813181
case 'L': // Level difference
31823182
case 'M': // MSL arc
31833183
case 'S': // Slope distance
3184-
case 'V': // Zenith angle
3184+
case 'V': // Zenith distance
31853185
case 'Z': // Vertical angle
31863186
case 'H': // Orthometric height
31873187
case 'I': // Astronomic latitude
@@ -3479,6 +3479,20 @@ void dna_adjust::ValidateandFinaliseAdjustment(cpu_timer& tot_time)
34793479
fabs(maxCorr_) > projectSettings_.a.iteration_threshold)
34803480
adjustStatus_ = ADJUST_MAX_ITERATIONS_EXCEEDED;
34813481

3482+
// Back up simultaneous rigorous variance estimates (for serialising
3483+
// to disk at SerialiseAdjustedVarianceMatrices() ), so that executing adjust
3484+
// in report-results mode has access to the latest variance estimates
3485+
switch (projectSettings_.a.adjust_mode)
3486+
{
3487+
case SimultaneousMode:
3488+
v_rigorousVariances_.at(0) = v_normals_.at(0);
3489+
break;
3490+
case Phased_Block_1Mode:
3491+
case PhasedMode:
3492+
default:
3493+
break;
3494+
}
3495+
34823496
// Print status
34833497
PrintAdjustmentStatus();
34843498
// Compute and print time taken to run adjustment
@@ -5029,7 +5043,7 @@ void dna_adjust::UpdateDesignNormalMeasMatrices(pit_vmsr_t _it_msr, UINT32& desi
50295043
UpdateDesignNormalMeasMatrices_S(_it_msr, design_row, block,
50305044
measMinusComp, estimatedStations, normals, design, AtVinv, buildnewMatrices);
50315045
break;
5032-
case 'V': // Zenith angle
5046+
case 'V': // Zenith distance
50335047
UpdateDesignNormalMeasMatrices_V(_it_msr, design_row, block,
50345048
measMinusComp, estimatedStations, normals, design, AtVinv, buildnewMatrices);
50355049
break;
@@ -6003,7 +6017,7 @@ void dna_adjust::UpdateDesignNormalMeasMatrices_BK(pit_vmsr_t _it_msr, UINT32& d
60036017
{
60046018
////////////////////////////////////////////////////////////////////////////
60056019
// Astronomic azimuths must be corrected for deflection of the vertical via
6006-
// "Laplace correction". This correction requires zenith angle and geodetic
6020+
// "Laplace correction". This correction requires zenith distance and geodetic
60076021
// azimuth (comp_msr), both of which must be computed from coordinates.
60086022

60096023
////////////////////////////////////////////////////////////////////////////
@@ -6527,8 +6541,9 @@ void dna_adjust::UpdateDesignNormalMeasMatrices_S(pit_vmsr_t _it_msr, UINT32& de
65276541
design_row++;
65286542
}
65296543

6530-
6531-
// Like vertical angles and slope distances, the relationship between zenith distances and the
6544+
// Zenith distance
6545+
//
6546+
// Like vertical angles, the relationship between zenith distances and the
65326547
// coordinates of p1 and p2 requires a little extra work to take into consideration instrument
65336548
// and target height. For the measurements-minus-computed vector, the "computed" zenith distance
65346549
// is the true angle between the ellipsoid normal and instrument-target vector, and so must take
@@ -6570,12 +6585,12 @@ void dna_adjust::UpdateDesignNormalMeasMatrices_V(pit_vmsr_t _it_msr, UINT32& de
65706585
stn1_it->currentLongitude));
65716586

65726587
// 2. Compute correction
6573-
(*_it_msr)->preAdjCorr = ZenithDeflectionCorrection<double>( // Correction to vertical angle for deflection of vertical
6588+
(*_it_msr)->preAdjCorr = ZenithDeflectionCorrection<double>( // Correction to zenith distance for deflection of vertical
65746589
azimuth, // geodetic azimuth
65756590
stn1_it->verticalDef, // deflection in prime vertical
65766591
stn1_it->meridianDef); // deflection in prime meridian
65776592

6578-
(*_it_msr)->term1 -= (*_it_msr)->preAdjCorr; // apply deflection correction
6593+
(*_it_msr)->term1 += (*_it_msr)->preAdjCorr; // apply deflection correction
65796594
////////////////////////////////////////////////////////////////////////////
65806595
}
65816596
else
@@ -6585,7 +6600,7 @@ void dna_adjust::UpdateDesignNormalMeasMatrices_V(pit_vmsr_t _it_msr, UINT32& de
65856600
return;
65866601
}
65876602

6588-
// compute zenith angle from estimated coordinates
6603+
// compute zenith distance from estimated coordinates
65896604
double comp_msr(ZenithDistance(
65906605
estimatedStations->get(stn1, 0), // X1
65916606
estimatedStations->get(stn1+1, 0), // Y1
@@ -6635,7 +6650,9 @@ void dna_adjust::UpdateDesignNormalMeasMatrices_V(pit_vmsr_t _it_msr, UINT32& de
66356650
}
66366651

66376652

6638-
// Like zenith distances and vertical angles, the relationship between slope distances and the
6653+
// Vertical angles
6654+
//
6655+
// Like zenith distances, the relationship between slope distances and the
66396656
// coordinates of p1 and p2 requires a little extra work to take into consideration instrument
66406657
// and target height. For the measurements-minus-computed vector, the "computed" distance
66416658
// is the true distance between the instrument and target, and so must take into consideration
@@ -8366,7 +8383,7 @@ void dna_adjust::ComputeChiSquare(const UINT32& block)
83668383
case 'Q': // Geodetic longitude
83678384
case 'R': // Ellipsoidal height
83688385
case 'S': // Slope distance
8369-
case 'V': // Zenith angle
8386+
case 'V': // Zenith distance
83708387
case 'Z': // Vertical angle
83718388
ComputeChiSquare_ABCEHIJKLMPQRSVZ(_it_msr, measurement_index, &v_measMinusComp_.at(block));
83728389
break;
@@ -8653,7 +8670,7 @@ void dna_adjust::ComputePrecisionAdjMsrs(const UINT32& block /*= 0*/)
86538670
case 'L': // Level difference
86548671
case 'M': // MSL arc
86558672
case 'S': // Slope distance
8656-
case 'V': // Zenith angle
8673+
case 'V': // Zenith distance
86578674
case 'Z': // Vertical angle
86588675
ComputePrecisionAdjMsrs_BCEKLMSVZ(block,
86598676
GetBlkMatrixElemStn1(block, &_it_msr),
@@ -8967,9 +8984,11 @@ void dna_adjust::UpdateMsrRecords_GXY(const UINT32& block, it_vmsr_t& _it_msr, U
89678984

89688985
void dna_adjust::UpdateMsrRecord(const UINT32& block, it_vmsr_t& _it_msr,
89698986
const UINT32& msr_row, const UINT32& precadjmsr_row, const double& measPrec)
8970-
{ // adjusted measurement
8971-
_it_msr->measCorr = -v_measMinusComp_.at(block).get(msr_row, 0); // correction
8987+
{
8988+
// set adjusted measurement correction
8989+
_it_msr->measCorr = -v_measMinusComp_.at(block).get(msr_row, 0);
89728990

8991+
// apply adjusted measurement correction
89738992
if (_it_msr->measType == 'D')
89748993
{
89758994
_it_msr->measAdj = _it_msr->scale1 + _it_msr->measCorr;
@@ -9029,17 +9048,20 @@ void dna_adjust::UpdateMsrRecord(const UINT32& block, it_vmsr_t& _it_msr,
90299048
_it_msr->measAdj -= _it_msr->preAdjCorr;
90309049
break;
90319050

9032-
// Apply correction for deflections
9051+
// Apply correction for deflections of the vertical
90339052
case 'A':
9034-
case 'B':
9053+
case 'D':
90359054
case 'I':
90369055
case 'J':
90379056
case 'K':
9038-
case 'P':
9039-
case 'Q':
9057+
case 'Z':
9058+
// add deflection of the vertical to adjusted value
9059+
_it_msr->measAdj += _it_msr->preAdjCorr;
9060+
break;
90409061
case 'V':
9041-
case 'z':
9042-
//_it_msr->measAdj += _it_msr->preAdjCorr;
9062+
// apply deflection of the vertical to the adjusted
9063+
// measurement to get the commensurate measurement value
9064+
_it_msr->measAdj -= _it_msr->preAdjCorr;
90439065
break;
90449066
}
90459067

@@ -10588,7 +10610,7 @@ void dna_adjust::PrintCompMeasurements(const UINT32& block, const string& type)
1058810610
break;
1058910611
case 'B': // Geodetic azimuth
1059010612
case 'K': // Astronomic azimuth
10591-
case 'V': // Zenith angle
10613+
case 'V': // Zenith distance
1059210614
case 'Z': // Vertical angle
1059310615
PrintCompMeasurements_BKVZ(block, _it_msr, design_row, computedMsrs);
1059410616
break;
@@ -11339,7 +11361,7 @@ void dna_adjust::UpdateIgnoredMeasurements_K(pit_vmsr_t _it_msr, bool storeOrigi
1133911361
{
1134011362
////////////////////////////////////////////////////////////////////////////
1134111363
// Astronomic azimuths must be corrected for deflection of the vertical via
11342-
// "Laplace correction". This correction requires zenith angle and geodetic
11364+
// "Laplace correction". This correction requires zenith distance and geodetic
1134311365
// azimuth (comp_msr), both of which must be computed from coordinates.
1134411366

1134511367
////////////////////////////////////////////////////////////////////////////
@@ -11558,7 +11580,8 @@ void dna_adjust::UpdateIgnoredMeasurements_S(pit_vmsr_t _it_msr, bool storeOrigi
1155811580
(*_it_msr)->measCorr = (*_it_msr)->measAdj - (*_it_msr)->preAdjMeas;
1155911581
}
1156011582

11561-
11583+
// Zenith distance
11584+
//
1156211585
void dna_adjust::UpdateIgnoredMeasurements_V(pit_vmsr_t _it_msr, bool storeOriginalMeasurement)
1156311586
{
1156411587
// initialise measurement (on the first adjustment only!)
@@ -11586,7 +11609,7 @@ void dna_adjust::UpdateIgnoredMeasurements_V(pit_vmsr_t _it_msr, bool storeOrigi
1158611609

1158711610
double local_12e, local_12n, local_12up;
1158811611

11589-
// compute zenith angle from estimated coordinates
11612+
// compute zenith distance from estimated coordinates
1159011613
(*_it_msr)->measAdj = (ZenithDistance(
1159111614
estimatedStations_stn1->get(stn1, 0), // X1
1159211615
estimatedStations_stn1->get(stn1 + 1, 0), // Y1
@@ -11631,7 +11654,7 @@ void dna_adjust::UpdateIgnoredMeasurements_V(pit_vmsr_t _it_msr, bool storeOrigi
1163111654
(*_it_msr)->preAdjCorr = 0.;
1163211655

1163311656
// apply correction for deflections in the vertical
11634-
(*_it_msr)->measAdj += (*_it_msr)->preAdjCorr;
11657+
(*_it_msr)->measAdj -= (*_it_msr)->preAdjCorr;
1163511658
// compute adjustment correction
1163611659
(*_it_msr)->measCorr = (*_it_msr)->measAdj - (*_it_msr)->preAdjMeas;
1163711660
}
@@ -11746,6 +11769,8 @@ void dna_adjust::UpdateIgnoredMeasurements_Y(pit_vmsr_t _it_msr, bool storeOrigi
1174611769
}
1174711770

1174811771

11772+
// Vertical angle
11773+
//
1174911774
void dna_adjust::UpdateIgnoredMeasurements_Z(pit_vmsr_t _it_msr, bool storeOriginalMeasurement)
1175011775
{
1175111776
// initialise measurement (on the first adjustment only!)
@@ -11884,7 +11909,7 @@ void dna_adjust::UpdateIgnoredMeasurements(pit_vmsr_t _it_msr, bool storeOrigina
1188411909
case 'S': // Slope distance
1188511910
UpdateIgnoredMeasurements_S(_it_msr, storeOriginalMeasurement);
1188611911
break;
11887-
case 'V': // Zenith angle
11912+
case 'V': // Zenith distance
1188811913
UpdateIgnoredMeasurements_V(_it_msr, storeOriginalMeasurement);
1188911914
break;
1189011915
case 'X': // GPS Baseline cluster
@@ -12036,7 +12061,7 @@ void dna_adjust::PrintIgnoredAdjMeasurements(bool printHeader)
1203612061
break;
1203712062
case 'B': // Geodetic azimuth
1203812063
case 'K': // Astronomic azimuth
12039-
case 'V': // Zenith angle
12064+
case 'V': // Zenith distance
1204012065
case 'Z': // Vertical angle
1204112066
PrintCompMeasurements_BKVZ(0, _it_msr, design_row, ignoredMsrs);
1204212067
break;
@@ -12096,7 +12121,7 @@ bool dna_adjust::IgnoredMeasurementContainsInvalidStation(pit_vmsr_t _it_msr)
1209612121
case 'L': // Level difference
1209712122
case 'M': // MSL arc
1209812123
case 'S': // Slope distance
12099-
case 'V': // Zenith angle
12124+
case 'V': // Zenith distance
1210012125
case 'Z': // Vertical angle
1210112126
if (vAssocStnList_.at((*_it_msr)->station2).IsInvalid())
1210212127
return false;
@@ -12305,7 +12330,7 @@ void dna_adjust::PrintAdjMeasurements(v_uint32_u32u32_pair msr_block, bool print
1230512330
break;
1230612331
case 'B': // Geodetic azimuth
1230712332
case 'K': // Astronomic azimuth
12308-
case 'V': // Zenith angle
12333+
case 'V': // Zenith distance
1230912334
case 'Z': // Vertical angle
1231012335
PrintAdjMeasurements_BKVZ(_it_msr);
1231112336
break;
@@ -12614,7 +12639,6 @@ void dna_adjust::PrintCompMeasurements_GXY(const UINT32& block, it_vmsr_t& _it_m
1261412639
UINT32 covariance_count;
1261512640
bool nextElement(false);
1261612641
double computed, correction;
12617-
string ignoreFlag;
1261812642

1261912643
for (cluster_msr=0; cluster_msr<cluster_count; ++cluster_msr)
1262012644
{
@@ -12655,10 +12679,6 @@ void dna_adjust::PrintCompMeasurements_GXY(const UINT32& block, it_vmsr_t& _it_m
1265512679
break;
1265612680
}
1265712681

12658-
ignoreFlag = " ";
12659-
if (_it_msr->ignore)
12660-
ignoreFlag = "*";
12661-
1266212682
// Print linear measurement, taking care of user requirements for precision
1266312683
PrintCompMeasurementsLinear('X', computed, correction, _it_msr);
1266412684

@@ -12678,10 +12698,6 @@ void dna_adjust::PrintCompMeasurements_GXY(const UINT32& block, it_vmsr_t& _it_m
1267812698
break;
1267912699
}
1268012700

12681-
ignoreFlag = " ";
12682-
if (_it_msr->ignore)
12683-
ignoreFlag = "*";
12684-
1268512701
// Print linear measurement, taking care of user requirements for precision
1268612702
PrintCompMeasurementsLinear('Y', computed, correction, _it_msr);
1268712703

@@ -12701,10 +12717,6 @@ void dna_adjust::PrintCompMeasurements_GXY(const UINT32& block, it_vmsr_t& _it_m
1270112717
break;
1270212718
}
1270312719

12704-
ignoreFlag = " ";
12705-
if (_it_msr->ignore)
12706-
ignoreFlag = "*";
12707-
1270812720
// Print linear measurement, taking care of user requirements for precision
1270912721
PrintCompMeasurementsLinear('Z', computed, correction, _it_msr);
1271012722

@@ -12741,10 +12753,6 @@ void dna_adjust::PrintCompMeasurements_HR(const UINT32& block, it_vmsr_t& _it_ms
1274112753
break;
1274212754
}
1274312755

12744-
string ignoreFlag(" ");
12745-
if (_it_msr->ignore)
12746-
ignoreFlag = "*";
12747-
1274812756
// Print linear measurement, taking care of user requirements for precision
1274912757
PrintCompMeasurementsLinear(' ', computed, correction, _it_msr);
1275012758

@@ -12948,26 +12956,8 @@ void dna_adjust::PrintMeasurementsAngular(const char cardinal, const double& mea
1294812956

1294912957
void dna_adjust::PrintAdjMeasurementsAngular(const char cardinal, const it_vmsr_t& _it_msr)
1295012958
{
12951-
double measAdj(_it_msr->measAdj);
12952-
12953-
switch (_it_msr->measType)
12954-
{
12955-
case 'A':
12956-
case 'D':
12957-
case 'J':
12958-
case 'I':
12959-
case 'K':
12960-
case 'V':
12961-
case 'Z':
12962-
// add deflection of the vertical to adjusted value
12963-
// Does a check need to be performed that it has been calculated?
12964-
//if (fabs(_it_msr->preAdjCorr) > E4_SEC_DEFLECTION)
12965-
measAdj += _it_msr->preAdjCorr;
12966-
break;
12967-
}
12968-
1296912959
// Print adjusted angular measurements
12970-
PrintMeasurementsAngular(cardinal, measAdj, _it_msr->measCorr, _it_msr);
12960+
PrintMeasurementsAngular(cardinal, _it_msr->measAdj, _it_msr->measCorr, _it_msr);
1297112961

1297212962
// Print adjusted statistics
1297312963
PrintAdjMeasurementStatistics(cardinal, _it_msr);

0 commit comments

Comments
 (0)