Revision: 76910
          http://sourceforge.net/p/brlcad/code/76910
Author:   brlcad
Date:     2020-08-24 04:59:59 +0000 (Mon, 24 Aug 2020)
Log Message:
-----------
put a header line on the rtweight density table output.

Modified Paths:
--------------
    brlcad/trunk/regress/weight/weight.ref
    brlcad/trunk/regress/weight/weight.test2.ref
    brlcad/trunk/src/rt/viewweight.c

Modified: brlcad/trunk/regress/weight/weight.ref
===================================================================
(Binary files differ)

Modified: brlcad/trunk/regress/weight/weight.test2.ref
===================================================================
(Binary files differ)

Modified: brlcad/trunk/src/rt/viewweight.c
===================================================================
--- brlcad/trunk/src/rt/viewweight.c    2020-08-24 03:42:52 UTC (rev 76909)
+++ brlcad/trunk/src/rt/viewweight.c    2020-08-24 04:59:59 UTC (rev 76910)
@@ -131,7 +131,7 @@
                if (material_id > 0 && material_id < MAX_MASS_TRACKED && 
!mass_undef[material_id]) {
                    bu_log("WARNING: Material ID %ld has no density file 
entry.\n"
                           "         Mass is undefined, only reporting 
volume.\n"
-                          "       ( Encountered on region %s )\n", 
material_id, reg->reg_name);
+                          "       ( Encountered on region %s )\n\n", 
material_id, reg->reg_name);
                    mass_undef[material_id] = 1;
                }
                density_factor = analyze_densities_density(density, 0);
@@ -205,9 +205,11 @@
 
     /* densityfile is global to this file and will be used later (and then 
freed) */
     bu_vls_init(&densityfile_vls);
+    if (analyze_densities_create(&density)) {
+       bu_log("INTERNAL ERROR: Unable to initialize density table\n");
+    }
 
     if (densityfile) {
-       analyze_densities_create(&density);
        bu_vls_sprintf(&densityfile_vls, "%s", densityfile);
        if (!bu_file_exists(bu_vls_cstr(&densityfile_vls), NULL)) {
            bu_log("Unable to load density file \"%s\" for reading\n", 
bu_vls_cstr(&densityfile_vls));
@@ -253,7 +255,6 @@
            bip = (struct rt_binunif_internal *)intern.idb_ptr;
            RT_CHECK_BINUNIF (bip);
 
-           analyze_densities_create(&density);
            buf = (char *)bu_calloc(bip->count+1, sizeof(char), "density 
buffer");
            memcpy(buf, bip->u.int8, bip->count);
            rt_db_free_internal(&intern);
@@ -273,7 +274,6 @@
        } else {
 
            /* If we still don't have density information, fall back on the 
pre-defined defaults */
-           analyze_densities_create(&density);
            bu_vls_sprintf(&densityfile_vls, "%s%c%s", bu_dir(NULL, 0, 
BU_DIR_CURR, NULL), BU_DIR_SEPARATOR, DENSITY_FILE);
 
            if (!bu_file_exists(bu_vls_cstr(&densityfile_vls), NULL)) {
@@ -429,7 +429,7 @@
        /* cm */
        bu_strlcpy(units, "grams", sizeof(units));
     } else {
-       bu_log("Warning: base2mm=%g, using default of %s--%s\n",
+       bu_log("WARNING: base2mm=%g, using default of %s--%s\n",
               dbp->dbi_base2local, units, unit2);
     }
 
@@ -440,7 +440,9 @@
     fprintf(outfp, "RT Weight Program Output:\n");
     fprintf(outfp, "\nDatabase Title: \"%s\"\n", dbp->dbi_title);
     fprintf(outfp, "Time Stamp: %s\n\nDensity Table Used:%s\n\n", timeptr, 
bu_vls_cstr(&densityfile_vls));
-    fprintf(outfp, "Material  Density(g/cm^3) Name\n");
+    fprintf(outfp,
+           "Material  Density(g/cm^3)  Name\n"
+           "--------  ---------------  -------------\n");
     {
        long int curr_id = -1;
        while ((curr_id = analyze_densities_next(density, curr_id)) != -1) {

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to