Revision: 76845
http://sourceforge.net/p/brlcad/code/76845
Author: brlcad
Date: 2020-08-19 08:18:17 +0000 (Wed, 19 Aug 2020)
Log Message:
-----------
track and report on the first few IDs that don't have a density defined, still
silently ignoring the rest. update the message as being a warning instead of
advisotry. don't report on objects without an ID.
Modified Paths:
--------------
brlcad/trunk/src/rt/viewweight.c
Modified: brlcad/trunk/src/rt/viewweight.c
===================================================================
--- brlcad/trunk/src/rt/viewweight.c 2020-08-19 02:06:49 UTC (rev 76844)
+++ brlcad/trunk/src/rt/viewweight.c 2020-08-19 08:18:17 UTC (rev 76845)
@@ -85,7 +85,6 @@
extern char *densityfile; /* name of density file */
extern int output_is_binary; /* !0 means output is binary */
-static int mass_undef = 0;
static int
hit(struct application *ap, struct partition *PartHeadp, struct seg
*UNUSED(segp))
@@ -122,18 +121,24 @@
dp->next = (struct datapoint *)addp;
bu_semaphore_release(BU_SEM_SYSCALL);
- /* if we don't have a valid material density to work with, use a
default material */
- if (density_factor < 0) {
- if (!mass_undef) {
- bu_log("Material type %d used, but has no density file
entry.\n", reg->reg_gmater);
- bu_log(" (region %s)\n", reg->reg_name);
- bu_log(" Mass is undefined.\n");
- mass_undef = 1;
+ /* no density factor means we use a default (zero) */
+ {
+ /* keep track of the first few only */
+ #define MAX_MASS_TRACKED 256
+ static int mass_undef[MAX_MASS_TRACKED] = {0};
+
+ if (density_factor < 0) {
+ 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", material_id);
+ bu_log(" Mass is undefined, only reporting
volume.\n");
+ bu_log(" ( Encountered on region %s )\n",
reg->reg_name);
+ mass_undef[material_id] = 1;
+ }
+ density_factor = analyze_densities_density(density, 0);
+ bu_semaphore_acquire(BU_SEM_SYSCALL);
+ reg->reg_gmater = 0;
+ bu_semaphore_release(BU_SEM_SYSCALL);
}
- density_factor = analyze_densities_density(density, 0);
- bu_semaphore_acquire(BU_SEM_SYSCALL);
- reg->reg_gmater = 0;
- bu_semaphore_release(BU_SEM_SYSCALL);
}
{
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