freepooma-devel
[Top][All Lists]
Advanced

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

[PATCH] Use Centering view constructor in FieldEngine


From: Richard Guenther
Subject: [PATCH] Use Centering view constructor in FieldEngine
Date: Sat, 8 Nov 2003 19:33:09 +0100 (CET)

Hi!

The following patch makes use of the new centering view constructor in
doing sub-field views of the FieldEngine. This saves 12% assembler text
size in a small example involving centering views aka Field::center(int).
The #ifdefs look ugly, but for correctness, they are needed.

Tested on ia32, with Field and Evaluator (together with changes posted in
previous patches).

Ok?

Richard.


2003Nov08  Richard Guenther <address@hidden>

        * src/Field/FieldEngine/FieldEngine.h: Use sub-centering view
        constructor for centering.

===== FieldEngine.h 1.9 vs edited =====
--- 1.9/r2/src/Field/FieldEngine/FieldEngine.h  Sat Nov  8 18:47:57 2003
+++ edited/FieldEngine.h        Sat Nov  8 19:03:00 2003
@@ -232,15 +232,23 @@

   FieldEngine(const This_t &model, int m, int c)
     : num_materials_m(1),
+#ifdef NOPAssert
+      centering_m(model.centering_m, c),
+#endif
       stride_m(model.stride_m),
+#ifdef NOPAssert
+      data_m(model.data_m + model.stride_m * m + c),
+#endif
       physicalCellDomain_m(model.physicalCellDomain_m),
       guards_m(model.guards_m),
       mesh_m(model.mesh_m)
   {
     PAssert((m >= 0) && (m < model.numMaterials()));
     PAssert((c >= 0) && (c < model.centeringSize()));
+#ifndef NOPAssert
     centering_m = model.centering()[c];
     data_m = model.data_m + model.stride_m * m + c;
+#endif
   }

   /// Takes a view of the specified centering point from all
@@ -248,14 +256,22 @@

   FieldEngine(const This_t &model, int c, const Pooma::CenteringViewTag&)
     : num_materials_m(model.num_materials_m),
+#ifdef NOPAssert
+      centering_m(model.centering_m, c),
+#endif
       stride_m(model.stride_m),
+#ifdef NOPAssert
+      data_m(model.data_m + c),
+#endif
       physicalCellDomain_m(model.physicalCellDomain_m),
       guards_m(model.guards_m),
       mesh_m(model.mesh_m)
   {
     PAssert((c >= 0) && (c < model.centeringSize()));
+#ifndef NOPAssert
     centering_m = model.centering()[c];
     data_m = model.data_m + c;
+#endif
   }

   /// Takes a view of the specified material retaining all centering points.
@@ -264,12 +280,17 @@
     : num_materials_m(1),
       centering_m(model.centering_m),
       stride_m(model.stride_m),
+#ifdef NOPAssert
+      data_m(model.data_m + m * model.stride_m),
+#endif
       physicalCellDomain_m(model.physicalCellDomain_m),
       guards_m(model.guards_m),
       mesh_m(model.mesh_m)
   {
     PAssert((m >= 0) && (m < model.numMaterials()));
+#ifndef NOPAssert
     data_m = model.data_m + m * model.stride_m;
+#endif
   }

   /// Takes a view of the specified centering point of the first material.
@@ -278,14 +299,22 @@

   FieldEngine(int c, const This_t &model)
     : num_materials_m(1),
+#ifdef NOPAssert
+      centering_m(model.centering_m, c),
+#endif
       stride_m(model.stride_m),
+#ifdef NOPAssert
+      data_m(model.data_m + c),
+#endif
       physicalCellDomain_m(model.physicalCellDomain_m),
       guards_m(model.guards_m),
       mesh_m(model.mesh_m)
   {
     PAssert((c >= 0) && (c < model.centeringSize()));
+#ifndef NOPAssert
     centering_m = model.centering()[c];
     data_m = model.data_m + c;
+#endif
   }

   //@}

reply via email to

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