This is a multipart MIME message.
The attached patch causes Replace to recompute the DXStatistics
attribute of the data component in case the invalid positions or invalid
connections component have been replaced. This is probably sufficient in
most situations. However, it might be more appropriate to loop over all
components and look for the simultaneous presence of a "dep" attribute
on the replaced field and presence of a statistics component. Then, one
may recompute the statistics for all relevant components.

As I am still a bit confused about what is a field/component/attribute
and where, I didn't quickly enough find an example of a loop over all
components and finally wasn't sure this was a good idea anyway I left it
at this "quick and easy" approach until someone convinces me it should be
made in more rigorously.

/Nils
-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
   Nils Smeds                        http://www.pdc.kth.se/
   Center for Parallel Computers     e-mail: [EMAIL PROTECTED]
   Royal Institute of Technology     Voice:  +46-8-7909115
   KTH                               Fax:    +46-8-247784 
   S-100 44 Stockholm, Sweden        Office: OB2, room 1546
-----------------------------------------------------------------------
Index: src/exec/dxmods/replace.c
===================================================================
RCS file: /src/master/dx/src/exec/dxmods/replace.c,v
retrieving revision 1.4
diff -p -r1.4 replace.c
*** src/exec/dxmods/replace.c   24 Aug 2000 20:04:46 -0000      1.4
--- src/exec/dxmods/replace.c   10 Sep 2002 08:37:19 -0000
*************** m_Replace(Object *in, Object *out)
*** 63,68 ****
--- 63,84 ----
       */
      if (!DXReplace(out[0], in[0], src, dst))
        goto error;
+ 
+     if (!(strcmp(dst,"invalid positions") && strcmp(dst,"invalid 
connections"))) {
+       /*  Update the statistics to reflect the new set of valid 
positions/connections  
+        *  Only the "data" component is updated here, other components 
dependent on 
+        *  positions and/or connections may need special attention
+        */
+       DXMessage("Replace: Invalid positions/connections have been modified. "
+               "Recomputing stats for data component...\n");
+       if (!DXStatistics(out[0], "data", NULL, NULL, NULL, NULL)) {
+       /* No need to raise an error, we only lost our statistics (if they were 
ever there) */
+       DXWarning("Replace: Recomputing stats failed");
+       } else {
+       DXMessage("Replace: Data component stats updated. "
+                 "Other dependent components might be present\n");
+       }
+     }
      
      return OK;
  

Reply via email to