Manual Patch: Example Code 1 of x

Jeffrey D . Oldham oldham at codesourcery.com
Thu Jan 31 22:57:00 UTC 2002


This is the first of x changes to the example code written for the
manual.

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

	* Doof2d/Doof2d-Array-distributed.cpp (main): Fix typo in comment.
	* Doof2d/Doof2d-C-element.cpp (main): Shorten comment.
	* Sequential/pairs-templated.cpp: New file.
	* Sequential/pairs-untemplated.cpp: Likewise.

Applied to	mainline

Thanks,
Jeffrey D. Oldham
oldham at codesourcery.com
-------------- next part --------------
Index: Doof2d/Doof2d-Array-distributed.cpp
===================================================================
RCS file: /home/pooma/Repository/r2/examples/Manual/Doof2d/Doof2d-Array-distributed.cpp,v
retrieving revision 1.3
diff -c -p -r1.3 Doof2d-Array-distributed.cpp
*** Doof2d/Doof2d-Array-distributed.cpp	2002/01/25 03:45:54	1.3
--- Doof2d/Doof2d-Array-distributed.cpp	2002/01/31 22:49:54
*************** int main(int argc, char *argv[])
*** 39,45 ****
    Pooma::initialize(argc,argv);
  
    // Since multiple copies of this program may simultaneously run, we
!   // 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;
--- 39,45 ----
    Pooma::initialize(argc,argv);
  
    // Since multiple copies of this program may simultaneously run, we
!   // cannot 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;
Index: Doof2d/Doof2d-C-element.cpp
===================================================================
RCS file: /home/pooma/Repository/r2/examples/Manual/Doof2d/Doof2d-C-element.cpp,v
retrieving revision 1.3
diff -c -p -r1.3 Doof2d-C-element.cpp
*** Doof2d/Doof2d-C-element.cpp	2002/01/25 03:45:54	1.3
--- Doof2d/Doof2d-C-element.cpp	2002/01/31 22:49:54
*************** int main()
*** 37,43 ****
        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.
--- 37,43 ----
        a[i][j] = b[i][j] = 0.0;
    b[n/2][n/2] = 1000.0;
  
!   // Average using this weight.
    const double weight = 1.0/9.0;
  
    // Perform the simulation.
Index: Sequential/pairs-templated.cpp
===================================================================
RCS file: pairs-templated.cpp
diff -N pairs-templated.cpp
*** /dev/null	Fri Mar 23 21:37:44 2001
--- pairs-templated.cpp	Thu Jan 31 15:49:54 2002
***************
*** 0 ****
--- 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_;
+ };
+ 
+ // Define a class storing a pair of integers.
+ pair<int> pair1;
+ 
+ // Define a class storing a pair of doubles;
+ pair<double> pair2;
Index: Sequential/pairs-untemplated.cpp
===================================================================
RCS file: pairs-untemplated.cpp
diff -N pairs-untemplated.cpp
*** /dev/null	Fri Mar 23 21:37:44 2001
--- pairs-untemplated.cpp	Thu Jan 31 15:49:54 2002
***************
*** 0 ****
--- 1,17 ----
+ // Declare a class storing a pair of integers.
+ struct pairOfInts {
+   pairOfInts(const int& left, const int& right)
+     : left_(left), right_(right) {}
+ 
+   int left_;
+   int right_;
+ };
+ 
+ // Declare a class storing a pair of doubles.
+ struct pairOfDoubles {
+   pairOfDoubles(const double& left, const double& right)
+     : left_(left), right_(right) {}
+ 
+   double left_;
+   double right_;
+ };


More information about the pooma-dev mailing list