aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2018-07-27 16:28:13 +0200
committerThomas White <taw@physics.org>2018-07-27 16:28:13 +0200
commit1c5619070d9aa13b97624f9845e7c0b284934cbe (patch)
tree01c0651d57db393b493a7dcc941c9df3d89d6673 /src
parentff1811d05af6435af21c51165951be7bd73920ce (diff)
partialator: More improvements to pr-log logic
Diffstat (limited to 'src')
-rw-r--r--src/partialator.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/partialator.c b/src/partialator.c
index 13db0e3d..1a2a2a75 100644
--- a/src/partialator.c
+++ b/src/partialator.c
@@ -877,6 +877,7 @@ int main(int argc, char *argv[])
char *audit_info;
int scaleflags = 0;
double min_res = 0.0;
+ int do_write_logs = 0;
/* Long options */
const struct option longopts[] = {
@@ -1172,7 +1173,14 @@ int main(int argc, char *argv[])
scaleflags |= SCALE_NO_B;
}
- if ( !no_logs ) {
+ /* Decide whether or not to create stuff in the pr-logs folder */
+ if ( !(no_logs || (no_pr && pmodel == PMODEL_UNITY)) ) {
+ do_write_logs = 1;
+ } else {
+ do_write_logs = 0;
+ }
+
+ if ( do_write_logs ) {
int r = mkdir("pr-logs", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
if ( r ) {
if ( errno == EEXIST ) {
@@ -1183,6 +1191,12 @@ int main(int argc, char *argv[])
return 1;
}
}
+ } else {
+ struct stat s;
+ if ( stat("pr-logs", &s) != -1 ) {
+ ERROR("WARNING: pr-logs folder exists, but I will not "
+ "write anything in it with these settings.\n");
+ }
}
/* Read the custom split list (if applicable) */
@@ -1366,7 +1380,8 @@ int main(int argc, char *argv[])
/* Check rejection and write figures of merit */
check_rejection(crystals, n_crystals, full, max_B);
show_all_residuals(crystals, n_crystals, full);
- if ( !(no_logs || (no_pr && pmodel == PMODEL_UNITY)) ) {
+
+ if ( do_write_logs ) {
write_pgraph(full, crystals, n_crystals, 0, "");
write_logs_parallel(crystals, n_crystals, full, 0, nthreads,
scaleflags);
@@ -1397,7 +1412,7 @@ int main(int argc, char *argv[])
check_rejection(crystals, n_crystals, full, max_B);
show_all_residuals(crystals, n_crystals, full);
- if ( !no_logs ) {
+ if ( do_write_logs ) {
write_pgraph(full, crystals, n_crystals, i+1, "");
}
@@ -1446,7 +1461,7 @@ int main(int argc, char *argv[])
/* Write final figures of merit (no rejection any more) */
show_all_residuals(crystals, n_crystals, full);
- if ( !no_pr && !no_logs ) {
+ if ( do_write_logs ) {
write_pgraph(full, crystals, n_crystals, -1, "");
write_logs_parallel(crystals, n_crystals, full, -1, nthreads,
scaleflags);