[PATCH] Fix Engine<.., MultiPatch<..> >::makeOwnCopy()

Richard Guenther rguenth at tat.physik.uni-tuebingen.de
Tue Apr 22 15:57:58 UTC 2003


Hi!

Currently for a multipatch engine makeOwnCopy() does no good (it doesnt
copy), it seems because just calling makeOwnCopy() on the
RefCountedBlockPtr does not copy the underlying engines. I didnt figure
out why and so came up with the following fix which works for me. I have
also an updated Field/BasicTest3.cpp which now checks every engine
combination for makeOwnCopy and it now succeeds for both MultiPatch<Brick>
and MultiPatch<Remote<Brick> >.

Ok to apply?

Richard.


2003 Apr 22  Richard Guenther <richard.guenther at uni-tuebingen.de>

	* Engine/MultiPatchEngine.cpp: do makeOwnCopy() manually.

===== MultiPatchEngine.cpp 1.3 vs edited =====
--- 1.3/r2/src/Engine/MultiPatchEngine.cpp	Fri Jan 24 10:35:52 2003
+++ edited/MultiPatchEngine.cpp	Tue Apr 22 17:42:04 2003
@@ -244,8 +244,17 @@
 Engine<Dim, T, MultiPatch<LayoutTag,PatchTag> >::
 makeOwnCopy()
 {
-  data_m.makeOwnCopy();
-
+  PAssert(data_m.isValid());
+  if (data_m.isShared()) {
+    PatchContainer_t model = data_m;
+    data_m = PatchContainer_t(model.size());
+    for (int i=0; i<model.size(); ++i) {
+      data_m[i] = model[i];
+      data_m[i].makeOwnCopy();
+    }
+    pDirty_m = new bool(*pDirty_m);
+  }
+
   return *this;
 }





More information about the pooma-dev mailing list