Patch: Reverse Overzealous makeOwnCopy() Changes

Jeffrey Oldham oldham at codesourcery.com
Wed May 23 21:14:22 UTC 2001


Jim Crotinger pointed out that "View" engines aren't supposed to have
makeOwnCopy().  Thus, I suggest reversing part of my overzealous
makeOwnCopy() patch.  With the patch (and with the patch I sent out
yesterday), Dave Nystrom's explicit instantiation code still compiles.
Also, the Pooma library and all the array_test<N> tests still compile.

2001-05-23  Jeffrey D. Oldham  <oldham at codesourcery.com>

        * Engine/CompressibleBrick.cpp
        (Engine<Dim,T,CompressibleBrickView>::makeOwnCopy()): Remove this
        incorrectly introduced function.
        * Engine/CompressibleBrick.h
        (Engine<Dim,T,CompressibleBrickView>::makeOwnCopy()): Likewise.
  
Tested on       sequential Linux using gcc 3.0
Approved by     Jim Crotinger (jcrotinger at mac.com)
  
Thanks,
Jeffrey D. Oldham
oldham at codesourcery.com
-------------- next part --------------
Index: CompressibleBrick.cpp
===================================================================
RCS file: /home/pooma/Repository/r2/src/Engine/CompressibleBrick.cpp,v
retrieving revision 1.25
diff -c -p -r1.25 CompressibleBrick.cpp
*** CompressibleBrick.cpp	2001/05/14 21:11:23	1.25
--- CompressibleBrick.cpp	2001/05/23 21:11:13
*************** Engine(const Engine<Dim,T,CompressibleBr
*** 501,542 ****
  
  //-----------------------------------------------------------------------------
  //
- // Engine<Dim,T,CompressibleBrickView> & makeOwnCopy()
- //
- // Causes the CompressibleBrickView-Engine to obtain a private copy of the data
- // that it refers to.
- //
- //-----------------------------------------------------------------------------
- 
- template <int Dim, class T>
- Engine<Dim,T,CompressibleBrickView> &Engine<Dim,T,CompressibleBrickView>::makeOwnCopy()
- {
-   // JIM: This is probably not thread safe??? 
-   // There is a race from checking isShared to getting into cblock's
-   // makeOwnCopy, which is thread safe. As a result, this should only
-   // be called after a blockAndEvaluate() to ensure that nobody else
-   // is messing with the underlying CBC while this is
-   // occuring. (Logically, this is necessary anyway since you probably
-   // want a copy of the data that results from all previous
-   // computations having taken place.)  Also, as mentioned elsewhere,
-   // the current implementation results in copying uncompressed data
-   // in the parse thread, which will result in incorrect memory
-   // affinity.
-   
-   if (cblock_m.isControllerValidUnlocked() && cblock_m.isShared()) 
-     {
-       cblock_m.detach(this);
-       cblock_m.makeOwnCopy();
-       cblock_m.attach(this);
- 
-       data0_m = cblock_m.data() + (cblock_m.compressed() ? 0 : baseOffset());
-     }
- 
-   return *this;
- }
- 
- //-----------------------------------------------------------------------------
- //
  // Engine<Dim, T, CompressibleBrickView>::
  // elementsCompressed() const
  //
--- 501,506 ----
Index: CompressibleBrick.h
===================================================================
RCS file: /home/pooma/Repository/r2/src/Engine/CompressibleBrick.h,v
retrieving revision 1.69
diff -c -p -r1.69 CompressibleBrick.h
*** CompressibleBrick.h	2001/05/16 21:21:06	1.69
--- CompressibleBrick.h	2001/05/23 21:11:13
*************** public:
*** 573,582 ****
      return domain_m;
    }
  
-   // Get a private copy of data viewed by this Engine.
- 
-   Engine_t &makeOwnCopy();
- 
    // Return the block controller (uncompressed). 
    // See comments in CompressibleBrick above.
    
--- 573,578 ----
*************** struct NewEngine<Engine<Dim,T,Compressib
*** 821,831 ****
  template <int Dim, class T>
  struct ElementProperties<Engine<Dim, T, CompressibleBrick> > 
    : public MakeOwnCopyProperties<Engine<Dim, T, CompressibleBrick> >
- { };
- 
- template <int Dim, class T>
- struct ElementProperties<Engine<Dim, T, CompressibleBrickView> > 
-   : public MakeOwnCopyProperties<Engine<Dim, T, CompressibleBrickView> >
  { };
  
  
--- 817,822 ----


More information about the pooma-dev mailing list