Changeset 122 for XMLIO_V2/dev/dev_rv/src/XMLIO/grid.hpp
- Timestamp:
- 09/20/10 17:30:34 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XMLIO_V2/dev/dev_rv/src/XMLIO/grid.hpp
r120 r122 13 13 CGrid(void) : ObjectTemplate<CGrid>(), GridAttribut(), hasAxis(false), axis(NULL), domain(NULL) 14 14 { /* Ne rien faire de plus */ } 15 15 16 CGrid(const string& _id) : ObjectTemplate<CGrid>(_id), GridAttribut(), hasAxis(false), axis(NULL), domain(NULL) 16 17 { /* Ne rien faire de plus */ } 17 18 18 19 static string GetName(void) { return ("grid"); } 20 21 const CAxis* getRelAxis(void) const { return (axis); } 22 const CDomain* getRelDomain(void) const { return (domain); } 19 23 20 24 inline void solveReference(void) ; … … 24 28 inline void computeIndex(void); 25 29 26 inline void storeField(const Array<double,1>& field, Array<double,1>& stored); 27 inline void storeField(const Array<double,2>& field, Array<double,1>& stored); 28 inline void storeField(const Array<double,3>& field, Array<double,1>& stored); 29 inline void storeField(const double* const data, Array<double,1>& stored); 30 31 inline void outputField(const Array<double,1>& stored, Array<double,2>& outField); 32 inline void outputField(const Array<double,1>& stored, Array<double,3>& outField); 30 bool _hasAxis(void) const { return (hasAxis); } 31 32 inline void storeField(const Array<double, 1>& field, Array<double, 1>& stored); 33 inline void storeField(const Array<double, 2>& field, Array<double, 1>& stored); 34 inline void storeField(const Array<double, 3>& field, Array<double, 1>& stored); 35 inline void storeField(const double* const data, Array<double, 1>& stored); 36 37 inline void outputField(const Array<double,1>& stored, Array<double, 2>& outField); 38 inline void outputField(const Array<double,1>& stored, Array<double, 3>& outField); 33 39 34 40 inline static CGrid* CreateObject(const CDomain* const a_domain, const CAxis* const a_axis); … … 77 83 void CGrid::solveReference(void) 78 84 { 85 79 86 static bool isReferenceSolved = false; 80 87 if (isReferenceSolved) return; … … 94 101 if (CDomain::HasObject(domain_ref)) 95 102 { 96 domain =CDomain::GetObject(domain_ref) ;103 domain = CDomain::GetObject(domain_ref) ; 97 104 domain->check() ; 98 105 } … … 115 122 void CGrid::computeIndex(void) 116 123 { 124 117 125 int ni = domain->ni ; 118 126 int nj = domain->nj ; … … 123 131 int data_jbegin = (data_dim == 2) ? (int)domain->data_jbegin : -1; 124 132 125 Array<int, 1>& data_i_index =* domain->data_i_index ;126 Array<int, 1>& data_j_index =* domain->data_j_index ;127 Array<bool, 2>& mask =* domain->mask ;133 Array<int, 1>& data_i_index =* domain->data_i_index ; 134 Array<int, 1>& data_j_index =* domain->data_j_index ; 135 Array<bool, 2>& mask =* domain->mask ; 128 136 int i, j, l, n ; 129 137 int count, indexCount ; … … 131 139 for(indexCount=0, l=0; l<size ; l++) 132 140 { 133 for(n=0 , indexCount=0; n<data_n_index; n++)141 for(n=0; n<data_n_index; n++) 134 142 { 135 143 if (data_dim == 1) … … 137 145 i = (data_i_index(n) + data_ibegin) % ni ; 138 146 j = (data_i_index(n) + data_ibegin) / ni ; 139 cout<<i<<" "<<j<<" "<<mask(i,j)<<endl ;147 //cout<<i<<" "<<j<<" "<<mask(i,j)<<endl ; 140 148 } 141 149 else … … 143 151 i = data_i_index(n) + data_ibegin ; 144 152 j = data_j_index(n) + data_jbegin ; 145 cout<<i<<" "<<j<<" "<<mask(i,j)<<endl ;153 //cout<<i<<" "<<j<<" "<<mask(i,j)<<endl ; 146 154 } 147 155 … … 157 165 for(count=0, indexCount=0, l=0; l<size; l++) 158 166 { 159 for(n=0; n<data_n_index; n++ )167 for(n=0; n<data_n_index; n++, count++) 160 168 { 161 169 if (data_dim == 1) … … 164 172 j = (data_i_index(n) + data_ibegin) / ni ; 165 173 } 166 else 174 else // (dat_dim == 2) 167 175 { 168 176 i = data_i_index(n) + data_ibegin ; … … 172 180 if (i>=0 && i<ni && j>=0 && j<nj && mask(i,j)) 173 181 { 174 storeIndex(indexCount) = n;182 storeIndex(indexCount) = count ; 175 183 out_l_index(indexCount) = l ; 176 184 out_i_index(indexCount) = i ; … … 178 186 indexCount++ ; 179 187 } 180 count++ ;181 188 } 182 189 } 183 190 191 /** Pour tests 192 184 193 cout << "Out of CGrid::ComputeIndex" << endl ; 194 195 cout << "storeIndex : " << endl ; 185 196 cout << storeIndex << endl ; 197 198 cout << "out_i_index : " << endl ; 186 199 cout << out_i_index << endl ; 200 201 cout << "out_j_index : " << endl ; 187 202 cout << out_j_index << endl ; 203 204 cout << "out_l_index : " << endl ; 188 205 cout << out_l_index << endl ; 206 207 **/ 208 189 209 } 190 210
Note: See TracChangeset
for help on using the changeset viewer.