/[escript]/trunk/escript/src/Taipan.cpp
ViewVC logotype

Diff of /trunk/escript/src/Taipan.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 121 by jgs, Fri May 6 04:26:16 2005 UTC revision 122 by jgs, Thu Jun 9 05:38:05 2005 UTC
# Line 15  Line 15 
15  #include "escript/Data/Taipan.h"  #include "escript/Data/Taipan.h"
16    
17  #include <iostream>  #include <iostream>
18    #include <cassert>
19    #ifdef _OPENMP
20    #include <omp.h>
21    #endif
22    
23  using namespace std;  using namespace std;
24    
# Line 53  Taipan::new_array(int dim, int N) { Line 57  Taipan::new_array(int dim, int N) {
57    assert(totalElements >= 0);    assert(totalElements >= 0);
58    
59    int len = 0;    int len = 0;
60                                                                                                                                          
61      #ifdef _OPENMP
62      int numThreads = omp_get_num_threads();
63      #else
64    int numThreads = 1;    int numThreads = 1;
65      #endif
66    
67    Taipan_MemTable *tab;    Taipan_MemTable *tab;
68    Taipan_MemTable *new_tab;    Taipan_MemTable *new_tab;
69    Taipan_MemTable *tab_prev;    Taipan_MemTable *tab_prev;
70    
71    //numThreads = omp_get_max_threads();  //  numThreads = omp_get_max_threads();
72    
73    // is a suitable array already available?    // is a suitable array already available?
74    if (memTable_Root != 0) {    if (memTable_Root != 0) {
# Line 96  Taipan::new_array(int dim, int N) { Line 105  Taipan::new_array(int dim, int N) {
105    
106    // allocate and initialise the new array    // allocate and initialise the new array
107    new_tab->array = new double[len];    new_tab->array = new double[len];
108      int i,j;
109    //#pragma omp parallel for private(i,j)    #pragma omp parallel for private(i,j) schedule(static)
110    for (int i=0; i<N; i++) {    for (i=0; i<N; i++) {
111      for (int j=0; j<dim; j++) {      for (j=0; j<dim; j++) {
112        new_tab->array[j+dim*i]=0.0;        new_tab->array[j+dim*i]=0.0;
113      }      }
114    }    }
   
115    totalElements += len;    totalElements += len;
116    
117    return new_tab->array;    return new_tab->array;

Legend:
Removed from v.121  
changed lines
  Added in v.122

  ViewVC Help
Powered by ViewVC 1.1.26