Diff of the two buildlogs: -- --- b1/build.log 2020-06-20 19:56:34.214810747 +0000 +++ b2/build.log 2020-06-20 20:11:32.308752401 +0000 @@ -1,6 +1,6 @@ I: pbuilder: network access will be disabled during build -I: Current time: Fri Jul 23 14:16:20 -12 2021 -I: pbuilder-time-stamp: 1627092980 +I: Current time: Sun Jun 21 09:56:36 +14 2020 +I: pbuilder-time-stamp: 1592682996 I: Building the build Environment I: extracting base tarball [/var/cache/pbuilder/buster-reproducible-base.tgz] I: copying local configuration @@ -18,7 +18,7 @@ I: Extracting source gpgv: unknown type of key resource 'trustedkeys.kbx' gpgv: keyblock resource '/root/.gnupg/trustedkeys.kbx': General error -gpgv: Signature made Fri Jan 4 20:36:15 2019 -12 +gpgv: Signature made Sat Jan 5 22:36:15 2019 +14 gpgv: using RSA key 3F464391498FE874BDB5D98F2124AA1983785C90 gpgv: Can't check signature: No public key dpkg-source: warning: failed to verify signature on ./octave-level-set_0.3.0-6.dsc @@ -30,138 +30,172 @@ dpkg-source: info: applying xtest-fastmarching.patch I: Not using root during the build. I: Installing the build-deps -I: user script /srv/workspace/pbuilder/5847/tmp/hooks/D02_print_environment starting +I: user script /srv/workspace/pbuilder/27201/tmp/hooks/D01_modify_environment starting +debug: Running on profitbricks-build2-i386. +I: Changing host+domainname to test build reproducibility +I: Adding a custom variable just for the fun of it... +I: Changing /bin/sh to bash +Removing 'diversion of /bin/sh to /bin/sh.distrib by dash' +Adding 'diversion of /bin/sh to /bin/sh.distrib by bash' +Removing 'diversion of /usr/share/man/man1/sh.1.gz to /usr/share/man/man1/sh.distrib.1.gz by dash' +Adding 'diversion of /usr/share/man/man1/sh.1.gz to /usr/share/man/man1/sh.distrib.1.gz by bash' +I: Setting pbuilder2's login shell to /bin/bash +I: Setting pbuilder2's GECOS to second user,second room,second work-phone,second home-phone,second other +I: user script /srv/workspace/pbuilder/27201/tmp/hooks/D01_modify_environment finished +I: user script /srv/workspace/pbuilder/27201/tmp/hooks/D02_print_environment starting I: set - BUILDDIR='/build' - BUILDUSERGECOS='first user,first room,first work-phone,first home-phone,first other' - BUILDUSERNAME='pbuilder1' - BUILD_ARCH='i386' - DEBIAN_FRONTEND='noninteractive' - DEB_BUILD_OPTIONS='buildinfo=+all reproducible=+all parallel=18' - DISTRIBUTION='' - HOME='/root' - HOST_ARCH='i386' + BASH=/bin/sh + BASHOPTS=checkwinsize:cmdhist:complete_fullquote:extquote:force_fignore:globasciiranges:hostcomplete:interactive_comments:progcomp:promptvars:sourcepath + BASH_ALIASES=() + BASH_ARGC=() + BASH_ARGV=() + BASH_CMDS=() + BASH_LINENO=([0]="12" [1]="0") + BASH_SOURCE=([0]="/tmp/hooks/D02_print_environment" [1]="/tmp/hooks/D02_print_environment") + BASH_VERSINFO=([0]="5" [1]="0" [2]="3" [3]="1" [4]="release" [5]="i686-pc-linux-gnu") + BASH_VERSION='5.0.3(1)-release' + BUILDDIR=/build + BUILDUSERGECOS='second user,second room,second work-phone,second home-phone,second other' + BUILDUSERNAME=pbuilder2 + BUILD_ARCH=i386 + DEBIAN_FRONTEND=noninteractive + DEB_BUILD_OPTIONS='buildinfo=+all reproducible=+all parallel=10' + DIRSTACK=() + DISTRIBUTION= + EUID=0 + FUNCNAME=([0]="Echo" [1]="main") + GROUPS=() + HOME=/root + HOSTNAME=i-capture-the-hostname + HOSTTYPE=i686 + HOST_ARCH=i386 IFS=' ' - INVOCATION_ID='333bd0fdf35a458e8601a9fa359385b1' - LANG='C' - LANGUAGE='en_US:en' - LC_ALL='C' - LD_LIBRARY_PATH='/usr/lib/libeatmydata' - LD_PRELOAD='libeatmydata.so' - MAIL='/var/mail/root' - OPTIND='1' - PATH='/usr/sbin:/usr/bin:/sbin:/bin:/usr/games' - PBCURRENTCOMMANDLINEOPERATION='build' - PBUILDER_OPERATION='build' - PBUILDER_PKGDATADIR='/usr/share/pbuilder' - PBUILDER_PKGLIBDIR='/usr/lib/pbuilder' - PBUILDER_SYSCONFDIR='/etc' - PPID='5847' - PS1='# ' - PS2='> ' + INVOCATION_ID=baaad593861b4b04b13c6a4ac353f66f + LANG=C + LANGUAGE=de_CH:de + LC_ALL=C + LD_LIBRARY_PATH=/usr/lib/libeatmydata + LD_PRELOAD=libeatmydata.so + MACHTYPE=i686-pc-linux-gnu + MAIL=/var/mail/root + OPTERR=1 + OPTIND=1 + OSTYPE=linux-gnu + PATH=/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/i/capture/the/path + PBCURRENTCOMMANDLINEOPERATION=build + PBUILDER_OPERATION=build + PBUILDER_PKGDATADIR=/usr/share/pbuilder + PBUILDER_PKGLIBDIR=/usr/lib/pbuilder + PBUILDER_SYSCONFDIR=/etc + PIPESTATUS=([0]="0") + POSIXLY_CORRECT=y + PPID=27201 PS4='+ ' - PWD='/' - SHELL='/bin/bash' - SHLVL='2' - SUDO_COMMAND='/usr/bin/timeout -k 18.1h 18h /usr/bin/ionice -c 3 /usr/bin/nice /usr/sbin/pbuilder --build --configfile /srv/reproducible-results/rbuild-debian/tmp.BSat8EGVgo/pbuilderrc_tZcD --hookdir /etc/pbuilder/first-build-hooks --debbuildopts -b --basetgz /var/cache/pbuilder/buster-reproducible-base.tgz --buildresult /srv/reproducible-results/rbuild-debian/tmp.BSat8EGVgo/b1 --logfile b1/build.log octave-level-set_0.3.0-6.dsc' - SUDO_GID='112' - SUDO_UID='107' - SUDO_USER='jenkins' - TERM='unknown' - TZ='/usr/share/zoneinfo/Etc/GMT+12' - USER='root' - _='/usr/bin/systemd-run' - http_proxy='http://85.184.249.68:3128' + PWD=/ + SHELL=/bin/bash + SHELLOPTS=braceexpand:errexit:hashall:interactive-comments:posix + SHLVL=3 + SUDO_COMMAND='/usr/bin/timeout -k 24.1h 24h /usr/bin/ionice -c 3 /usr/bin/nice -n 11 /usr/bin/unshare --uts -- /usr/sbin/pbuilder --build --configfile /srv/reproducible-results/rbuild-debian/tmp.BSat8EGVgo/pbuilderrc_25ks --hookdir /etc/pbuilder/rebuild-hooks --debbuildopts -b --basetgz /var/cache/pbuilder/buster-reproducible-base.tgz --buildresult /srv/reproducible-results/rbuild-debian/tmp.BSat8EGVgo/b2 --logfile b2/build.log octave-level-set_0.3.0-6.dsc' + SUDO_GID=112 + SUDO_UID=107 + SUDO_USER=jenkins + TERM=unknown + TZ=/usr/share/zoneinfo/Etc/GMT-14 + UID=0 + USER=root + _='I: set' + http_proxy=http://78.137.99.97:3128 I: uname -a - Linux profitbricks-build6-i386 4.19.0-9-amd64 #1 SMP Debian 4.19.118-2+deb10u1 (2020-06-07) x86_64 GNU/Linux + Linux i-capture-the-hostname 4.19.0-9-686-pae #1 SMP Debian 4.19.118-2+deb10u1 (2020-06-07) i686 GNU/Linux I: ls -l /bin - total 5476 - -rwxr-xr-x 1 root root 1302248 Apr 17 2019 bash - -rwxr-xr-x 3 root root 38280 Jul 10 2019 bunzip2 - -rwxr-xr-x 3 root root 38280 Jul 10 2019 bzcat - lrwxrwxrwx 1 root root 6 Jul 10 2019 bzcmp -> bzdiff - -rwxr-xr-x 1 root root 2227 Jul 10 2019 bzdiff - lrwxrwxrwx 1 root root 6 Jul 10 2019 bzegrep -> bzgrep - -rwxr-xr-x 1 root root 4877 Jun 24 2019 bzexe - lrwxrwxrwx 1 root root 6 Jul 10 2019 bzfgrep -> bzgrep - -rwxr-xr-x 1 root root 3641 Jul 10 2019 bzgrep - -rwxr-xr-x 3 root root 38280 Jul 10 2019 bzip2 - -rwxr-xr-x 1 root root 17768 Jul 10 2019 bzip2recover - lrwxrwxrwx 1 root root 6 Jul 10 2019 bzless -> bzmore - -rwxr-xr-x 1 root root 1297 Jul 10 2019 bzmore - -rwxr-xr-x 1 root root 38692 Feb 28 2019 cat - -rwxr-xr-x 1 root root 75588 Feb 28 2019 chgrp - -rwxr-xr-x 1 root root 63268 Feb 28 2019 chmod - -rwxr-xr-x 1 root root 75588 Feb 28 2019 chown - -rwxr-xr-x 1 root root 153732 Feb 28 2019 cp - -rwxr-xr-x 1 root root 132820 Jan 17 2019 dash - -rwxr-xr-x 1 root root 120676 Feb 28 2019 date - -rwxr-xr-x 1 root root 92040 Feb 28 2019 dd - -rwxr-xr-x 1 root root 100620 Feb 28 2019 df - -rwxr-xr-x 1 root root 149736 Feb 28 2019 dir - -rwxr-xr-x 1 root root 79412 Jan 9 2019 dmesg - lrwxrwxrwx 1 root root 8 Sep 26 2018 dnsdomainname -> hostname - lrwxrwxrwx 1 root root 8 Sep 26 2018 domainname -> hostname - -rwxr-xr-x 1 root root 34532 Feb 28 2019 echo - -rwxr-xr-x 1 root root 28 Jan 7 2019 egrep - -rwxr-xr-x 1 root root 34532 Feb 28 2019 false - -rwxr-xr-x 1 root root 28 Jan 7 2019 fgrep - -rwxr-xr-x 1 root root 67700 Jan 9 2019 findmnt - -rwsr-xr-x 1 root root 30112 Apr 22 2020 fusermount - -rwxr-xr-x 1 root root 206392 Jan 7 2019 grep - -rwxr-xr-x 2 root root 2345 Jan 5 2019 gunzip - -rwxr-xr-x 1 root root 6375 Jan 5 2019 gzexe - -rwxr-xr-x 1 root root 100952 Jan 5 2019 gzip - -rwxr-xr-x 1 root root 21916 Sep 26 2018 hostname - -rwxr-xr-x 1 root root 79752 Feb 28 2019 ln - -rwxr-xr-x 1 root root 55400 Jul 26 2018 login - -rwxr-xr-x 1 root root 149736 Feb 28 2019 ls - -rwxr-xr-x 1 root root 112032 Jan 9 2019 lsblk - -rwxr-xr-x 1 root root 87972 Feb 28 2019 mkdir - -rwxr-xr-x 1 root root 79748 Feb 28 2019 mknod - -rwxr-xr-x 1 root root 46916 Feb 28 2019 mktemp - -rwxr-xr-x 1 root root 42348 Jan 9 2019 more - -rwsr-xr-x 1 root root 50592 Jan 9 2019 mount - -rwxr-xr-x 1 root root 13724 Jan 9 2019 mountpoint - -rwxr-xr-x 1 root root 157832 Feb 28 2019 mv - lrwxrwxrwx 1 root root 8 Sep 26 2018 nisdomainname -> hostname - lrwxrwxrwx 1 root root 14 Feb 14 2019 pidof -> /sbin/killall5 - -rwxr-xr-x 1 root root 38660 Feb 28 2019 pwd - lrwxrwxrwx 1 root root 4 Apr 17 2019 rbash -> bash - -rwxr-xr-x 1 root root 46852 Feb 28 2019 readlink - -rwxr-xr-x 1 root root 75588 Feb 28 2019 rm - -rwxr-xr-x 1 root root 42756 Feb 28 2019 rmdir - -rwxr-xr-x 1 root root 22276 Jan 21 2019 run-parts - -rwxr-xr-x 1 root root 125036 Dec 22 2018 sed - lrwxrwxrwx 1 root root 4 Jul 23 02:47 sh -> dash - -rwxr-xr-x 1 root root 34532 Feb 28 2019 sleep - -rwxr-xr-x 1 root root 79652 Feb 28 2019 stty - -rwsr-xr-x 1 root root 71072 Jan 9 2019 su - -rwxr-xr-x 1 root root 34564 Feb 28 2019 sync - -rwxr-xr-x 1 root root 504024 Apr 23 2019 tar - -rwxr-xr-x 1 root root 13860 Jan 21 2019 tempfile - -rwxr-xr-x 1 root root 104292 Feb 28 2019 touch - -rwxr-xr-x 1 root root 34532 Feb 28 2019 true - -rwxr-xr-x 1 root root 17768 Apr 22 2020 ulockmgr_server - -rwsr-xr-x 1 root root 30108 Jan 9 2019 umount - -rwxr-xr-x 1 root root 34532 Feb 28 2019 uname - -rwxr-xr-x 2 root root 2345 Jan 5 2019 uncompress - -rwxr-xr-x 1 root root 149736 Feb 28 2019 vdir - -rwxr-xr-x 1 root root 34208 Jan 9 2019 wdctl - -rwxr-xr-x 1 root root 946 Jan 21 2019 which - lrwxrwxrwx 1 root root 8 Sep 26 2018 ypdomainname -> hostname - -rwxr-xr-x 1 root root 1983 Jan 5 2019 zcat - -rwxr-xr-x 1 root root 1677 Jan 5 2019 zcmp - -rwxr-xr-x 1 root root 5879 Jan 5 2019 zdiff - -rwxr-xr-x 1 root root 29 Jan 5 2019 zegrep - -rwxr-xr-x 1 root root 29 Jan 5 2019 zfgrep - -rwxr-xr-x 1 root root 2080 Jan 5 2019 zforce - -rwxr-xr-x 1 root root 7584 Jan 5 2019 zgrep - -rwxr-xr-x 1 root root 2205 Jan 5 2019 zless - -rwxr-xr-x 1 root root 1841 Jan 5 2019 zmore - -rwxr-xr-x 1 root root 4552 Jan 5 2019 znew -I: user script /srv/workspace/pbuilder/5847/tmp/hooks/D02_print_environment finished + total 5500 + -rwxr-xr-x 1 root root 1302248 Apr 18 2019 bash + -rwxr-xr-x 3 root root 38280 Jul 11 2019 bunzip2 + -rwxr-xr-x 3 root root 38280 Jul 11 2019 bzcat + lrwxrwxrwx 1 root root 6 Jul 11 2019 bzcmp -> bzdiff + -rwxr-xr-x 1 root root 2227 Jul 11 2019 bzdiff + lrwxrwxrwx 1 root root 6 Jul 11 2019 bzegrep -> bzgrep + -rwxr-xr-x 1 root root 4877 Jun 25 2019 bzexe + lrwxrwxrwx 1 root root 6 Jul 11 2019 bzfgrep -> bzgrep + -rwxr-xr-x 1 root root 3641 Jul 11 2019 bzgrep + -rwxr-xr-x 3 root root 38280 Jul 11 2019 bzip2 + -rwxr-xr-x 1 root root 17768 Jul 11 2019 bzip2recover + lrwxrwxrwx 1 root root 6 Jul 11 2019 bzless -> bzmore + -rwxr-xr-x 1 root root 1297 Jul 11 2019 bzmore + -rwxr-xr-x 1 root root 38692 Mar 1 2019 cat + -rwxr-xr-x 1 root root 75588 Mar 1 2019 chgrp + -rwxr-xr-x 1 root root 63268 Mar 1 2019 chmod + -rwxr-xr-x 1 root root 75588 Mar 1 2019 chown + -rwxr-xr-x 1 root root 153732 Mar 1 2019 cp + -rwxr-xr-x 1 root root 132820 Jan 18 2019 dash + -rwxr-xr-x 1 root root 120676 Mar 1 2019 date + -rwxr-xr-x 1 root root 92040 Mar 1 2019 dd + -rwxr-xr-x 1 root root 100620 Mar 1 2019 df + -rwxr-xr-x 1 root root 149736 Mar 1 2019 dir + -rwxr-xr-x 1 root root 79412 Jan 10 2019 dmesg + lrwxrwxrwx 1 root root 8 Sep 27 2018 dnsdomainname -> hostname + lrwxrwxrwx 1 root root 8 Sep 27 2018 domainname -> hostname + -rwxr-xr-x 1 root root 34532 Mar 1 2019 echo + -rwxr-xr-x 1 root root 28 Jan 8 2019 egrep + -rwxr-xr-x 1 root root 34532 Mar 1 2019 false + -rwxr-xr-x 1 root root 28 Jan 8 2019 fgrep + -rwxr-xr-x 1 root root 67700 Jan 10 2019 findmnt + -rwsr-xr-x 1 root root 30112 Apr 23 09:38 fusermount + -rwxr-xr-x 1 root root 206392 Jan 8 2019 grep + -rwxr-xr-x 2 root root 2345 Jan 6 2019 gunzip + -rwxr-xr-x 1 root root 6375 Jan 6 2019 gzexe + -rwxr-xr-x 1 root root 100952 Jan 6 2019 gzip + -rwxr-xr-x 1 root root 21916 Sep 27 2018 hostname + -rwxr-xr-x 1 root root 79752 Mar 1 2019 ln + -rwxr-xr-x 1 root root 55400 Jul 27 2018 login + -rwxr-xr-x 1 root root 149736 Mar 1 2019 ls + -rwxr-xr-x 1 root root 112032 Jan 10 2019 lsblk + -rwxr-xr-x 1 root root 87972 Mar 1 2019 mkdir + -rwxr-xr-x 1 root root 79748 Mar 1 2019 mknod + -rwxr-xr-x 1 root root 46916 Mar 1 2019 mktemp + -rwxr-xr-x 1 root root 42348 Jan 10 2019 more + -rwsr-xr-x 1 root root 50592 Jan 10 2019 mount + -rwxr-xr-x 1 root root 13724 Jan 10 2019 mountpoint + -rwxr-xr-x 1 root root 157832 Mar 1 2019 mv + lrwxrwxrwx 1 root root 8 Sep 27 2018 nisdomainname -> hostname + lrwxrwxrwx 1 root root 14 Feb 15 2019 pidof -> /sbin/killall5 + -rwxr-xr-x 1 root root 38660 Mar 1 2019 pwd + lrwxrwxrwx 1 root root 4 Apr 18 2019 rbash -> bash + -rwxr-xr-x 1 root root 46852 Mar 1 2019 readlink + -rwxr-xr-x 1 root root 75588 Mar 1 2019 rm + -rwxr-xr-x 1 root root 42756 Mar 1 2019 rmdir + -rwxr-xr-x 1 root root 22276 Jan 22 2019 run-parts + -rwxr-xr-x 1 root root 125036 Dec 23 2018 sed + lrwxrwxrwx 1 root root 4 Jun 21 10:01 sh -> bash + lrwxrwxrwx 1 root root 4 Jun 19 22:45 sh.distrib -> dash + -rwxr-xr-x 1 root root 34532 Mar 1 2019 sleep + -rwxr-xr-x 1 root root 79652 Mar 1 2019 stty + -rwsr-xr-x 1 root root 71072 Jan 10 2019 su + -rwxr-xr-x 1 root root 34564 Mar 1 2019 sync + -rwxr-xr-x 1 root root 504024 Apr 24 2019 tar + -rwxr-xr-x 1 root root 13860 Jan 22 2019 tempfile + -rwxr-xr-x 1 root root 104292 Mar 1 2019 touch + -rwxr-xr-x 1 root root 34532 Mar 1 2019 true + -rwxr-xr-x 1 root root 17768 Apr 23 09:38 ulockmgr_server + -rwsr-xr-x 1 root root 30108 Jan 10 2019 umount + -rwxr-xr-x 1 root root 34532 Mar 1 2019 uname + -rwxr-xr-x 2 root root 2345 Jan 6 2019 uncompress + -rwxr-xr-x 1 root root 149736 Mar 1 2019 vdir + -rwxr-xr-x 1 root root 34208 Jan 10 2019 wdctl + -rwxr-xr-x 1 root root 946 Jan 22 2019 which + lrwxrwxrwx 1 root root 8 Sep 27 2018 ypdomainname -> hostname + -rwxr-xr-x 1 root root 1983 Jan 6 2019 zcat + -rwxr-xr-x 1 root root 1677 Jan 6 2019 zcmp + -rwxr-xr-x 1 root root 5879 Jan 6 2019 zdiff + -rwxr-xr-x 1 root root 29 Jan 6 2019 zegrep + -rwxr-xr-x 1 root root 29 Jan 6 2019 zfgrep + -rwxr-xr-x 1 root root 2080 Jan 6 2019 zforce + -rwxr-xr-x 1 root root 7584 Jan 6 2019 zgrep + -rwxr-xr-x 1 root root 2205 Jan 6 2019 zless + -rwxr-xr-x 1 root root 1841 Jan 6 2019 zmore + -rwxr-xr-x 1 root root 4552 Jan 6 2019 znew +I: user script /srv/workspace/pbuilder/27201/tmp/hooks/D02_print_environment finished -> Attempting to satisfy build-dependencies -> Creating pbuilder-satisfydepends-dummy package Package: pbuilder-satisfydepends-dummy @@ -553,7 +587,7 @@ Get: 350 http://deb.debian.org/debian buster/main i386 dh-octave all 0.6.2 [19.9 kB] Get: 351 http://deb.debian.org/debian buster/main i386 octave-struct i386 1.0.15-2 [39.7 kB] Get: 352 http://deb.debian.org/debian buster/main i386 octave-parallel i386 3.1.3-2 [196 kB] -Fetched 135 MB in 5s (27.3 MB/s) +Fetched 135 MB in 53s (2542 kB/s) debconf: delaying package configuration, since apt-utils is not installed Selecting previously unselected package libbsd0:i386. (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 19234 files and directories currently installed.) @@ -2008,7 +2042,7 @@ Building tag database... -> Finished parsing the build-deps I: Building the package -I: Running cd /build/octave-level-set-0.3.0/ && env PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/games" HOME="/nonexistent/first-build" dpkg-buildpackage -us -uc -b +I: Running cd /build/octave-level-set-0.3.0/ && env PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/i/capture/the/path" HOME="/nonexistent/second-build" dpkg-buildpackage -us -uc -b dpkg-buildpackage: info: source package octave-level-set dpkg-buildpackage: info: source version 0.3.0-6 dpkg-buildpackage: info: source distribution unstable @@ -2063,13 +2097,13 @@ CXXFLAGS="-g -O2 -ffile-prefix-map=/build/octave-level-set-0.3.0=. -fstack-protector-strong -Wformat -Werror=format-security -g -O2 -ffile-prefix-map=/build/octave-level-set-0.3.0=. -fstack-protector-strong -Wformat -Werror=format-security" /usr/bin/mkoctfile --verbose nbFromGeom.cpp FastMarching.o Utils.o -o __levelset_nbFromGeom.oct CXXFLAGS="-g -O2 -ffile-prefix-map=/build/octave-level-set-0.3.0=. -fstack-protector-strong -Wformat -Werror=format-security -g -O2 -ffile-prefix-map=/build/octave-level-set-0.3.0=. -fstack-protector-strong -Wformat -Werror=format-security" /usr/bin/mkoctfile --verbose internal_mesh.cpp FastMarching.o Utils.o -o __levelset_internal_mesh.oct CXXFLAGS="-g -O2 -ffile-prefix-map=/build/octave-level-set-0.3.0=. -fstack-protector-strong -Wformat -Werror=format-security -g -O2 -ffile-prefix-map=/build/octave-level-set-0.3.0=. -fstack-protector-strong -Wformat -Werror=format-security" /usr/bin/mkoctfile --verbose upwindGrad.cpp FastMarching.o Utils.o -o __levelset_upwindGrad.oct +g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-4.4.1/octave/.. -I/usr/include/octave-4.4.1/octave -pthread -fopenmp -mieee-fp -g -O2 -ffile-prefix-map=/build/octave-level-set-0.3.0=. -fstack-protector-strong -Wformat -Werror=format-security -g -O2 -ffile-prefix-map=/build/octave-level-set-0.3.0=. -fstack-protector-strong -Wformat -Werror=format-security geomElements.cpp -o geomElements.o g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-4.4.1/octave/.. -I/usr/include/octave-4.4.1/octave -pthread -fopenmp -mieee-fp -g -O2 -ffile-prefix-map=/build/octave-level-set-0.3.0=. -fstack-protector-strong -Wformat -Werror=format-security -g -O2 -ffile-prefix-map=/build/octave-level-set-0.3.0=. -fstack-protector-strong -Wformat -Werror=format-security internal_fastmarching.cpp -o internal_fastmarching.o g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-4.4.1/octave/.. -I/usr/include/octave-4.4.1/octave -pthread -fopenmp -mieee-fp -g -O2 -ffile-prefix-map=/build/octave-level-set-0.3.0=. -fstack-protector-strong -Wformat -Werror=format-security -g -O2 -ffile-prefix-map=/build/octave-level-set-0.3.0=. -fstack-protector-strong -Wformat -Werror=format-security internal_init_narrowband.cpp -o internal_init_narrowband.o -g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-4.4.1/octave/.. -I/usr/include/octave-4.4.1/octave -pthread -fopenmp -mieee-fp -g -O2 -ffile-prefix-map=/build/octave-level-set-0.3.0=. -fstack-protector-strong -Wformat -Werror=format-security -g -O2 -ffile-prefix-map=/build/octave-level-set-0.3.0=. -fstack-protector-strong -Wformat -Werror=format-security geomElements.cpp -o geomElements.o +g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-4.4.1/octave/.. -I/usr/include/octave-4.4.1/octave -pthread -fopenmp -mieee-fp -g -O2 -ffile-prefix-map=/build/octave-level-set-0.3.0=. -fstack-protector-strong -Wformat -Werror=format-security -g -O2 -ffile-prefix-map=/build/octave-level-set-0.3.0=. -fstack-protector-strong -Wformat -Werror=format-security internal_mesh.cpp -o internal_mesh.o g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-4.4.1/octave/.. -I/usr/include/octave-4.4.1/octave -pthread -fopenmp -mieee-fp -g -O2 -ffile-prefix-map=/build/octave-level-set-0.3.0=. -fstack-protector-strong -Wformat -Werror=format-security -g -O2 -ffile-prefix-map=/build/octave-level-set-0.3.0=. -fstack-protector-strong -Wformat -Werror=format-security geomBoundary.cpp -o geomBoundary.o g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-4.4.1/octave/.. -I/usr/include/octave-4.4.1/octave -pthread -fopenmp -mieee-fp -g -O2 -ffile-prefix-map=/build/octave-level-set-0.3.0=. -fstack-protector-strong -Wformat -Werror=format-security -g -O2 -ffile-prefix-map=/build/octave-level-set-0.3.0=. -fstack-protector-strong -Wformat -Werror=format-security geomGamma.cpp -o geomGamma.o g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-4.4.1/octave/.. -I/usr/include/octave-4.4.1/octave -pthread -fopenmp -mieee-fp -g -O2 -ffile-prefix-map=/build/octave-level-set-0.3.0=. -fstack-protector-strong -Wformat -Werror=format-security -g -O2 -ffile-prefix-map=/build/octave-level-set-0.3.0=. -fstack-protector-strong -Wformat -Werror=format-security nbFromGeom.cpp -o nbFromGeom.o -g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-4.4.1/octave/.. -I/usr/include/octave-4.4.1/octave -pthread -fopenmp -mieee-fp -g -O2 -ffile-prefix-map=/build/octave-level-set-0.3.0=. -fstack-protector-strong -Wformat -Werror=format-security -g -O2 -ffile-prefix-map=/build/octave-level-set-0.3.0=. -fstack-protector-strong -Wformat -Werror=format-security internal_mesh.cpp -o internal_mesh.o g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-4.4.1/octave/.. -I/usr/include/octave-4.4.1/octave -pthread -fopenmp -mieee-fp -g -O2 -ffile-prefix-map=/build/octave-level-set-0.3.0=. -fstack-protector-strong -Wformat -Werror=format-security -g -O2 -ffile-prefix-map=/build/octave-level-set-0.3.0=. -fstack-protector-strong -Wformat -Werror=format-security upwindGrad.cpp -o upwindGrad.o In file included from /usr/include/c++/8/cassert:44, from internal_fastmarching.cpp:29: @@ -2148,8 +2182,8 @@ /usr/include/octave-4.4.1/octave/../octave/Array.h:363:19: note: declared here octave_idx_type nelem (void) const { return numel (); } ^~~~~ -g++ -I/usr/include/octave-4.4.1/octave/.. -I/usr/include/octave-4.4.1/octave -pthread -fopenmp -mieee-fp -g -O2 -ffile-prefix-map=/build/octave-level-set-0.3.0=. -fstack-protector-strong -Wformat -Werror=format-security -g -O2 -ffile-prefix-map=/build/octave-level-set-0.3.0=. -fstack-protector-strong -Wformat -Werror=format-security -shared -Wl,-Bsymbolic -o __levelset_upwindGrad.oct FastMarching.o Utils.o upwindGrad.o -L/usr/lib/i386-linux-gnu/octave/4.4.1 -L/usr/lib/i386-linux-gnu -loctinterp -loctave -Wl,-z,relro g++ -I/usr/include/octave-4.4.1/octave/.. -I/usr/include/octave-4.4.1/octave -pthread -fopenmp -mieee-fp -g -O2 -ffile-prefix-map=/build/octave-level-set-0.3.0=. -fstack-protector-strong -Wformat -Werror=format-security -g -O2 -ffile-prefix-map=/build/octave-level-set-0.3.0=. -fstack-protector-strong -Wformat -Werror=format-security -shared -Wl,-Bsymbolic -o __levelset_internal_init_narrowband.oct FastMarching.o Utils.o internal_init_narrowband.o -L/usr/lib/i386-linux-gnu/octave/4.4.1 -L/usr/lib/i386-linux-gnu -loctinterp -loctave -Wl,-z,relro +g++ -I/usr/include/octave-4.4.1/octave/.. -I/usr/include/octave-4.4.1/octave -pthread -fopenmp -mieee-fp -g -O2 -ffile-prefix-map=/build/octave-level-set-0.3.0=. -fstack-protector-strong -Wformat -Werror=format-security -g -O2 -ffile-prefix-map=/build/octave-level-set-0.3.0=. -fstack-protector-strong -Wformat -Werror=format-security -shared -Wl,-Bsymbolic -o __levelset_upwindGrad.oct FastMarching.o Utils.o upwindGrad.o -L/usr/lib/i386-linux-gnu/octave/4.4.1 -L/usr/lib/i386-linux-gnu -loctinterp -loctave -Wl,-z,relro g++ -I/usr/include/octave-4.4.1/octave/.. -I/usr/include/octave-4.4.1/octave -pthread -fopenmp -mieee-fp -g -O2 -ffile-prefix-map=/build/octave-level-set-0.3.0=. -fstack-protector-strong -Wformat -Werror=format-security -g -O2 -ffile-prefix-map=/build/octave-level-set-0.3.0=. -fstack-protector-strong -Wformat -Werror=format-security -shared -Wl,-Bsymbolic -o __levelset_internal_fastmarching.oct FastMarching.o Utils.o internal_fastmarching.o -L/usr/lib/i386-linux-gnu/octave/4.4.1 -L/usr/lib/i386-linux-gnu -loctinterp -loctave -Wl,-z,relro g++ -I/usr/include/octave-4.4.1/octave/.. -I/usr/include/octave-4.4.1/octave -pthread -fopenmp -mieee-fp -g -O2 -ffile-prefix-map=/build/octave-level-set-0.3.0=. -fstack-protector-strong -Wformat -Werror=format-security -g -O2 -ffile-prefix-map=/build/octave-level-set-0.3.0=. -fstack-protector-strong -Wformat -Werror=format-security -shared -Wl,-Bsymbolic -o __levelset_geomElements.oct FastMarching.o Utils.o geomElements.o -L/usr/lib/i386-linux-gnu/octave/4.4.1 -L/usr/lib/i386-linux-gnu -loctinterp -loctave -Wl,-z,relro g++ -I/usr/include/octave-4.4.1/octave/.. -I/usr/include/octave-4.4.1/octave -pthread -fopenmp -mieee-fp -g -O2 -ffile-prefix-map=/build/octave-level-set-0.3.0=. -fstack-protector-strong -Wformat -Werror=format-security -g -O2 -ffile-prefix-map=/build/octave-level-set-0.3.0=. -fstack-protector-strong -Wformat -Werror=format-security -shared -Wl,-Bsymbolic -o __levelset_nbFromGeom.oct FastMarching.o Utils.o nbFromGeom.o -L/usr/lib/i386-linux-gnu/octave/4.4.1 -L/usr/lib/i386-linux-gnu -loctinterp -loctave -Wl,-z,relro @@ -2158,313 +2192,534 @@ g++ -I/usr/include/octave-4.4.1/octave/.. -I/usr/include/octave-4.4.1/octave -pthread -fopenmp -mieee-fp -g -O2 -ffile-prefix-map=/build/octave-level-set-0.3.0=. -fstack-protector-strong -Wformat -Werror=format-security -g -O2 -ffile-prefix-map=/build/octave-level-set-0.3.0=. -fstack-protector-strong -Wformat -Werror=format-security -shared -Wl,-Bsymbolic -o __levelset_internal_mesh.oct FastMarching.o Utils.o internal_mesh.o -L/usr/lib/i386-linux-gnu/octave/4.4.1 -L/usr/lib/i386-linux-gnu -loctinterp -loctave -Wl,-z,relro make[1]: Leaving directory '/build/octave-level-set-0.3.0/src' copyfile /build/octave-level-set-0.3.0/./src/__levelset_geomBoundary.oct /build/octave-level-set-0.3.0/./src/__levelset_geomElements.oct /build/octave-level-set-0.3.0/./src/__levelset_geomGamma.oct /build/octave-level-set-0.3.0/./src/__levelset_internal_fastmarching.oct /build/octave-level-set-0.3.0/./src/__levelset_internal_init_narrowband.oct /build/octave-level-set-0.3.0/./src/__levelset_internal_mesh.oct /build/octave-level-set-0.3.0/./src/__levelset_nbFromGeom.oct /build/octave-level-set-0.3.0/./src/__levelset_upwindGrad.oct /build/octave-level-set-0.3.0/./inst/i686-pc-linux-gnu-api-v52 -/tmp/octave-help-qLnxDt:136: table requires an argument: the formatter for @item -/tmp/octave-help-7suC1J:132: table requires an argument: the formatter for @item -/tmp/octave-help-lau6os:131: @code expected braces -/tmp/octave-help-lau6os:135: @code expected braces -/tmp/octave-help-cEPsqN:130: @code expected braces -/tmp/octave-help-cEPsqN:134: @code expected braces +/tmp/octave-help-lcsirU:136: table requires an argument: the formatter for @item +/tmp/octave-help-D04mVE:132: table requires an argument: the formatter for @item +/tmp/octave-help-BvLpX6:131: @code expected braces +/tmp/octave-help-BvLpX6:135: @code expected braces +/tmp/octave-help-kMspc1:130: @code expected braces +/tmp/octave-help-kMspc1:134: @code expected braces For information about changes from previous versions of the level-set package, run 'news level-set'. dh_octave_check -O--buildsystem=octave Checking package... Checking m files ... -[inst/upwind_gradient_norm.m] ->>>>> /build/octave-level-set-0.3.0/inst/upwind_gradient_norm.m +[inst/so_save_descent.m] +>>>>> /build/octave-level-set-0.3.0/inst/so_save_descent.m ***** error - upwind_gradient_norm () + so_save_descent (1, 2); ***** error - upwind_gradient_norm (1, 2, 3, 4) + so_save_descent (1, 2, 3, 4); +***** error + so_save_descent (1, 2, 3); +***** error + so_save_descent (struct (), 2, struct ()); +***** error + so_save_descent ([2, 3], 2, struct ()); +***** error <'fsave' is not available> + try + pkg unload parallel; + end_try_catch + so_save_descent ("foo", 2, struct ()); +***** shared run_tests + run_tests = ! strcmp ('Not installed', ... + nthargout (2, 'pkg', 'describe', 'parallel')); +***** testif ; run_tests + pkg load parallel; + so_save_descent ("foo", 2, struct ()); + so_save_descent (5, 2, struct ()); +7 tests, 7 passed, 0 known failure, 0 skipped +[inst/ls_absolute_geom.m] +>>>>> /build/octave-level-set-0.3.0/inst/ls_absolute_geom.m ***** error - upwind_gradient_norm ([1, 1], [2, 2], [3, 3]) -***** error - upwind_gradient_norm ([1, 1], [2, 2, 2]) -***** error - upwind_gradient_norm ([1, 1], [2, 2, 2], 5) + ls_absolute_geom (1, 2); +***** error + ls_absolute_geom (1, 2, 3, 4); +***** error + x = [-1, 1]; + [XX, YY, ZZ] = ndgrid (x); + ls_absolute_geom (struct (), XX, YY); +***** error + ls_absolute_geom (struct (), [-1, 0, 1], [0, 0, 0]); +***** error + ls_absolute_geom (struct (), zeros (3, 2), zeros (2, 2)); +5 tests, 5 passed, 0 known failure, 0 skipped +[inst/fastmarching.m] +>>>>> /build/octave-level-set-0.3.0/inst/fastmarching.m +***** error + fastmarching () +***** error + fastmarching (1, 2, 3, 4) +***** error + [a, b] = fastmarching (1, 2) +***** error + fastmarching ([1, 2], [1; 2]) +***** error + fastmarching ([1, 2], [1; 2], [1, 2]) +***** error + fastmarching ([NA, 1], [0, 5]); ***** test - phi = [0, 2, 3]; - fPos = ones (size (phi)); - - % Propagate the original phi to the right. This should result - % in the *backward* difference to be used in the middle. - g = upwind_gradient_norm (phi); - assert (g(2), 2); - gp = upwind_gradient_norm (phi, fPos); - assert (gp, g); - gp = upwind_gradient_norm (phi, 0.5); - assert (gp, 2 * g); - gp = upwind_gradient_norm (phi, fPos, 0.5); - assert (gp, 2 * g); + n = 600; + x = linspace (0, 1, n); + h = x(2) - x(1); + [XX, YY] = meshgrid (x, x); + u0 = NA (n, n); + u0(2 : end - 1, 2 : end - 1) = Inf; + u0(1, 1) = 0; + f = 1 + YY; + u = fastmarching (u0, h * f); - % Propagate to the left for the reverse effect. - g = upwind_gradient_norm (phi, -fPos); - assert (g(2), 1); + % Length of vertical side: integrate (1 + y, y, 0, x) + vertLength = @(x) x/2 .* (x + 2); - % Propagate -phi, which again turns everything around. - g = upwind_gradient_norm (-phi, fPos); - assert (g(2), 1); - g = upwind_gradient_norm (-phi, -fPos); - assert (g(2), 2); -***** test - n = 50; - x = linspace (-1, 1, n); - h = x(2) - x(1); - [XX, YY, ZZ] = ndgrid (x, x, x); + % Speed difference at top and bottom, gives where the + % paths will meet on the bottom side. + % solve (x * fBot = fTop + (1 - x) * fBot, x) + fTop = mean (f(1, :)); + fBot = mean (f(end, :)); + xMeet = (fTop + fBot) / 2 / fBot; + botRow = vertLength (1) + fBot * x; + where = (x > xMeet); + botRow(where) = vertLength (1) + 1 + fBot * (1 - x(where)); - phi = XX.^2 + YY.^2 + ZZ.^2; - g = upwind_gradient_norm (phi, h); - - r = sqrt (phi); - assert (g, 2 * r, 0.1); -7 tests, 7 passed, 0 known failure, 0 skipped -[inst/ls_time_step.m] ->>>>> /build/octave-level-set-0.3.0/inst/ls_time_step.m -***** error - ls_time_step (1, 2) -***** error - ls_time_step (1, 2, 3, 4, 5, 6) -***** error - ls_time_step (1, 2, 3, 4, [5, 5]) -***** error - ls_time_step ([1; 1], [2, 2], [3, 3, 3]) -***** error - ls_time_step ([1, 1], 1, [2, 2], [3, 3, 3]) -***** error - ls_time_step (ones (2, 2), 1, 1) + assert (u(1, :), x, sqrt (eps)); + assert (u(:, 1), vertLength (x'), 1e-3); + assert (u(:, end), 1 + vertLength (x'), 1e-3); + assert (u(end, :), botRow, 1e-3); ***** test - n = 100; + n = 1100; x = linspace (0, 1, n); h = x(2) - x(1); - phi0 = sin (x); - fPos = ones (size (phi0)); + obst1 = round (0.5 / h); + obst2 = round (0.75 / h); + s1 = round (0.2 / h); + s1val = 1; + s2 = round (0.9 / h); + s2val = -1; - % Single time step, moving exactly one grid step. - phit = ls_time_step (1, phi0, fPos); - assert (phit(2 : end), phi0(1 : end - 1)); + u0 = NA (n, 1); + u0([obst1, obst2]) = Inf; + u0([s1, s2]) = [s1val, s2val]; + f = ones (size (u0)); + g0 = NA (size (u0)); + g0([s1, s2]) = [s1val, s2val]; - % t = 1 should correspond to the previous result, and t = 2 - % shifts one more time step. However, due to boundary effects, - % we have to exclude some elements in the comparisons. - phitArr = ls_time_step ([1, 2], 0.5, phi0, fPos); - assert (size (phitArr), [2, 1]); - assert (phitArr{1}(3 : end), phit(3 : end), 1e-4); - assert (phitArr{2}(5 : end), phi0(3 : end - 2), 1e-4); + [u, g] = fastmarching (u0, g0, f * h); - % Try out movement in the other direction. - phit = ls_time_step (0.5, 0.1, phi0, -fPos, 0.5); - assert (phit(1 : end - 4), phi0(2 : end - 3), 1e-4); -***** function compareFastMarching (t, phi0, F, h, tol) - phit = ls_time_step (t, phi0, F, h); - d = ls_solve_stationary (phi0, F, h); - phit_fm = ls_extract_solution (t, d, phi0, F); + gDesired = NA (size (u0)); + gDesired(1 : obst1 - 1) = s1val; + gDesired(obst2 + 1 : end) = s2val; + assert (g, gDesired, sqrt (eps)); - sd1 = ls_signed_distance (phit, h); - sd2 = ls_signed_distance (phit_fm, h); - assert (sd1, sd2, tol); -***** endfunction + uDesired = NA (size (u0)); + uDesired([obst1, obst2]) = Inf; + uDesired(1 : obst1 - 1) = s1val + abs (s1 * h - x(1 : obst1 - 1)); + uDesired(obst2 + 1 : end) = s2val + abs (s2 * h - x(obst2 + 1 : end)); + assert (u, uDesired, 1e-3); ***** test - warning ("off", "level-set:fast-marching:too-far-alive"); + assert (fastmarching ([], []), []); +***** test + n = 42; + r = 1; + R = 2; + x = linspace (-R, R, n); + h = x(2) - x(1); - n = 100; - x = linspace (-5, 5, n); + [XX, YY, ZZ] = ndgrid (x); + RR = sqrt (XX.^2 + YY.^2 + ZZ.^2); + PPhi = NA (size (XX)); + for i = 1 : numel (PPhi) + pt = [XX(i), YY(i), ZZ(i)]; + PPhi(i) = acos (dot (pt, [0, 0, 1]) / norm (pt)); + endfor + + initial = (RR < r); + u0 = NA (size (XX)); + u0(initial) = 0; + g0 = NA (size (XX)); + g0(initial) = PPhi(initial); + f = ones (size (u0)); + [u, g] = fastmarching (u0, g0, h * f); + + assert (u(~initial), RR(~initial) - r, 1e-1); + assert (g(~initial), PPhi(~initial), 2e-1); +***** function [dx, dy] = gradient (fcn, h) + ext = NA (size (fcn) + 2); + ext(2 : end - 1, 2 : end - 1) = fcn; + ext(:, 1) = 2 * ext(:, 2) - ext(:, 3); + ext(:, end) = 2 * ext(:, end - 1) - ext(:, end - 2); + ext(1, :) = 2 * ext(2, :) - ext(3, :); + ext(end, :) = 2 * ext(end - 1, :) - ext(end - 2, :); + dx = (ext(2 : end - 1, 3 : end) - ext(2 : end - 1, 1 : end - 2)) / (2 * h); + dy = (ext(3 : end, 2 : end - 1) - ext(1 : end - 2, 2 : end - 1)) / (2 * h); +***** endfunction +***** test + n = 1000; + x = linspace (-2, 2, n); h = x(2) - x(1); [XX, YY] = meshgrid (x, x); - phi0 = ls_genbasic (XX, YY, "sphere", [0, 0], [3, 1.5]); - F = ones (size (phi0)); - compareFastMarching (0.5, phi0, F, h, h / 2); - compareFastMarching (1.5, phi0, F, h, h / 2); + phi0 = 2 * XX.^2 + 0.4 * YY.^2 - 1; + initial = (phi0 < 0); + %contour (XX, YY, phi0, [0, 0], "r"); - phi0 = ls_genbasic (XX, YY, "box", [-3, -3], [3, 3]); - F = YY / 5; - compareFastMarching (1, phi0, F, h, h); + f = ones (size (XX)); + u0 = NA (size (XX)); + u0(initial) = 0; + g0 = NA (size (XX)); + g0(initial) = sin (atan2 (YY(initial), XX(initial))); - F = ones (size (phi0)); - compareFastMarching (1, phi0, F, h, h / 2); + [u, g] = fastmarching (u0, g0, h * f); - phi0 = ls_genbasic (XX, YY, "sphere", [0, 0], 3); - F = sin (XX .* YY); - compareFastMarching (1, phi0, F, h, h); + [dxu, dyu] = gradient (u, h); + [dxg, dyg] = gradient (g, h); + + % We only verify the mean error here, since there tend + % to be lower-dimensional lines on which the error is + % large while it is very low otherwise. + err = abs (dxu .* dxg + dyu .* dyg); + assert (mean (err(initial)), 0, 1e-3); ***** test - warning ("off", "level-set:fast-marching:increased-distance"); + u0 = [1.257221, NA, NA; Inf, 0.275128, 0.433001]; + f = [NA, 0.85714, 0.66667; NA, NA, NA]; + u = fastmarching (u0, f); +warning: increased distance in fast marching 1.121446 to 1.131670 +***** test + u0 = [0, NA; Inf, 2]; + f = ones (size (u0)); + u = fastmarching (u0, f); + assert (u(1, 2), 1, sqrt (eps)); +warning: found too far alive point in fast marching, d = -8.000000 +warning: found too far alive point in fast marching, d = -8.000000 +***** test + u0 = [0, NA, NA, NA, 0.1; ... + Inf, Inf, Inf, Inf, Inf; ... + 0.1, NA, NA, NA, 0]; + f = ones (size (u0)); + u = fastmarching (u0, f); - n = 50; - x = linspace (-5, 5, n); - h = x(2) - x(1); - [XX, YY, ZZ] = ndgrid (x, x, x); + uExpected = [0, 1, 2, 1.1, 0.1; ... + Inf, Inf, Inf, Inf, Inf; ... + 0.1, 1.1, 2, 1, 0]; + assert (u, uExpected, sqrt (eps)); +***** xtest + ns = [101, 201, 501, 1001, 2001]; + realNs = NA (size (ns)); + times = NA (size (ns)); + for i = 1 : length (ns) + nMid = (ns(i) + 1) / 2; + assert (nMid, round (nMid)); + u0 = NA (ns(i), ns(i)); + u0(nMid, nMid) = 0; + f = ones (size (u0)); + realNs(i) = numel (u0); - phi0 = ls_genbasic (XX, YY, ZZ, "sphere", [0, 0, 0], 3); - F = ones (size (phi0)); - compareFastMarching (1, phi0, F, h, h / 2); - compareFastMarching (1, phi0, -F, h, h / 2); + old = cputime (); + u = fastmarching (u0, f); + new = cputime (); + times(i) = new - old; + + printf ("n = %4d: t = %6.3f s\n", ns(i), times(i)); + endfor + + nLogN = realNs .* log (realNs); + p = polyfit (log (realNs), log (times), 1); + pLogN = polyfit (log(nLogN), log (times), 1); + printf ("Exponents:\n O(n): %4.2f\n O(n log n): %4.2f\n", ... + p(1), pLogN(1)); + assert (p(1), 1, 1e-1); + assert (pLogN(1), 1, 1e-1); +n = 101: t = 0.033 s +n = 201: t = 0.126 s +n = 501: t = 0.921 s +n = 1001: t = 3.735 s +n = 2001: t = 16.816 s +Exponents: + O(n): 1.04 + O(n log n): 0.96 +***** test + T = 1.6; + timeSteps = 10000; + L = 2; + gridSteps = 10000; + eps = 1e-4; + floorValue = -1/2; + tol = 7e-2; + + t = linspace (0, T, timeSteps); + dt = t(2) - t(1); + x = linspace (-L/2, L/2, gridSteps); + h = x(2) - x(1); + + F = sqrt (abs (x)); + phi0 = NA (size (x)); + phi0(1 : end/4) = floorValue; + phi0(3*end/4 : end) = floorValue; + phi0 = fastmarching (phi0, h ./ F); + + % Plot the speed field and initial data. + %{ + figure (); + plot (x, F, "r", x, phi0, "k"); + legend ("F", "\\phi_0"); + title ("Speed Field and Initial Data"); + ax = [-L/2, L/2, -1, 1]; + axis (ax); + %} + + % Create the Laplacian as matrix. We assume homogeneous Neumann boundary + % conditions so that the initial data can be chosen as we like. + Delta = spdiags (repmat ([1, -2, 1], gridSteps, 1), [-1, 0, 1], ... + gridSteps, gridSteps); + Delta(1, 1) += Delta(1, 2); + Delta(end, end) += Delta(end - 1, end); + Delta /= h^2; + + % Perform the calculation. The Laplacian is done implicitly, the + % non-linear term explicitly: + % + % phi+ - phi0 = dt (eps Delta phi+ - F |grad phi0|) + % => (I - dt eps Delta) phi+ = phi0 - F |grad phi0| + + %figure (); + phi = phi0'; + M = eye (gridSteps) - dt * eps * Delta; + for tInd = 2 : timeSteps + + % Calculate derivatives as symmetric differences, and zero on the + % boundary. Since the data is flat there, this is correct. + d = NA (size (phi)); + low = 1 : gridSteps - 2; + mid = 2 : gridSteps - 1; + high = 3 : gridSteps; + d(mid) = (phi(high) - phi(low)) / (2 * h); + d([1, end]) = 0; + gradNorm = abs (d); + + % Do the solve. + phi = M \ (phi - dt * F' .* gradNorm); + phiEx = max (phi0 - t(tInd), floorValue); + assert (phi, phiEx', tol); + + % Show solution as animation in real time. + %{ + if (mod (tInd, 100) == 0) + plot (x, phi, "r", x, phiEx, "k"); + legend ("Approximate", "Exact"); + axis (ax); + title (sprintf ("t = %.2f", t(tInd))); + drawnow (); + %sleep (0.1); + endif + %} + endfor ***** demo - n = 500; - x = linspace (-5, 5, n); + n = 100; + x = linspace (-1, 1, n); h = x(2) - x(1); [XX, YY] = meshgrid (x, x); - F = sin (XX .* YY); - phi0 = ls_genbasic (XX, YY, "sphere", [0, 0], 3); - phit = ls_time_step ([0.5, 1], phi0, F, h); + u0 = NA (size (XX)); + u0(sqrt (XX.^2 + YY.^2) < 0.5) = Inf; + u0(end, :) = 0; + f = 3 + XX; + g0 = NA (size (XX)); + g0(end, :) = x; + + [u, g] = fastmarching (u0, g0, h * f); figure (); - hold ("on"); - imagesc (x, x, F); - set (gca (), "ydir", "normal"); - ls_sign_colourmap (); - contour (XX, YY, phi0, [0, 0], "k", "LineWidth", 2); - contour (XX, YY, phit{1}, [0, 0], "k", "LineWidth", 2); - contour (XX, YY, phit{2}, [0, 0], "k", "LineWidth", 2); - hold ("off"); -9 tests, 9 passed, 0 known failure, 0 skipped -[inst/ls_normalise.m] ->>>>> /build/octave-level-set-0.3.0/inst/ls_normalise.m -***** error - ls_normalise () -***** error - ls_normalise (1, 2, 3, 4) -***** test - h = 0.1; - zeroTol = 0.2; - phi = ones (4, 4); - phiEx = phi; - phi(2 : 3, 2 : 3) = [-eps, -0; 0, eps]; - phiEx(2 : 3, 2 : 3) = [-zeroTol*h, -zeroTol*h; zeroTol*h, zeroTol*h]; - phin = ls_normalise (phi, h, zeroTol); - if (exist ("signbit") == 5) - assert (phin, phiEx); - else - warning ("'signbit' function not available, skipping test."); + subplot (2, 2, 1); + imagesc (f); + colorbar (); + title ("Speed Field"); + subplot (2, 2, 2); + imagesc (u0); + colorbar (); + title ("Initial Distances"); + subplot (2, 2, 3); + imagesc (u); + colorbar (); + title ("Distance u"); + subplot (2, 2, 4); + imagesc (g); + colorbar (); + title ("Extended Function g"); +***** demo + pkgs = pkg ("list"); + file = false; + for i = 1 : length (pkgs) + if (strcmp (pkgs{i}.name, "level-set")) + file = fullfile (pkgs{i}.dir, "maze.png"); + endif + endfor + if (!file) + error ("could not locate example image file"); endif -3 tests, 3 passed, 0 known failure, 0 skipped -[inst/ls_sign_colourmap.m] ->>>>> /build/octave-level-set-0.3.0/inst/ls_sign_colourmap.m -***** shared colours - colours = [1, 1, 1; 0, 0, 0; 1, 1, 1; 0, 0, 0]; -***** error - ls_sign_colourmap (1, 2); -***** error - ls_sign_colourmap (1); -***** error - cmap = ls_sign_colourmap (); -***** error - ls_sign_colourmap ("foo"); -***** test + img = double (imread (file)) / 255; + + % Red is the start area, white (not black) the accessible domain. + start = (img(:, :, 1) > img(:, :, 2) + img(:, :, 3)); + domain = (img(:, :, 2) + img(:, :, 3) > 1.0) | start; + + u0 = NA (size (domain)); + u0(start) = 0; + u0(~domain) = Inf; + f = ones (size (u0)); + + u = fastmarching (u0, f); + u = u / max (u(isfinite (u))); + + % Format result as image. + walls = isinf (u); + notReached = isna (u); + ur = u; + ug = u; + ub = u; + ur(notReached) = 1; + ug(notReached) = 0; + ub(notReached) = 0; + ur(walls) = 0; + ug(walls) = 0; + ub(walls) = 1; + ur(start) = 1; + ug(start) = 1; + ub(start) = 0; + u = NA (size (u, 1), size (u, 2), 3); + u(:, :, 1) = ur; + u(:, :, 2) = ug; + u(:, :, 3) = ub; figure (); - ls_sign_colourmap (); - ls_sign_colourmap ("highlight"); - ls_sign_colourmap (colours); - close (); -***** error - ls_sign_colourmap (1, 2, 3); + imshow (u); + title ("Solved Maze. Blue: Walls, Red: Unreachable, Yellow: Start."); +16 tests, 16 passed, 0 known failure, 0 skipped +[inst/ls_distance_fcn.m] +>>>>> /build/octave-level-set-0.3.0/inst/ls_distance_fcn.m ***** error - ls_sign_colourmap ([1, 2, 3]); + ls_distance_fcn () ***** error - ls_sign_colourmap ([1, 2], 1); -***** error - ls_sign_colourmap ([1, 2], "foo"); + ls_distance_fcn (1, 2, 3) ***** test - cmap = ls_sign_colourmap ([1, 2]); - cmap = ls_sign_colourmap ([1; 2], "highlight"); - cmap = ls_sign_colourmap ([1; 2], colours); -***** demo - n = 100; + assert (ls_distance_fcn ([]), []); +***** test + n = 10; x = linspace (-2, 2, n); - y = linspace (-1, 3, n); - [XX, YY] = meshgrid (x, y); - phi = ls_genbasic (XX, YY, "sphere", [0, 1], 1); + h = x(2) - x(1); + phi = abs (x) - 1; - figure (); - imagesc (x, y, phi); - set (gca (), "ydir", "normal"); - ls_sign_colourmap (); - colorbar (); - title ("Type 'sign'"); + d = ls_distance_fcn (phi, h); + assert (d, max (phi, 0), sqrt (eps)); +***** test + n = 50; + x = linspace (-2, 2, n); + h = x(2) - x(1); + [XX, YY, ZZ] = ndgrid (x); + RRsq = XX.^2 + YY.^2 + ZZ.^2; + phi = RRsq - 1; + + d = ls_distance_fcn (phi, h); + assert (d, max (sqrt (RRsq) - 1, 0), h); +***** test + n = 500; + x = linspace (-10, 10, n); + h = x(2) - x(1); + + [XX, YY] = meshgrid (x, x); + phi = ls_genbasic (XX, YY, "sphere", [0, 0], 8); + + id = tic (); + d = ls_distance_fcn (phi, h); + time1 = toc (id); + + id = tic (); + sd = ls_signed_distance (phi, h); + time2 = toc (id); + + assert (d, max (sd, 0), sqrt (eps)); + printf ("ls_distance_fcn faster than ls_signed_distance by %.1f%%\n", ... + 100 * ((time2 - time1) / time2)); + assert (time1 < time2); +ls_distance_fcn faster than ls_signed_distance by 24.5% +***** test + phis = ls_get_tests (); + for i = 1 : length (phis) + phi = ls_normalise (phis{i}); + d = ls_distance_fcn (phi); + sd = ls_signed_distance (phi); + assert (d, max (sd, 0), sqrt (eps)); + endfor ***** demo n = 100; - x = linspace (-2, 2, n); + x = linspace (-10, 10, n); h = x(2) - x(1); [XX, YY] = meshgrid (x, x); - phi = ls_genbasic (XX, YY, "sphere", [0, 0], 1); - d = ls_signed_distance (phi, h); - F = YY .* exp (-10 * d.^2); + phi = ls_genbasic (XX, YY, "sphere", [0, 0], [8, 5]); + d = ls_distance_fcn (phi, h); figure (); - hold ("on"); - imagesc (x, x, F); - set (gca (), "ydir", "normal"); - ls_sign_colourmap ("highlight"); - colorbar (); - contour (XX, YY, phi, [0, 0], "k", "LineWidth", 2); - hold ("off"); - title ("Type 'highlight'"); -10 tests, 10 passed, 0 known failure, 0 skipped -[inst/ls_disjoint.m] ->>>>> /build/octave-level-set-0.3.0/inst/ls_disjoint.m + mesh (XX, YY, d); + view ([45, 45]); +7 tests, 7 passed, 0 known failure, 0 skipped +[inst/ls_issubset.m] +>>>>> /build/octave-level-set-0.3.0/inst/ls_issubset.m ***** error - ls_disjoint () -***** error - ls_disjoint (1, -2, [1, 2]) -***** test - assert (ls_disjoint ([-1, 0, 1], [0, 0, 0], [1, 0, -1])); - assert (~ls_disjoint ([Inf, -Inf, 1], [-1, -1, 1])); - assert (~ls_disjoint ([-1, -1, 1], [0, 0, 0], [1, -1, -1])); + ls_issubset (1) +***** error + ls_issubset (1, 2, 3) +***** error + ls_issubset (1, [1, 2]) ***** test n = 50; x = linspace (-10, 10, n); [XX, YY] = meshgrid (x, x); - phi1 = (XX - 2).^2 + (YY - 2).^2 - 2^2; - phi2 = (XX + 2).^2 + (YY + 2).^2 - 2^2; - phi3 = XX.^2 + YY.^2 - 2^2; + phi1 = XX.^2 + YY.^2 - 1^2; + phi2 = XX.^2 + YY.^2 - 5^2; + phi3 = XX.^2 + YY.^2 - 8^2; + phi4 = (XX - 3).^2 + YY.^2 - 3^2; - assert (ls_disjoint (phi1, phi2)); - assert (~ls_disjoint (phi1, phi3)); - assert (~ls_disjoint (phi2, phi3)); - assert (~ls_disjoint (phi1, phi2, phi3)); + assert (ls_issubset (phi1, phi2)); + assert (ls_issubset (phi4, phi3)); + assert (~ls_issubset (phi4, phi2)); 4 tests, 4 passed, 0 known failure, 0 skipped -[inst/ls_intersect.m] ->>>>> /build/octave-level-set-0.3.0/inst/ls_intersect.m +[inst/ls_setdiff.m] +>>>>> /build/octave-level-set-0.3.0/inst/ls_setdiff.m ***** error - ls_intersect () -***** error - ls_intersect (1, -2, [1, 2]) + ls_setdiff (1) +***** error + ls_setdiff (1, 2, 3) +***** error + ls_setdiff (1, [1, 2]) ***** test + assert (ls_equal (ls_setdiff ([-1, -1, 1], [1, -1, -1]), [-1, 1, 1])); n = 50; x = linspace (-10, 10, n); + h = x(2) - x(1); [XX, YY] = meshgrid (x, x); - phi1 = (XX - 2).^2 + (YY - 2).^2 - 2^2; - phi2 = (XX + 2).^2 + (YY + 2).^2 - 2^2; - phi3 = XX.^2 + YY.^2 - 2^2; - - assert (ls_isempty (ls_intersect (phi1, phi2))); - assert (ls_intersect (phi3), phi3); + phi1 = XX.^2 + YY.^2 - 8^2; + phi2 = XX.^2 + YY.^2 - 5^2; - phi = ls_intersect (phi1, phi3); - assert (~ls_isempty (phi)); - assert (ls_issubset (phi, phi1) && ls_issubset (phi, phi3)); + phi = ls_setdiff (phi1, phi2); + assert (ls_issubset (phi, phi1)); + assert (ls_disjoint (phi, phi2)); - phi = ls_intersect (phi2, phi3); - assert (~ls_isempty (phi)); - assert (ls_issubset (phi, phi2) && ls_issubset (phi, phi3)); + phi = ls_setdiff (phi2, phi1); + assert (ls_isempty (phi)); ***** demo n = 100; x = linspace (-7, 7, n); [XX, YY] = meshgrid (x, x); - phi1 = (XX - 2 * cos (7/6 * pi)).^2 + (YY - 2 * sin (7/6 * pi)).^2 - 3^2; - phi2 = (XX - 2 * cos (11/6 * pi)).^2 + (YY - 2 * sin (11/6 * pi)).^2 - 3^2; - phi3 = XX.^2 + (YY - 2).^2 - 3^2; - phi = ls_intersect (phi1, phi2, phi3); + phi1 = (XX - 2).^2 + YY.^2 - 3^2; + phi2 = (XX + 2).^2 + YY.^2 - 3^2; + phi = ls_setdiff (phi1, phi2); figure (); subplot (1, 2, 1); hold ("on"); contour (XX, YY, phi1, [0, 0], "k"); contour (XX, YY, phi2, [0, 0], "k"); - contour (XX, YY, phi3, [0, 0], "k"); hold ("off"); axis ("equal"); @@ -2476,392 +2731,24 @@ contour (XX, YY, phi, [0, 0], "k"); hold ("off"); axis ("equal"); -3 tests, 3 passed, 0 known failure, 0 skipped -[inst/ls_build_mesh.m] ->>>>> /build/octave-level-set-0.3.0/inst/ls_build_mesh.m -***** error - ls_build_mesh (1) -***** error - ls_build_mesh (1, 2, 3, 4) -***** error - x = linspace (-10, 10, 10); - h = x(2) - x(1); - [XX, YY] = meshgrid (x, x); - phi = ls_genbasic (XX, YY, "sphere", [0, 0], 5); - phi = ls_normalise (phi, h); - geom = ls_find_geometry (phi, h); - ls_build_mesh (geom, phi); -***** function verifyDirection (a, b, centre) - v1 = [a - centre; 0]; - v2 = [b - centre; 0]; - x = cross (v1, v2); - assert (x(1 : 2), zeros (2, 1)); - assert (x(3) > 0); -***** endfunction -***** function verifyMesh (geom, phi, glob) - [mesh, vmap] = ls_build_mesh (geom, phi, glob); - nPts = prod (geom.dim); - - % Verify ordering of triangle points. - for i = 1 : size (mesh.t, 2) - verifyDirection (mesh.p(:, mesh.t(1, i)), mesh.p(:, mesh.t(2, i)), ... - mesh.p(:, mesh.t(3, i))); - endfor - - % Go through all grid points and verify them with the mesh. - for i = 1 : nPts - gridInd = vmap.grid(i); - if (isna (gridInd)) - assert (!glob); - continue; - endif - - assert (vmap.mesh(gridInd), i); - assert (mesh.p(:, gridInd), geom.nodes.coord(i, :)'); - endfor - - % Go through all intersection points and verify them. - for i = 1 : geom.ispts.n - gridInd = vmap.ispt(i); - assert (vmap.mesh(gridInd), -i); - assert (mesh.p(:, gridInd), geom.ispts.coord(i, :)'); - endfor - - % Verify mesh.e against geom.bedges. - for i = 1 : geom.bedges.n - assert (mesh.e(1 : 2, i), vmap.ispt(geom.bedges.ispts(i, :)')); - assert (mesh.e(5, i), geom.bedges.comp(i)); - endfor -***** endfunction -***** function verifyPhi (phi, XX, YY, h) - for s = [-1, 1] - cur = phi * s; - cur = ls_normalise (cur, h); - geom = ls_find_geometry (cur, h); - geom = ls_absolute_geom (geom, XX, YY); - - verifyMesh (geom, cur, false); - verifyMesh (geom, cur, true); - endfor -***** endfunction -***** test - n = 20; - x = linspace (-10, 10, n); - h = x(2) - x(1); - [XX, YY] = meshgrid (x, x); - - phi = ls_union (ls_genbasic (XX, YY, "sphere", [-6, -6], 3), ... - ls_genbasic (XX, YY, "sphere", [6, 6], 3)); - verifyPhi (phi, XX, YY, h); - - phi = ls_setdiff (ls_genbasic (XX, YY, "sphere", [0, 0], 8), ... - ls_genbasic (XX, YY, "sphere", [0, 0], 4)); - verifyPhi (phi, XX, YY, h); ***** demo - x = linspace (-10, 10, 11); - h = x(2) - x(1); + n = 100; + x = linspace (-7, 7, n); [XX, YY] = meshgrid (x, x); - phi = ls_union (ls_genbasic (XX, YY, "sphere", [5, 5], 4.5), ... - ls_genbasic (XX, YY, "sphere", [-2, -2], 4)); - phi = ls_normalise (phi, h); - geom = ls_find_geometry (phi, h); - geom = ls_absolute_geom (geom, XX, YY); - - mesh = ls_build_mesh (geom, phi, false); - meshGlob = ls_build_mesh (geom, phi, true); + phi1 = XX.^2 + YY.^2 - 6^2; + phi2 = XX.^2 + YY.^2 - 3^2; + phi = ls_setdiff (phi1, phi2); figure (); + subplot (1, 2, 1); hold ("on"); - trimesh (meshGlob.t(1 : 3, :)', meshGlob.p(1, :), meshGlob.p(2, :), "r"); - trimesh (mesh.t(1 : 3, :)', mesh.p(1, :), mesh.p(2, :), "g"); - for i = 1 : size (mesh.e, 2) - plot (mesh.p(1, mesh.e(1 : 2, i)), mesh.p(2, mesh.e(1 : 2, i)), "b"); - endfor + contour (XX, YY, phi1, [0, 0], "k"); + contour (XX, YY, phi2, [0, 0], "k"); hold ("off"); - legend ("Global", "Domain", "Boundary"); axis ("equal"); - axis ("square"); -4 tests, 4 passed, 0 known failure, 0 skipped -[inst/ls_nb_from_geom.m] ->>>>> /build/octave-level-set-0.3.0/inst/ls_nb_from_geom.m -***** error - ls_nb_from_geom (1) -***** error - ls_nb_from_geom (1, 2, 3, 4) -***** error - [a, b] = ls_nb_from_geom (1, 2); -***** error - ls_nb_from_geom (1, 2, rand (2, 2)); -***** error - x = linspace (-10, 10, 10); - h = x(2) - x(1); - [XX, YY] = meshgrid (x, x); - phi = ls_genbasic (XX, YY, "sphere", [0, 0], 5); - phi = ls_normalise (phi, h); - geom = ls_find_geometry (phi, h); - ls_nb_from_geom (geom, phi); -***** error - x = linspace (-10, 10, 10); - h = x(2) - x(1); - [XX, YY] = meshgrid (x, x); - phi = ls_genbasic (XX, YY, "sphere", [0, 0], 5); - phi = ls_normalise (phi, h); - geom = ls_find_geometry (phi, h); - ls_nb_from_geom (geom, phi, [1, 2, 3]); -***** test - n = 50; - x = linspace (-10, 10, n); - h = x(2) - x(1); - [XX, YY] = meshgrid (x, x); - - phi = ls_setdiff (ls_genbasic (XX, YY, "sphere", [0, 0], 8), ... - ls_genbasic (XX, YY, "sphere", [1, 1], 5)); - phi = ls_normalise (phi, h); - geom = ls_find_geometry (phi, h); - geom = ls_absolute_geom (geom, XX, YY); - - dOld = ls_init_narrowband (phi, h); - dNew = ls_nb_from_geom (geom, phi); - - where = (!isna (dOld)); - assert (all (!isna (dNew(where)))); - assert (dNew(where), dOld(where), h / 4); -***** demo - n = 50; - x = linspace (-10, 10, n); - h = x(2) - x(1); - [XX, YY] = meshgrid (x, x); - - phi = ls_genbasic (XX, YY, "sphere", [0, 0], 3); - phi = ls_normalise (phi, h); - geom = ls_find_geometry (phi, h); - geom = ls_absolute_geom (geom, XX, YY); - - g0 = NA (1, geom.bedges.n); - for i = 1 : geom.bedges.n - a = geom.ispts.coord(geom.bedges.ispts(i, 1), :); - b = geom.ispts.coord(geom.bedges.ispts(i, 2), :); - m = (a + b) / 2; - angle = abs (atan2 (m(2), m(1))); - g0(i) = min (angle, 2 * pi - angle); - endfor - - [d, g] = ls_nb_from_geom (geom, phi, g0); - [d, g] = fastmarching (d, g, h * ones (size (phi))); - - figure (); - hold ("on"); - imagesc (x, x, g); - set (gca (), "ydir", "normal"); - contour (XX, YY, phi, [0, 0], "k"); - hold ("off"); - colorbar (); -7 tests, 7 passed, 0 known failure, 0 skipped -[inst/ls_enforce_speed.m] ->>>>> /build/octave-level-set-0.3.0/inst/ls_enforce_speed.m -***** error - ls_enforce_speed (1, 2) -***** error - ls_enforce_speed (1, 2, 3, 4) -***** error - ls_enforce_speed (1, "inside", [1, 2]); -***** error - ls_enforce_speed (1, "foo", true); -***** error - ls_enforce_speed (1, NA, false); -***** function checkCircleRadius (XX, YY, h, phi, r) - phiCorrect = XX.^2 + YY.^2 - r^2; - sd1 = ls_signed_distance (phi, h); - sd2 = ls_signed_distance (phiCorrect, h); - assert (sd1, sd2, h); -***** endfunction -***** test - n = 100; - x = linspace (-10, 10, n); - h = x(2) - x(1); - [XX, YY] = meshgrid (x, x); - - phi = XX.^2 + YY.^2 - 3^2; - F = ones (size (XX)); - whereContain = (XX.^2 + YY.^2 < 5^2); - F = ls_enforce_speed (F, "contain", whereContain); - whereInside = (XX.^2 + YY.^2 < 8^2); - F = ls_enforce_speed (F, "inside", whereInside); - dists = ls_solve_stationary (phi, F, h); - phi2 = ls_extract_solution (10, dists, phi, F); - assert (ls_check (phi2, "contain", whereContain)); - assert (ls_check (phi2, "inside", whereInside)); - checkCircleRadius (XX, YY, h, phi2, 8); - - phi = XX.^2 + YY.^2 - 8^2; - F = -ones (size (XX)); - whereContain = (XX.^2 + YY.^2 < 5^2); - F = ls_enforce_speed (F, "contain", whereContain); - whereOutside = (XX.^2 + YY.^2 >= 7^2); - F = ls_enforce_speed (F, "outside", whereOutside); - dists = ls_solve_stationary (phi, F, h); - phi2 = ls_extract_solution (10, dists, phi, F); - assert (ls_check (phi2, "contain", whereContain)); - assert (ls_check (phi2, "outside", whereOutside)); - checkCircleRadius (XX, YY, h, phi2, 5); -***** demo - n = 100; - x = linspace (-10, 10, n); - h = x(2) - x(1); - [XX, YY] = meshgrid (x, x); - - phi = XX.^2 + YY.^2 - 8^2; - F = -ones (size (XX)); - F = ls_enforce_speed (F, "outside", XX.^2 + YY.^2 >= 7^2); - F = ls_enforce_speed (F, "contain", XX.^2 + YY.^2 < 3^2); - times = linspace (1, 6, 40); - ls_animate_evolution (phi, F, h, times, 0.05); - - phi = XX.^2 + YY.^2 - 3^2; - F = ones (size (XX)); - F = ls_enforce_speed (F, "inside", XX.^2 + YY.^2 < 8^2); - F = ls_enforce_speed (F, "contain", XX.^2 + YY.^2 < 5^2); - ls_animate_evolution (phi, F, h, times, 0.05); -6 tests, 6 passed, 0 known failure, 0 skipped -[inst/ls_inside.m] ->>>>> /build/octave-level-set-0.3.0/inst/ls_inside.m -***** error - ls_inside () -***** error - ls_inside (1, 2) -***** test - assert (ls_inside ([1, 0, -1, 0, 1]), [false, false, true, false, false]); -***** test - if (exist ("signbit") == 5) - assert (ls_inside ([-0, 0]), [true, false]); - else - warning ("'signbit' function not available, skipping test."); - endif -4 tests, 4 passed, 0 known failure, 0 skipped -[inst/ls_absolute_geom.m] ->>>>> /build/octave-level-set-0.3.0/inst/ls_absolute_geom.m -***** error - ls_absolute_geom (1, 2); -***** error - ls_absolute_geom (1, 2, 3, 4); -***** error - x = [-1, 1]; - [XX, YY, ZZ] = ndgrid (x); - ls_absolute_geom (struct (), XX, YY); -***** error - ls_absolute_geom (struct (), [-1, 0, 1], [0, 0, 0]); -***** error - ls_absolute_geom (struct (), zeros (3, 2), zeros (2, 2)); -5 tests, 5 passed, 0 known failure, 0 skipped -[inst/ls_genbasic.m] ->>>>> /build/octave-level-set-0.3.0/inst/ls_genbasic.m -***** shared x, y, XX, YY, XXX, YYY, ZZZ - n = 121; - x = linspace (-5, 7, n); - y = linspace (-7, 5, n); - [XX, YY] = meshgrid (x, y); - [XXX, YYY, ZZZ] = ndgrid (x, y, x); -***** error - ls_genbasic (); -***** error - ls_genbasic (1, 2); -***** error - ls_genbasic ("sphere"); -***** error - ls_genbasic (XX, YY, "unknown"); -***** test - ls_genbasic (x, "sphere", 0, 1); - ls_genbasic (x', "sphere", 0, 1); - ls_genbasic (XX, YY, "sphere", [0, 0], 1); - ls_genbasic (0, 1, "sphere", [0, 0], 1); -***** error - ls_genbasic (XX, YY, "sphere"); -***** error - ls_genbasic (XX, YY, "sphere", 1); -***** error - ls_genbasic (XX, YY, "sphere", 1, 2, 3); -***** error - ls_genbasic (XX, YY, "sphere", [1, 2, 3], 1); -***** error - ls_genbasic (XX, YY, "sphere", [1, 2], [1, 2, 3]); -***** test - assert (ls_genbasic (XX, YY, "sphere", [1, -1], 1), ... - ls_genbasic (XX, YY, "sphere", [1, -1], [1, 1])); -***** test - c = [1; -1; 2]; - r = [1; 2; 0.6]; - tol = 0.4; - phi1 = ls_genbasic (XXX, YYY, ZZZ, "sphere", c, r); - phi2 = ls_genbasic (XXX, YYY, ZZZ, "sphere", c, min (r) - tol); - assert (ls_issubset (phi2, phi1)); - coords = {XXX, YYY, ZZZ}; - for i = 1 : length (c) - assert (ls_disjoint (phi1, ... - coords{i} - (c(i) - r(i)), ... - c(i) + r(i) - coords{i})); - assert (~ls_disjoint (phi1 - tol, coords{i} - (c(i) - r(i)))); - assert (~ls_disjoint (phi1 - tol, c(i) + r(i) - coords{i})); - endfor -***** error - ls_genbasic (XX, YY, "box", 1); -***** error - ls_genbasic (XX, YY, "box", 1, 2, 3); -***** error - ls_genbasic (XX, YY, "box", [1, 2, 3], [1, 2]); -***** error - ls_genbasic (XX, YY, "box", [1; 2], [1, 2, 3]); -***** test - assert (ls_equal (ls_genbasic (x, "box", -1, 2), abs (x - 0.5) - 1.5)); - assert (ls_equal (ls_genbasic (x, "box", 2, -1), abs (x - 0.5) - 1.5)); -***** test - a = [2; -3; 1]; - b = [0; 2; -1]; - tol = 0.2; - phi1 = ls_genbasic (XXX, YYY, ZZZ, "box", a, b); - phi2 = ls_genbasic (XXX, YYY, ZZZ, "box", b, a); - assert (phi1, phi2); - coords = {XXX, YYY, ZZZ}; - for i = 1 : length (coords) - assert (ls_disjoint (phi1, ... - coords{i} - min (a(i), b(i)), ... - max (a(i), b(i)) - coords{i})); - assert (~ls_disjoint (phi1 - tol, coords{i} - min (a(i), b(i)))); - assert (~ls_disjoint (phi1 - tol, max (a(i), b(i)) - coords{i})); - endfor -***** error - ls_genbasic (XX, YY, "half", 1); -***** error - ls_genbasic (XX, YY, "half", 1, 2, 3); -***** error - ls_genbasic (XX, YY, "half", [1, 2, 3], [1, 2]); -***** error - ls_genbasic (XX, YY, "half", [1; 2], [1, 2, 3]); -***** test - p = [0, 2, 1]; - - phi = ls_genbasic (XXX, YYY, ZZZ, "half", p, [0; 0; 1]); - assert (ls_equal (phi, 1 - ZZZ)); - - normal = [1; 2; -0.5]; - phi1 = ls_genbasic (XXX, YYY, ZZZ, "half", p, normal); - phi2 = ls_genbasic (XXX, YYY, ZZZ, "half", p, 2 * normal); - assert (ls_equal (phi1, phi2)); - - phi = ls_genbasic (XX, YY, "half", [0, 0], [1, -1]); - assert (ls_equal (phi, YY - XX)); -***** demo - n = 200; - x = linspace (-7, 7, n); - [XX, YY] = meshgrid (x, x); - - phi1 = ls_genbasic (XX, YY, "box", [-5, -3], [3, 6]); - phi2 = ls_genbasic (XX, YY, "sphere", [-1; 1], 2); - phi3 = ls_genbasic (XX, YY, "sphere", [0; 0], [6, 1]); - phi4 = ls_genbasic (XX, YY, "half", [3, -3], [1, -2]) / 8; - phi = ls_union (ls_setdiff (phi1, phi2), phi3, phi4); - figure (); + subplot (1, 2, 2); hold ("on"); imagesc (x, x, phi); set (gca (), "ydir", "normal"); @@ -2869,7 +2756,7 @@ contour (XX, YY, phi, [0, 0], "k"); hold ("off"); axis ("equal"); -23 tests, 23 passed, 0 known failure, 0 skipped +4 tests, 4 passed, 0 known failure, 0 skipped [inst/so_replay_descent.m] >>>>> /build/octave-level-set-0.3.0/inst/so_replay_descent.m ***** error @@ -3116,31 +3003,160 @@ fclose (pr); printf ("Final cost: %.6d\n", s.cost); 13 tests, 13 passed, 0 known failure, 0 skipped -[inst/so_save_descent.m] ->>>>> /build/octave-level-set-0.3.0/inst/so_save_descent.m +[inst/ls_isempty.m] +>>>>> /build/octave-level-set-0.3.0/inst/ls_isempty.m ***** error - so_save_descent (1, 2); + ls_isempty () ***** error - so_save_descent (1, 2, 3, 4); -***** error - so_save_descent (1, 2, 3); -***** error - so_save_descent (struct (), 2, struct ()); -***** error - so_save_descent ([2, 3], 2, struct ()); -***** error <'fsave' is not available> - try - pkg unload parallel; - end_try_catch - so_save_descent ("foo", 2, struct ()); -***** shared run_tests - run_tests = ! strcmp ('Not installed', ... - nthargout (2, 'pkg', 'describe', 'parallel')); -***** testif ; run_tests - pkg load parallel; - so_save_descent ("foo", 2, struct ()); - so_save_descent (5, 2, struct ()); -7 tests, 7 passed, 0 known failure, 0 skipped + ls_isempty (1, 2) +***** test + n = 50; + x = linspace (-10, 10, n); + [XX, YY] = meshgrid (x, x); + + phi1 = (XX - 2).^2 + (YY - 2).^2 - 2^2; + phi2 = (XX + 2).^2 + (YY + 2).^2 - 2^2; + + assert (~ls_isempty (phi1) && ~ls_isempty (phi2)); + assert (ls_isempty (ls_intersect (phi1, phi2))); + assert (~ls_isempty (ls_union (phi1, phi2))); +3 tests, 3 passed, 0 known failure, 0 skipped +[inst/ls_equal.m] +>>>>> /build/octave-level-set-0.3.0/inst/ls_equal.m +***** error + ls_equal (1) +***** error + ls_equal (1, 2, 3) +***** error + ls_equal (1, [1, 2]) +***** test + assert (ls_equal ([Inf, 0, -2, -Inf, eps], ... + [1, 0, -Inf, -eps, 1])); + assert (ls_equal ([1, 0; -1, 0], [Inf, 0; -5, 0])); + assert (!ls_equal ([1, -1; 0, 0], [1, 0; 0, 0])); +***** test + if (exist ("signbit") == 5) + assert (ls_equal ([0, -0], [1, -1])); + else + warning ("'signbit' function not available, skipping test."); + endif +5 tests, 5 passed, 0 known failure, 0 skipped +[inst/ls_genbasic.m] +>>>>> /build/octave-level-set-0.3.0/inst/ls_genbasic.m +***** shared x, y, XX, YY, XXX, YYY, ZZZ + n = 121; + x = linspace (-5, 7, n); + y = linspace (-7, 5, n); + [XX, YY] = meshgrid (x, y); + [XXX, YYY, ZZZ] = ndgrid (x, y, x); +***** error + ls_genbasic (); +***** error + ls_genbasic (1, 2); +***** error + ls_genbasic ("sphere"); +***** error + ls_genbasic (XX, YY, "unknown"); +***** test + ls_genbasic (x, "sphere", 0, 1); + ls_genbasic (x', "sphere", 0, 1); + ls_genbasic (XX, YY, "sphere", [0, 0], 1); + ls_genbasic (0, 1, "sphere", [0, 0], 1); +***** error + ls_genbasic (XX, YY, "sphere"); +***** error + ls_genbasic (XX, YY, "sphere", 1); +***** error + ls_genbasic (XX, YY, "sphere", 1, 2, 3); +***** error + ls_genbasic (XX, YY, "sphere", [1, 2, 3], 1); +***** error + ls_genbasic (XX, YY, "sphere", [1, 2], [1, 2, 3]); +***** test + assert (ls_genbasic (XX, YY, "sphere", [1, -1], 1), ... + ls_genbasic (XX, YY, "sphere", [1, -1], [1, 1])); +***** test + c = [1; -1; 2]; + r = [1; 2; 0.6]; + tol = 0.4; + phi1 = ls_genbasic (XXX, YYY, ZZZ, "sphere", c, r); + phi2 = ls_genbasic (XXX, YYY, ZZZ, "sphere", c, min (r) - tol); + assert (ls_issubset (phi2, phi1)); + coords = {XXX, YYY, ZZZ}; + for i = 1 : length (c) + assert (ls_disjoint (phi1, ... + coords{i} - (c(i) - r(i)), ... + c(i) + r(i) - coords{i})); + assert (~ls_disjoint (phi1 - tol, coords{i} - (c(i) - r(i)))); + assert (~ls_disjoint (phi1 - tol, c(i) + r(i) - coords{i})); + endfor +***** error + ls_genbasic (XX, YY, "box", 1); +***** error + ls_genbasic (XX, YY, "box", 1, 2, 3); +***** error + ls_genbasic (XX, YY, "box", [1, 2, 3], [1, 2]); +***** error + ls_genbasic (XX, YY, "box", [1; 2], [1, 2, 3]); +***** test + assert (ls_equal (ls_genbasic (x, "box", -1, 2), abs (x - 0.5) - 1.5)); + assert (ls_equal (ls_genbasic (x, "box", 2, -1), abs (x - 0.5) - 1.5)); +***** test + a = [2; -3; 1]; + b = [0; 2; -1]; + tol = 0.2; + phi1 = ls_genbasic (XXX, YYY, ZZZ, "box", a, b); + phi2 = ls_genbasic (XXX, YYY, ZZZ, "box", b, a); + assert (phi1, phi2); + coords = {XXX, YYY, ZZZ}; + for i = 1 : length (coords) + assert (ls_disjoint (phi1, ... + coords{i} - min (a(i), b(i)), ... + max (a(i), b(i)) - coords{i})); + assert (~ls_disjoint (phi1 - tol, coords{i} - min (a(i), b(i)))); + assert (~ls_disjoint (phi1 - tol, max (a(i), b(i)) - coords{i})); + endfor +***** error + ls_genbasic (XX, YY, "half", 1); +***** error + ls_genbasic (XX, YY, "half", 1, 2, 3); +***** error + ls_genbasic (XX, YY, "half", [1, 2, 3], [1, 2]); +***** error + ls_genbasic (XX, YY, "half", [1; 2], [1, 2, 3]); +***** test + p = [0, 2, 1]; + + phi = ls_genbasic (XXX, YYY, ZZZ, "half", p, [0; 0; 1]); + assert (ls_equal (phi, 1 - ZZZ)); + + normal = [1; 2; -0.5]; + phi1 = ls_genbasic (XXX, YYY, ZZZ, "half", p, normal); + phi2 = ls_genbasic (XXX, YYY, ZZZ, "half", p, 2 * normal); + assert (ls_equal (phi1, phi2)); + + phi = ls_genbasic (XX, YY, "half", [0, 0], [1, -1]); + assert (ls_equal (phi, YY - XX)); +***** demo + n = 200; + x = linspace (-7, 7, n); + [XX, YY] = meshgrid (x, x); + + phi1 = ls_genbasic (XX, YY, "box", [-5, -3], [3, 6]); + phi2 = ls_genbasic (XX, YY, "sphere", [-1; 1], 2); + phi3 = ls_genbasic (XX, YY, "sphere", [0; 0], [6, 1]); + phi4 = ls_genbasic (XX, YY, "half", [3, -3], [1, -2]) / 8; + + phi = ls_union (ls_setdiff (phi1, phi2), phi3, phi4); + figure (); + hold ("on"); + imagesc (x, x, phi); + set (gca (), "ydir", "normal"); + ls_sign_colourmap (); + contour (XX, YY, phi, [0, 0], "k"); + hold ("off"); + axis ("equal"); +23 tests, 23 passed, 0 known failure, 0 skipped [inst/ls_union.m] >>>>> /build/octave-level-set-0.3.0/inst/ls_union.m ***** error @@ -3190,6 +3206,165 @@ hold ("off"); axis ("equal"); 3 tests, 3 passed, 0 known failure, 0 skipped +[inst/ls_hausdorff_dist.m] +>>>>> /build/octave-level-set-0.3.0/inst/ls_hausdorff_dist.m +***** error + ls_hausdorff_dist (1) +***** error + ls_hausdorff_dist (1, 2, 3, 4) +***** error + ls_hausdorff_dist (1, 2, [3, 3]) +***** error + ls_hausdorff_dist (1, 2, "foo") +***** test + n = 50; + x = linspace (-5, 5, n); + h = x(2) - x(1); + [XX, YY] = meshgrid (x, x); + + phi1 = ls_genbasic (XX, YY, "sphere", [3, 0], 1); + phi2 = ls_genbasic (XX, YY, "sphere", [-2, 0], 2); + assert (ls_hausdorff_dist (phi1, phi2, h), 6, h); + + % Make sure that phi isn't a signed-distance fcn already. + % ls_genbasic should return the same, but make it explicit. + rSq = XX.^2 + YY.^2; + d = ls_hausdorff_dist (rSq - 4^2, rSq - 2^2, h); + assert (d, 2, h); + dWrong = ls_hausdorff_dist (rSq - 4^2, rSq - 2^2, "sd"); + assert (abs (d - dWrong) > 10 * h); + dRight = ls_hausdorff_dist (sqrt (rSq) - 4, sqrt (rSq) - 2, "sd"); + assert (dRight, d, h); +***** test + n = 200; + x = linspace (-5, 5, n); + h = x(2) - x(1); + [XX, YY] = meshgrid (x, x); + + phiA = ls_genbasic (XX, YY, "sphere", [0, 0], 4); + phiInner = ls_genbasic (XX, YY, "sphere", [0, 0], 2); + phiB = ls_setdiff (phiA, phiInner); + + d1 = ls_hausdorff_dist (phiA, phiB, h); + d2 = ls_hausdorff_dist (phiB, phiA, h); + assert (d1, d2); + assert (d1, 2, 2 * h); + dc = ls_hausdorff_dist (ls_complement (phiA), ... + ls_complement (phiB), h); + assert (dc, 4, 2 * h); + + sdA = ls_signed_distance (phiA, h); + sdB = ls_signed_distance (phiB, h); + sdDiff = norm (sdA(:) - sdB(:), inf); + assert (abs (sdDiff - d1) > 10 * h); +6 tests, 6 passed, 0 known failure, 0 skipped +[inst/ls_enforce.m] +>>>>> /build/octave-level-set-0.3.0/inst/ls_enforce.m +***** error + ls_enforce (1, 2) +***** error + ls_enforce (1, 2, 3, 4) +***** error + ls_enforce (1, "inside", [1, 2]); +***** error + ls_enforce (1, "foo", true); +***** error + ls_enforce (1, NA, false); +***** test + n = 100; + x = linspace (-10, 10, n); + [XX, YY] = meshgrid (x, x); + + circ2 = (XX.^2 + YY.^2 < 2^2); + circ8 = (XX.^2 + YY.^2 < 8^2); + phi = (XX.^2 + YY.^2 - 5^2); + + phi2 = ls_enforce (phi, "inside", circ8); + assert (ls_equal (phi2, phi)); + phi2 = ls_enforce (phi, "inside", circ2); + assert (ls_check (phi2, "inside", circ2)); + + phi2 = ls_enforce (phi, "contain", circ2); + assert (ls_equal (phi2, phi)); + phi2 = ls_enforce (phi, "contain", circ8); + assert (ls_check (phi2, "contain", circ8)); + + phi2 = ls_enforce (phi, "outside", ~circ8); + assert (ls_equal (phi2, phi)); + phi2 = ls_enforce (phi, "outside", ~circ2); + ls_check (phi2, "outside", ~circ2); + phi2 = ls_enforce (phi, "outside", circ2); + ls_check (phi2, "outside", circ2); +6 tests, 6 passed, 0 known failure, 0 skipped +[inst/so_init_params.m] +>>>>> /build/octave-level-set-0.3.0/inst/so_init_params.m +***** error + so_init_params () +***** error + so_init_params (true, 1, 2) +***** error + so_init_params (true, 0); +***** error + so_init_params (true, 1.5); +***** shared run_tests + run_tests = ! strcmp ('Not installed', ... + nthargout (2, 'pkg', 'describe', 'parallel')); +***** test + p = so_init_params (true); +***** error <'pararrayfun' is not available> + if run_tests + pkg unload parallel; + endif + p = so_init_params (true, 2); +***** testif ; run_tests + pkg load parallel; + p = so_init_params (true, 2); +7 tests, 7 passed, 0 known failure, 0 skipped +[inst/ls_setxor.m] +>>>>> /build/octave-level-set-0.3.0/inst/ls_setxor.m +***** error + ls_setxor (1) +***** error + ls_setxor (1, 2, 3) +***** error + ls_setxor (1, [1, 2]) +***** test + assert (ls_equal (ls_setxor ([-1, -1, Inf], [1, -1, -Inf]), [-1, 1, -1])); + n = 50; + x = linspace (-10, 10, n); + h = x(2) - x(1); + [XX, YY] = meshgrid (x, x); + + phi1 = XX.^2 + YY.^2 - 8^2; + phi2 = XX.^2 + YY.^2 - 5^2; + + assert (ls_equal (ls_setdiff (phi1, phi2), ls_setxor (phi1, phi2))); +***** demo + n = 100; + x = linspace (-7, 7, n); + [XX, YY] = meshgrid (x, x); + + phi1 = (XX - 2).^2 + YY.^2 - 3^2; + phi2 = (XX + 2).^2 + YY.^2 - 3^2; + phi = ls_setxor (phi1, phi2); + + figure (); + subplot (1, 2, 1); + hold ("on"); + contour (XX, YY, phi1, [0, 0], "k"); + contour (XX, YY, phi2, [0, 0], "k"); + hold ("off"); + axis ("equal"); + + subplot (1, 2, 2); + hold ("on"); + imagesc (x, x, phi); + set (gca (), "ydir", "normal"); + ls_sign_colourmap (); + contour (XX, YY, phi, [0, 0], "k"); + hold ("off"); + axis ("equal"); +4 tests, 4 passed, 0 known failure, 0 skipped [inst/so_step_armijo.m] >>>>> /build/octave-level-set-0.3.0/inst/so_step_armijo.m ***** function s = updateState (phi, data) @@ -3301,93 +3476,48 @@ warning ("'parallel' package not installed, skipping test."); error ('volume too large'); end_try_catch - parcellfun: 0/2 jobs done parcellfun: 0/2 jobs done parcellfun: 1/2 jobs done parcellfun: 2/2 jobs done + parcellfun: 0/2 jobs done parcellfun: 1/2 jobs done parcellfun: 2/2 jobs done 19 tests, 19 passed, 0 known failure, 0 skipped -[inst/so_init_params.m] ->>>>> /build/octave-level-set-0.3.0/inst/so_init_params.m -***** error - so_init_params () +[inst/ls_disjoint.m] +>>>>> /build/octave-level-set-0.3.0/inst/ls_disjoint.m ***** error - so_init_params (true, 1, 2) -***** error - so_init_params (true, 0); -***** error - so_init_params (true, 1.5); -***** shared run_tests - run_tests = ! strcmp ('Not installed', ... - nthargout (2, 'pkg', 'describe', 'parallel')); + ls_disjoint () +***** error + ls_disjoint (1, -2, [1, 2]) ***** test - p = so_init_params (true); -***** error <'pararrayfun' is not available> - if run_tests - pkg unload parallel; - endif - p = so_init_params (true, 2); -***** testif ; run_tests - pkg load parallel; - p = so_init_params (true, 2); -7 tests, 7 passed, 0 known failure, 0 skipped -[inst/ls_setxor.m] ->>>>> /build/octave-level-set-0.3.0/inst/ls_setxor.m -***** error - ls_setxor (1) -***** error - ls_setxor (1, 2, 3) -***** error - ls_setxor (1, [1, 2]) + assert (ls_disjoint ([-1, 0, 1], [0, 0, 0], [1, 0, -1])); + assert (~ls_disjoint ([Inf, -Inf, 1], [-1, -1, 1])); + assert (~ls_disjoint ([-1, -1, 1], [0, 0, 0], [1, -1, -1])); ***** test - assert (ls_equal (ls_setxor ([-1, -1, Inf], [1, -1, -Inf]), [-1, 1, -1])); n = 50; x = linspace (-10, 10, n); - h = x(2) - x(1); - [XX, YY] = meshgrid (x, x); - - phi1 = XX.^2 + YY.^2 - 8^2; - phi2 = XX.^2 + YY.^2 - 5^2; - - assert (ls_equal (ls_setdiff (phi1, phi2), ls_setxor (phi1, phi2))); -***** demo - n = 100; - x = linspace (-7, 7, n); [XX, YY] = meshgrid (x, x); - phi1 = (XX - 2).^2 + YY.^2 - 3^2; - phi2 = (XX + 2).^2 + YY.^2 - 3^2; - phi = ls_setxor (phi1, phi2); - - figure (); - subplot (1, 2, 1); - hold ("on"); - contour (XX, YY, phi1, [0, 0], "k"); - contour (XX, YY, phi2, [0, 0], "k"); - hold ("off"); - axis ("equal"); + phi1 = (XX - 2).^2 + (YY - 2).^2 - 2^2; + phi2 = (XX + 2).^2 + (YY + 2).^2 - 2^2; + phi3 = XX.^2 + YY.^2 - 2^2; - subplot (1, 2, 2); - hold ("on"); - imagesc (x, x, phi); - set (gca (), "ydir", "normal"); - ls_sign_colourmap (); - contour (XX, YY, phi, [0, 0], "k"); - hold ("off"); - axis ("equal"); + assert (ls_disjoint (phi1, phi2)); + assert (~ls_disjoint (phi1, phi3)); + assert (~ls_disjoint (phi2, phi3)); + assert (~ls_disjoint (phi1, phi2, phi3)); 4 tests, 4 passed, 0 known failure, 0 skipped -[inst/ls_distance_fcn.m] ->>>>> /build/octave-level-set-0.3.0/inst/ls_distance_fcn.m +[inst/ls_signed_distance.m] +>>>>> /build/octave-level-set-0.3.0/inst/ls_signed_distance.m ***** error - ls_distance_fcn () + ls_signed_distance () ***** error - ls_distance_fcn (1, 2, 3) + ls_signed_distance (1, 2, 3) ***** test - assert (ls_distance_fcn ([]), []); + assert (ls_signed_distance ([]), []); ***** test n = 10; x = linspace (-2, 2, n); h = x(2) - x(1); phi = abs (x) - 1; - d = ls_distance_fcn (phi, h); - assert (d, max (phi, 0), sqrt (eps)); + d = ls_signed_distance (phi, h); + assert (d, phi, sqrt (eps)); ***** test n = 50; x = linspace (-2, 2, n); @@ -3396,50 +3526,117 @@ RRsq = XX.^2 + YY.^2 + ZZ.^2; phi = RRsq - 1; - d = ls_distance_fcn (phi, h); - assert (d, max (sqrt (RRsq) - 1, 0), h); + d = ls_signed_distance (phi, h); + assert (d, sqrt (RRsq) - 1, h); ***** test - n = 500; + phi = [5e-6, 1.7e-154, -1.3e-2]; + for h = [0.02, 0.01, 0.005] + d = ls_signed_distance (phi, h); + assert (all (isfinite (d))); + assert (d(2), 0); + endfor +***** test + phis = ls_get_tests (); + for i = 1 : length (phis) + phi = ls_normalise (phis{i}); + d = ls_signed_distance (phi); + assert (ls_equal (d, phi)); + endfor +***** test + if (exist ("signbit") == 5) + phi = [-0, 0]; + d = ls_signed_distance (phi); + assert (ls_equal (phi, d)); + else + warning ("'signbit' function not available, skipping test."); + endif +***** demo + n = 100; x = linspace (-10, 10, n); h = x(2) - x(1); - [XX, YY] = meshgrid (x, x); - phi = ls_genbasic (XX, YY, "sphere", [0, 0], 8); - id = tic (); - d = ls_distance_fcn (phi, h); - time1 = toc (id); + phi0 = atan (ls_union ((XX.^2 + (YY - 5).^2) - 20, ... + (XX.^2 + (YY + 5).^2) - 20)); + %phi0 = XX.^2 / 1.3^2 + YY.^2 - 1; + d = ls_signed_distance (phi0, h); - id = tic (); - sd = ls_signed_distance (phi, h); - time2 = toc (id); + figure (); + subplot (1, 2, 1); + contour (XX, YY, phi0); + title ("Initial"); + colorbar (); + axis ("equal"); - assert (d, max (sd, 0), sqrt (eps)); - printf ("ls_distance_fcn faster than ls_signed_distance by %.1f%%\n", ... - 100 * ((time2 - time1) / time2)); - assert (time1 < time2); -ls_distance_fcn faster than ls_signed_distance by 36.0% + subplot (1, 2, 2); + contour (XX, YY, d); + title ("Signed Distance"); + colorbar (); + axis ("equal"); +8 tests, 8 passed, 0 known failure, 0 skipped +[inst/ls_sign_colourmap.m] +>>>>> /build/octave-level-set-0.3.0/inst/ls_sign_colourmap.m +***** shared colours + colours = [1, 1, 1; 0, 0, 0; 1, 1, 1; 0, 0, 0]; +***** error + ls_sign_colourmap (1, 2); +***** error + ls_sign_colourmap (1); +***** error + cmap = ls_sign_colourmap (); +***** error + ls_sign_colourmap ("foo"); ***** test - phis = ls_get_tests (); - for i = 1 : length (phis) - phi = ls_normalise (phis{i}); - d = ls_distance_fcn (phi); - sd = ls_signed_distance (phi); - assert (d, max (sd, 0), sqrt (eps)); - endfor + figure (); + ls_sign_colourmap (); + ls_sign_colourmap ("highlight"); + ls_sign_colourmap (colours); + close (); +***** error + ls_sign_colourmap (1, 2, 3); +***** error + ls_sign_colourmap ([1, 2, 3]); +***** error + ls_sign_colourmap ([1, 2], 1); +***** error + ls_sign_colourmap ([1, 2], "foo"); +***** test + cmap = ls_sign_colourmap ([1, 2]); + cmap = ls_sign_colourmap ([1; 2], "highlight"); + cmap = ls_sign_colourmap ([1; 2], colours); ***** demo n = 100; - x = linspace (-10, 10, n); + x = linspace (-2, 2, n); + y = linspace (-1, 3, n); + [XX, YY] = meshgrid (x, y); + phi = ls_genbasic (XX, YY, "sphere", [0, 1], 1); + + figure (); + imagesc (x, y, phi); + set (gca (), "ydir", "normal"); + ls_sign_colourmap (); + colorbar (); + title ("Type 'sign'"); +***** demo + n = 100; + x = linspace (-2, 2, n); h = x(2) - x(1); [XX, YY] = meshgrid (x, x); - phi = ls_genbasic (XX, YY, "sphere", [0, 0], [8, 5]); - d = ls_distance_fcn (phi, h); + phi = ls_genbasic (XX, YY, "sphere", [0, 0], 1); + d = ls_signed_distance (phi, h); + F = YY .* exp (-10 * d.^2); figure (); - mesh (XX, YY, d); - view ([45, 45]); -7 tests, 7 passed, 0 known failure, 0 skipped + hold ("on"); + imagesc (x, x, F); + set (gca (), "ydir", "normal"); + ls_sign_colourmap ("highlight"); + colorbar (); + contour (XX, YY, phi, [0, 0], "k", "LineWidth", 2); + hold ("off"); + title ("Type 'highlight'"); +10 tests, 10 passed, 0 known failure, 0 skipped [inst/so_example_problem.m] >>>>> /build/octave-level-set-0.3.0/inst/so_example_problem.m ***** shared basicData @@ -3514,76 +3711,54 @@ testDeriv (-1, 3, data); testDeriv (-3, 1, data); 6 tests, 6 passed, 0 known failure, 0 skipped -[inst/so_explore_descent.m] ->>>>> /build/octave-level-set-0.3.0/inst/so_explore_descent.m +[inst/upwind_gradient_norm.m] +>>>>> /build/octave-level-set-0.3.0/inst/upwind_gradient_norm.m ***** error - so_explore_descent (1); + upwind_gradient_norm () ***** error - so_explore_descent (1, 2, 3); -***** error - so_explore_descent (struct (), 2); -***** error - so_explore_descent ([2, 3], 2); -***** error <'fload' is not available> - try - pkg unload parallel; - end_try_catch - so_explore_descent ("foo", 2); -***** demo - pkg load parallel; + upwind_gradient_norm (1, 2, 3, 4) +***** error + upwind_gradient_norm ([1, 1], [2, 2], [3, 3]) +***** error + upwind_gradient_norm ([1, 1], [2, 2, 2]) +***** error + upwind_gradient_norm ([1, 1], [2, 2, 2], 5) +***** test + phi = [0, 2, 3]; + fPos = ones (size (phi)); - data = struct (); - data.p = so_init_params (false); - data.p.vol = 10; - data.p.weight = 50; + % Propagate the original phi to the right. This should result + % in the *backward* difference to be used in the middle. + g = upwind_gradient_norm (phi); + assert (g(2), 2); + gp = upwind_gradient_norm (phi, fPos); + assert (gp, g); + gp = upwind_gradient_norm (phi, 0.5); + assert (gp, 2 * g); + gp = upwind_gradient_norm (phi, fPos, 0.5); + assert (gp, 2 * g); - data.p.nSteps = 10; - data.figs = struct (); - data.figs.speed = figure (); - data.figs.exploreCosts = figure (); + % Propagate to the left for the reverse effect. + g = upwind_gradient_norm (phi, -fPos); + assert (g(2), 1); - n = 100; - x = linspace (-10, 10, n); + % Propagate -phi, which again turns everything around. + g = upwind_gradient_norm (-phi, fPos); + assert (g(2), 1); + g = upwind_gradient_norm (-phi, -fPos); + assert (g(2), 2); +***** test + n = 50; + x = linspace (-1, 1, n); h = x(2) - x(1); - data.g = struct ("x", x, "h", h); - - data = so_example_problem (data); - phi0 = ls_genbasic (data.g.x, "box", -3, 7); - - printf ("Computing descent...\n"); - f = tmpfile (); - d = data; - d.handler = struct (); - d = so_save_descent (f, struct (), d); - s = so_run_descent (data.p.nSteps, phi0, d); - printf ("Final cost: %.6d\n", s.cost); + [XX, YY, ZZ] = ndgrid (x, x, x); - printf ("\nNow replaying...\n"); - init = @() data; - frewind (f); - so_explore_descent (f, init); - fclose (f); -5 tests, 5 passed, 0 known failure, 0 skipped -[inst/ls_equal.m] ->>>>> /build/octave-level-set-0.3.0/inst/ls_equal.m -***** error - ls_equal (1) -***** error - ls_equal (1, 2, 3) -***** error - ls_equal (1, [1, 2]) -***** test - assert (ls_equal ([Inf, 0, -2, -Inf, eps], ... - [1, 0, -Inf, -eps, 1])); - assert (ls_equal ([1, 0; -1, 0], [Inf, 0; -5, 0])); - assert (!ls_equal ([1, -1; 0, 0], [1, 0; 0, 0])); -***** test - if (exist ("signbit") == 5) - assert (ls_equal ([0, -0], [1, -1])); - else - warning ("'signbit' function not available, skipping test."); - endif -5 tests, 5 passed, 0 known failure, 0 skipped + phi = XX.^2 + YY.^2 + ZZ.^2; + g = upwind_gradient_norm (phi, h); + + r = sqrt (phi); + assert (g, 2 * r, 0.1); +7 tests, 7 passed, 0 known failure, 0 skipped [inst/ls_complement.m] >>>>> /build/octave-level-set-0.3.0/inst/ls_complement.m ***** error @@ -3609,58 +3784,142 @@ sd2 = ls_complement (ls_signed_distance (phi1, h)); assert (sd1, sd2, sqrt (eps)); 3 tests, 3 passed, 0 known failure, 0 skipped -[inst/ls_hausdorff_dist.m] ->>>>> /build/octave-level-set-0.3.0/inst/ls_hausdorff_dist.m +[inst/ls_extract_solution.m] +>>>>> /build/octave-level-set-0.3.0/inst/ls_extract_solution.m ***** error - ls_hausdorff_dist (1) + ls_extract_solution (1, 2, 3) ***** error - ls_hausdorff_dist (1, 2, 3, 4) -***** error - ls_hausdorff_dist (1, 2, [3, 3]) -***** error - ls_hausdorff_dist (1, 2, "foo") + ls_extract_solution (1, 2, 3, 4, 5) +***** error + ls_extract_solution (1, [1, 2], [1, 2], [3; 4]); +***** error + ls_extract_solution (1, [1; 2], [3, 4], [3, 4]); ***** test - n = 50; - x = linspace (-5, 5, n); + assert (ls_extract_solution (1, [], [], []), []); +***** test + ts = [0, 1, 2, 3]; + phis = ls_get_tests (); + for i = 1 : length (phis) + f = ones (size (phis{i})); + for j = -1 : 1 + curF = j * f; + d = ls_solve_stationary (phis{i}, curF); + for t = ts + phit = ls_extract_solution (t, d, phis{i}, curF); + assert (phit(curF == 0), phis{i}(curF == 0)); + endfor + endfor + endfor +***** test + n = 100; + x = linspace (-1.5, 1.5, n); h = x(2) - x(1); [XX, YY] = meshgrid (x, x); - phi1 = ls_genbasic (XX, YY, "sphere", [3, 0], 1); - phi2 = ls_genbasic (XX, YY, "sphere", [-2, 0], 2); - assert (ls_hausdorff_dist (phi1, phi2, h), 6, h); + phi = ls_genbasic (XX, YY, "sphere", [0, 0], 1); + f = -ones (size (XX)); - % Make sure that phi isn't a signed-distance fcn already. - % ls_genbasic should return the same, but make it explicit. - rSq = XX.^2 + YY.^2; - d = ls_hausdorff_dist (rSq - 4^2, rSq - 2^2, h); - assert (d, 2, h); - dWrong = ls_hausdorff_dist (rSq - 4^2, rSq - 2^2, "sd"); - assert (abs (d - dWrong) > 10 * h); - dRight = ls_hausdorff_dist (sqrt (rSq) - 4, sqrt (rSq) - 2, "sd"); - assert (dRight, d, h); + d = ls_solve_stationary (phi, f, h); + phiNew = ls_extract_solution (2, d, phi, f); + assert (ls_isempty (phiNew)); ***** test - n = 200; - x = linspace (-5, 5, n); + n = 50; + x = linspace (-3, 3, n); + h = x(2) - x(1); + [XX, YY, ZZ] = ndgrid (x); + + phi0 = ls_genbasic (XX, YY, ZZ, "sphere", [0, 0, 0], 1); + phit = ls_genbasic (XX, YY, ZZ, "sphere", [0, 0, 0], 2); + f = ones (size (phi0)); + + d = ls_solve_stationary (phi0, f, h); + phi = ls_extract_solution (1, d, phi0, f); + + sd1 = ls_signed_distance (phi, h); + sd2 = ls_signed_distance (phit, h); + diff = norm (sd1(:) - sd2(:), Inf); + assert (diff, 0, h); +warning: increased distance in fast marching 0.088561 to 0.090209 +warning: increased distance in fast marching 0.088561 to 0.090209 +warning: increased distance in fast marching 0.088561 to 0.090209 +warning: increased distance in fast marching 0.088561 to 0.090209 +warning: increased distance in fast marching 0.088561 to 0.090209 +warning: increased distance in fast marching 0.088561 to 0.090209 +warning: increased distance in fast marching 0.088561 to 0.090209 +warning: increased distance in fast marching 0.088561 to 0.090209 +warning: increased distance in fast marching 0.088561 to 0.090209 +warning: increased distance in fast marching 0.088561 to 0.090209 +warning: increased distance in fast marching 0.088561 to 0.090209 +warning: increased distance in fast marching 0.088561 to 0.090209 +warning: increased distance in fast marching 0.088561 to 0.090209 +warning: increased distance in fast marching 0.088561 to 0.090209 +warning: increased distance in fast marching 0.088561 to 0.090209 +warning: increased distance in fast marching 0.088561 to 0.090209 +warning: increased distance in fast marching 0.088561 to 0.090209 +warning: increased distance in fast marching 0.088561 to 0.090209 +warning: increased distance in fast marching 0.088561 to 0.090209 +warning: increased distance in fast marching 0.088561 to 0.090209 +warning: increased distance in fast marching 0.088561 to 0.090209 +warning: increased distance in fast marching 0.088561 to 0.090209 +warning: increased distance in fast marching 0.088561 to 0.090209 +warning: increased distance in fast marching 0.088561 to 0.090209 +warning: increased distance in fast marching 0.105699 to 0.105896 +warning: increased distance in fast marching 0.105699 to 0.105896 +warning: increased distance in fast marching 0.105699 to 0.105896 +warning: increased distance in fast marching 0.105699 to 0.105896 +warning: increased distance in fast marching 0.105699 to 0.105896 +warning: increased distance in fast marching 0.105699 to 0.105896 +warning: increased distance in fast marching 0.105699 to 0.105896 +warning: increased distance in fast marching 0.105699 to 0.105896 +warning: increased distance in fast marching 0.105699 to 0.105896 +warning: increased distance in fast marching 0.105699 to 0.105896 +warning: increased distance in fast marching 0.105699 to 0.105896 +warning: increased distance in fast marching 0.105699 to 0.105896 +warning: increased distance in fast marching 0.105699 to 0.105896 +warning: increased distance in fast marching 0.105699 to 0.105896 +warning: increased distance in fast marching 0.105699 to 0.105896 +warning: increased distance in fast marching 0.105699 to 0.105896 +warning: increased distance in fast marching 0.105699 to 0.105896 +warning: increased distance in fast marching 0.105699 to 0.105896 +warning: increased distance in fast marching 0.105699 to 0.105896 +warning: increased distance in fast marching 0.105699 to 0.105896 +warning: increased distance in fast marching 0.105699 to 0.105896 +warning: increased distance in fast marching 0.105699 to 0.105896 +warning: increased distance in fast marching 0.105699 to 0.105896 +warning: increased distance in fast marching 0.105699 to 0.105896 +***** demo + n = 100; + x = linspace (-10, 10, n); h = x(2) - x(1); [XX, YY] = meshgrid (x, x); - phiA = ls_genbasic (XX, YY, "sphere", [0, 0], 4); - phiInner = ls_genbasic (XX, YY, "sphere", [0, 0], 2); - phiB = ls_setdiff (phiA, phiInner); + phi = ls_genbasic (XX, YY, "half", [5, -10], [1, -1]); + f = sign (XX) + 2; - d1 = ls_hausdorff_dist (phiA, phiB, h); - d2 = ls_hausdorff_dist (phiB, phiA, h); - assert (d1, d2); - assert (d1, 2, 2 * h); - dc = ls_hausdorff_dist (ls_complement (phiA), ... - ls_complement (phiB), h); - assert (dc, 4, 2 * h); + times = linspace (1, 9, 80); + ls_animate_evolution (phi, f, h, times, 0.05); +***** demo + n = 101; + x = linspace (-10, 10, n); + h = x(2) - x(1); + [XX, YY] = meshgrid (x, x); - sdA = ls_signed_distance (phiA, h); - sdB = ls_signed_distance (phiB, h); - sdDiff = norm (sdA(:) - sdB(:), inf); - assert (abs (sdDiff - d1) > 10 * h); -6 tests, 6 passed, 0 known failure, 0 skipped + phi = ls_genbasic (XX, YY, "half", [-9, 0], [-1, 0]); + f = ones (size (phi)); + f(XX == 0 & abs (YY) > 2) = 0; + + times = linspace (1, 19, 80); + ls_animate_evolution (phi, f, h, times, 0.05); +***** demo + n = 1000; + x = linspace (-5, 5, n); + h = x(2) - x(1); + [XX, YY] = meshgrid (x, x); + + F = sin (XX .* YY); + phi0 = ls_genbasic (XX, YY, "sphere", [0, 0], 3); + ls_animate_evolution (phi0, F, h, linspace (0, 3, 40), 0.01); +8 tests, 8 passed, 0 known failure, 0 skipped [inst/ls_solve_stationary.m] >>>>> /build/octave-level-set-0.3.0/inst/ls_solve_stationary.m ***** error @@ -3759,164 +4018,191 @@ line ([0, 0], [2, 10]); title ("Diffraction"); 8 tests, 8 passed, 0 known failure, 0 skipped -[inst/ls_issubset.m] ->>>>> /build/octave-level-set-0.3.0/inst/ls_issubset.m -***** error - ls_issubset (1) -***** error - ls_issubset (1, 2, 3) -***** error - ls_issubset (1, [1, 2]) -***** test - n = 50; +[inst/so_run_descent.m] +>>>>> /build/octave-level-set-0.3.0/inst/so_run_descent.m +***** shared data, phi0 + data = struct (); + data.p = so_init_params (false); + data.p.vol = 10; + data.p.weight = 50; + + n = 100; x = linspace (-10, 10, n); - [XX, YY] = meshgrid (x, x); + h = x(2) - x(1); + data.g = struct ("x", x, "h", h); - phi1 = XX.^2 + YY.^2 - 1^2; - phi2 = XX.^2 + YY.^2 - 5^2; - phi3 = XX.^2 + YY.^2 - 8^2; - phi4 = (XX - 3).^2 + YY.^2 - 3^2; + data = so_example_problem (data); + data.handler = struct (); - assert (ls_issubset (phi1, phi2)); - assert (ls_issubset (phi4, phi3)); - assert (~ls_issubset (phi4, phi2)); -4 tests, 4 passed, 0 known failure, 0 skipped -[inst/ls_extract_solution.m] ->>>>> /build/octave-level-set-0.3.0/inst/ls_extract_solution.m + phi0 = ls_genbasic (data.g.x, "box", -3, 5); ***** error - ls_extract_solution (1, 2, 3) + so_run_descent (1, 2); ***** error - ls_extract_solution (1, 2, 3, 4, 5) -***** error - ls_extract_solution (1, [1, 2], [1, 2], [3; 4]); -***** error - ls_extract_solution (1, [1; 2], [3, 4], [3, 4]); -***** test - assert (ls_extract_solution (1, [], [], []), []); + so_run_descent (1, 2, 3, 4); +***** error + so_run_descent (0, phi0, data); +***** error + so_run_descent (1.5, phi0, data); +***** error + so_run_descent ([2, 3], phi0, data); +***** error + d = data; + d.p.descent.initialStep = 0; + so_run_descent (1, phi0, d); ***** test - ts = [0, 1, 2, 3]; - phis = ls_get_tests (); - for i = 1 : length (phis) - f = ones (size (phis{i})); - for j = -1 : 1 - curF = j * f; - d = ls_solve_stationary (phis{i}, curF); - for t = ts - phit = ls_extract_solution (t, d, phis{i}, curF); - assert (phit(curF == 0), phis{i}(curF == 0)); - endfor - endfor - endfor + nSteps = 12; + + [s, descentLog] = so_run_descent (nSteps, phi0, data); + assert (s.cost, 0, 1e-3); + assert (length (descentLog.costs), nSteps + 1); + assert (descentLog.costs(end), s.cost); + %semilogy (descentLog.costs, "o"); ***** test + tol = 5e-2; + nSteps = 100; + d = data; + d.cb.check_stop = @(data) (data.cost < tol); + + [s, descentLog] = so_run_descent (nSteps, phi0, d); + assert (s.cost < tol); + printf ("Steps needed: %d\n", descentLog.steps); + assert (descentLog.steps < nSteps); +Steps needed: 8 +***** demo + data = struct (); + data.p = so_init_params (true); + data.p.vol = 10; + data.p.weight = 50; + n = 100; - x = linspace (-1.5, 1.5, n); + x = linspace (-10, 10, n); h = x(2) - x(1); - [XX, YY] = meshgrid (x, x); + data.g = struct ("x", x, "h", h); - phi = ls_genbasic (XX, YY, "sphere", [0, 0], 1); - f = -ones (size (XX)); + % Look at so_example_problem to see how the callbacks + % and the plotting handler is defined. + data = so_example_problem (data); - d = ls_solve_stationary (phi, f, h); - phiNew = ls_extract_solution (2, d, phi, f); - assert (ls_isempty (phiNew)); + phi0 = ls_genbasic (data.g.x, "box", -3, 7); + [s, descentLog] = so_run_descent (5, phi0, data); + + figure (); + semilogy (0 : descentLog.steps, descentLog.costs, "o"); + title ("Cost Descrease"); + + printf ("\nFinal interval: [%.6d, %.6d]\n", s.a, s.b); + printf ("Final cost: %.6d\n", s.cost); +8 tests, 8 passed, 0 known failure, 0 skipped +[inst/ls_check.m] +>>>>> /build/octave-level-set-0.3.0/inst/ls_check.m +***** error + ls_check (1, 2) +***** error + ls_check (1, 2, 3, 4) +***** error + ls_check (1, "inside", [1, 2]); +***** error + ls_check (1, "foo", true); +***** error + ls_check (1, NA, false); ***** test - n = 50; - x = linspace (-3, 3, n); - h = x(2) - x(1); - [XX, YY, ZZ] = ndgrid (x); + n = 100; + x = linspace (-10, 10, n); + [XX, YY] = meshgrid (x, x); - phi0 = ls_genbasic (XX, YY, ZZ, "sphere", [0, 0, 0], 1); - phit = ls_genbasic (XX, YY, ZZ, "sphere", [0, 0, 0], 2); - f = ones (size (phi0)); + circ2 = (XX.^2 + YY.^2 < 2^2); + circ8 = (XX.^2 + YY.^2 < 8^2); + phi = (XX.^2 + YY.^2 - 5^2); - d = ls_solve_stationary (phi0, f, h); - phi = ls_extract_solution (1, d, phi0, f); + assert (ls_check (phi, "inside", circ8)); + assert (ls_check (phi, "contain", circ2)); + assert (ls_check (phi, "outside", ~circ8)); + assert (~ls_check (phi, "inside", circ2)); + assert (~ls_check (phi, "contain", circ8)); + assert (~ls_check (phi, "outside", circ8)); +6 tests, 6 passed, 0 known failure, 0 skipped +[inst/ls_inside.m] +>>>>> /build/octave-level-set-0.3.0/inst/ls_inside.m +***** error + ls_inside () +***** error + ls_inside (1, 2) +***** test + assert (ls_inside ([1, 0, -1, 0, 1]), [false, false, true, false, false]); +***** test + if (exist ("signbit") == 5) + assert (ls_inside ([-0, 0]), [true, false]); + else + warning ("'signbit' function not available, skipping test."); + endif +4 tests, 4 passed, 0 known failure, 0 skipped +[inst/ls_enforce_speed.m] +>>>>> /build/octave-level-set-0.3.0/inst/ls_enforce_speed.m +***** error + ls_enforce_speed (1, 2) +***** error + ls_enforce_speed (1, 2, 3, 4) +***** error + ls_enforce_speed (1, "inside", [1, 2]); +***** error + ls_enforce_speed (1, "foo", true); +***** error + ls_enforce_speed (1, NA, false); +***** function checkCircleRadius (XX, YY, h, phi, r) + phiCorrect = XX.^2 + YY.^2 - r^2; sd1 = ls_signed_distance (phi, h); - sd2 = ls_signed_distance (phit, h); - diff = norm (sd1(:) - sd2(:), Inf); - assert (diff, 0, h); -warning: increased distance in fast marching 0.088561 to 0.090209 -warning: increased distance in fast marching 0.088561 to 0.090209 -warning: increased distance in fast marching 0.088561 to 0.090209 -warning: increased distance in fast marching 0.088561 to 0.090209 -warning: increased distance in fast marching 0.088561 to 0.090209 -warning: increased distance in fast marching 0.088561 to 0.090209 -warning: increased distance in fast marching 0.088561 to 0.090209 -warning: increased distance in fast marching 0.088561 to 0.090209 -warning: increased distance in fast marching 0.088561 to 0.090209 -warning: increased distance in fast marching 0.088561 to 0.090209 -warning: increased distance in fast marching 0.088561 to 0.090209 -warning: increased distance in fast marching 0.088561 to 0.090209 -warning: increased distance in fast marching 0.088561 to 0.090209 -warning: increased distance in fast marching 0.088561 to 0.090209 -warning: increased distance in fast marching 0.088561 to 0.090209 -warning: increased distance in fast marching 0.088561 to 0.090209 -warning: increased distance in fast marching 0.088561 to 0.090209 -warning: increased distance in fast marching 0.088561 to 0.090209 -warning: increased distance in fast marching 0.088561 to 0.090209 -warning: increased distance in fast marching 0.088561 to 0.090209 -warning: increased distance in fast marching 0.088561 to 0.090209 -warning: increased distance in fast marching 0.088561 to 0.090209 -warning: increased distance in fast marching 0.088561 to 0.090209 -warning: increased distance in fast marching 0.088561 to 0.090209 -warning: increased distance in fast marching 0.105699 to 0.105896 -warning: increased distance in fast marching 0.105699 to 0.105896 -warning: increased distance in fast marching 0.105699 to 0.105896 -warning: increased distance in fast marching 0.105699 to 0.105896 -warning: increased distance in fast marching 0.105699 to 0.105896 -warning: increased distance in fast marching 0.105699 to 0.105896 -warning: increased distance in fast marching 0.105699 to 0.105896 -warning: increased distance in fast marching 0.105699 to 0.105896 -warning: increased distance in fast marching 0.105699 to 0.105896 -warning: increased distance in fast marching 0.105699 to 0.105896 -warning: increased distance in fast marching 0.105699 to 0.105896 -warning: increased distance in fast marching 0.105699 to 0.105896 -warning: increased distance in fast marching 0.105699 to 0.105896 -warning: increased distance in fast marching 0.105699 to 0.105896 -warning: increased distance in fast marching 0.105699 to 0.105896 -warning: increased distance in fast marching 0.105699 to 0.105896 -warning: increased distance in fast marching 0.105699 to 0.105896 -warning: increased distance in fast marching 0.105699 to 0.105896 -warning: increased distance in fast marching 0.105699 to 0.105896 -warning: increased distance in fast marching 0.105699 to 0.105896 -warning: increased distance in fast marching 0.105699 to 0.105896 -warning: increased distance in fast marching 0.105699 to 0.105896 -warning: increased distance in fast marching 0.105699 to 0.105896 -warning: increased distance in fast marching 0.105699 to 0.105896 -***** demo + sd2 = ls_signed_distance (phiCorrect, h); + assert (sd1, sd2, h); +***** endfunction +***** test n = 100; x = linspace (-10, 10, n); h = x(2) - x(1); [XX, YY] = meshgrid (x, x); - phi = ls_genbasic (XX, YY, "half", [5, -10], [1, -1]); - f = sign (XX) + 2; + phi = XX.^2 + YY.^2 - 3^2; + F = ones (size (XX)); + whereContain = (XX.^2 + YY.^2 < 5^2); + F = ls_enforce_speed (F, "contain", whereContain); + whereInside = (XX.^2 + YY.^2 < 8^2); + F = ls_enforce_speed (F, "inside", whereInside); + dists = ls_solve_stationary (phi, F, h); + phi2 = ls_extract_solution (10, dists, phi, F); + assert (ls_check (phi2, "contain", whereContain)); + assert (ls_check (phi2, "inside", whereInside)); + checkCircleRadius (XX, YY, h, phi2, 8); - times = linspace (1, 9, 80); - ls_animate_evolution (phi, f, h, times, 0.05); + phi = XX.^2 + YY.^2 - 8^2; + F = -ones (size (XX)); + whereContain = (XX.^2 + YY.^2 < 5^2); + F = ls_enforce_speed (F, "contain", whereContain); + whereOutside = (XX.^2 + YY.^2 >= 7^2); + F = ls_enforce_speed (F, "outside", whereOutside); + dists = ls_solve_stationary (phi, F, h); + phi2 = ls_extract_solution (10, dists, phi, F); + assert (ls_check (phi2, "contain", whereContain)); + assert (ls_check (phi2, "outside", whereOutside)); + checkCircleRadius (XX, YY, h, phi2, 5); ***** demo - n = 101; + n = 100; x = linspace (-10, 10, n); h = x(2) - x(1); [XX, YY] = meshgrid (x, x); - phi = ls_genbasic (XX, YY, "half", [-9, 0], [-1, 0]); - f = ones (size (phi)); - f(XX == 0 & abs (YY) > 2) = 0; - - times = linspace (1, 19, 80); - ls_animate_evolution (phi, f, h, times, 0.05); -***** demo - n = 1000; - x = linspace (-5, 5, n); - h = x(2) - x(1); - [XX, YY] = meshgrid (x, x); + phi = XX.^2 + YY.^2 - 8^2; + F = -ones (size (XX)); + F = ls_enforce_speed (F, "outside", XX.^2 + YY.^2 >= 7^2); + F = ls_enforce_speed (F, "contain", XX.^2 + YY.^2 < 3^2); + times = linspace (1, 6, 40); + ls_animate_evolution (phi, F, h, times, 0.05); - F = sin (XX .* YY); - phi0 = ls_genbasic (XX, YY, "sphere", [0, 0], 3); - ls_animate_evolution (phi0, F, h, linspace (0, 3, 40), 0.01); -8 tests, 8 passed, 0 known failure, 0 skipped + phi = XX.^2 + YY.^2 - 3^2; + F = ones (size (XX)); + F = ls_enforce_speed (F, "inside", XX.^2 + YY.^2 < 8^2); + F = ls_enforce_speed (F, "contain", XX.^2 + YY.^2 < 5^2); + ls_animate_evolution (phi, F, h, times, 0.05); +6 tests, 6 passed, 0 known failure, 0 skipped [inst/ls_find_geometry.m] >>>>> /build/octave-level-set-0.3.0/inst/ls_find_geometry.m ***** error @@ -4142,6 +4428,235 @@ set (gca (), "xtick", x, "ytick", x, "xticklabel", "", "yticklabel", ""); hold ("off"); 12 tests, 12 passed, 0 known failure, 0 skipped +[inst/so_explore_descent.m] +>>>>> /build/octave-level-set-0.3.0/inst/so_explore_descent.m +***** error + so_explore_descent (1); +***** error + so_explore_descent (1, 2, 3); +***** error + so_explore_descent (struct (), 2); +***** error + so_explore_descent ([2, 3], 2); +***** error <'fload' is not available> + try + pkg unload parallel; + end_try_catch + so_explore_descent ("foo", 2); +***** demo + pkg load parallel; + + data = struct (); + data.p = so_init_params (false); + data.p.vol = 10; + data.p.weight = 50; + + data.p.nSteps = 10; + data.figs = struct (); + data.figs.speed = figure (); + data.figs.exploreCosts = figure (); + + n = 100; + x = linspace (-10, 10, n); + h = x(2) - x(1); + data.g = struct ("x", x, "h", h); + + data = so_example_problem (data); + phi0 = ls_genbasic (data.g.x, "box", -3, 7); + + printf ("Computing descent...\n"); + f = tmpfile (); + d = data; + d.handler = struct (); + d = so_save_descent (f, struct (), d); + s = so_run_descent (data.p.nSteps, phi0, d); + printf ("Final cost: %.6d\n", s.cost); + + printf ("\nNow replaying...\n"); + init = @() data; + frewind (f); + so_explore_descent (f, init); + fclose (f); +5 tests, 5 passed, 0 known failure, 0 skipped +[inst/ls_build_mesh.m] +>>>>> /build/octave-level-set-0.3.0/inst/ls_build_mesh.m +***** error + ls_build_mesh (1) +***** error + ls_build_mesh (1, 2, 3, 4) +***** error + x = linspace (-10, 10, 10); + h = x(2) - x(1); + [XX, YY] = meshgrid (x, x); + phi = ls_genbasic (XX, YY, "sphere", [0, 0], 5); + phi = ls_normalise (phi, h); + geom = ls_find_geometry (phi, h); + ls_build_mesh (geom, phi); +***** function verifyDirection (a, b, centre) + v1 = [a - centre; 0]; + v2 = [b - centre; 0]; + x = cross (v1, v2); + assert (x(1 : 2), zeros (2, 1)); + assert (x(3) > 0); +***** endfunction +***** function verifyMesh (geom, phi, glob) + [mesh, vmap] = ls_build_mesh (geom, phi, glob); + nPts = prod (geom.dim); + + % Verify ordering of triangle points. + for i = 1 : size (mesh.t, 2) + verifyDirection (mesh.p(:, mesh.t(1, i)), mesh.p(:, mesh.t(2, i)), ... + mesh.p(:, mesh.t(3, i))); + endfor + + % Go through all grid points and verify them with the mesh. + for i = 1 : nPts + gridInd = vmap.grid(i); + if (isna (gridInd)) + assert (!glob); + continue; + endif + + assert (vmap.mesh(gridInd), i); + assert (mesh.p(:, gridInd), geom.nodes.coord(i, :)'); + endfor + + % Go through all intersection points and verify them. + for i = 1 : geom.ispts.n + gridInd = vmap.ispt(i); + assert (vmap.mesh(gridInd), -i); + assert (mesh.p(:, gridInd), geom.ispts.coord(i, :)'); + endfor + + % Verify mesh.e against geom.bedges. + for i = 1 : geom.bedges.n + assert (mesh.e(1 : 2, i), vmap.ispt(geom.bedges.ispts(i, :)')); + assert (mesh.e(5, i), geom.bedges.comp(i)); + endfor +***** endfunction +***** function verifyPhi (phi, XX, YY, h) + for s = [-1, 1] + cur = phi * s; + cur = ls_normalise (cur, h); + geom = ls_find_geometry (cur, h); + geom = ls_absolute_geom (geom, XX, YY); + + verifyMesh (geom, cur, false); + verifyMesh (geom, cur, true); + endfor +***** endfunction +***** test + n = 20; + x = linspace (-10, 10, n); + h = x(2) - x(1); + [XX, YY] = meshgrid (x, x); + + phi = ls_union (ls_genbasic (XX, YY, "sphere", [-6, -6], 3), ... + ls_genbasic (XX, YY, "sphere", [6, 6], 3)); + verifyPhi (phi, XX, YY, h); + + phi = ls_setdiff (ls_genbasic (XX, YY, "sphere", [0, 0], 8), ... + ls_genbasic (XX, YY, "sphere", [0, 0], 4)); + verifyPhi (phi, XX, YY, h); +***** demo + x = linspace (-10, 10, 11); + h = x(2) - x(1); + [XX, YY] = meshgrid (x, x); + + phi = ls_union (ls_genbasic (XX, YY, "sphere", [5, 5], 4.5), ... + ls_genbasic (XX, YY, "sphere", [-2, -2], 4)); + phi = ls_normalise (phi, h); + geom = ls_find_geometry (phi, h); + geom = ls_absolute_geom (geom, XX, YY); + + mesh = ls_build_mesh (geom, phi, false); + meshGlob = ls_build_mesh (geom, phi, true); + + figure (); + hold ("on"); + trimesh (meshGlob.t(1 : 3, :)', meshGlob.p(1, :), meshGlob.p(2, :), "r"); + trimesh (mesh.t(1 : 3, :)', mesh.p(1, :), mesh.p(2, :), "g"); + for i = 1 : size (mesh.e, 2) + plot (mesh.p(1, mesh.e(1 : 2, i)), mesh.p(2, mesh.e(1 : 2, i)), "b"); + endfor + hold ("off"); + legend ("Global", "Domain", "Boundary"); + axis ("equal"); + axis ("square"); +4 tests, 4 passed, 0 known failure, 0 skipped +[inst/ls_intersect.m] +>>>>> /build/octave-level-set-0.3.0/inst/ls_intersect.m +***** error + ls_intersect () +***** error + ls_intersect (1, -2, [1, 2]) +***** test + n = 50; + x = linspace (-10, 10, n); + [XX, YY] = meshgrid (x, x); + + phi1 = (XX - 2).^2 + (YY - 2).^2 - 2^2; + phi2 = (XX + 2).^2 + (YY + 2).^2 - 2^2; + phi3 = XX.^2 + YY.^2 - 2^2; + + assert (ls_isempty (ls_intersect (phi1, phi2))); + assert (ls_intersect (phi3), phi3); + + phi = ls_intersect (phi1, phi3); + assert (~ls_isempty (phi)); + assert (ls_issubset (phi, phi1) && ls_issubset (phi, phi3)); + + phi = ls_intersect (phi2, phi3); + assert (~ls_isempty (phi)); + assert (ls_issubset (phi, phi2) && ls_issubset (phi, phi3)); +***** demo + n = 100; + x = linspace (-7, 7, n); + [XX, YY] = meshgrid (x, x); + + phi1 = (XX - 2 * cos (7/6 * pi)).^2 + (YY - 2 * sin (7/6 * pi)).^2 - 3^2; + phi2 = (XX - 2 * cos (11/6 * pi)).^2 + (YY - 2 * sin (11/6 * pi)).^2 - 3^2; + phi3 = XX.^2 + (YY - 2).^2 - 3^2; + phi = ls_intersect (phi1, phi2, phi3); + + figure (); + subplot (1, 2, 1); + hold ("on"); + contour (XX, YY, phi1, [0, 0], "k"); + contour (XX, YY, phi2, [0, 0], "k"); + contour (XX, YY, phi3, [0, 0], "k"); + hold ("off"); + axis ("equal"); + + subplot (1, 2, 2); + hold ("on"); + imagesc (x, x, phi); + set (gca (), "ydir", "normal"); + ls_sign_colourmap (); + contour (XX, YY, phi, [0, 0], "k"); + hold ("off"); + axis ("equal"); +3 tests, 3 passed, 0 known failure, 0 skipped +[inst/ls_normalise.m] +>>>>> /build/octave-level-set-0.3.0/inst/ls_normalise.m +***** error + ls_normalise () +***** error + ls_normalise (1, 2, 3, 4) +***** test + h = 0.1; + zeroTol = 0.2; + phi = ones (4, 4); + phiEx = phi; + phi(2 : 3, 2 : 3) = [-eps, -0; 0, eps]; + phiEx(2 : 3, 2 : 3) = [-zeroTol*h, -zeroTol*h; zeroTol*h, zeroTol*h]; + phin = ls_normalise (phi, h, zeroTol); + if (exist ("signbit") == 5) + assert (phin, phiEx); + else + warning ("'signbit' function not available, skipping test."); + endif +3 tests, 3 passed, 0 known failure, 0 skipped [inst/ls_init_narrowband.m] >>>>> /build/octave-level-set-0.3.0/inst/ls_init_narrowband.m ***** error @@ -4225,663 +4740,182 @@ i = 5: dist = 0.085786 i = 6: dist = 0.085786 7 tests, 7 passed, 0 known failure, 0 skipped -[inst/ls_check.m] ->>>>> /build/octave-level-set-0.3.0/inst/ls_check.m +[inst/ls_time_step.m] +>>>>> /build/octave-level-set-0.3.0/inst/ls_time_step.m ***** error - ls_check (1, 2) + ls_time_step (1, 2) ***** error - ls_check (1, 2, 3, 4) -***** error - ls_check (1, "inside", [1, 2]); -***** error - ls_check (1, "foo", true); -***** error - ls_check (1, NA, false); + ls_time_step (1, 2, 3, 4, 5, 6) +***** error + ls_time_step (1, 2, 3, 4, [5, 5]) +***** error + ls_time_step ([1; 1], [2, 2], [3, 3, 3]) +***** error + ls_time_step ([1, 1], 1, [2, 2], [3, 3, 3]) +***** error + ls_time_step (ones (2, 2), 1, 1) ***** test n = 100; - x = linspace (-10, 10, n); - [XX, YY] = meshgrid (x, x); - - circ2 = (XX.^2 + YY.^2 < 2^2); - circ8 = (XX.^2 + YY.^2 < 8^2); - phi = (XX.^2 + YY.^2 - 5^2); - - assert (ls_check (phi, "inside", circ8)); - assert (ls_check (phi, "contain", circ2)); - assert (ls_check (phi, "outside", ~circ8)); + x = linspace (0, 1, n); + h = x(2) - x(1); - assert (~ls_check (phi, "inside", circ2)); - assert (~ls_check (phi, "contain", circ8)); - assert (~ls_check (phi, "outside", circ8)); -6 tests, 6 passed, 0 known failure, 0 skipped -[inst/so_run_descent.m] ->>>>> /build/octave-level-set-0.3.0/inst/so_run_descent.m -***** shared data, phi0 - data = struct (); - data.p = so_init_params (false); - data.p.vol = 10; - data.p.weight = 50; + phi0 = sin (x); + fPos = ones (size (phi0)); - n = 100; - x = linspace (-10, 10, n); - h = x(2) - x(1); - data.g = struct ("x", x, "h", h); + % Single time step, moving exactly one grid step. + phit = ls_time_step (1, phi0, fPos); + assert (phit(2 : end), phi0(1 : end - 1)); - data = so_example_problem (data); - data.handler = struct (); + % t = 1 should correspond to the previous result, and t = 2 + % shifts one more time step. However, due to boundary effects, + % we have to exclude some elements in the comparisons. + phitArr = ls_time_step ([1, 2], 0.5, phi0, fPos); + assert (size (phitArr), [2, 1]); + assert (phitArr{1}(3 : end), phit(3 : end), 1e-4); + assert (phitArr{2}(5 : end), phi0(3 : end - 2), 1e-4); - phi0 = ls_genbasic (data.g.x, "box", -3, 5); -***** error - so_run_descent (1, 2); -***** error - so_run_descent (1, 2, 3, 4); -***** error - so_run_descent (0, phi0, data); -***** error - so_run_descent (1.5, phi0, data); -***** error - so_run_descent ([2, 3], phi0, data); -***** error - d = data; - d.p.descent.initialStep = 0; - so_run_descent (1, phi0, d); -***** test - nSteps = 12; + % Try out movement in the other direction. + phit = ls_time_step (0.5, 0.1, phi0, -fPos, 0.5); + assert (phit(1 : end - 4), phi0(2 : end - 3), 1e-4); +***** function compareFastMarching (t, phi0, F, h, tol) + phit = ls_time_step (t, phi0, F, h); + d = ls_solve_stationary (phi0, F, h); + phit_fm = ls_extract_solution (t, d, phi0, F); - [s, descentLog] = so_run_descent (nSteps, phi0, data); - assert (s.cost, 0, 1e-3); - assert (length (descentLog.costs), nSteps + 1); - assert (descentLog.costs(end), s.cost); - %semilogy (descentLog.costs, "o"); + sd1 = ls_signed_distance (phit, h); + sd2 = ls_signed_distance (phit_fm, h); + assert (sd1, sd2, tol); +***** endfunction ***** test - tol = 5e-2; - nSteps = 100; - d = data; - d.cb.check_stop = @(data) (data.cost < tol); - - [s, descentLog] = so_run_descent (nSteps, phi0, d); - assert (s.cost < tol); - printf ("Steps needed: %d\n", descentLog.steps); - assert (descentLog.steps < nSteps); -Steps needed: 8 -***** demo - data = struct (); - data.p = so_init_params (true); - data.p.vol = 10; - data.p.weight = 50; + warning ("off", "level-set:fast-marching:too-far-alive"); n = 100; - x = linspace (-10, 10, n); + x = linspace (-5, 5, n); h = x(2) - x(1); - data.g = struct ("x", x, "h", h); + [XX, YY] = meshgrid (x, x); - % Look at so_example_problem to see how the callbacks - % and the plotting handler is defined. - data = so_example_problem (data); + phi0 = ls_genbasic (XX, YY, "sphere", [0, 0], [3, 1.5]); + F = ones (size (phi0)); + compareFastMarching (0.5, phi0, F, h, h / 2); + compareFastMarching (1.5, phi0, F, h, h / 2); - phi0 = ls_genbasic (data.g.x, "box", -3, 7); - [s, descentLog] = so_run_descent (5, phi0, data); + phi0 = ls_genbasic (XX, YY, "box", [-3, -3], [3, 3]); + F = YY / 5; + compareFastMarching (1, phi0, F, h, h); - figure (); - semilogy (0 : descentLog.steps, descentLog.costs, "o"); - title ("Cost Descrease"); + F = ones (size (phi0)); + compareFastMarching (1, phi0, F, h, h / 2); - printf ("\nFinal interval: [%.6d, %.6d]\n", s.a, s.b); - printf ("Final cost: %.6d\n", s.cost); -8 tests, 8 passed, 0 known failure, 0 skipped -[inst/ls_setdiff.m] ->>>>> /build/octave-level-set-0.3.0/inst/ls_setdiff.m -***** error - ls_setdiff (1) -***** error - ls_setdiff (1, 2, 3) -***** error - ls_setdiff (1, [1, 2]) + phi0 = ls_genbasic (XX, YY, "sphere", [0, 0], 3); + F = sin (XX .* YY); + compareFastMarching (1, phi0, F, h, h); ***** test - assert (ls_equal (ls_setdiff ([-1, -1, 1], [1, -1, -1]), [-1, 1, 1])); + warning ("off", "level-set:fast-marching:increased-distance"); + n = 50; - x = linspace (-10, 10, n); + x = linspace (-5, 5, n); h = x(2) - x(1); - [XX, YY] = meshgrid (x, x); - - phi1 = XX.^2 + YY.^2 - 8^2; - phi2 = XX.^2 + YY.^2 - 5^2; - - phi = ls_setdiff (phi1, phi2); - assert (ls_issubset (phi, phi1)); - assert (ls_disjoint (phi, phi2)); - - phi = ls_setdiff (phi2, phi1); - assert (ls_isempty (phi)); -***** demo - n = 100; - x = linspace (-7, 7, n); - [XX, YY] = meshgrid (x, x); - - phi1 = (XX - 2).^2 + YY.^2 - 3^2; - phi2 = (XX + 2).^2 + YY.^2 - 3^2; - phi = ls_setdiff (phi1, phi2); - - figure (); - subplot (1, 2, 1); - hold ("on"); - contour (XX, YY, phi1, [0, 0], "k"); - contour (XX, YY, phi2, [0, 0], "k"); - hold ("off"); - axis ("equal"); + [XX, YY, ZZ] = ndgrid (x, x, x); - subplot (1, 2, 2); - hold ("on"); - imagesc (x, x, phi); - set (gca (), "ydir", "normal"); - ls_sign_colourmap (); - contour (XX, YY, phi, [0, 0], "k"); - hold ("off"); - axis ("equal"); + phi0 = ls_genbasic (XX, YY, ZZ, "sphere", [0, 0, 0], 3); + F = ones (size (phi0)); + compareFastMarching (1, phi0, F, h, h / 2); + compareFastMarching (1, phi0, -F, h, h / 2); ***** demo - n = 100; - x = linspace (-7, 7, n); + n = 500; + x = linspace (-5, 5, n); + h = x(2) - x(1); [XX, YY] = meshgrid (x, x); - phi1 = XX.^2 + YY.^2 - 6^2; - phi2 = XX.^2 + YY.^2 - 3^2; - phi = ls_setdiff (phi1, phi2); + F = sin (XX .* YY); + phi0 = ls_genbasic (XX, YY, "sphere", [0, 0], 3); + phit = ls_time_step ([0.5, 1], phi0, F, h); figure (); - subplot (1, 2, 1); - hold ("on"); - contour (XX, YY, phi1, [0, 0], "k"); - contour (XX, YY, phi2, [0, 0], "k"); - hold ("off"); - axis ("equal"); - - subplot (1, 2, 2); hold ("on"); - imagesc (x, x, phi); + imagesc (x, x, F); set (gca (), "ydir", "normal"); ls_sign_colourmap (); - contour (XX, YY, phi, [0, 0], "k"); + contour (XX, YY, phi0, [0, 0], "k", "LineWidth", 2); + contour (XX, YY, phit{1}, [0, 0], "k", "LineWidth", 2); + contour (XX, YY, phit{2}, [0, 0], "k", "LineWidth", 2); hold ("off"); - axis ("equal"); -4 tests, 4 passed, 0 known failure, 0 skipped -[inst/ls_signed_distance.m] ->>>>> /build/octave-level-set-0.3.0/inst/ls_signed_distance.m +9 tests, 9 passed, 0 known failure, 0 skipped +[inst/ls_nb_from_geom.m] +>>>>> /build/octave-level-set-0.3.0/inst/ls_nb_from_geom.m ***** error - ls_signed_distance () + ls_nb_from_geom (1) ***** error - ls_signed_distance (1, 2, 3) -***** test - assert (ls_signed_distance ([]), []); -***** test - n = 10; - x = linspace (-2, 2, n); - h = x(2) - x(1); - phi = abs (x) - 1; - - d = ls_signed_distance (phi, h); - assert (d, phi, sqrt (eps)); -***** test - n = 50; - x = linspace (-2, 2, n); - h = x(2) - x(1); - [XX, YY, ZZ] = ndgrid (x); - RRsq = XX.^2 + YY.^2 + ZZ.^2; - phi = RRsq - 1; - - d = ls_signed_distance (phi, h); - assert (d, sqrt (RRsq) - 1, h); -***** test - phi = [5e-6, 1.7e-154, -1.3e-2]; - for h = [0.02, 0.01, 0.005] - d = ls_signed_distance (phi, h); - assert (all (isfinite (d))); - assert (d(2), 0); - endfor -***** test - phis = ls_get_tests (); - for i = 1 : length (phis) - phi = ls_normalise (phis{i}); - d = ls_signed_distance (phi); - assert (ls_equal (d, phi)); - endfor -***** test - if (exist ("signbit") == 5) - phi = [-0, 0]; - d = ls_signed_distance (phi); - assert (ls_equal (phi, d)); - else - warning ("'signbit' function not available, skipping test."); - endif -***** demo - n = 100; - x = linspace (-10, 10, n); + ls_nb_from_geom (1, 2, 3, 4) +***** error + [a, b] = ls_nb_from_geom (1, 2); +***** error + ls_nb_from_geom (1, 2, rand (2, 2)); +***** error + x = linspace (-10, 10, 10); h = x(2) - x(1); [XX, YY] = meshgrid (x, x); - - phi0 = atan (ls_union ((XX.^2 + (YY - 5).^2) - 20, ... - (XX.^2 + (YY + 5).^2) - 20)); - %phi0 = XX.^2 / 1.3^2 + YY.^2 - 1; - d = ls_signed_distance (phi0, h); - - figure (); - subplot (1, 2, 1); - contour (XX, YY, phi0); - title ("Initial"); - colorbar (); - axis ("equal"); - - subplot (1, 2, 2); - contour (XX, YY, d); - title ("Signed Distance"); - colorbar (); - axis ("equal"); -8 tests, 8 passed, 0 known failure, 0 skipped -[inst/ls_enforce.m] ->>>>> /build/octave-level-set-0.3.0/inst/ls_enforce.m -***** error - ls_enforce (1, 2) -***** error - ls_enforce (1, 2, 3, 4) -***** error - ls_enforce (1, "inside", [1, 2]); -***** error - ls_enforce (1, "foo", true); -***** error - ls_enforce (1, NA, false); -***** test - n = 100; - x = linspace (-10, 10, n); + phi = ls_genbasic (XX, YY, "sphere", [0, 0], 5); + phi = ls_normalise (phi, h); + geom = ls_find_geometry (phi, h); + ls_nb_from_geom (geom, phi); +***** error + x = linspace (-10, 10, 10); + h = x(2) - x(1); [XX, YY] = meshgrid (x, x); - - circ2 = (XX.^2 + YY.^2 < 2^2); - circ8 = (XX.^2 + YY.^2 < 8^2); - phi = (XX.^2 + YY.^2 - 5^2); - - phi2 = ls_enforce (phi, "inside", circ8); - assert (ls_equal (phi2, phi)); - phi2 = ls_enforce (phi, "inside", circ2); - assert (ls_check (phi2, "inside", circ2)); - - phi2 = ls_enforce (phi, "contain", circ2); - assert (ls_equal (phi2, phi)); - phi2 = ls_enforce (phi, "contain", circ8); - assert (ls_check (phi2, "contain", circ8)); - - phi2 = ls_enforce (phi, "outside", ~circ8); - assert (ls_equal (phi2, phi)); - phi2 = ls_enforce (phi, "outside", ~circ2); - ls_check (phi2, "outside", ~circ2); - phi2 = ls_enforce (phi, "outside", circ2); - ls_check (phi2, "outside", circ2); -6 tests, 6 passed, 0 known failure, 0 skipped -[inst/ls_isempty.m] ->>>>> /build/octave-level-set-0.3.0/inst/ls_isempty.m -***** error - ls_isempty () -***** error - ls_isempty (1, 2) + phi = ls_genbasic (XX, YY, "sphere", [0, 0], 5); + phi = ls_normalise (phi, h); + geom = ls_find_geometry (phi, h); + ls_nb_from_geom (geom, phi, [1, 2, 3]); ***** test n = 50; x = linspace (-10, 10, n); - [XX, YY] = meshgrid (x, x); - - phi1 = (XX - 2).^2 + (YY - 2).^2 - 2^2; - phi2 = (XX + 2).^2 + (YY + 2).^2 - 2^2; - - assert (~ls_isempty (phi1) && ~ls_isempty (phi2)); - assert (ls_isempty (ls_intersect (phi1, phi2))); - assert (~ls_isempty (ls_union (phi1, phi2))); -3 tests, 3 passed, 0 known failure, 0 skipped -[inst/fastmarching.m] ->>>>> /build/octave-level-set-0.3.0/inst/fastmarching.m -***** error - fastmarching () -***** error - fastmarching (1, 2, 3, 4) -***** error - [a, b] = fastmarching (1, 2) -***** error - fastmarching ([1, 2], [1; 2]) -***** error - fastmarching ([1, 2], [1; 2], [1, 2]) -***** error - fastmarching ([NA, 1], [0, 5]); -***** test - n = 600; - x = linspace (0, 1, n); - h = x(2) - x(1); - [XX, YY] = meshgrid (x, x); - u0 = NA (n, n); - u0(2 : end - 1, 2 : end - 1) = Inf; - u0(1, 1) = 0; - f = 1 + YY; - u = fastmarching (u0, h * f); - - % Length of vertical side: integrate (1 + y, y, 0, x) - vertLength = @(x) x/2 .* (x + 2); - - % Speed difference at top and bottom, gives where the - % paths will meet on the bottom side. - % solve (x * fBot = fTop + (1 - x) * fBot, x) - fTop = mean (f(1, :)); - fBot = mean (f(end, :)); - xMeet = (fTop + fBot) / 2 / fBot; - botRow = vertLength (1) + fBot * x; - where = (x > xMeet); - botRow(where) = vertLength (1) + 1 + fBot * (1 - x(where)); - - assert (u(1, :), x, sqrt (eps)); - assert (u(:, 1), vertLength (x'), 1e-3); - assert (u(:, end), 1 + vertLength (x'), 1e-3); - assert (u(end, :), botRow, 1e-3); -***** test - n = 1100; - x = linspace (0, 1, n); - h = x(2) - x(1); - - obst1 = round (0.5 / h); - obst2 = round (0.75 / h); - s1 = round (0.2 / h); - s1val = 1; - s2 = round (0.9 / h); - s2val = -1; - - u0 = NA (n, 1); - u0([obst1, obst2]) = Inf; - u0([s1, s2]) = [s1val, s2val]; - f = ones (size (u0)); - g0 = NA (size (u0)); - g0([s1, s2]) = [s1val, s2val]; - - [u, g] = fastmarching (u0, g0, f * h); - - gDesired = NA (size (u0)); - gDesired(1 : obst1 - 1) = s1val; - gDesired(obst2 + 1 : end) = s2val; - assert (g, gDesired, sqrt (eps)); - - uDesired = NA (size (u0)); - uDesired([obst1, obst2]) = Inf; - uDesired(1 : obst1 - 1) = s1val + abs (s1 * h - x(1 : obst1 - 1)); - uDesired(obst2 + 1 : end) = s2val + abs (s2 * h - x(obst2 + 1 : end)); - assert (u, uDesired, 1e-3); -***** test - assert (fastmarching ([], []), []); -***** test - n = 42; - r = 1; - R = 2; - x = linspace (-R, R, n); - h = x(2) - x(1); - - [XX, YY, ZZ] = ndgrid (x); - RR = sqrt (XX.^2 + YY.^2 + ZZ.^2); - PPhi = NA (size (XX)); - for i = 1 : numel (PPhi) - pt = [XX(i), YY(i), ZZ(i)]; - PPhi(i) = acos (dot (pt, [0, 0, 1]) / norm (pt)); - endfor - - initial = (RR < r); - u0 = NA (size (XX)); - u0(initial) = 0; - g0 = NA (size (XX)); - g0(initial) = PPhi(initial); - f = ones (size (u0)); - [u, g] = fastmarching (u0, g0, h * f); - - assert (u(~initial), RR(~initial) - r, 1e-1); - assert (g(~initial), PPhi(~initial), 2e-1); -***** function [dx, dy] = gradient (fcn, h) - ext = NA (size (fcn) + 2); - ext(2 : end - 1, 2 : end - 1) = fcn; - ext(:, 1) = 2 * ext(:, 2) - ext(:, 3); - ext(:, end) = 2 * ext(:, end - 1) - ext(:, end - 2); - ext(1, :) = 2 * ext(2, :) - ext(3, :); - ext(end, :) = 2 * ext(end - 1, :) - ext(end - 2, :); - dx = (ext(2 : end - 1, 3 : end) - ext(2 : end - 1, 1 : end - 2)) / (2 * h); - dy = (ext(3 : end, 2 : end - 1) - ext(1 : end - 2, 2 : end - 1)) / (2 * h); -***** endfunction -***** test - n = 1000; - x = linspace (-2, 2, n); h = x(2) - x(1); [XX, YY] = meshgrid (x, x); - phi0 = 2 * XX.^2 + 0.4 * YY.^2 - 1; - initial = (phi0 < 0); - %contour (XX, YY, phi0, [0, 0], "r"); - - f = ones (size (XX)); - u0 = NA (size (XX)); - u0(initial) = 0; - g0 = NA (size (XX)); - g0(initial) = sin (atan2 (YY(initial), XX(initial))); - - [u, g] = fastmarching (u0, g0, h * f); - - [dxu, dyu] = gradient (u, h); - [dxg, dyg] = gradient (g, h); - - % We only verify the mean error here, since there tend - % to be lower-dimensional lines on which the error is - % large while it is very low otherwise. - err = abs (dxu .* dxg + dyu .* dyg); - assert (mean (err(initial)), 0, 1e-3); -***** test - u0 = [1.257221, NA, NA; Inf, 0.275128, 0.433001]; - f = [NA, 0.85714, 0.66667; NA, NA, NA]; - u = fastmarching (u0, f); -warning: increased distance in fast marching 1.121446 to 1.131670 -***** test - u0 = [0, NA; Inf, 2]; - f = ones (size (u0)); - u = fastmarching (u0, f); - assert (u(1, 2), 1, sqrt (eps)); -warning: found too far alive point in fast marching, d = -8.000000 -warning: found too far alive point in fast marching, d = -8.000000 -***** test - u0 = [0, NA, NA, NA, 0.1; ... - Inf, Inf, Inf, Inf, Inf; ... - 0.1, NA, NA, NA, 0]; - f = ones (size (u0)); - u = fastmarching (u0, f); - - uExpected = [0, 1, 2, 1.1, 0.1; ... - Inf, Inf, Inf, Inf, Inf; ... - 0.1, 1.1, 2, 1, 0]; - assert (u, uExpected, sqrt (eps)); -***** xtest - ns = [101, 201, 501, 1001, 2001]; - realNs = NA (size (ns)); - times = NA (size (ns)); - for i = 1 : length (ns) - nMid = (ns(i) + 1) / 2; - assert (nMid, round (nMid)); - u0 = NA (ns(i), ns(i)); - u0(nMid, nMid) = 0; - f = ones (size (u0)); - realNs(i) = numel (u0); - - old = cputime (); - u = fastmarching (u0, f); - new = cputime (); - times(i) = new - old; + phi = ls_setdiff (ls_genbasic (XX, YY, "sphere", [0, 0], 8), ... + ls_genbasic (XX, YY, "sphere", [1, 1], 5)); + phi = ls_normalise (phi, h); + geom = ls_find_geometry (phi, h); + geom = ls_absolute_geom (geom, XX, YY); - printf ("n = %4d: t = %6.3f s\n", ns(i), times(i)); - endfor + dOld = ls_init_narrowband (phi, h); + dNew = ls_nb_from_geom (geom, phi); - nLogN = realNs .* log (realNs); - p = polyfit (log (realNs), log (times), 1); - pLogN = polyfit (log(nLogN), log (times), 1); - printf ("Exponents:\n O(n): %4.2f\n O(n log n): %4.2f\n", ... - p(1), pLogN(1)); - assert (p(1), 1, 1e-1); - assert (pLogN(1), 1, 1e-1); -n = 101: t = 0.034 s -n = 201: t = 0.140 s -n = 501: t = 0.877 s -n = 1001: t = 3.787 s -n = 2001: t = 16.234 s -Exponents: - O(n): 1.03 - O(n log n): 0.95 -***** test - T = 1.6; - timeSteps = 10000; - L = 2; - gridSteps = 10000; - eps = 1e-4; - floorValue = -1/2; - tol = 7e-2; - - t = linspace (0, T, timeSteps); - dt = t(2) - t(1); - x = linspace (-L/2, L/2, gridSteps); - h = x(2) - x(1); - - F = sqrt (abs (x)); - phi0 = NA (size (x)); - phi0(1 : end/4) = floorValue; - phi0(3*end/4 : end) = floorValue; - phi0 = fastmarching (phi0, h ./ F); - - % Plot the speed field and initial data. - %{ - figure (); - plot (x, F, "r", x, phi0, "k"); - legend ("F", "\\phi_0"); - title ("Speed Field and Initial Data"); - ax = [-L/2, L/2, -1, 1]; - axis (ax); - %} - - % Create the Laplacian as matrix. We assume homogeneous Neumann boundary - % conditions so that the initial data can be chosen as we like. - Delta = spdiags (repmat ([1, -2, 1], gridSteps, 1), [-1, 0, 1], ... - gridSteps, gridSteps); - Delta(1, 1) += Delta(1, 2); - Delta(end, end) += Delta(end - 1, end); - Delta /= h^2; - - % Perform the calculation. The Laplacian is done implicitly, the - % non-linear term explicitly: - % - % phi+ - phi0 = dt (eps Delta phi+ - F |grad phi0|) - % => (I - dt eps Delta) phi+ = phi0 - F |grad phi0| - - %figure (); - phi = phi0'; - M = eye (gridSteps) - dt * eps * Delta; - for tInd = 2 : timeSteps - - % Calculate derivatives as symmetric differences, and zero on the - % boundary. Since the data is flat there, this is correct. - d = NA (size (phi)); - low = 1 : gridSteps - 2; - mid = 2 : gridSteps - 1; - high = 3 : gridSteps; - d(mid) = (phi(high) - phi(low)) / (2 * h); - d([1, end]) = 0; - gradNorm = abs (d); - - % Do the solve. - phi = M \ (phi - dt * F' .* gradNorm); - phiEx = max (phi0 - t(tInd), floorValue); - assert (phi, phiEx', tol); - - % Show solution as animation in real time. - %{ - if (mod (tInd, 100) == 0) - plot (x, phi, "r", x, phiEx, "k"); - legend ("Approximate", "Exact"); - axis (ax); - title (sprintf ("t = %.2f", t(tInd))); - drawnow (); - %sleep (0.1); - endif - %} - endfor + where = (!isna (dOld)); + assert (all (!isna (dNew(where)))); + assert (dNew(where), dOld(where), h / 4); ***** demo - n = 100; - x = linspace (-1, 1, n); + n = 50; + x = linspace (-10, 10, n); h = x(2) - x(1); [XX, YY] = meshgrid (x, x); - u0 = NA (size (XX)); - u0(sqrt (XX.^2 + YY.^2) < 0.5) = Inf; - u0(end, :) = 0; - f = 3 + XX; - g0 = NA (size (XX)); - g0(end, :) = x; - - [u, g] = fastmarching (u0, g0, h * f); + phi = ls_genbasic (XX, YY, "sphere", [0, 0], 3); + phi = ls_normalise (phi, h); + geom = ls_find_geometry (phi, h); + geom = ls_absolute_geom (geom, XX, YY); - figure (); - subplot (2, 2, 1); - imagesc (f); - colorbar (); - title ("Speed Field"); - subplot (2, 2, 2); - imagesc (u0); - colorbar (); - title ("Initial Distances"); - subplot (2, 2, 3); - imagesc (u); - colorbar (); - title ("Distance u"); - subplot (2, 2, 4); - imagesc (g); - colorbar (); - title ("Extended Function g"); -***** demo - pkgs = pkg ("list"); - file = false; - for i = 1 : length (pkgs) - if (strcmp (pkgs{i}.name, "level-set")) - file = fullfile (pkgs{i}.dir, "maze.png"); - endif + g0 = NA (1, geom.bedges.n); + for i = 1 : geom.bedges.n + a = geom.ispts.coord(geom.bedges.ispts(i, 1), :); + b = geom.ispts.coord(geom.bedges.ispts(i, 2), :); + m = (a + b) / 2; + angle = abs (atan2 (m(2), m(1))); + g0(i) = min (angle, 2 * pi - angle); endfor - if (!file) - error ("could not locate example image file"); - endif - img = double (imread (file)) / 255; - - % Red is the start area, white (not black) the accessible domain. - start = (img(:, :, 1) > img(:, :, 2) + img(:, :, 3)); - domain = (img(:, :, 2) + img(:, :, 3) > 1.0) | start; - - u0 = NA (size (domain)); - u0(start) = 0; - u0(~domain) = Inf; - f = ones (size (u0)); - u = fastmarching (u0, f); - u = u / max (u(isfinite (u))); + [d, g] = ls_nb_from_geom (geom, phi, g0); + [d, g] = fastmarching (d, g, h * ones (size (phi))); - % Format result as image. - walls = isinf (u); - notReached = isna (u); - ur = u; - ug = u; - ub = u; - ur(notReached) = 1; - ug(notReached) = 0; - ub(notReached) = 0; - ur(walls) = 0; - ug(walls) = 0; - ub(walls) = 1; - ur(start) = 1; - ug(start) = 1; - ub(start) = 0; - u = NA (size (u, 1), size (u, 2), 3); - u(:, :, 1) = ur; - u(:, :, 2) = ug; - u(:, :, 3) = ub; figure (); - imshow (u); - title ("Solved Maze. Blue: Walls, Red: Unreachable, Yellow: Start."); -16 tests, 16 passed, 0 known failure, 0 skipped + hold ("on"); + imagesc (x, x, g); + set (gca (), "ydir", "normal"); + contour (XX, YY, phi, [0, 0], "k"); + hold ("off"); + colorbar (); +7 tests, 7 passed, 0 known failure, 0 skipped Checking C++ files ... Summary: 260 tests, 260 passed, 0 known failures, 0 skipped dh_octave_substvar -O--buildsystem=octave @@ -4901,8 +4935,8 @@ dh_strip -O--buildsystem=octave dh_makeshlibs -O--buildsystem=octave dh_shlibdeps -O--buildsystem=octave -dpkg-shlibdeps: warning: package could avoid a useless dependency if debian/octave-level-set/usr/lib/i386-linux-gnu/octave/packages/level-set-0.3.0/i686-pc-linux-gnu-api-v52/__levelset_upwindGrad.oct debian/octave-level-set/usr/lib/i386-linux-gnu/octave/packages/level-set-0.3.0/i686-pc-linux-gnu-api-v52/__levelset_internal_mesh.oct debian/octave-level-set/usr/lib/i386-linux-gnu/octave/packages/level-set-0.3.0/i686-pc-linux-gnu-api-v52/__levelset_internal_fastmarching.oct debian/octave-level-set/usr/lib/i386-linux-gnu/octave/packages/level-set-0.3.0/i686-pc-linux-gnu-api-v52/__levelset_geomElements.oct debian/octave-level-set/usr/lib/i386-linux-gnu/octave/packages/level-set-0.3.0/i686-pc-linux-gnu-api-v52/__levelset_geomGamma.oct debian/octave-level-set/usr/lib/i386-linux-gnu/octave/packages/level-set-0.3.0/i686-pc-linux-gnu-api-v52/__levelset_internal_init_narrowband.oct debian/octave-level-set/usr/lib/i386-linux-gnu/octave/packages/level-set-0.3.0/i686-pc-linux-gnu-api-v52/__levelset_geomBoundary.oct debian/octave-level-set/usr/lib/i386-linux-gnu/octave/packages/level-set-0.3.0/i686-pc-linux-gnu-api-v52/__levelset_nbFromGeom.oct were not linked against libgomp.so.1 (they use none of the library's symbols) -dpkg-shlibdeps: warning: package could avoid a useless dependency if debian/octave-level-set/usr/lib/i386-linux-gnu/octave/packages/level-set-0.3.0/i686-pc-linux-gnu-api-v52/__levelset_upwindGrad.oct debian/octave-level-set/usr/lib/i386-linux-gnu/octave/packages/level-set-0.3.0/i686-pc-linux-gnu-api-v52/__levelset_internal_mesh.oct debian/octave-level-set/usr/lib/i386-linux-gnu/octave/packages/level-set-0.3.0/i686-pc-linux-gnu-api-v52/__levelset_internal_fastmarching.oct debian/octave-level-set/usr/lib/i386-linux-gnu/octave/packages/level-set-0.3.0/i686-pc-linux-gnu-api-v52/__levelset_geomElements.oct debian/octave-level-set/usr/lib/i386-linux-gnu/octave/packages/level-set-0.3.0/i686-pc-linux-gnu-api-v52/__levelset_geomGamma.oct debian/octave-level-set/usr/lib/i386-linux-gnu/octave/packages/level-set-0.3.0/i686-pc-linux-gnu-api-v52/__levelset_internal_init_narrowband.oct debian/octave-level-set/usr/lib/i386-linux-gnu/octave/packages/level-set-0.3.0/i686-pc-linux-gnu-api-v52/__levelset_geomBoundary.oct debian/octave-level-set/usr/lib/i386-linux-gnu/octave/packages/level-set-0.3.0/i686-pc-linux-gnu-api-v52/__levelset_nbFromGeom.oct were not linked against libpthread.so.0 (they use none of the library's symbols) +dpkg-shlibdeps: warning: package could avoid a useless dependency if debian/octave-level-set/usr/lib/i386-linux-gnu/octave/packages/level-set-0.3.0/i686-pc-linux-gnu-api-v52/__levelset_geomBoundary.oct debian/octave-level-set/usr/lib/i386-linux-gnu/octave/packages/level-set-0.3.0/i686-pc-linux-gnu-api-v52/__levelset_nbFromGeom.oct debian/octave-level-set/usr/lib/i386-linux-gnu/octave/packages/level-set-0.3.0/i686-pc-linux-gnu-api-v52/__levelset_internal_fastmarching.oct debian/octave-level-set/usr/lib/i386-linux-gnu/octave/packages/level-set-0.3.0/i686-pc-linux-gnu-api-v52/__levelset_internal_init_narrowband.oct debian/octave-level-set/usr/lib/i386-linux-gnu/octave/packages/level-set-0.3.0/i686-pc-linux-gnu-api-v52/__levelset_geomGamma.oct debian/octave-level-set/usr/lib/i386-linux-gnu/octave/packages/level-set-0.3.0/i686-pc-linux-gnu-api-v52/__levelset_geomElements.oct debian/octave-level-set/usr/lib/i386-linux-gnu/octave/packages/level-set-0.3.0/i686-pc-linux-gnu-api-v52/__levelset_internal_mesh.oct debian/octave-level-set/usr/lib/i386-linux-gnu/octave/packages/level-set-0.3.0/i686-pc-linux-gnu-api-v52/__levelset_upwindGrad.oct were not linked against libpthread.so.0 (they use none of the library's symbols) +dpkg-shlibdeps: warning: package could avoid a useless dependency if debian/octave-level-set/usr/lib/i386-linux-gnu/octave/packages/level-set-0.3.0/i686-pc-linux-gnu-api-v52/__levelset_geomBoundary.oct debian/octave-level-set/usr/lib/i386-linux-gnu/octave/packages/level-set-0.3.0/i686-pc-linux-gnu-api-v52/__levelset_nbFromGeom.oct debian/octave-level-set/usr/lib/i386-linux-gnu/octave/packages/level-set-0.3.0/i686-pc-linux-gnu-api-v52/__levelset_internal_fastmarching.oct debian/octave-level-set/usr/lib/i386-linux-gnu/octave/packages/level-set-0.3.0/i686-pc-linux-gnu-api-v52/__levelset_internal_init_narrowband.oct debian/octave-level-set/usr/lib/i386-linux-gnu/octave/packages/level-set-0.3.0/i686-pc-linux-gnu-api-v52/__levelset_geomGamma.oct debian/octave-level-set/usr/lib/i386-linux-gnu/octave/packages/level-set-0.3.0/i686-pc-linux-gnu-api-v52/__levelset_geomElements.oct debian/octave-level-set/usr/lib/i386-linux-gnu/octave/packages/level-set-0.3.0/i686-pc-linux-gnu-api-v52/__levelset_internal_mesh.oct debian/octave-level-set/usr/lib/i386-linux-gnu/octave/packages/level-set-0.3.0/i686-pc-linux-gnu-api-v52/__levelset_upwindGrad.oct were not linked against libgomp.so.1 (they use none of the library's symbols) dh_installdeb -O--buildsystem=octave dh_gencontrol -O--buildsystem=octave dpkg-gencontrol: warning: package octave-level-set: substitution variable ${octave:Upstream-Description} unused, but is defined @@ -4918,12 +4952,14 @@ dpkg-source: info: using options from octave-level-set-0.3.0/debian/source/options: --extend-diff-ignore=src/config.log|src/config.status|src/Makefile dpkg-buildpackage: info: binary-only upload (no source included) I: copying local configuration +I: user script /srv/workspace/pbuilder/27201/tmp/hooks/B01_cleanup starting +I: user script /srv/workspace/pbuilder/27201/tmp/hooks/B01_cleanup finished I: unmounting dev/ptmx filesystem I: unmounting dev/pts filesystem I: unmounting dev/shm filesystem I: unmounting proc filesystem I: unmounting sys filesystem I: cleaning the build env -I: removing directory /srv/workspace/pbuilder/5847 and its subdirectories -I: Current time: Fri Jul 23 14:19:30 -12 2021 -I: pbuilder-time-stamp: 1627093170 +I: removing directory /srv/workspace/pbuilder/27201 and its subdirectories +I: Current time: Sun Jun 21 10:11:31 +14 2020 +I: pbuilder-time-stamp: 1592683891