Changeset 469


Ignore:
Timestamp:
Jun 9, 2006 1:41:09 PM (18 years ago)
Author:
mmc
Message:

Fixed nanovis server to handle the flavor of dx files used by BioMOCA.

Location:
trunk/gui/vizservers/nanovis
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/vizservers/nanovis/nanovis.cpp

    r467 r469  
    13071307                break;
    13081308            }
     1309            else if (sscanf(start, "object %d class array type %s rank 0 times %d data follows", &dummy, type, &npts) == 3) {
     1310                if (npts != nx*ny*nz) {
     1311                    std::cerr << "inconsistent data: expected " << nx*ny*nz << " points but found " << npts << " points" << std::endl;
     1312                    return;
     1313                }
     1314                break;
     1315            }
    13091316        }
    13101317    } while (!fin.eof());
     
    15111518                break;
    15121519            }
     1520            else if (sscanf(start, "object %d class array type %s rank 0 times %d data follows", &dummy, type, &npts) == 3) {
     1521                if (npts != nx*ny*nz) {
     1522                    char mesg[256];
     1523                    sprintf(mesg,"inconsistent data: expected %d points but found %d points", nx*ny*nz, npts);
     1524                    return result.error(mesg);
     1525                }
     1526                break;
     1527            }
    15131528        }
    15141529    } while (!fin.eof());
     
    15241539            double dval;
    15251540            int nread = 0;
    1526             for (int ix=0; ix < nx; ix++) {
    1527                 for (int iy=0; iy < ny; iy++) {
    1528                     for (int iz=0; iz < nz; iz++) {
    1529                         if (fin.eof() || nread > npts) {
    1530                             break;
    1531                         }
    1532                         fin.getline(line,sizeof(line)-1);
    1533                         if (sscanf(line, "%lg", &dval) == 1) {
    1534                             int nindex = iz*nx*ny + iy*nx + ix;
    1535                             field.define(nindex, dval);
    1536                             nread++;
     1541            int ix = 0;
     1542            int iy = 0;
     1543            int iz = 0;
     1544            while (!fin.eof() && nread < npts) {
     1545                fin.getline(line,sizeof(line)-1);
     1546                if (sscanf(line, "%lg", &dval) == 1) {
     1547                    int nindex = iz*nx*ny + iy*nx + ix;
     1548                    field.define(nindex, dval);
     1549                    nread++;
     1550                    if (++iz >= nz) {
     1551                        iz = 0;
     1552                        if (++iy >= ny) {
     1553                            iy = 0;
     1554                            ++ix;
    15371555                        }
    15381556                    }
     
    31123130int main(int argc, char** argv)
    31133131{
     3132  sleep(30);
    31143133#ifdef XINETD
    31153134   init_service();
  • trunk/gui/vizservers/nanovis/start_server

    r410 r469  
    44export DISPLAY
    55
    6 ../nanoscale/server -l 4000 -b 4001 -s 172.18.3.255 -c ./nanovis
     6../nanoscale/server -l 3000 -b 3001 -s 172.18.3.255 -c ./nanovis
    77
Note: See TracChangeset for help on using the changeset viewer.