Skip to content

Commit c3043fe

Browse files
gmgunterGitHub Enterprise
authored andcommitted
Port upstream changes from SNAPHU v2.0.5 (#995)
1 parent 3f62709 commit c3043fe

File tree

5 files changed

+431
-116
lines changed

5 files changed

+431
-116
lines changed

cxx/isce3/unwrap/snaphu/README

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
SNAPHU
22
Statistical-Cost, Netowrk-Flow Algorithm for Phase Unwrapping
33
Author: Curtis W. Chen
4-
Version 2.0.4, August 2020
4+
Version 2.0.5, December 2021
55

66

77
Contents
@@ -10,7 +10,7 @@ Contents
1010
1. Bugs and Bug Reporting
1111
2. Notes on Compiling
1212
3. Run-Time Configuration Files
13-
4. Copyright
13+
4. Copyright
1414

1515

1616
Bugs And Bug Reporting
@@ -66,7 +66,7 @@ accept.
6666
Copyright
6767
---------
6868

69-
Copyright 2002-2020 Board of Trustees, Leland Stanford Jr. University
69+
Copyright 2002-2021 Board of Trustees, Leland Stanford Jr. University
7070

7171
Except as noted below, permission to use, copy, modify, and
7272
distribute, this software and its documentation for any purpose is

cxx/isce3/unwrap/snaphu/snaphu.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ int UnwrapTile(infileT *infiles, outfileT *outfiles, paramT *params,
599599
/* set the tree root (equivalent to source of shortest path problem) */
600600
Array1D<nodeT*> sourcelist;
601601
Array1D<long> nconnectedarr;
602-
nsource=SelectSources(nodes,ground,nflow,flows,ngroundarcs,
602+
nsource=SelectSources(nodes,mag,ground,nflow,flows,ngroundarcs,
603603
nrow,ncol,params,&sourcelist,&nconnectedarr);
604604

605605
/* set up network variables for tree solver */
@@ -615,8 +615,12 @@ int UnwrapTile(infileT *infiles, outfileT *outfiles, paramT *params,
615615
source=sourcelist[isource];
616616

617617
/* show status if verbose */
618-
fprintf(sp3,"Source %ld row, col = %d, %d\n",
619-
isource,source->row,source->col);
618+
if(source->row==GROUNDROW){
619+
fprintf(sp3,"Source %ld: (edge ground)\n",isource);
620+
}else{
621+
fprintf(sp3,"Source %ld: row, col = %d, %d\n",
622+
isource,source->row,source->col);
623+
}
620624

621625
/* run the solver, and increment nflowdone if no cycles are found */
622626
Array2D<nodesuppT> dummy;
@@ -630,9 +634,12 @@ int UnwrapTile(infileT *infiles, outfileT *outfiles, paramT *params,
630634
}
631635

632636
/* evaluate and save the total cost (skip if first loop through nflow) */
637+
Array1D<int> dummy;
638+
fprintf(sp2,"Current solution cost: %.16g\n",
639+
(double )EvaluateTotalCost(costs,flows,nrow,ncol,dummy,params,tag));
640+
fflush(NULL);
633641
if(notfirstloop){
634642
oldtotalcost=totalcost;
635-
Array1D<int> dummy;
636643
totalcost=EvaluateTotalCost(costs,flows,nrow,ncol,dummy,params,tag);
637644
if(totalcost<mintotalcost){
638645
mintotalcost=totalcost;

cxx/isce3/unwrap/snaphu/snaphu.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
/**********************/
2525

2626
#define PROGRAMNAME "snaphu"
27-
#define VERSION "2.0.4"
27+
#define VERSION "2.0.5"
2828
#define BUGREPORTEMAIL "[email protected]"
2929
#ifdef PI
3030
#undef PI
@@ -55,7 +55,7 @@
5555
#define BOUNDARYCANDIDATE -7
5656
#define BOUNDARYLEVEL LARGEINT
5757
#define INTERIORLEVEL (BOUNDARYLEVEL-1)
58-
#define MINBOUNDARYSIZE 3
58+
#define MINBOUNDARYSIZE 100
5959
#define POSINCR 0
6060
#define NEGINCR 1
6161
#define NOCOSTSHELF -LARGESHORT
@@ -806,7 +806,7 @@ int InitNodes(long nrow, long ncol, Array2D<nodeT>& nodes, nodeT *ground);
806806
void BucketInsert(nodeT *node, long ind, bucketT *bkts);
807807
void BucketRemove(nodeT *node, long ind, bucketT *bkts);
808808
nodeT *ClosestNode(bucketT *bkts);
809-
long SelectSources(Array2D<nodeT>& nodes, nodeT *ground, long nflow,
809+
long SelectSources(Array2D<nodeT>& nodes, Array2D<float>& mag, nodeT *ground, long nflow,
810810
Array2D<short>& flows, long ngroundarcs,
811811
long nrow, long ncol, paramT *params,
812812
Array1D<nodeT*>* sourcelistptr, Array1D<long>* nconnectedarrptr);

0 commit comments

Comments
 (0)