freepooma-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Richard Guenther
Subject: RE: [pooma-dev] [PATCH] Fix Engine<.., MultiPatch<..> >::makeOwnC opy()
Date: Tue, 22 Apr 2003 19:56:15 +0200 (CEST)

On Tue, 22 Apr 2003, James Crotinger wrote:

> Hmmm. I don't have time to play with this, but something looks wrong.

Btw., the failing testcase is the following (which is fixed with my
patch), failing tester.check()s marked with XXXX:

#include "Pooma/Fields.h"
#include "Pooma/Tiny.h"
#include "Utilities/Tester.h"

#include <iostream>
#include <math.h>


template <class Mesh, class Engine>
void check(Pooma::Tester& tester, Field<Mesh, int, Engine>& f)
{
  typedef Field<Mesh, int, Engine> Field_t;
  f.all() = 2;

  // make a deep copy
  Field_t h(f);
  h.makeOwnCopy();

  // write to copy and check if it did not clobber f
  h.all() = 1;
  tester.check("f != h", all(f.all() == 2)
                         && all(h.all() == 1)); // XXXX
}

//-----------------------------------------------------------------------------
// Main program:
//-----------------------------------------------------------------------------

int main(int argc, char *argv[])
{
  Pooma::initialize(argc, argv);
  Pooma::Tester tester(argc, argv);

  // Create the physical domain.

  const int NX = 5, NY = 5;
  Interval<1> I(NX), J(NY);

  Vector<2,double> origin;
  Vector<2,double> spacings;
  for (int d = 0; d < 2; d++)
    {
      origin(d) = d;
      spacings(d) = d + 1;
    }

  Centering<2> vert = canonicalCentering<2>(VertexType, Continuous);

  // MultiPatch<Brick>
  tester.out() << "MultiPatch<Brick>...\n";
  {
    GridLayout<2> layout1(Interval<2>(I, J), Loc<2>(1, 1), GuardLayers<2>(1), 
DistributedTag());
    Field<UniformRectilinearMesh<2>, int, MultiPatch<GridTag, Brick> >
      f(vert, layout1, origin, spacings);
    check(tester, f);
  }

  // MultiPatch<Remote<Brick> >
  tester.out() << "MultiPatch<Remote<Brick> >...\n";
  {
    GridLayout<2> layout1(Interval<2>(I, J), Loc<2>(1, 1), GuardLayers<2>(1), 
DistributedTag());
    Field<UniformRectilinearMesh<2>, int, MultiPatch<GridTag, Remote<Brick> > >
      f(vert, layout1, origin, spacings);
    check(tester, f);
  }

  int ret = tester.results("BasicTest3");
  Pooma::finalize();
  return ret;
}

reply via email to

[Prev in Thread] Current Thread [Next in Thread]