[pooma-dev] [PATCH] Fix Engine<.., MultiPatch<..> >::makeOwnC opy()

Richard Guenther rguenth at tat.physik.uni-tuebingen.de
Tue Apr 22 17:51:22 UTC 2003


On Tue, 22 Apr 2003, James Crotinger wrote:

> Hmmm. I don't have time to play with this, but something looks wrong. The
> sequence
>
> 	data_m.makeOwnCopy();
> 	if (data_m.isShared())

Well ;) I attached a unified patch, the data_m.makeOwnCopy() is removed,
the rest added. The problem is, the data_m.makeOwnCopy() does not work.

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