Changeset 1529 for trunk/packages
- Timestamp:
- Jun 24, 2009, 11:20:14 AM (15 years ago)
- Location:
- trunk/packages/vizservers/nanovis
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/nanovis/FlowCmd.cpp
r1524 r1529 2129 2129 } 2130 2130 2131 2132 #ifdef notdef 2133 2134 // Read the header of a vtk data file. Returns 0 if error. 2135 bool 2136 VtkReadHeader() 2137 { 2138 char *p, *endPtr; 2139 2140 line = getline(&p, endPtr); 2141 if (line == endPtr) { 2142 vtkErrorMacro(<<"Premature EOF reading first line! " << " for file: " 2143 << (this->FileName?this->FileName:"(Null FileName)")); 2144 return false; 2145 } 2146 if (sscanf(line, "# vtk DataFile Version %s", version) != 1) { 2147 vtkErrorMacro(<< "Unrecognized file type: "<< line << " for file: " 2148 << (this->FileName?this->FileName:"(Null FileName)")); 2149 return false; 2150 } 2151 // Read title 2152 line = getline(&p, endPtr); 2153 if (line == endPtr) { 2154 vtkErrorMacro(<<"Premature EOF reading title! " << " for file: " 2155 << (this->FileName?this->FileName:"(Null FileName)")); 2156 return false; 2157 } 2158 if (_title != NULL) { 2159 delete [] _title; 2160 } 2161 _title = new char[strlen(line) + 1]; 2162 strcpy(_title, line); 2163 2164 // Read type 2165 line = getline(&p, endPtr); 2166 if (line == endPtr) { 2167 vtkErrorMacro(<<"Premature EOF reading file type!" << " for file: " 2168 << (this->FileName?this->FileName:"(Null FileName)")); 2169 return false; 2170 } 2171 word = GetWord(line, &endPtr); 2172 if (strncasecmp(word, "ascii", 5) == 0) { 2173 _fileType = VTK_ASCII; 2174 } else if (strcasecmp(word, "binary", 6) == 0) { 2175 _fileType = VTK_BINARY; 2176 } else { 2177 vtkErrorMacro(<< "Unrecognized file type: "<< line << " for file: " 2178 << (this->FileName?this->FileName:"(Null FileName)")); 2179 _fileType = 0; 2180 return false; 2181 2182 } 2183 // Read dataset type 2184 line = getline(&p, endPtr); 2185 if (line == endPtr) { 2186 vtkErrorMacro(<<"Premature EOF reading file type!" << " for file: " 2187 << (this->FileName?this->FileName:"(Null FileName)")); 2188 return false; 2189 } 2190 word = GetWord(line, &endPtr); 2191 if (strncasecmp(word, "dataset", 7) == 0) { 2192 // Read dataset type 2193 line = getline(&p, endPtr); 2194 if (line == endPtr) { 2195 // EOF 2196 } 2197 type = GetWord(line, &endPtr); 2198 if (strncasecmp(word, "structured_grid", 15) == 0) { 2199 vtkErrorMacro(<< "Cannot read dataset type: " << line); 2200 return 1; 2201 } 2202 // Read keyword and dimensions 2203 // 2204 while (!done) 2205 { 2206 if (!this->ReadString(line)) 2207 { 2208 break; 2209 } 2210 2211 // Have to read field data because it may be binary. 2212 if (! strncmp(this->LowerCase(line), "field", 5)) 2213 { 2214 vtkFieldData* fd = this->ReadFieldData(); 2215 fd->Delete(); 2216 } 2217 2218 if ( ! strncmp(this->LowerCase(line),"dimensions",10) ) 2219 { 2220 int ext[6]; 2221 if (!(this->Read(ext+1) && 2222 this->Read(ext+3) && 2223 this->Read(ext+5))) 2224 { 2225 vtkErrorMacro(<<"Error reading dimensions!"); 2226 this->CloseVTKFile (); 2227 return 1; 2228 } 2229 // read dimensions, change to extent; 2230 ext[0] = ext[2] = ext[4] = 0; 2231 --ext[1]; 2232 --ext[3]; 2233 --ext[5]; 2234 outInfo->Set(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(), 2235 ext, 6); 2236 // That is all we wanted !!!!!!!!!!!!!!! 2237 this->CloseVTKFile(); 2238 return 1; 2239 } 2240 } 2241 } 2242 2243 2244 2245 float progress=this->GetProgress(); 2246 this->UpdateProgress(progress + 0.5*(1.0 - progress)); 2247 2248 return 1; 2249 } 2250 #endif -
trunk/packages/vizservers/nanovis/Unirect.cpp
r1510 r1529 306 306 Tcl_Obj *const *objv) 307 307 { 308 309 308 if ((objc & 0x01) == 0) { 310 309 Tcl_AppendResult(interp, Tcl_GetString(objv[0]), ": ", … … 453 452 } 454 453 455 #ifndef notdef456 454 if ((axis[0] != 1) || (axis[1] != 0)) { 457 455 fprintf(stderr, "reordering data\n"); 458 / / Reorder the data into x, y where x varies fastest and so on.456 /* Reorder the data into x, y where x varies fastest and so on. */ 459 457 size_t y; 460 458 float *data, *dp; … … 478 476 _values = data; 479 477 } 480 #endif481 478 _initialized = true; 482 479 return TCL_OK; … … 490 487 int nx, ny, nz, npts; 491 488 double x0, y0, z0, dx, dy, dz, ddx, ddy, ddz; 492 char *p, * endPtr;493 494 dx = dy = dz = 0.0; / / Suppress compiler warning.495 x0 = y0 = z0 = 0.0; / / May not have an origin line.496 nx = ny = nz = npts = 0; / / Suppress compiler warning.497 for (p = string, endPtr = p + length; p < endPtr; /*empty*/) {489 char *p, *pend; 490 491 dx = dy = dz = 0.0; /* Suppress compiler warning. */ 492 x0 = y0 = z0 = 0.0; /* May not have an origin line. */ 493 nx = ny = nz = npts = 0; /* Suppress compiler warning. */ 494 for (p = string, pend = p + length; p < pend; /*empty*/) { 498 495 char *line; 499 496 500 line = getline(&p, endPtr);501 if (line == endPtr) {502 break; 497 line = getline(&p, pend); 498 if (line == pend) { 499 break; /* EOF */ 503 500 } 504 501 if ((line[0] == '#') || (line == '\0')) { 505 continue; // Skip blank or comment lines.502 continue; /* Skip blank or comment lines. */ 506 503 } 507 504 if (sscanf(line, "object %*d class gridpositions counts %d %d %d", … … 513 510 } 514 511 } else if (sscanf(line, "origin %lg %lg %lg", &x0, &y0, &z0) == 3) { 515 / / found origin512 /* Found origin. */ 516 513 } else if (sscanf(line, "delta %lg %lg %lg", &ddx, &ddy, &ddz) == 3) { 517 / / found one of the delta lines514 /* Found one of the delta lines. */ 518 515 if (ddx != 0.0) { 519 516 dx = ddx; … … 571 568 for (size_t iz = 0; iz < _zNum; iz++) { 572 569 char *line; 573 if ((p == endPtr) || (_nValues > (size_t)npts)) {570 if ((p == pend) || (_nValues > (size_t)npts)) { 574 571 break; 575 572 } 576 line = getline(&p, endPtr);573 line = getline(&p, pend); 577 574 if ((line[0] == '#') || (line[0] == '\0')) { 578 continue; // Skip blank or comment lines.575 continue; /* Skip blank or comment lines. */ 579 576 } 580 577 double vx, vy, vz; … … 604 601 } 605 602 } 606 / / make sure that we read all of the expected points603 /* Make sure that we read all of the expected points. */ 607 604 if (_nValues != (size_t)npts) { 608 605 result.addError("inconsistent data: expected %d points"
Note: See TracChangeset
for help on using the changeset viewer.