Manual Patch: Program Movements and Additions

Jeffrey Oldham oldham at codesourcery.com
Fri Jan 4 11:02:05 UTC 2002


This patch moves some existing program examples and adds some new short
program examples to the R2 manual.

2002-Jan-04  Jeffrey D. Oldham  <oldham at codesourcery.com>

	* examples/Doof2d/Doof2d-Array-distributed-annotated.patch: Moved
	from '.'.
	* examples/Doof2d/Doof2d-Array-element-annotated.patch: Likewise.
	* examples/Doof2d/Doof2d-Array-parallel-annotated.patch: Likewise.
	* examples/Doof2d/Doof2d-Array-stencil-annotated.patch: Likewise.
	* examples/Doof2d/Doof2d-C-element-annotated.patch: Likewise.
	* examples/Doof2d/Doof2d-Field-distributed-annotated.patch: Likewise.
	* examples/Doof2d/Doof2d-Field-parallel-annotated.patch: Likewise.
	* examples/Doof2d/Makefile: Likewise.
	* examples/Sequential/Makefile: New file.
	* examples/Sequential/initialize-finalize-annotated.patch: New file.
	* examples/Templates/Makefile: New file.
	* examples/Templates/pairs-templated-annotated.patch: New file.
	* examples/Templates/pairs-untemplated-annotated.patch: New file.

Applied to mainline.

