freepooma-devel
[Top][All Lists]
Advanced

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

RFA: Patch for fixes for regression test failures


From: Mark P Mitchell
Subject: RFA: Patch for fixes for regression test failures
Date: 9 Oct 2001 18:35:25 -0600

The attached patch attempts to fix several regression tests.

Here is a summary:

  src/Array/tests/ScalarAdvection.cpp:
 
    Updated to use approximately the same code that Scott used in 
    examples/Field/ScalarAdvection/ScalarAdvection.cpp.  

    Note that although this test now compiles, it still fails.  This code
    works in dimension 2.  Scott's code fails in dimension 2, as well.
    
  src/Connect/Lux/tests/*:

    These tests failed because LuxConnector.Field.h had not been 
    updated for the new fields.  

  src/DynamicArray/tests/dynamic_array_badcreate.cpp:

    This test tests to make sure that you cannot dynamically change the
    size of a DynamicArray when there is a view outstanding for the
    DynamicArray.  (Doing so could leave the view pointing at 
    nonsense.)

    However, nothing in the DynamicArray code actually seems to
    enforce this constraint, so the test fails at run time.

    I couldn't fix this one.  Should the test be changed?  Should
    such a check be implemented?

  src/Field/tests/Positions.cpp:
  src/Field/tests/CrossBox.cpp: 

    Also needed updating for the new fields.

  src/Pooma/tests/pooma.cpp:

    This test was written wrong -- it was not set up to exit with
    code zero on success.

OK to check in?

--
Mark Mitchell                   address@hidden
CodeSourcery, LLC               http://www.codesourcery.com

Index: src/Array/tests/ScalarAdvection.cpp
===================================================================
RCS file: /home/pooma/Repository/r2/src/Array/tests/ScalarAdvection.cpp,v
retrieving revision 1.4
diff -c -p -r1.4 ScalarAdvection.cpp
*** src/Array/tests/ScalarAdvection.cpp 2000/07/20 15:36:24     1.4
--- src/Array/tests/ScalarAdvection.cpp 2001/10/10 00:33:08
***************
*** 35,56 ****
  #include "Pooma/Fields.h"
  #include "Utilities/Clock.h"
  
  #include <iostream>
  #include <string>
  #include <stdio.h>
  using namespace std;
  
  // Forward declarations:
  // Ensight output:
  void ensightCaseOut(char *fn, int increment, int lastTimeStep, double dt);
  template<int Dim>
  void ensightGeometryOut(char *fn, UniformRectilinearMesh<Dim> &mesh);
! template<class T, class EngineTag>
! void ensightVariableOut(char *fn, const Array<1, T, EngineTag> &a);
! template<class T, class EngineTag>
! void ensightVariableOut(char *fn, const Array<2, T, EngineTag> &a);
! template<class T, class EngineTag>
! void ensightVariableOut(char *fn, const Array<3, T, EngineTag> &a);
  
  // Workaround for not-yet-correct canned stencil-based div():
  template<class Geometry, class EngineTag>
--- 35,65 ----
  #include "Pooma/Fields.h"
  #include "Utilities/Clock.h"
  
+ #if POOMA_CHEETAH
+   typedef DistributedTag LayoutTag_t;
+   typedef Remote<CompressibleBrick> BrickTag_t;
+ #else
+   typedef ReplicatedTag LayoutTag_t;
+   typedef CompressibleBrick BrickTag_t;
+ #endif
+ 
  #include <iostream>
  #include <string>
  #include <stdio.h>
  using namespace std;
  
+ // Typedefs and constants.
+ const int Dim = 1;
+ typedef UniformRectilinearMesh<Dim> Mesh_t;
+ typedef MultiPatch<UniformTag, BrickTag_t> MP_t;
+ typedef Field<Mesh_t, double, MP_t> Field_t;
+ 
  // Forward declarations:
  // Ensight output:
  void ensightCaseOut(char *fn, int increment, int lastTimeStep, double dt);
  template<int Dim>
  void ensightGeometryOut(char *fn, UniformRectilinearMesh<Dim> &mesh);
! void ensightVariableOut(char *fn, Field_t &f);
  
  // Workaround for not-yet-correct canned stencil-based div():
  template<class Geometry, class EngineTag>
*************** private:
*** 136,187 ****
    
  };
  
- template<int Dim>
- struct PeriodicBCThing
- {
- };
- 
- template<>
- struct PeriodicBCThing<2>
- {
-   template<class Layout>
-   PeriodicBCThing(const Layout &layout)
-   {
-     Interval<2> dom = layout.domain();
-     int x1 = dom[0].first();
-     int x2 = dom[0].last();
-     int y1 = dom[1].first();
-     int y2 = dom[1].last();
- 
-     Interval<1> xinterior(x1 + 1, x2 - 1);
-     //    Interval<1> yinterior(y1 + 1, y2 - 1);
-     Interval<1> yinterior(y1, y2);
- 
-     north_m = Interval<2>(xinterior, Interval<1>(y1, y1));
-     south_m = Interval<2>(xinterior, Interval<1>(y2, y2));
-     east_m  = Interval<2>(Interval<1>(x1, x1), yinterior);
-     west_m  = Interval<2>(Interval<1>(x2, x2), yinterior);
- 
-     northFrom_m = Interval<2>(xinterior, Interval<1>(y2 - 1, y2 - 1));
-     southFrom_m = Interval<2>(xinterior, Interval<1>(y1 + 1, y1 + 1));
-     eastFrom_m  = Interval<2>(Interval<1>(x2 - 1, x2 - 1), yinterior);
-     westFrom_m  = Interval<2>(Interval<1>(x1 + 1, x1 + 1), yinterior);
-   }
- 
-   template<class Array>
-   void apply(const Array &a)
-   {
-     a(north_m) = a(northFrom_m);
-     a(south_m) = a(southFrom_m);
-     a(west_m)  = a(westFrom_m);
-     a(east_m)  = a(eastFrom_m);
-   }
- 
-   Interval<2> north_m, south_m, east_m, west_m;
-   Interval<2> northFrom_m, southFrom_m, eastFrom_m, westFrom_m;
- };
- 
- 
  int main(int argc, char *argv[])
  {
    Pooma::initialize(argc,argv); // Initialize the library
--- 145,150 ----
*************** int main(int argc, char *argv[])
*** 189,250 ****
    // PrintArray class, to format output as desired:
    PrintArray pa(3, 10, 3, 6, true, 1);
  
-   const int Dim = 2; // Set the dimensionality
-   
    // The SAOptions object sets the default option values
    // and parses argv for options that override the defaults.
    
    SAOptions<Dim> opts(argc, argv);
    
    opts.print(pout);
  
!   // Create the physical domains:
!   Interval<Dim> vertexDomain, cellDomain;
    int d;
    for (d = 0; d < Dim; d++) {
      vertexDomain[d] = Interval<1>(opts.nVerts[d]);
-     cellDomain[d] = Interval<1>(opts.nCells[d]);
    }
  
    // Create the (uniform, logically rectilinear) mesh.
-   Vector<Dim> origin(0.0), spacings(0.2);
-   typedef UniformRectilinearMesh<Dim> Mesh_t;
-   Mesh_t mesh(vertexDomain, origin, spacings);
  
!   // Create two geometry objects - one allowing 1 guard layer to account for
!   // stencil width and another with no guard layers to support temporaries:
  
!   typedef DiscreteGeometry<Cell, UniformRectilinearMesh<Dim> > Geometry_t;
!   Geometry_t geom(mesh, GuardLayers<Dim>(1));
!   Geometry_t geomNG(mesh);
! 
!   // Create the layouts
!   Loc<Dim> patches(8);
!   for (d = 0; d < Dim; d++) { patches[d] = Loc<1>(opts.nPatches[d]); }
!   GridLayout<Dim> layoutc(cellDomain, patches, 
!                           GuardLayers<Dim>(1), GuardLayers<Dim>(1), 
!                         ReplicatedTag());
!   GridLayout<Dim> layoutcNG(cellDomain, patches, ReplicatedTag());
!   typedef MultiPatch<GridTag, CompressibleBrick> MP_t;
  
    // Create the Fields:
- 
-   // The flow Field u(x,t), a duplicate (stored at the previous
-   // timestep for staggered leapfrog), and a useful temporary:
- 
-   Array<Dim, double, MP_t> 
-     u(layoutc), uPrev(layoutcNG), uTemp(layoutcNG),
-     uTemp2(layoutcNG);
- 
-   Interval<2> physical = uPrev.domain();
  
!   // Needed for div() bug WORKAROUND below:
!   Array<Dim, Vector<Dim, double>, MP_t> uv(layoutc);
  
    // Initialize Fields to zero everywhere, even global guard layers:
!   u = 0.0;
  
!   PeriodicBCThing<Dim> pbc(u.engine().layout());
  
    // Load initial condition u(x,0), a symmetric pulse centered around nCells/4
    // and decaying to zero away from nCells/4 all directions, with a height of
--- 152,207 ----
    // PrintArray class, to format output as desired:
    PrintArray pa(3, 10, 3, 6, true, 1);
  
    // The SAOptions object sets the default option values
    // and parses argv for options that override the defaults.
    
    SAOptions<Dim> opts(argc, argv);
    
    opts.print(pout);
+ 
+   // Create the physical domains
  
!   Interval<Dim> vertexDomain;
    int d;
    for (d = 0; d < Dim; d++) {
      vertexDomain[d] = Interval<1>(opts.nVerts[d]);
    }
  
+   // Create some layouts.
+   Loc<Dim> patches(opts.nPatches[0]);
+   UniformGridLayout<Dim> layout(vertexDomain, patches, 
+                               GuardLayers<Dim>(1), GuardLayers<Dim>(1), 
+                               LayoutTag_t());
+   UniformGridLayout<Dim> layoutNG(vertexDomain, patches, LayoutTag_t());
+ 
    // Create the (uniform, logically rectilinear) mesh.
  
!   Vector<Dim> origin(0.0), spacings(0.2);
!   Mesh_t mesh(layout, origin, spacings);
!   Mesh_t meshNG(layoutNG, origin, spacings);
  
!   // Create the centering.
!   
!   Centering<Dim> cell = canonicalCentering<Dim>(CellType, Continuous);
  
    // Create the Fields:
  
!   // The flow Field u(x,t):
!   
!   Field_t u(cell, layout, mesh);
!   Field<Mesh_t, Vector<Dim>, MP_t> dtvu(cell, layout, mesh);
!   
!   // The same, stored at the previous timestep for staggered leapfrog
!   // plus a useful temporary:
!   
!   Field_t uPrev(cell, layoutNG, meshNG), uTemp(cell, layoutNG, meshNG);
  
    // Initialize Fields to zero everywhere, even global guard layers:
!   u.all() = 0.0;
  
!   // Set up periodic boundary conditions on all mesh faces:
!   
!   Pooma::addAllPeriodicFaceBC(u);
  
    // Load initial condition u(x,0), a symmetric pulse centered around nCells/4
    // and decaying to zero away from nCells/4 all directions, with a height of
*************** int main(int argc, char *argv[])
*** 256,263 ****
    for (d = 0; d < Dim; d++) { pulseCenter[d] = Loc<1>(opts.nCells[0]/4); }
    Pooma::blockAndEvaluate(); // Needed pre-scalar-indexing read
  
!   Vector<Dim> u0 = geom.x()(pulseCenter);
!   u = 1.0 * exp(-dot(geom.x() - u0, geom.x() - u0) / (2.0 * pulseHalfWidth));
  
    const Vector<Dim> v(0.2);   // Propagation velocity
    const double dt = 0.1;      // Timestep
--- 213,221 ----
    for (d = 0; d < Dim; d++) { pulseCenter[d] = Loc<1>(opts.nCells[0]/4); }
    Pooma::blockAndEvaluate(); // Needed pre-scalar-indexing read
  
!   PositionsTraits<Mesh_t>::Type_t ux = positions(u);
!   Vector<Dim> u0 = ux.read(pulseCenter);
!   u = 1.0 * exp(-dot(ux - u0, ux - u0) / (2.0 * pulseHalfWidth));
  
    const Vector<Dim> v(0.2);   // Propagation velocity
    const double dt = 0.1;      // Timestep
*************** int main(int argc, char *argv[])
*** 268,284 ****
      ensightGeometryOut("ScalarAdvection.geo", mesh);
    }
  
!   // Print out information at t = 0:
    if (opts.purge) {
!     u = where((fabs(u) < opts.epsilon), 0.0); // Purge initial conditions
    }
  
    Pooma::blockAndEvaluate(); // Needed for compressedFraction() validity
    pout << "t = " << double(0.0) << " ; compressedFraction(u) = "
         << compressedFraction(u) << std::endl;
!   //  pout << u(physical) << std::endl;
!   pbc.apply(u);
!   if (opts.doSumOut) pout << "sum(u) = " << sum(u(physical)) << std::endl;
    char timeStepFileName[6];
    if (opts.doEnsightOut) {
      sprintf(timeStepFileName, "u.%04d", 0);
--- 226,243 ----
      ensightGeometryOut("ScalarAdvection.geo", mesh);
    }
  
! #if 0
    if (opts.purge) {
!     u = where(u, (fabs(u) < opts.epsilon), 0.0); // Purge initial conditions
    }
+ #endif
  
+   // Print out information at t = 0:
    Pooma::blockAndEvaluate(); // Needed for compressedFraction() validity
    pout << "t = " << double(0.0) << " ; compressedFraction(u) = "
         << compressedFraction(u) << std::endl;
!   //  pout << u << std::endl;
!   if (opts.doSumOut) pout << "sum(u) = " << sum(u) << std::endl;
    char timeStepFileName[6];
    if (opts.doEnsightOut) {
      sprintf(timeStepFileName, "u.%04d", 0);
*************** int main(int argc, char *argv[])
*** 288,317 ****
  
    // Prime the leapfrog by setting the field at the previous timestep using 
the
    // initial conditions:
!   uPrev = u(physical);
  
    // Do a preliminary timestep using forward Euler, using the canned POOMA
!   // div() function:
!   // BROKEN  u -= div<Cell>(v * dt * u);
!   // WORKAROUND:
!   // Use the Field<Vector> temporay for most straightforward r1 comparison:
!   uv = u * v * dt;
! 
!   Interval<1> I = geom.mesh().physicalCellDomain()[0];
!   Interval<1> J = geom.mesh().physicalCellDomain()[1];
! 
!   Geometry_t::Mesh_t::PointType_t dx2i = geom.mesh().meshSpacing();
! 
!   dx2i = 0.5/dx2i;
! 
!   uTemp2(I,J) = 
!     (uv.comp(0)(I + 1, J) - uv.comp(0)(I - 1, J))*dx2i(0) +
!     (uv.comp(1)(I, J + 1) - uv.comp(1)(I, J - 1))*dx2i(1);
! 
!   //  divv(uv, uTemp2);
!   u(physical) -= uTemp2;
!   pbc.apply(u);
!   // WORKAROUND.
  
    // Start timer to time main loop; do blockAndEvaluate first so results are
    // meaningful:
--- 247,259 ----
  
    // Prime the leapfrog by setting the field at the previous timestep using 
the
    // initial conditions:
!   uPrev = u;
  
    // Do a preliminary timestep using forward Euler, using the canned POOMA
!   // stencil-based divergence operator div() for the spatial difference:
! 
!   dtvu.all() = dt * v * u.all();
!   u -= divCellToCell(dtvu);
  
    // Start timer to time main loop; do blockAndEvaluate first so results are
    // meaningful:
*************** int main(int argc, char *argv[])
*** 323,356 ****
    // The spatial derivative is just the second-order finite difference in the
    // canned POOMA stencil-based divergence operator div():
    for (int timestep = 2; timestep <= opts.lastTimeStep; timestep++) {
!     uTemp = u(physical);
!     
!     // BROKEN    u = uPrev - 2.0 * div<Cell>(v * dt * u);
!     // WORKAROUND:
!     // Use the Field<Vector> temporay for most straightforward r1 comparison:
!     uv = u * v * dt;
!     uTemp2(I,J) = 
!       (uv.comp(0)(I + 1, J) - uv.comp(0)(I - 1, J))*dx2i(0) +
!       (uv.comp(1)(I, J + 1) - uv.comp(1)(I, J - 1))*dx2i(1);
! 
!     //    divv(uv, uTemp2);
!     u(physical) = uPrev - 2.0 * uTemp2;
! 
!     // WORKAROUND.
!     //tjw workaround.
!     if (opts.purge) {
!       if ((timestep % opts.purgeIncrement) == 0) {
!         u(physical) = where((fabs(u(physical)) < opts.epsilon), 0.0);
!       // WORKAROUND for WCY
!       }
!     }
  
      if ((timestep % opts.outputIncrement) == 0) {
        Pooma::blockAndEvaluate(); // Needed for compressedFraction() validity
        pout << "t = " << timestep*dt << " ; compressedFraction(u) = "
                  << compressedFraction(u) << std::endl;
!       //      pout << u(physical) << std::endl;
!       if (opts.doSumOut) pout << "sum(u) = " << sum(u(physical)) << std::endl;
        if (opts.doEnsightOut) {
          //      u.applyBoundaryConditions(); // Update prior to output.
          sprintf(timeStepFileName, "u.%04d", timestep);
--- 265,280 ----
    // The spatial derivative is just the second-order finite difference in the
    // canned POOMA stencil-based divergence operator div():
    for (int timestep = 2; timestep <= opts.lastTimeStep; timestep++) {
!     uTemp = u;
!     dtvu.all() = dt * v * u.all();
!     u = uPrev - 2.0 * divCellToCell(dtvu);
  
      if ((timestep % opts.outputIncrement) == 0) {
        Pooma::blockAndEvaluate(); // Needed for compressedFraction() validity
        pout << "t = " << timestep*dt << " ; compressedFraction(u) = "
                  << compressedFraction(u) << std::endl;
!       //      pout << u << std::endl;
!       if (opts.doSumOut) pout << "sum(u) = " << sum(u) << std::endl;
        if (opts.doEnsightOut) {
          //      u.applyBoundaryConditions(); // Update prior to output.
          sprintf(timeStepFileName, "u.%04d", timestep);
*************** int main(int argc, char *argv[])
*** 359,366 ****
        if (opts.doTextOut) { pa.print(pout, u); }
      }
  
-     pbc.apply(u);
- 
      uPrev = uTemp;
    }
  
--- 283,288 ----
*************** SAOptions()
*** 391,397 ****
    for (int d = 0; d < D; ++d)
      {
        nPatches[d] = 10;
!       nCells[d]   = 100;
        nVerts[d]   = nCells[d] + 1;
      }
    pulseHalfWidthCells = nCells[0]/8.0;
--- 313,319 ----
    for (int d = 0; d < D; ++d)
      {
        nPatches[d] = 10;
!       nCells[d]   = 99;
        nVerts[d]   = nCells[d] + 1;
      }
    pulseHalfWidthCells = nCells[0]/8.0;
*************** void ensightGeometryOut(char *fn, Unifor
*** 797,803 ****
    int id[3];
    int d;
    for (d = 0; d < Dim; d++) {
!     id[d] = mesh.physicalDomain()[d].size();
    }
    for (d = Dim; d < 3; d++) { 
      id[d] = 1;
--- 719,725 ----
    int id[3];
    int d;
    for (d = 0; d < Dim; d++) {
!     id[d] = mesh.physicalVertexDomain()[d].size();
    }
    for (d = Dim; d < 3; d++) { 
      id[d] = 1;
*************** void ensightGeometryOut(char *fn, Unifor
*** 817,823 ****
    // Mesh spacings:
    float dxd[3];
    for (d = 0; d < Dim; d++) {
!     dxd[d] = mesh.meshSpacing()(d);
    }
    for (d = Dim; d < 3; d++) { 
      dxd[d] = 0.0;
--- 739,745 ----
    // Mesh spacings:
    float dxd[3];
    for (d = 0; d < Dim; d++) {
!     dxd[d] = mesh.spacings()(d);
    }
    for (d = Dim; d < 3; d++) { 
      dxd[d] = 0.0;
*************** void ensightGeometryOut(char *fn, Unifor
*** 827,867 ****
  }
  
  // Variable file:
! // Partial specializations for 1D, 2D, 3D Arrays:
! // 1D:
! template<class T, class EngineTag>
! void ensightVariableOut(char *fn, const Array<1, T, EngineTag> &a) 
  {
-   char      descript[80];
-   FILE     *fp;
-   int       ii;
  
!   fp = fopen(fn, "w");
!   sprintf(descript,"Scalar Variable u at %s",fn);
!   fwrite(descript,sizeof(char),80,fp);
!   strcpy(descript,"part");
!   fwrite(descript,sizeof(char),80,fp);
!   ii = 1;
!   fwrite(&ii,sizeof(int),1,fp);
!   strcpy(descript,"block uniform");
!   fwrite(descript,sizeof(char),80,fp);
! 
!   float *var;
!   int nnodes = a.domain().size();
!   var = new float[nnodes];
!   for (int i = a.domain()[0].first(); i <= a.domain()[0].last(); i++) {
!     var[i] = a(i);
!   }
!   
!   fwrite (var, sizeof(float), nnodes, fp);
!   delete [] var;
!   fclose(fp);
! }
  
- // 2D:
- template<class T, class EngineTag>
- void ensightVariableOut(char *fn, const Array<2, T, EngineTag> &a) 
- {
    char      descript[80];
    FILE     *fp;
    int       ii;
--- 749,760 ----
  }
  
  // Variable file:
! void ensightVariableOut(char *fn, Field_t &f) 
  {
  
!   typedef Field_t::Domain_t Domain_t;
!   Domain_t domain(f.layout().domain());
  
    char      descript[80];
    FILE     *fp;
    int       ii;
*************** void ensightVariableOut(char *fn, const 
*** 870,876 ****
    int nelems = 1;
    int d;
    for (d = 0; d < 2; d++) {
!     id[d] = a.domain()[d].size();
      nelems*= id[d];
    }
    for (d = 2; d < 3; d++) { 
--- 763,769 ----
    int nelems = 1;
    int d;
    for (d = 0; d < 2; d++) {
!     id[d] = domain[d].size();
      nelems*= id[d];
    }
    for (d = 2; d < 3; d++) { 
*************** void ensightVariableOut(char *fn, const 
*** 889,939 ****
  
    float *var;
    var = new float[nelems];
-   int count = 0;
-   for (int j = a.domain()[1].first(); j <= a.domain()[1].last(); j++) {
-     for (int i = a.domain()[0].first(); i <= a.domain()[0].last(); i++) {
-       var[count++] = a(i,j);
-     }
-   }
-   
-   fwrite (var, sizeof(float), nelems, fp);
-   delete [] var;
-   fclose(fp);
- }
- 
- // 3D:
- template<class T, class EngineTag>
- void ensightVariableOut(char *fn, const Array<3, T, EngineTag> &a) 
- {
-   char      descript[80];
-   FILE     *fp;
-   int       ii;
- 
-   int id[3];
-   int nelems = 1;
-   for (int d = 0; d < 3; d++) {
-     id[d] = a.domain()[d].size();
-     nelems*= id[d];
-   }
- 
-   fp = fopen(fn, "w");
-   sprintf(descript,"Scalar Variable u at %s",fn);
-   fwrite(descript,sizeof(char),80,fp);
-   strcpy(descript,"part");
-   fwrite(descript,sizeof(char),80,fp);
-   ii = 1;
-   fwrite(&ii,sizeof(int),1,fp);
-   strcpy(descript,"block uniform");
-   fwrite(descript,sizeof(char),80,fp);
- 
-   float *var;
-   var = new float[nelems];
    int count = 0;
!   for (int k = a.domain()[2].first(); k <= a.domain()[2].last(); k++) {
!     for (int j = a.domain()[1].first(); j <= a.domain()[1].last(); j++) {
!       for (int i = a.domain()[0].first(); i <= a.domain()[0].last(); i++) {
!         var[count++] = a(i,j,k);
!       }
      }
    }
    
--- 782,792 ----
  
    float *var;
    var = new float[nelems];
    int count = 0;
!   // This should be rewritten in a domain-independent way.
!   for (int j = domain[1].first(); j <= domain[1].last(); j++) {
!     for (int i = domain[0].first(); i <= domain[0].last(); i++) {
!       var[count++] = f(i,j);
      }
    }
    
Index: src/Connect/Lux/LuxConnector.Field.h
===================================================================
RCS file: /home/pooma/Repository/r2/src/Connect/Lux/LuxConnector.Field.h,v
retrieving revision 1.2
diff -c -p -r1.2 LuxConnector.Field.h
*** src/Connect/Lux/LuxConnector.Field.h        2000/03/07 13:16:19     1.2
--- src/Connect/Lux/LuxConnector.Field.h        2001/10/10 00:33:08
***************
*** 81,90 ****
  //
  
//-----------------------------------------------------------------------------
  
! template<class Geom, class T, class EngineTag>
! class Connector<Field<Geom, T, EngineTag>, Lux>
!   : public Connector<typename ArrayView<Field<Geom,T,EngineTag>,
!                      typename Field<Geom,T,EngineTag>::Domain_t>::Type_t,
                       Lux>
  {
  public:
--- 81,90 ----
  //
  
//-----------------------------------------------------------------------------
  
! template<class Mesh, class T, class EngineTag>
! class Connector<Field<Mesh, T, EngineTag>, Lux>
!   : public Connector<Array<FieldEngine<Mesh, T, EngineTag>::dimensions,
!                            T, EngineTag>,
                       Lux>
  {
  public:
*************** public:
*** 92,100 ****
    // Public typedefs and enums
    //============================================================
  
!   typedef Field<Geom, T, EngineTag>                      Field_t;
    typedef typename Field_t::Domain_t                     Domain_t;
!   typedef typename ArrayView<Field_t, Domain_t>::Type_t  Array_t;
    typedef Connector<Array_t, Lux>                        Base_t;
    typedef Connection<Lux>                                Connection_t;
    typedef Connector<Field_t, Lux>                        Connector_t;
--- 92,101 ----
    // Public typedefs and enums
    //============================================================
  
!   typedef Field<Mesh, T, EngineTag>                      Field_t;
    typedef typename Field_t::Domain_t                     Domain_t;
!   typedef Array<FieldEngine<Mesh, T, EngineTag>::dimensions,
!                 T, EngineTag>                            Array_t;
    typedef Connector<Array_t, Lux>                        Base_t;
    typedef Connection<Lux>                                Connection_t;
    typedef Connector<Field_t, Lux>                        Connector_t;
*************** private:
*** 154,160 ****
    //============================================================
  
    // Reset the mesh data in the base class to the data for the given
!   // Field's geometry.
  
    void setupMeshInfo(const Field_t &f)
    {
--- 155,161 ----
    //============================================================
  
    // Reset the mesh data in the base class to the data for the given
!   // Field's mesh.
  
    void setupMeshInfo(const Field_t &f)
    {
Index: src/Field/Mesh/PositionFunctions.h
===================================================================
RCS file: /home/pooma/Repository/r2/src/Field/Mesh/PositionFunctions.h,v
retrieving revision 1.1
diff -c -p -r1.1 PositionFunctions.h
*** src/Field/Mesh/PositionFunctions.h  2001/08/30 01:15:12     1.1
--- src/Field/Mesh/PositionFunctions.h  2001/10/10 00:33:08
*************** struct XField
*** 157,166 ****
  template<int Dim, class TM>
  struct XField<UniformRectilinearMesh<Dim, TM> >
  {
!   typedef UniformRectilinearMesh<Dim, TM> GeometryTag_t;
    typedef Vector<Dim, TM> PointType_t;
    typedef IndexFunction<PositionFunctorUR<Dim, TM> > PositionEngine_t;
!   typedef Field<GeometryTag_t, PointType_t, PositionEngine_t> Type_t;
  };
  
  template<class F>
--- 157,166 ----
  template<int Dim, class TM>
  struct XField<UniformRectilinearMesh<Dim, TM> >
  {
!   typedef UniformRectilinearMesh<Dim, TM> Mesh_t;
    typedef Vector<Dim, TM> PointType_t;
    typedef IndexFunction<PositionFunctorUR<Dim, TM> > PositionEngine_t;
!   typedef Field<Mesh_t, PointType_t, PositionEngine_t> Type_t;
  };
  
  template<class F>
*************** void setXField(F &f)
*** 170,179 ****
  }
  
  template<class F, class Init>
! typename XField<typename F::GeometryTag_t>::Type_t
  xField(const F &f, const Init &centering)
  {
!   typename XField<typename F::GeometryTag_t>::Type_t ret(centering, f);
    setXField(ret);
    return ret;
  }
--- 170,180 ----
  }
  
  template<class F, class Init>
! typename XField<typename F::Mesh_t>::Type_t
  xField(const F &f, const Init &centering)
  {
!   typedef XField<typename F::Mesh_t>::Type_t Field_t;
!   Field_t ret(centering, f.layout(), f.mesh());
    setXField(ret);
    return ret;
  }
Index: src/Field/tests/CrossBox.cpp
===================================================================
RCS file: /home/pooma/Repository/r2/src/Field/tests/CrossBox.cpp,v
retrieving revision 1.1
diff -c -p -r1.1 CrossBox.cpp
*** src/Field/tests/CrossBox.cpp        2001/08/30 01:15:18     1.1
--- src/Field/tests/CrossBox.cpp        2001/10/10 00:33:08
*************** int main(int argc, char *argv[])
*** 82,93 ****
  
    Centering<2> allFace = canonicalCentering<2>(FaceType, Continuous);
  
!   typedef UniformRectilinear<2> Geometry_t;
    typedef MultiPatch<UniformTag, Remote<Brick> > EngineTag_t;
  
!   typedef Field<Geometry_t, double, EngineTag_t > Field_t;
  
!   typedef Field<Geometry_t, Vector<2>, EngineTag_t > VField_t;
  
    Vector<2> origin(0.0, 0.0);
    Vector<2> spacings(1.0, 1.0);
--- 82,93 ----
  
    Centering<2> allFace = canonicalCentering<2>(FaceType, Continuous);
  
!   typedef UniformRectilinearMesh<2> Mesh_t;
    typedef MultiPatch<UniformTag, Remote<Brick> > EngineTag_t;
  
!   typedef Field<Mesh_t, double, EngineTag_t > Field_t;
  
!   typedef Field<Mesh_t, Vector<2>, EngineTag_t > VField_t;
  
    Vector<2> origin(0.0, 0.0);
    Vector<2> spacings(1.0, 1.0);
*************** int main(int argc, char *argv[])
*** 99,105 ****
    // Should really figure out how to repackage these three lines:
  
    DomainLayout<2> layoutDom(physicalVertexDomain, GuardLayers<2>(1));
!   XField<Geometry_t>::Type_t x(allFace, layoutDom, origin, spacings);
    setXField(x);
  
    b = 0.0;
--- 99,105 ----
    // Should really figure out how to repackage these three lines:
  
    DomainLayout<2> layoutDom(physicalVertexDomain, GuardLayers<2>(1));
!   XField<Mesh_t>::Type_t x(allFace, layoutDom, origin, spacings);
    setXField(x);
  
    b = 0.0;
Index: src/Field/tests/Positions.cpp
===================================================================
RCS file: /home/pooma/Repository/r2/src/Field/tests/Positions.cpp,v
retrieving revision 1.1
diff -c -p -r1.1 Positions.cpp
*** src/Field/tests/Positions.cpp       2001/08/30 01:15:18     1.1
--- src/Field/tests/Positions.cpp       2001/10/10 00:33:08
*************** int main(int argc, char *argv[])
*** 69,78 ****
    Centering<2> vert = canonicalCentering<2>(VertexType, Continuous);
    Centering<2> allFace = canonicalCentering<2>(FaceType, Continuous);
  
!   typedef UniformRectilinear<2> Geometry_t;
!   typedef Field<Geometry_t, double, Brick> Field_t;
  
!   typedef XField<Geometry_t>::Type_t XField_t;
    
    Field_t f(cell, layout1, origin, spacings);
    XField_t x(cell, layout1, origin, spacings);
--- 69,78 ----
    Centering<2> vert = canonicalCentering<2>(VertexType, Continuous);
    Centering<2> allFace = canonicalCentering<2>(FaceType, Continuous);
  
!   typedef UniformRectilinearMesh<2> Mesh_t;
!   typedef Field<Mesh_t, double, Brick> Field_t;
  
!   typedef XField<Mesh_t>::Type_t XField_t;
    
    Field_t f(cell, layout1, origin, spacings);
    XField_t x(cell, layout1, origin, spacings);
Index: src/Pooma/Fields.h
===================================================================
RCS file: /home/pooma/Repository/r2/src/Pooma/Fields.h,v
retrieving revision 1.13
diff -c -p -r1.13 Fields.h
*** src/Pooma/Fields.h  2001/10/06 00:39:19     1.13
--- src/Pooma/Fields.h  2001/10/10 00:33:08
***************
*** 54,59 ****
--- 54,60 ----
  #include "Field/Mesh/NoMesh.h"
  #include "Field/Mesh/UniformRectilinearMesh.h"
  #include "Field/Mesh/MeshFunctions.h"
+ #include "Field/Mesh/PositionFunctions.h"
  
  // Relations:
  
Index: src/Pooma/tests/pooma.cpp
===================================================================
RCS file: /home/pooma/Repository/r2/src/Pooma/tests/pooma.cpp,v
retrieving revision 1.4
diff -c -p -r1.4 pooma.cpp
*** src/Pooma/tests/pooma.cpp   2001/05/24 17:17:36     1.4
--- src/Pooma/tests/pooma.cpp   2001/10/10 00:33:08
***************
*** 46,51 ****
--- 46,54 ----
  // Pooma general interface test program.
  
//-----------------------------------------------------------------------------
  
+ #include <signal.h>
+ #include <stdlib.h>
+ 
  #include "Pooma/Pooma.h"
  
  void newAbortHandler()
*************** void newAbortHandler()
*** 53,58 ****
--- 56,70 ----
    std::cerr << "Running newly installed abort handler." << std::endl;
  }
  
+ // This function is registered as the signal handler for SIGABRT.
+ 
+ void abortSignalHandler(int)
+ {
+   // Exit with a `0' exit status to indicate that all went well.
+   // This test is *expected* to bort.
+   exit(0);
+ }
+ 
  
  int main(int argc, char *argv[])
  {
*************** int main(int argc, char *argv[])
*** 107,116 ****
  
    Pooma::pinfo << "Shutting down POOMA with abort()..." << std::endl;
  
    Pooma::abortHandler(newAbortHandler);
    Pooma::pAbort("This is the abort message.", 2);
  
!   return 0;
  }
  
  
--- 119,134 ----
  
    Pooma::pinfo << "Shutting down POOMA with abort()..." << std::endl;
  
+   // Register a signal handler so that when Pooma::pAbort calls the
+   // abort standard library function, this program does not exit with
+   // a nonzero exit code.
+   signal(SIGABRT, abortSignalHandler);
+ 
    Pooma::abortHandler(newAbortHandler);
    Pooma::pAbort("This is the abort message.", 2);
  
!   // If we get here, the call to Pooma::pAbort did not work.
!   return 1;
  }
  
  

reply via email to

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