+#========== update _ocean-*.txt ==========
+
+our $localtopo_path;
+
+sub localtopo_rewrite () {
+ $localtopo_path= '_ocean-'.(lc $ocean).'.txt';
+ my $fh= new IO::File "$localtopo_path.tmp", 'w';
+ print $fh "# autogenerated - do not edit\n" or die $!;
+ print $fh "ocean $ocean\n" or die $!;
+ my %arches;
+ foreach my $isle (sort keys %wtisland2arch) {
+ my $arch= $wtisland2arch{$isle};
+ push @{ $arches{$arch} }, $isle;
+ }
+ foreach my $arch (sort keys %arches) {
+ print $fh " $arch\n" or die $!;
+ foreach my $isle (@{ $arches{$arch} }) {
+ print $fh " $isle\n" or die $!;
+ }
+ }
+ print $fh "\n" or die $!;
+ close $fh or die $!;
+}
+
+sub localtopo_commit () {
+ rename "$localtopo_path.tmp", $localtopo_path or die $!;
+}
+