Thanks,
Jeffrey D. Oldham
oldham at codesourcery.com
-------------- next part --------------
Index: examples/Doof2d/Doof2d-Array-distributed-annotated.patch
===================================================================
RCS file: Doof2d-Array-distributed-annotated.patch
diff -N Doof2d-Array-distributed-annotated.patch
*** /dev/null	Fri Mar 23 21:37:44 2001
--- Doof2d-Array-distributed-annotated.patch	Fri Jan  4 10:53:56 2002
***************
*** 0 ****
--- 1,184 ----
+ *** Doof2d-Array-distributed.cpp	Wed Dec  5 14:04:36 2001
+ --- Doof2d-Array-distributed-annotated.cpp	Wed Dec  5 14:07:56 2001
+ ***************
+ *** 1,3 ****
+ ! #include <stdlib.h>		// has EXIT_SUCCESS
+   #include "Pooma/Arrays.h"	// has Pooma's Array
+   
+ --- 1,5 ----
+ ! <programlisting id="tutorial-array_distributed-doof2d-program" linenumbering="numbered" format="linespecific">
+ ! #include <iostream>		// has std::cout, ...
+ ! #include <stdlib.h>		// has EXIT_SUCCESS
+   #include "Pooma/Arrays.h"	// has Pooma's Array
+   
+ ***************
+ *** 14,18 ****
+     // (i,j).  The "C" template parameter permits use of this stencil
+     // operator with both Arrays and Fields.
+ !   template <class C>
+     inline
+     typename C::Element_t
+ --- 16,20 ----
+     // (i,j).  The "C" template parameter permits use of this stencil
+     // operator with both Arrays and Fields.
+ !   template <class C>
+     inline
+     typename C::Element_t
+ ***************
+ *** 42,46 ****
+     // canot use standard input and output.  Instead we use command-line
+     // arguments, which are replicated, for input, and we use an Inform
+ !   // stream for output.
+     Inform output;
+   
+ --- 44,48 ----
+     // canot use standard input and output.  Instead we use command-line
+     // arguments, which are replicated, for input, and we use an Inform
+ !   // stream for output.  <co id="tutorial-array_distributed-doof2d-io"></co>
+     Inform output;
+   
+ ***************
+ *** 48,52 ****
+     if (argc != 4) {
+       // Incorrect number of command-line arguments.
+ !     output << argv[0] << ": number-of-processors number-of-averagings number-of-values" << std::endl;
+       return EXIT_FAILURE;
+     }
+ --- 50,54 ----
+     if (argc != 4) {
+       // Incorrect number of command-line arguments.
+ !     output &openopen; argv[0] &openopen; ": number-of-processors number-of-averagings number-of-values" &openopen; std::endl;
+       return EXIT_FAILURE;
+     }
+ ***************
+ *** 55,63 ****
+     // Determine the number of processors.
+     long nuProcessors;
+ !   nuProcessors = strtol(argv[1], &tail, 0);
+   
+     // Determine the number of averagings.
+     long nuAveragings, nuIterations;
+ !   nuAveragings = strtol(argv[2], &tail, 0);
+     nuIterations = (nuAveragings+1)/2; // Each iteration performs two averagings.
+   
+ --- 57,65 ----
+     // Determine the number of processors.
+     long nuProcessors;
+ !   nuProcessors = strtol(argv[1], &tail, 0);
+   
+     // Determine the number of averagings.
+     long nuAveragings, nuIterations;
+ !   nuAveragings = strtol(argv[2], &tail, 0);
+     nuIterations = (nuAveragings+1)/2; // Each iteration performs two averagings.
+   
+ ***************
+ *** 65,69 ****
+     // the grid.
+     long n;
+ !   n = strtol(argv[3], &tail, 0);
+     // The dimension must be a multiple of the number of processors
+     // since we are using a UniformGridLayout.
+ --- 67,71 ----
+     // the grid.
+     long n;
+ !   n = strtol(argv[3], &tail, 0);
+     // The dimension must be a multiple of the number of processors
+     // since we are using a UniformGridLayout.
+ ***************
+ *** 71,80 ****
+   
+     // Specify the arrays' domains [0,n) x [0,n).
+ !   Interval<1> N(0, n-1);
+ !   Interval<2> vertDomain(N, N);
+   
+     // Set up interior domains [1,n-1) x [1,n-1) for computation.
+ !   Interval<1> I(1,n-2);
+ !   Interval<2> interiorDomain(I,I);
+   
+     // Create the distributed arrays.
+ --- 73,82 ----
+   
+     // Specify the arrays' domains [0,n) x [0,n).
+ !   Interval<1> N(0, n-1);
+ !   Interval<2> vertDomain(N, N);
+   
+     // Set up interior domains [1,n-1) x [1,n-1) for computation.
+ !   Interval<1> I(1,n-2);
+ !   Interval<2> interiorDomain(I,I);
+   
+     // Create the distributed arrays.
+ ***************
+ *** 83,98 ****
+     // dimension.  Guard layers optimize communication between patches.
+     // Internal guards surround each patch.  External guards surround
+ !   // the entire array domain.
+ !   UniformGridPartition<2> partition(Loc<2>(nuProcessors, nuProcessors),
+ ! 				    GuardLayers<2>(1),  // internal
+ ! 				    GuardLayers<2>(0)); // external
+ !   UniformGridLayout<2> layout(vertDomain, partition, DistributedTag());
+   
+     // The template parameters indicate 2 dimensions and a 'double'
+     // element type.  MultiPatch indicates multiple computation patches,
+     // i.e., distributed computation.  The UniformTag indicates the
+ !   // patches should have the same size.  Each patch has Brick type.
+ !   Array<2, double, MultiPatch<UniformTag, Remote<Brick> > > a(layout);
+ !   Array<2, double, MultiPatch<UniformTag, Remote<Brick> > > b(layout);
+   
+     // Set up the initial conditions.
+ --- 85,100 ----
+     // dimension.  Guard layers optimize communication between patches.
+     // Internal guards surround each patch.  External guards surround
+ !   // the entire array domain.  <co id="tutorial-array_distributed-doof2d-layout"></co>
+ !   UniformGridPartition<2> partition(Loc<2>(nuProcessors, nuProcessors),
+ ! 				    GuardLayers<2>(1),  // internal
+ ! 				    GuardLayers<2>(0)); // external
+ !   UniformGridLayout<2> layout(vertDomain, partition, DistributedTag());
+   
+     // The template parameters indicate 2 dimensions and a 'double'
+     // element type.  MultiPatch indicates multiple computation patches,
+     // i.e., distributed computation.  The UniformTag indicates the
+ !   // patches should have the same size.  Each patch has Brick type.  <co id="tutorial-array_distributed-doof2d-remote"></co>
+ !   Array<2, double, MultiPatch<UniformTag, Remote<Brick> > > a(layout);
+ !   Array<2, double, MultiPatch<UniformTag, Remote<Brick> > > b(layout);
+   
+     // Set up the initial conditions.
+ ***************
+ *** 104,112 ****
+   
+     // Create the stencil performing the computation.
+ !   Stencil<DoofNinePt> stencil;
+   
+     // Perform the simulation.
+ !   for (int k = 0; k < nuIterations; ++k) {
+ !     // Read from b.  Write to a.
+       a(interiorDomain) = stencil(b, interiorDomain);
+   
+ --- 106,114 ----
+   
+     // Create the stencil performing the computation.
+ !   Stencil<DoofNinePt> stencil;
+   
+     // Perform the simulation.
+ !   for (int k = 0; k < nuIterations; ++k) {
+ !     // Read from b.  Write to a.  <co id="tutorial-array_distributed-doof2d-first_write"></co>
+       a(interiorDomain) = stencil(b, interiorDomain);
+   
+ ***************
+ *** 117,121 ****
+     // Print out the final central value.
+     Pooma::blockAndEvaluate();	// Ensure all computation has finished.
+ !   output << (nuAveragings % 2 ? a(n/2,n/2) : b(n/2,n/2)) << std::endl;
+   
+     // The arrays are automatically deallocated.
+ --- 119,123 ----
+     // Print out the final central value.
+     Pooma::blockAndEvaluate();	// Ensure all computation has finished.
+ !   output &openopen; (nuAveragings % 2 ? a(n/2,n/2) : b(n/2,n/2)) &openopen; std::endl;
+   
+     // The arrays are automatically deallocated.
+ ***************
+ *** 125,126 ****
+ --- 127,129 ----
+     return EXIT_SUCCESS;
+   }
+ + </programlisting>
Index: examples/Doof2d/Doof2d-Array-element-annotated.patch
===================================================================
RCS file: Doof2d-Array-element-annotated.patch
diff -N Doof2d-Array-element-annotated.patch
*** /dev/null	Fri Mar 23 21:37:44 2001
--- Doof2d-Array-element-annotated.patch	Fri Jan  4 10:53:56 2002
***************
*** 0 ****
--- 1,143 ----
+ *** Doof2d-Array-element.cpp	Tue Dec  4 12:02:10 2001
+ --- Doof2d-Array-element-annotated.cpp	Tue Dec  4 12:24:25 2001
+ ***************
+ *** 1,5 ****
+ ! #include <iostream>		// has std::cout, ...
+ ! #include <stdlib.h>		// has EXIT_SUCCESS
+ ! #include "Pooma/Arrays.h"	// has Pooma's Array
+   
+   // Doof2d: Pooma Arrays, element-wise implementation
+ --- 1,6 ----
+ ! <programlisting id="tutorial-array_elementwise-doof2d-program" linenumbering="numbered" format="linespecific">
+ ! #include <iostream>		// has std::cout, ...
+ ! #include <stdlib.h>		// has EXIT_SUCCESS
+ ! #include "Pooma/Arrays.h"	// has Pooma's Array  <co id="tutorial-array_elementwise-doof2d-header"></co>
+   
+   // Doof2d: Pooma Arrays, element-wise implementation
+ ***************
+ *** 7,17 ****
+   int main(int argc, char *argv[])
+   {
+ !   // Prepare the Pooma library for execution.
+     Pooma::initialize(argc,argv);
+     
+     // Ask the user for the number of averagings.
+     long nuAveragings, nuIterations;
+ !   std::cout << "Please enter the number of averagings: ";
+ !   std::cin >> nuAveragings;
+     nuIterations = (nuAveragings+1)/2; // Each iteration performs two averagings.
+   
+ --- 8,18 ----
+   int main(int argc, char *argv[])
+   {
+ !   // Prepare the Pooma library for execution.  <co id="tutorial-array_elementwise-doof2d-pooma_initialize"></co>
+     Pooma::initialize(argc,argv);
+     
+     // Ask the user for the number of averagings.
+     long nuAveragings, nuIterations;
+ !   std::cout &openopen; "Please enter the number of averagings: ";
+ !   std::cin &closeclose; nuAveragings;
+     nuIterations = (nuAveragings+1)/2; // Each iteration performs two averagings.
+   
+ ***************
+ *** 19,37 ****
+     // the grid.
+     long n;
+ !   std::cout << "Please enter the array size: ";
+ !   std::cin >> n;
+   
+ !   // Specify the arrays' domains [0,n) x [0,n).
+ !   Interval<1> N(0, n-1);
+ !   Interval<2> vertDomain(N, N);
+   
+ !   // Create the arrays.
+     // The template parameters indicate 2 dimensions, a 'double' element
+     // type, and ordinary 'Brick' storage.
+ !   Array<2, double, Brick> a(vertDomain);
+ !   Array<2, double, Brick> b(vertDomain);
+   
+     // Set up the initial conditions.
+ !   // All grid values should be zero except for the central value.
+     for (int j = 1; j < n-1; j++)
+       for (int i = 1; i < n-1; i++)
+ --- 20,38 ----
+     // the grid.
+     long n;
+ !   std::cout &openopen; "Please enter the array size: ";
+ !   std::cin &closeclose; n;
+   
+ !   // Specify the arrays' domains [0,n) x [0,n).  <co id="tutorial-array_elementwise-doof2d-domain"></co>
+ !   Interval<1> N(0, n-1);
+ !   Interval<2> vertDomain(N, N);
+   
+ !   // Create the arrays.  <co id="tutorial-array_elementwise-doof2d-array_creation"></co>
+     // The template parameters indicate 2 dimensions, a 'double' element
+     // type, and ordinary 'Brick' storage.
+ !   Array<2, double, Brick> a(vertDomain);
+ !   Array<2, double, Brick> b(vertDomain);
+   
+     // Set up the initial conditions.
+ !   // All grid values should be zero except for the central value.  <co id="tutorial-array_elementwise-doof2d-initialization"></co>
+     for (int j = 1; j < n-1; j++)
+       for (int i = 1; i < n-1; i++)
+ ***************
+ *** 43,51 ****
+   
+     // Perform the simulation.
+ !   for (int k = 0; k < nuIterations; ++k) {
+       // Read from b.  Write to a.
+ !     for (int j = 1; j < n-1; j++)
+ !       for (int i = 1; i < n-1; i++)
+ !         a(i,j) = weight *
+             (b(i+1,j+1) + b(i+1,j  ) + b(i+1,j-1) +
+              b(i  ,j+1) + b(i  ,j  ) + b(i  ,j-1) +
+ --- 44,52 ----
+   
+     // Perform the simulation.
+ !   for (int k = 0; k < nuIterations; ++k) {
+       // Read from b.  Write to a.
+ !     for (int j = 1; j < n-1; j++)
+ !       for (int i = 1; i < n-1; i++)
+ !         a(i,j) = weight *  <co id="tutorial-array_elementwise-doof2d-first_write"></co>
+             (b(i+1,j+1) + b(i+1,j  ) + b(i+1,j-1) +
+              b(i  ,j+1) + b(i  ,j  ) + b(i  ,j-1) +
+ ***************
+ *** 53,58 ****
+   
+       // Read from a.  Write to b.
+ !     for (int j = 1; j < n-1; j++)
+ !       for (int i = 1; i < n-1; i++)
+           b(i,j) = weight *
+             (a(i+1,j+1) + a(i+1,j  ) + a(i+1,j-1) +
+ --- 54,59 ----
+   
+       // Read from a.  Write to b.
+ !     for (int j = 1; j < n-1; j++)
+ !       for (int i = 1; i < n-1; i++)
+           b(i,j) = weight *
+             (a(i+1,j+1) + a(i+1,j  ) + a(i+1,j-1) +
+ ***************
+ *** 62,71 ****
+   
+     // Print out the final central value.
+ !   std::cout << (nuAveragings % 2 ? a(n/2,n/2) : b(n/2,n/2)) << std::endl;
+   
+ !   // The arrays are automatically deallocated.
+   
+ !   // Tell the Pooma library execution has finished.
+     Pooma::finalize();
+     return EXIT_SUCCESS;
+   }
+ --- 63,74 ----
+   
+     // Print out the final central value.
+ !   Pooma::blockAndEvaluate();	// Ensure all computation has finished.
+ !   std::cout &openopen; (nuAveragings % 2 ? a(n/2,n/2) : b(n/2,n/2)) &openopen; std::endl;
+   
+ !   // The arrays are automatically deallocated.  <co id="tutorial-array_elementwise-doof2d-deallocation"></co>
+   
+ !   // Tell the Pooma library execution has finished.  <co id="tutorial-array_elementwise-doof2d-pooma_finish"></co>
+     Pooma::finalize();
+     return EXIT_SUCCESS;
+   }
+ + </programlisting>
Index: examples/Doof2d/Doof2d-Array-parallel-annotated.patch
===================================================================
RCS file: Doof2d-Array-parallel-annotated.patch
diff -N Doof2d-Array-parallel-annotated.patch
*** /dev/null	Fri Mar 23 21:37:44 2001
--- Doof2d-Array-parallel-annotated.patch	Fri Jan  4 10:53:56 2002
***************
*** 0 ****
--- 1,116 ----
+ *** Doof2d-Array-parallel.cpp	Tue Dec  4 11:49:43 2001
+ --- Doof2d-Array-parallel-annotated.cpp	Tue Dec  4 12:24:36 2001
+ ***************
+ *** 1,4 ****
+ ! #include <iostream>		// has std::cout, ...
+ ! #include <stdlib.h>		// has EXIT_SUCCESS
+   #include "Pooma/Arrays.h"	// has Pooma's Array
+   
+ --- 1,5 ----
+ ! <programlisting id="tutorial-array_parallel-doof2d-program" linenumbering="numbered" format="linespecific">
+ ! #include <iostream>		// has std::cout, ...
+ ! #include <stdlib.h>		// has EXIT_SUCCESS
+   #include "Pooma/Arrays.h"	// has Pooma's Array
+   
+ ***************
+ *** 12,17 ****
+     // Ask the user for the number of averagings.
+     long nuAveragings, nuIterations;
+ !   std::cout << "Please enter the number of averagings: ";
+ !   std::cin >> nuAveragings;
+     nuIterations = (nuAveragings+1)/2; // Each iteration performs two averagings.
+   
+ --- 13,18 ----
+     // Ask the user for the number of averagings.
+     long nuAveragings, nuIterations;
+ !   std::cout &openopen; "Please enter the number of averagings: ";
+ !   std::cin &closeclose; nuAveragings;
+     nuIterations = (nuAveragings+1)/2; // Each iteration performs two averagings.
+   
+ ***************
+ *** 19,43 ****
+     // the grid.
+     long n;
+ !   std::cout << "Please enter the array size: ";
+ !   std::cin >> n;
+   
+     // Specify the arrays' domains [0,n) x [0,n).
+ !   Interval<1> N(0, n-1);
+ !   Interval<2> vertDomain(N, N);
+   
+ !   // Set up interior domains [1,n-1) x [1,n-1) for computation.
+ !   Interval<1> I(1,n-2);
+ !   Interval<1> J(1,n-2);
+   
+     // Create the arrays.
+     // The template parameters indicate 2 dimensions, a 'double' element
+     // type, and ordinary 'Brick' storage.
+ !   Array<2, double, Brick> a(vertDomain);
+ !   Array<2, double, Brick> b(vertDomain);
+   
+     // Set up the initial conditions.
+     // All grid values should be zero except for the central value.
+     a = b = 0.0;
+ !   // Ensure all data-parallel computation finishes before accessing a value.
+     Pooma::blockAndEvaluate();
+     b(n/2,n/2) = 1000.0;
+ --- 20,44 ----
+     // the grid.
+     long n;
+ !   std::cout &openopen; "Please enter the array size: ";
+ !   std::cin &closeclose; n;
+   
+     // Specify the arrays' domains [0,n) x [0,n).
+ !   Interval<1> N(0, n-1);
+ !   Interval<2> vertDomain(N, N);
+   
+ !   // Set up interior domains [1,n-1) x [1,n-1) for computation.  <co id="tutorial-array_parallel-doof2d-innerdomain"></co>
+ !   Interval<1> I(1,n-2);
+ !   Interval<1> J(1,n-2);
+   
+     // Create the arrays.
+     // The template parameters indicate 2 dimensions, a 'double' element
+     // type, and ordinary 'Brick' storage.
+ !   Array<2, double, Brick> a(vertDomain);
+ !   Array<2, double, Brick> b(vertDomain);
+   
+     // Set up the initial conditions.
+     // All grid values should be zero except for the central value.
+     a = b = 0.0;
+ !   // Ensure all data-parallel computation finishes before accessing a value.  <co id="tutorial-array_parallel-doof2d-blockAndEvaluate"></co>
+     Pooma::blockAndEvaluate();
+     b(n/2,n/2) = 1000.0;
+ ***************
+ *** 47,52 ****
+   
+     // Perform the simulation.
+ !   for (int k = 0; k < nuIterations; ++k) {
+ !     // Read from b.  Write to a.
+       a(I,J) = weight *
+         (b(I+1,J+1) + b(I+1,J  ) + b(I+1,J-1) +
+ --- 48,53 ----
+   
+     // Perform the simulation.
+ !   for (int k = 0; k < nuIterations; ++k) {
+ !     // Read from b.  Write to a.  <co id="tutorial-array_parallel-doof2d-first_write"></co>
+       a(I,J) = weight *
+         (b(I+1,J+1) + b(I+1,J  ) + b(I+1,J-1) +
+ ***************
+ *** 63,67 ****
+     // Print out the final central value.
+     Pooma::blockAndEvaluate();	// Ensure all computation has finished.
+ !   std::cout << (nuAveragings % 2 ? a(n/2,n/2) : b(n/2,n/2)) << std::endl;
+   
+     // The arrays are automatically deallocated.
+ --- 64,68 ----
+     // Print out the final central value.
+     Pooma::blockAndEvaluate();	// Ensure all computation has finished.
+ !   std::cout &openopen; (nuAveragings % 2 ? a(n/2,n/2) : b(n/2,n/2)) &openopen; std::endl;
+   
+     // The arrays are automatically deallocated.
+ ***************
+ *** 71,72 ****
+ --- 72,74 ----
+     return EXIT_SUCCESS;
+   }
+ + </programlisting>
Index: examples/Doof2d/Doof2d-Array-stencil-annotated.patch
===================================================================
RCS file: Doof2d-Array-stencil-annotated.patch
diff -N Doof2d-Array-stencil-annotated.patch
*** /dev/null	Fri Mar 23 21:37:44 2001
--- Doof2d-Array-stencil-annotated.patch	Fri Jan  4 10:53:56 2002
***************
*** 0 ****
--- 1,152 ----
+ *** Doof2d-Array-stencil.cpp	Tue Dec  4 11:49:39 2001
+ --- Doof2d-Array-stencil-annotated.cpp	Tue Dec  4 12:26:46 2001
+ ***************
+ *** 1,9 ****
+ ! #include <iostream>		// has std::cout, ...
+ ! #include <stdlib.h>		// has EXIT_SUCCESS
+   #include "Pooma/Arrays.h"	// has Pooma's Array
+   
+   // Doof2d: Pooma Arrays, stencil implementation
+   
+ ! // Define the stencil class performing the computation.
+   class DoofNinePt
+   {
+ --- 1,10 ----
+ ! <programlisting id="tutorial-array_stencil-doof2d-program" linenumbering="numbered" format="linespecific">
+ ! #include <iostream>		// has std::cout, ...
+ ! #include <stdlib.h>		// has EXIT_SUCCESS
+   #include "Pooma/Arrays.h"	// has Pooma's Array
+   
+   // Doof2d: Pooma Arrays, stencil implementation
+   
+ ! // Define the stencil class performing the computation.  <co id="tutorial-array_stencil-doof2d-stencil"></co>
+   class DoofNinePt
+   {
+ ***************
+ *** 14,19 ****
+     // This stencil operator is applied to each interior domain position
+     // (i,j).  The "C" template parameter permits use of this stencil
+ !   // operator with both Arrays and Fields.
+ !   template <class C>
+     inline
+     typename C::Element_t
+ --- 15,20 ----
+     // This stencil operator is applied to each interior domain position
+     // (i,j).  The "C" template parameter permits use of this stencil
+ !   // operator with both Arrays and Fields.  <co id="tutorial-array_stencil-doof2d-stencil_operator"></co>
+ !   template <class C>
+     inline
+     typename C::Element_t
+ ***************
+ *** 26,30 ****
+     }
+   
+ !   inline int lowerExtent(int) const { return 1; }
+     inline int upperExtent(int) const { return 1; }
+   
+ --- 27,31 ----
+     }
+   
+ !   inline int lowerExtent(int) const { return 1; }  <co id="tutorial-array_stencil-doof2d-stencil_extent"></co>
+     inline int upperExtent(int) const { return 1; }
+   
+ ***************
+ *** 42,47 ****
+     // Ask the user for the number of averagings.
+     long nuAveragings, nuIterations;
+ !   std::cout << "Please enter the number of averagings: ";
+ !   std::cin >> nuAveragings;
+     nuIterations = (nuAveragings+1)/2; // Each iteration performs two averagings.
+   
+ --- 43,48 ----
+     // Ask the user for the number of averagings.
+     long nuAveragings, nuIterations;
+ !   std::cout &openopen; "Please enter the number of averagings: ";
+ !   std::cin &closeclose; nuAveragings;
+     nuIterations = (nuAveragings+1)/2; // Each iteration performs two averagings.
+   
+ ***************
+ *** 49,68 ****
+     // the grid.
+     long n;
+ !   std::cout << "Please enter the array size: ";
+ !   std::cin >> n;
+   
+     // Specify the arrays' domains [0,n) x [0,n).
+ !   Interval<1> N(0, n-1);
+ !   Interval<2> vertDomain(N, N);
+   
+     // Set up interior domains [1,n-1) x [1,n-1) for computation.
+ !   Interval<1> I(1,n-2);
+ !   Interval<2> interiorDomain(I,I);
+   
+     // Create the arrays.
+     // The template parameters indicate 2 dimensions, a 'double' element
+     // type, and ordinary 'Brick' storage.
+ !   Array<2, double, Brick> a(vertDomain);
+ !   Array<2, double, Brick> b(vertDomain);
+   
+     // Set up the initial conditions.
+ --- 50,69 ----
+     // the grid.
+     long n;
+ !   std::cout &openopen; "Please enter the array size: ";
+ !   std::cin &closeclose; n;
+   
+     // Specify the arrays' domains [0,n) x [0,n).
+ !   Interval<1> N(0, n-1);
+ !   Interval<2> vertDomain(N, N);
+   
+     // Set up interior domains [1,n-1) x [1,n-1) for computation.
+ !   Interval<1> I(1,n-2);
+ !   Interval<2> interiorDomain(I,I);
+   
+     // Create the arrays.
+     // The template parameters indicate 2 dimensions, a 'double' element
+     // type, and ordinary 'Brick' storage.
+ !   Array<2, double, Brick> a(vertDomain);
+ !   Array<2, double, Brick> b(vertDomain);
+   
+     // Set up the initial conditions.
+ ***************
+ *** 73,82 ****
+     b(n/2,n/2) = 1000.0;
+   
+ !   // Create the stencil performing the computation.
+ !   Stencil<DoofNinePt> stencil;
+   
+     // Perform the simulation.
+ !   for (int k = 0; k < nuIterations; ++k) {
+ !     // Read from b.  Write to a.
+       a(interiorDomain) = stencil(b, interiorDomain);
+   
+ --- 74,83 ----
+     b(n/2,n/2) = 1000.0;
+   
+ !   // Create the stencil performing the computation.  <co id="tutorial-array_stencil-doof2d-stencil_creation"></co>
+ !   Stencil<DoofNinePt> stencil;
+   
+     // Perform the simulation.
+ !   for (int k = 0; k < nuIterations; ++k) {
+ !     // Read from b.  Write to a.  <co id="tutorial-array_stencil-doof2d-first_write"></co>
+       a(interiorDomain) = stencil(b, interiorDomain);
+   
+ ***************
+ *** 87,91 ****
+     // Print out the final central value.
+     Pooma::blockAndEvaluate();	// Ensure all computation has finished.
+ !   std::cout << (nuAveragings % 2 ? a(n/2,n/2) : b(n/2,n/2)) << std::endl;
+   
+     // The arrays are automatically deallocated.
+ --- 88,92 ----
+     // Print out the final central value.
+     Pooma::blockAndEvaluate();	// Ensure all computation has finished.
+ !   std::cout &openopen; (nuAveragings % 2 ? a(n/2,n/2) : b(n/2,n/2)) &openopen; std::endl;
+   
+     // The arrays are automatically deallocated.
+ ***************
+ *** 95,96 ****
+ --- 96,98 ----
+     return EXIT_SUCCESS;
+   }
+ + </programlisting>
Index: examples/Doof2d/Doof2d-C-element-annotated.patch
===================================================================
RCS file: Doof2d-C-element-annotated.patch
diff -N Doof2d-C-element-annotated.patch
*** /dev/null	Fri Mar 23 21:37:44 2001
--- Doof2d-C-element-annotated.patch	Fri Jan  4 10:53:56 2002
***************
*** 0 ****
--- 1,150 ----
+ *** Doof2d-C-element.cpp	Tue Nov 27 08:36:38 2001
+ --- Doof2d-C-element-annotated.cpp	Tue Nov 27 12:08:03 2001
+ ***************
+ *** 1,4 ****
+ ! #include <iostream>		// has std::cout, ...
+ ! #include <stdlib.h>		// has EXIT_SUCCESS
+   
+   // Doof2d: C-like, element-wise implementation
+ --- 1,5 ----
+ ! <programlisting id="tutorial-hand_coded-doof2d-program" linenumbering="numbered" format="linespecific">
+ ! #include <iostream>		// has std::cout, ...
+ ! #include <stdlib.h>		// has EXIT_SUCCESS
+   
+   // Doof2d: C-like, element-wise implementation
+ ***************
+ *** 6,30 ****
+   int main()
+   {
+ !   // Ask the user for the number of averagings.
+     long nuAveragings, nuIterations;
+ !   std::cout << "Please enter the number of averagings: ";
+ !   std::cin >> nuAveragings;
+     nuIterations = (nuAveragings+1)/2; // Each iteration performs two averagings.
+   
+ !   // Use two-dimensional grids of values.
+     double **a;
+     double **b;
+   
+     // Ask the user for the number n of elements along one dimension of
+ !   // the grid.
+     long n;
+ !   std::cout << "Please enter the array size: ";
+ !   std::cin >> n;
+   
+ !   // Allocate the arrays.
+     typedef double* doublePtr;
+     a = new doublePtr[n];
+     b = new doublePtr[n];
+ !   for (int i = 0; i < n; i++) {
+       a[i] = new double[n];
+       b[i] = new double[n];
+ --- 7,31 ----
+   int main()
+   {
+ !   // Ask the user for the number of averagings.  <co id="tutorial-hand_coded-doof2d-nuaveragings"></co>
+     long nuAveragings, nuIterations;
+ !   std::cout &openopen; "Please enter the number of averagings: ";
+ !   std::cin &closeclose; nuAveragings;
+     nuIterations = (nuAveragings+1)/2; // Each iteration performs two averagings.
+   
+ !   // Use two-dimensional grids of values.  <co id="tutorial-hand_coded-doof2d-array_storage"></co>
+     double **a;
+     double **b;
+   
+     // Ask the user for the number n of elements along one dimension of
+ !   // the grid.  <co id="tutorial-hand_coded-doof2d-grid_size"></co>
+     long n;
+ !   std::cout &openopen; "Please enter the array size: ";
+ !   std::cin &closeclose; n;
+   
+ !   // Allocate the arrays.  <co id="tutorial-hand_coded-doof2d-allocation"></co>
+     typedef double* doublePtr;
+     a = new doublePtr[n];
+     b = new doublePtr[n];
+ !   for (int i = 0; i < n; i++) {
+       a[i] = new double[n];
+       b[i] = new double[n];
+ ***************
+ *** 32,49 ****
+   
+     // Set up the initial conditions.
+ !   // All grid values should be zero except for the central value.
+ !   for (int j = 0; j < n; j++)
+ !     for (int i = 0; i < n; i++)
+         a[i][j] = b[i][j] = 0.0;
+     b[n/2][n/2] = 1000.0;
+   
+ !   // In the average, weight elements with this value.
+     const double weight = 1.0/9.0;
+   
+     // Perform the simulation.
+ !   for (int k = 0; k < nuIterations; ++k) {
+ !     // Read from b.  Write to a.
+ !     for (int j = 1; j < n-1; j++)
+ !       for (int i = 1; i < n-1; i++)
+           a[i][j] = weight *
+             (b[i+1][j+1] + b[i+1][j  ] + b[i+1][j-1] +
+ --- 33,50 ----
+   
+     // Set up the initial conditions.
+ !   // All grid values should be zero except for the central value.  <co id="tutorial-hand_coded-doof2d-initialization"></co>
+ !   for (int j = 0; j < n; j++)
+ !     for (int i = 0; i < n; i++)
+         a[i][j] = b[i][j] = 0.0;
+     b[n/2][n/2] = 1000.0;
+   
+ !   // In the average, weight elements with this value.  <co id="tutorial-hand_coded-doof2d-constants"></co>
+     const double weight = 1.0/9.0;
+   
+     // Perform the simulation.
+ !   for (int k = 0; k < nuIterations; ++k) {
+ !     // Read from b.  Write to a.  <co id="tutorial-hand_coded-doof2d-first_write"></co>
+ !     for (int j = 1; j < n-1; j++)
+ !       for (int i = 1; i < n-1; i++)
+           a[i][j] = weight *
+             (b[i+1][j+1] + b[i+1][j  ] + b[i+1][j-1] +
+ ***************
+ *** 51,57 ****
+              b[i-1][j+1] + b[i-1][j  ] + b[i-1][j-1]);
+   
+ !     // Read from a.  Write to b.
+ !     for (int j = 1; j < n-1; j++)
+ !       for (int i = 1; i < n-1; i++)
+           b[i][j] = weight *
+             (a[i+1][j+1] + a[i+1][j  ] + a[i+1][j-1] +
+ --- 52,58 ----
+              b[i-1][j+1] + b[i-1][j  ] + b[i-1][j-1]);
+   
+ !     // Read from a.  Write to b.  <co id="tutorial-hand_coded-doof2d-second_write"></co>
+ !     for (int j = 1; j < n-1; j++)
+ !       for (int i = 1; i < n-1; i++)
+           b[i][j] = weight *
+             (a[i+1][j+1] + a[i+1][j  ] + a[i+1][j-1] +
+ ***************
+ *** 60,68 ****
+     }
+   
+ !   // Print out the final central value.
+ !   std::cout << (nuAveragings % 2 ? a[n/2][n/2] : b[n/2][n/2]) << std::endl;
+   
+ !   // Deallocate the arrays.
+ !   for (int i = 0; i < n; i++) {
+       delete [] a[i];
+       delete [] b[i];
+ --- 61,69 ----
+     }
+   
+ !   // Print out the final central value.  <co id="tutorial-hand_coded-doof2d-answer"></co>
+ !   std::cout &openopen; (nuAveragings % 2 ? a[n/2][n/2] : b[n/2][n/2]) &openopen; std::endl;
+   
+ !   // Deallocate the arrays.  <co id="tutorial-hand_coded-doof2d-deallocation"></co>
+ !   for (int i = 0; i < n; i++) {
+       delete [] a[i];
+       delete [] b[i];
+ ***************
+ *** 73,74 ****
+ --- 74,76 ----
+     return EXIT_SUCCESS;
+   }
+ + </programlisting>
Index: examples/Doof2d/Doof2d-Field-distributed-annotated.patch
===================================================================
RCS file: Doof2d-Field-distributed-annotated.patch
diff -N Doof2d-Field-distributed-annotated.patch
*** /dev/null	Fri Mar 23 21:37:44 2001
--- Doof2d-Field-distributed-annotated.patch	Fri Jan  4 10:53:56 2002
***************
*** 0 ****
--- 1,176 ----
+ *** Doof2d-Field-distributed.cpp	Wed Dec  5 14:05:10 2001
+ --- Doof2d-Field-distributed-annotated.cpp	Wed Dec  5 14:41:24 2001
+ ***************
+ *** 1,3 ****
+ ! #include <stdlib.h>		// has EXIT_SUCCESS
+   #include "Pooma/Fields.h"	// has Pooma's Field
+   
+ --- 1,4 ----
+ ! <programlisting id="tutorial-field_distributed-doof2d-program" linenumbering="numbered" format="linespecific">
+ ! #include <stdlib.h>		// has EXIT_SUCCESS
+   #include "Pooma/Fields.h"	// has Pooma's Field
+   
+ ***************
+ *** 12,16 ****
+     // canot use standard input and output.  Instead we use command-line
+     // arguments, which are replicated, for input, and we use an Inform
+ !   // stream for output.
+     Inform output;
+   
+ --- 13,17 ----
+     // canot use standard input and output.  Instead we use command-line
+     // arguments, which are replicated, for input, and we use an Inform
+ !   // stream for output.  <co id="tutorial-field_distributed-doof2d-io"></co>
+     Inform output;
+   
+ ***************
+ *** 18,22 ****
+     if (argc != 4) {
+       // Incorrect number of command-line arguments.
+ !     output << argv[0] << ": number-of-processors number-of-averagings number-of-values" << std::endl;
+       return EXIT_FAILURE;
+     }
+ --- 19,23 ----
+     if (argc != 4) {
+       // Incorrect number of command-line arguments.
+ !     output &openopen; argv[0] &openopen; ": number-of-processors number-of-averagings number-of-values" &openopen; std::endl;
+       return EXIT_FAILURE;
+     }
+ ***************
+ *** 25,33 ****
+     // Determine the number of processors.
+     long nuProcessors;
+ !   nuProcessors = strtol(argv[1], &tail, 0);
+   
+     // Determine the number of averagings.
+     long nuAveragings, nuIterations;
+ !   nuAveragings = strtol(argv[2], &tail, 0);
+     nuIterations = (nuAveragings+1)/2; // Each iteration performs two averagings.
+   
+ --- 26,34 ----
+     // Determine the number of processors.
+     long nuProcessors;
+ !   nuProcessors = strtol(argv[1], &tail, 0);
+   
+     // Determine the number of averagings.
+     long nuAveragings, nuIterations;
+ !   nuAveragings = strtol(argv[2], &tail, 0);
+     nuIterations = (nuAveragings+1)/2; // Each iteration performs two averagings.
+   
+ ***************
+ *** 35,39 ****
+     // the grid.
+     long n;
+ !   n = strtol(argv[3], &tail, 0);
+     // The dimension must be a multiple of the number of processors
+     // since we are using a UniformGridLayout.
+ --- 36,40 ----
+     // the grid.
+     long n;
+ !   n = strtol(argv[3], &tail, 0);
+     // The dimension must be a multiple of the number of processors
+     // since we are using a UniformGridLayout.
+ ***************
+ *** 41,50 ****
+   
+     // Specify the fields' domains [0,n) x [0,n).
+ !   Interval<1> N(0, n-1);
+ !   Interval<2> vertDomain(N, N);
+   
+     // Set up interior domains [1,n-1) x [1,n-1) for computation.
+ !   Interval<1> I(1,n-2);
+ !   Interval<1> J(1,n-2);
+   
+     // Partition the fields' domains uniformly, i.e., each patch has the
+ --- 42,51 ----
+   
+     // Specify the fields' domains [0,n) x [0,n).
+ !   Interval<1> N(0, n-1);
+ !   Interval<2> vertDomain(N, N);
+   
+     // Set up interior domains [1,n-1) x [1,n-1) for computation.
+ !   Interval<1> I(1,n-2);
+ !   Interval<1> J(1,n-2);
+   
+     // Partition the fields' domains uniformly, i.e., each patch has the
+ ***************
+ *** 52,74 ****
+     // dimension.  Guard layers optimize communication between patches.
+     // Internal guards surround each patch.  External guards surround
+ !   // the entire field domain.
+ !   UniformGridPartition<2> partition(Loc<2>(nuProcessors, nuProcessors),
+ ! 				    GuardLayers<2>(1),  // internal
+ ! 				    GuardLayers<2>(0)); // external
+ !   UniformGridLayout<2> layout(vertDomain, partition, DistributedTag());
+   
+     // Specify the fields' mesh, i.e., its spatial extent, and its
+ !   // centering type.
+ !   UniformRectilinearMesh<2> mesh(layout, Vector<2>(0.0), Vector<2>(1.0, 1.0));
+ !   Centering<2> cell = canonicalCentering<2>(CellType, Continuous, AllDim);
+   
+     // The template parameters indicate a mesh and a 'double'
+     // element type.  MultiPatch indicates multiple computation patches,
+     // i.e., distributed computation.  The UniformTag indicates the
+ !   // patches should have the same size.  Each patch has Brick type.
+ !   Field<UniformRectilinearMesh<2>, double, MultiPatch<UniformTag,
+ !     Remote<Brick> > > a(cell, layout, mesh);
+ !   Field<UniformRectilinearMesh<2>, double, MultiPatch<UniformTag,
+ !     Remote<Brick> > > b(cell, layout, mesh);
+   
+     // Set up the initial conditions.
+ --- 53,75 ----
+     // dimension.  Guard layers optimize communication between patches.
+     // Internal guards surround each patch.  External guards surround
+ !   // the entire field domain.  <co id="tutorial-field_distributed-doof2d-layout"></co>
+ !   UniformGridPartition<2> partition(Loc<2>(nuProcessors, nuProcessors),
+ ! 				    GuardLayers<2>(1),  // internal
+ ! 				    GuardLayers<2>(0)); // external
+ !   UniformGridLayout<2> layout(vertDomain, partition, DistributedTag());
+   
+     // Specify the fields' mesh, i.e., its spatial extent, and its
+ !   // centering type.  <co id="tutorial-field_distributed-doof2d-mesh"></co>
+ !   UniformRectilinearMesh<2> mesh(layout, Vector<2>(0.0), Vector<2>(1.0, 1.0));
+ !   Centering<2> cell = canonicalCentering<2>(CellType, Continuous, AllDim);
+   
+     // The template parameters indicate a mesh and a 'double'
+     // element type.  MultiPatch indicates multiple computation patches,
+     // i.e., distributed computation.  The UniformTag indicates the
+ !   // patches should have the same size.  Each patch has Brick type.  <co id="tutorial-field_distributed-doof2d-remote"></co>
+ !   Field<UniformRectilinearMesh<2>, double, MultiPatch<UniformTag,
+ !     Remote<Brick> > > a(cell, layout, mesh);
+ !   Field<UniformRectilinearMesh<2>, double, MultiPatch<UniformTag,
+ !     Remote<Brick> > > b(cell, layout, mesh);
+   
+     // Set up the initial conditions.
+ ***************
+ *** 83,87 ****
+   
+     // Perform the simulation.
+ !   for (int k = 0; k < nuIterations; ++k) {
+       // Read from b.  Write to a.
+       a(I,J) = weight *
+ --- 84,88 ----
+   
+     // Perform the simulation.
+ !   for (int k = 0; k < nuIterations; ++k) {
+       // Read from b.  Write to a.
+       a(I,J) = weight *
+ ***************
+ *** 99,103 ****
+     // Print out the final central value.
+     Pooma::blockAndEvaluate();	// Ensure all computation has finished.
+ !   output << (nuAveragings % 2 ? a(n/2,n/2) : b(n/2,n/2)) << std::endl;
+   
+     // The fields are automatically deallocated.
+ --- 100,104 ----
+     // Print out the final central value.
+     Pooma::blockAndEvaluate();	// Ensure all computation has finished.
+ !   output &openopen; (nuAveragings % 2 ? a(n/2,n/2) : b(n/2,n/2)) &openopen; std::endl;
+   
+     // The fields are automatically deallocated.
+ ***************
+ *** 107,108 ****
+ --- 108,110 ----
+     return EXIT_SUCCESS;
+   }
+ + </programlisting>
Index: examples/Doof2d/Doof2d-Field-parallel-annotated.patch
===================================================================
RCS file: Doof2d-Field-parallel-annotated.patch
diff -N Doof2d-Field-parallel-annotated.patch
*** /dev/null	Fri Mar 23 21:37:44 2001
--- Doof2d-Field-parallel-annotated.patch	Fri Jan  4 10:53:56 2002
***************
*** 0 ****
--- 1,120 ----
+ *** Doof2d-Field-parallel.cpp	Tue Dec  4 10:01:28 2001
+ --- Doof2d-Field-parallel-annotated.cpp	Tue Dec  4 11:04:26 2001
+ ***************
+ *** 1,5 ****
+ ! #include <iostream>		// has std::cout, ...
+ ! #include <stdlib.h>		// has EXIT_SUCCESS
+ ! #include "Pooma/Fields.h"	// has Pooma's Field
+   
+   // Doof2d: Pooma Fields, data-parallel implementation
+ --- 1,6 ----
+ ! <programlisting id="tutorial-field_parallel-doof2d-program" linenumbering="numbered" format="linespecific">
+ ! #include <iostream>		// has std::cout, ...
+ ! #include <stdlib.h>		// has EXIT_SUCCESS
+ ! #include "Pooma/Fields.h"	// has Pooma's Field  <co id="tutorial-field_parallel-doof2d-header"></co>
+   
+   // Doof2d: Pooma Fields, data-parallel implementation
+ ***************
+ *** 12,17 ****
+     // Ask the user for the number of averagings.
+     long nuAveragings, nuIterations;
+ !   std::cout << "Please enter the number of averagings: ";
+ !   std::cin >> nuAveragings;
+     nuIterations = (nuAveragings+1)/2; // Each iteration performs two averagings.
+   
+ --- 13,18 ----
+     // Ask the user for the number of averagings.
+     long nuAveragings, nuIterations;
+ !   std::cout &openopen; "Please enter the number of averagings: ";
+ !   std::cin &closeclose; nuAveragings;
+     nuIterations = (nuAveragings+1)/2; // Each iteration performs two averagings.
+   
+ ***************
+ *** 19,44 ****
+     // the grid.
+     long n;
+ !   std::cout << "Please enter the field size: ";
+ !   std::cin >> n;
+   
+     // Specify the fields' domains [0,n) x [0,n).
+ !   Interval<1> N(0, n-1);
+ !   Interval<2> vertDomain(N, N);
+   
+     // Set up interior domains [1,n-1) x [1,n-1) for computation.
+ !   Interval<1> I(1,n-2);
+ !   Interval<1> J(1,n-2);
+   
+     // Specify the fields' mesh, i.e., its spatial extent, and its
+ !   // centering type.
+ !   DomainLayout<2> layout(vertDomain);
+ !   UniformRectilinearMesh<2> mesh(layout, Vector<2>(0.0), Vector<2>(1.0, 1.0));
+ !   Centering<2> cell = canonicalCentering<2>(CellType, Continuous, AllDim);
+   
+     // Create the fields.
+     // The template parameters indicate a mesh, a 'double' element
+ !   // type, and ordinary 'Brick' storage.
+ !   Field<UniformRectilinearMesh<2>, double, Brick> a(cell, layout, mesh);
+ !   Field<UniformRectilinearMesh<2>, double, Brick> b(cell, layout, mesh);
+   
+     // Set up the initial conditions.
+ --- 20,45 ----
+     // the grid.
+     long n;
+ !   std::cout &openopen; "Please enter the field size: ";
+ !   std::cin &closeclose; n;
+   
+     // Specify the fields' domains [0,n) x [0,n).
+ !   Interval<1> N(0, n-1);
+ !   Interval<2> vertDomain(N, N);
+   
+     // Set up interior domains [1,n-1) x [1,n-1) for computation.
+ !   Interval<1> I(1,n-2);
+ !   Interval<1> J(1,n-2);
+   
+     // Specify the fields' mesh, i.e., its spatial extent, and its
+ !   // centering type.  <co id="tutorial-field_parallel-doof2d-mesh"></co>
+ !   DomainLayout<2> layout(vertDomain);
+ !   UniformRectilinearMesh<2> mesh(layout, Vector<2>(0.0), Vector<2>(1.0, 1.0));
+ !   Centering<2> cell = canonicalCentering<2>(CellType, Continuous, AllDim);
+   
+     // Create the fields.
+     // The template parameters indicate a mesh, a 'double' element
+ !   // type, and ordinary 'Brick' storage.  <co id="tutorial-field_parallel-doof2d-field_creation"></co>
+ !   Field<UniformRectilinearMesh<2>, double, Brick> a(cell, layout, mesh);
+ !   Field<UniformRectilinearMesh<2>, double, Brick> b(cell, layout, mesh);
+   
+     // Set up the initial conditions.
+ ***************
+ *** 51,56 ****
+   
+     // Perform the simulation.
+ !   for (int k = 0; k < nuIterations; ++k) {
+ !     // Read from b.  Write to a.
+       a(I,J) = weight *
+         (b(I+1,J+1) + b(I+1,J  ) + b(I+1,J-1) +
+ --- 52,57 ----
+   
+     // Perform the simulation.
+ !   for (int k = 0; k < nuIterations; ++k) {
+ !     // Read from b.  Write to a.  <co id="tutorial-field_parallel-doof2d-first_write"></co>
+       a(I,J) = weight *
+         (b(I+1,J+1) + b(I+1,J  ) + b(I+1,J-1) +
+ ***************
+ *** 67,71 ****
+     // Print out the final central value.
+     Pooma::blockAndEvaluate();	// Ensure all computation has finished.
+ !   std::cout << (nuAveragings % 2 ? a(n/2,n/2) : b(n/2,n/2)) << std::endl;
+   
+     // The fields are automatically deallocated.
+ --- 68,72 ----
+     // Print out the final central value.
+     Pooma::blockAndEvaluate();	// Ensure all computation has finished.
+ !   std::cout &openopen; (nuAveragings % 2 ? a(n/2,n/2) : b(n/2,n/2)) &openopen; std::endl;
+   
+     // The fields are automatically deallocated.
+ ***************
+ *** 75,76 ****
+ --- 76,78 ----
+     return EXIT_SUCCESS;
+   }
+ + </programlisting>
Index: examples/Doof2d/Makefile
===================================================================
RCS file: Makefile
diff -N Makefile
*** /dev/null	Fri Mar 23 21:37:44 2001
--- Makefile	Fri Jan  4 10:53:56 2002
***************
*** 0 ****
--- 1,13 ----
+ ### Oldham, Jeffrey D.
+ ### 2001Nov27
+ ### Pooma
+ ###
+ ### Produce Annotated Source Code
+ 
+ all: Doof2d-C-element-annotated.cpp Doof2d-Array-element-annotated.cpp \
+      Doof2d-Array-parallel-annotated.cpp Doof2d-Array-stencil-annotated.cpp \
+      Doof2d-Array-distributed-annotated.cpp \
+      Doof2d-Field-parallel-annotated.cpp Doof2d-Field-distributed-annotated.cpp
+ 
+ %-annotated.cpp: %-annotated.patch %.cpp
+ 	patch -o $@ < $<
Index: examples/Sequential/Makefile
===================================================================
RCS file: Makefile
diff -N Makefile
*** /dev/null	Fri Mar 23 21:37:44 2001
--- Makefile	Fri Jan  4 10:53:56 2002
***************
*** 0 ****
--- 1,10 ----
+ ### Oldham, Jeffrey D.
+ ### 2001Nov27
+ ### Pooma
+ ###
+ ### Produce Annotated Source Code
+ 
+ all: initialize-finalize-annotated.cpp
+ 
+ %-annotated.cpp: %-annotated.patch %.cpp
+ 	patch -o $@ < $<
Index: examples/Sequential/initialize-finalize-annotated.patch
===================================================================
RCS file: initialize-finalize-annotated.patch
diff -N initialize-finalize-annotated.patch
*** /dev/null	Fri Mar 23 21:37:44 2001
--- initialize-finalize-annotated.patch	Fri Jan  4 10:53:56 2002
***************
*** 0 ****
--- 1,14 ----
+ *** initialize-finalize.cpp	Sat Dec 15 15:35:57 2001
+ --- initialize-finalize-annotated.cpp	Sun Dec 16 14:24:43 2001
+ ***************
+ *** 1,2 ****
+ --- 1,3 ----
+ + <programlisting id="initialize-finalize-program" linenumbering="numbered" format="linespecific">
+   #include "Pooma/Pooma.h"
+   
+ ***************
+ *** 10,11 ****
+ --- 11,13 ----
+     return 0;
+   }
+ + </programlisting>
Index: examples/Templates/Makefile
===================================================================
RCS file: Makefile
diff -N Makefile
*** /dev/null	Fri Mar 23 21:37:44 2001
--- Makefile	Fri Jan  4 10:53:56 2002
***************
*** 0 ****
--- 1,10 ----
+ ### Oldham, Jeffrey D.
+ ### 2002Jan04
+ ### Pooma
+ ###
+ ### Produce Annotated Source Code
+ 
+ all: pairs-templated-annotated.cpp pairs-untemplated-annotated.cpp
+ 
+ %-annotated.cpp: %-annotated.patch %.cpp
+ 	patch -o $@ < $<
Index: examples/Templates/pairs-templated-annotated.patch
===================================================================
RCS file: pairs-templated-annotated.patch
diff -N pairs-templated-annotated.patch
*** /dev/null	Fri Mar 23 21:37:44 2001
--- pairs-templated-annotated.patch	Fri Jan  4 10:53:56 2002
***************
*** 0 ****
--- 1,37 ----
+ *** pairs-templated.cpp	Wed Dec 26 14:01:38 2001
+ --- pairs-templated-annotated.cpp	Wed Dec 26 14:12:51 2001
+ ***************
+ *** 1,15 ****
+ ! // Declare a template class storing a pair of values with the same type.
+ ! template <typename T>
+   struct pair {
+ !   pair(const int& left, const int& right)
+       : left_(left), right_(right) {}
+   
+ !   T left_;
+     T right_;
+   };
+   
+ ! // Use a class storing a pair of integers.
+ ! pair<int> pair1;
+   
+   // Use a class storing a pair of doubles;
+ ! pair<double> pair2;
+ --- 1,17 ----
+ ! <programlisting id="template_programming-template_use-templated_pair_program" linenumbering="numbered" format="linespecific">
+ ! // Declare a template class storing a pair of values with the same type.  <co id="template_programming-template_use-templated_pair_program-template_declaration"></co>
+ ! template <typename T>
+   struct pair {
+ !   pair(const T& left, const T& right)  // <co id="template_programming-template_use-templated_pair_program-constructor"></co>
+       : left_(left), right_(right) {}
+   
+ !   T left_;  // <co id="template_programming-template_use-templated_pair_program-members"></co>
+     T right_;
+   };
+   
+ ! // Use a class storing a pair of integers. <co id="template_programming-template_use-templated_pair_program-use"></co>
+ ! pair<int> pair1;
+   
+   // Use a class storing a pair of doubles;
+ ! pair<double> pair2;
+ ! </programlisting>
Index: examples/Templates/pairs-untemplated-annotated.patch
===================================================================
RCS file: pairs-untemplated-annotated.patch
diff -N pairs-untemplated-annotated.patch
*** /dev/null	Fri Mar 23 21:37:44 2001
--- pairs-untemplated-annotated.patch	Fri Jan  4 10:53:56 2002
***************
*** 0 ****
--- 1,35 ----
+ *** pairs-untemplated.cpp	Wed Dec 26 13:48:10 2001
+ --- pairs-untemplated-annotated.cpp	Wed Dec 26 14:02:58 2001
+ ***************
+ *** 1,5 ****
+   // Declare a class storing a pair of integers.
+   struct pairOfInts {
+ !   pairOfInts(const int& left, const int& right)
+       : left_(left), right_(right) {}
+   
+ --- 1,6 ----
+ + <programlisting id="template_programming-template_use-untemplated_pair_program" linenumbering="numbered" format="linespecific">
+   // Declare a class storing a pair of integers.
+   struct pairOfInts {
+ !   pairOfInts(const int& left, const int& right)
+       : left_(left), right_(right) {}
+   
+ ***************
+ *** 10,14 ****
+   // Declare a class storing a pair of doubles.
+   struct pairOfDoubles {
+ !   pairOfDoubles(const double& left, const double& right)
+       : left_(left), right_(right) {}
+   
+ --- 11,15 ----
+   // Declare a class storing a pair of doubles.
+   struct pairOfDoubles {
+ !   pairOfDoubles(const double& left, const double& right)
+       : left_(left), right_(right) {}
+   
+ ***************
+ *** 16,17 ****
+ --- 17,19 ----
+     double right_;
+   };
+ + </programlisting>


More information about the pooma-dev mailing list