[pooma-dev] CompressibleBrickView's makeOwnCopy
Jeffrey Oldham
oldham at codesourcery.com
Tue May 15 14:33:29 UTC 2001
On Tue, May 15, 2001 at 07:22:06AM -0600, James Crotinger wrote:
>
> > (Engine<Dim,T,CompressibleBrickView>::makeOwnCopy()): New
> > declaration.
>
>
> "View" engines aren't supposed to have makeOwnCopy(). I'm not exactly sure
> what this would mean in general since, in a sense, they don't own their data
> in the first place.
OK to commit the following patch to eliminate CompressibleBrickView's
makeOwnCopy()? Will the resulting code still solve Dave Nystrom's
makeOwnCopy() problem?
2001-05-15 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 gcc 3.0 by compiling library
Approved by ???Jim Crotinger???
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/15 14:20:24
*************** 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.68
diff -c -p -r1.68 CompressibleBrick.h
*** CompressibleBrick.h 2001/05/14 21:11:23 1.68
--- CompressibleBrick.h 2001/05/15 14:20:25
*************** public:
*** 573,582 ****
return Layout_t(domain_m).domain();
}
- // 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