[cig-commits] r13744 - cs/cigma/trunk/src

luis at geodynamics.org luis at geodynamics.org
Wed Dec 17 02:32:53 PST 2008


Author: luis
Date: 2008-12-17 02:32:53 -0800 (Wed, 17 Dec 2008)
New Revision: 13744

Modified:
   cs/cigma/trunk/src/io_vtk_reader.cpp
Log:
Clean up stuff that was moved to io_vtk.{h,cpp}

Modified: cs/cigma/trunk/src/io_vtk_reader.cpp
===================================================================
--- cs/cigma/trunk/src/io_vtk_reader.cpp	2008-12-17 10:32:51 UTC (rev 13743)
+++ cs/cigma/trunk/src/io_vtk_reader.cpp	2008-12-17 10:32:53 UTC (rev 13744)
@@ -65,22 +65,6 @@
 
     if (ext == ".vtk")
     {
-        /*
-        legacy_reader = vtkDataSetReader::New();
-        legacy_reader->SetFileName(filename);
-        gridType = VTK;
-
-        status = legacy_reader->OpenVTKFile();
-        if (status == 0)
-        {
-            cerr << "Could not read legacy VTK file " << filename << endl;
-            gridType = NULL_GRID;
-            return -1;
-        }
-
-        legacy_reader->Update();
-        */
-
         legacyReader = vtk_read_legacy(filename, this->gridType);
 
         if (legacyReader)
@@ -97,60 +81,6 @@
     }
     else if (is_vtk_extension(ext.c_str()))
     {
-        /*
-        if (ext == ".vtu")
-        {
-            xml_reader = vtkXMLUnstructuredGridReader::New();
-            gridType = VTU;
-        }
-        else if (ext == ".vts")
-        {
-            xml_reader = vtkXMLStructuredGridReader::New();
-            gridType = VTS;
-        }
-        else if (ext == ".vtr")
-        {
-            xml_reader = vtkXMLRectilinearGridReader::New();
-            gridType = VTR;
-        }
-        else if (ext == ".pvtu")
-        {
-            xml_reader = vtkXMLPUnstructuredGridReader::New();
-            gridType == PVTU;
-        }
-        else if (ext == ".pvts")
-        {
-            xml_reader = vtkXMLPStructuredGridReader::New();
-            gridType = PVTS;
-        }
-        else if (ext == ".pvtr")
-        {
-            xml_reader = vtkXMLPRectilinearGridReader::New();
-            gridType = PVTR;
-        }
-        else
-        {
-            cerr << "Unsupported VTK file (" << ext << ")" << endl;
-            return -1;
-        }
-
-        status = xml_reader->CanReadFile(filename);
-        if (status == 0)
-        {
-            cerr << "Could not read XML VTK file " << filename << endl;
-            gridType = NULL_GRID;
-            return -1;
-        }
-
-        xml_reader->SetFileName(filename);
-        xml_reader->Update();
-
-        xml_reader->GetPointDataArraySelection()->EnableAllArrays();
-
-        dataset = xml_reader->GetOutputAsDataSet();
-        dataset->Update();
-        */
-
         xmlReader = vtk_read_xml(filename, this->gridType);
 
         if (xmlReader)
@@ -200,212 +130,22 @@
 }
 
 
-/*
-static int GetDimensionFromCellType(int cellType)
-{
-    if ((cellType == VTK_TRIANGLE) ||
-        (cellType == VTK_QUADRATIC_TRIANGLE) ||
-        (cellType == VTK_PARAMETRIC_TRI_SURFACE) ||
-        (cellType == VTK_HIGHER_ORDER_TRIANGLE))
-    {
-        return 2;
-    }
-
-    if ((cellType == VTK_QUAD) ||
-        (cellType == VTK_QUADRATIC_QUAD) ||
-        (cellType == VTK_PARAMETRIC_QUAD_SURFACE) ||
-        (cellType == VTK_HIGHER_ORDER_QUAD))
-    {
-        return 2;
-    }
-
-    if ((cellType == VTK_TETRA) ||
-        (cellType == VTK_QUADRATIC_TETRA) ||
-        (cellType == VTK_PARAMETRIC_TETRA_REGION) ||
-        (cellType == VTK_HIGHER_ORDER_TETRAHEDRON))
-    {
-        return 3;
-    }
-
-    if ((cellType == VTK_VOXEL) ||
-        (cellType == VTK_HEXAHEDRON) ||
-        (cellType == VTK_QUADRATIC_HEXAHEDRON) ||
-        (cellType == VTK_PARAMETRIC_HEX_REGION) ||
-        (cellType == VTK_HIGHER_ORDER_HEXAHEDRON))
-    {
-        return 3;
-    }
-
-    return -1;
-}
-*/
-
-
 int VtkReader::getDataset(const char *loc, double **data, int *num, int *dim)
 {
-    /*
     TRI_LOG_STR("VtkReader::getDataset()");
-
-    int i,j;
-    int n_points;
-    int rank;
-    double *array = 0;
-
-    if (dataset == 0)
-    {
-        return -1;
-    }
-
-    vtkPointData *pointData = dataset->GetPointData();
-
-    assert(pointData != 0);
-
-    if (pointData->HasArray(loc) == 1)
-    {
-        vtkDataArray *dataArray = pointData->GetArray(loc);
-        assert(dataArray != 0);
-
-        // XXX: verify that we are loading a dataset of the correct type
-        //int dataType = dataArray->GetDataType();
-        //if ((dataType != VTK_DOUBLE) || (dataType != VTK_FLOAT))
-        //{
-        //    assert(false); // XXX
-        //    return -1;
-        //}
-
-        n_points = dataArray->GetNumberOfTuples();
-        rank = dataArray->GetNumberOfComponents();
-        array = new double[n_points * rank];
-
-        for (i = 0; i < n_points; i++)
-        {
-            double dofval[rank];
-            dataArray->GetTuple(i, dofval);
-            for (j = 0; j < rank; j++)
-            {
-                array[i*rank + j] = dofval[j];
-            }
-        }
-    }
-    else
-    {
-        assert(false); // XXX
-        return -1;
-    }
-
-    *data = array;
-    *num = n_points;
-    *dim = rank;
-
-    TRI_LOG(*data);
-    TRI_LOG(n_points);
-    TRI_LOG(rank);
-
-    return 0;
-    */
-
-    TRI_LOG_STR("VtkReader::getDataset()");
     return vtk_read_pointdata<double>(this->dataset, loc, data, num, dim);
 }
 
 
 int VtkReader::getCoordinates(const char *loc, double **coordinates, int *nno, int *nsd)
 {
-    /*
     TRI_LOG_STR("VtkReader::getCoordinates()");
-
-    int i,j;
-    int n_points;
-    int n_dims;
-    double *array = 0;
-
-    if (dataset == 0)
-    {
-        return -1;
-    }
-
-    int cellType = dataset->GetCellType(0); // XXX: assumes uniform cell types
-
-    n_points = dataset->GetNumberOfPoints();
-    n_dims = GetDimensionFromCellType(cellType);
-
-    assert(n_dims <= 3);
-
-    if (n_dims < 0)
-    {
-        assert(false);
-        return -1;
-    }
-
-    array = new double[n_points * n_dims];
-
-    for (i = 0; i < n_points; i++)
-    {
-        double point[3];
-        dataset->GetPoint(i, point);
-        for (j = 0; j < n_dims; j++)
-        {
-            array[i*n_dims + j] = point[j];
-        }
-    }
-
-    *coordinates = array;
-    *nno = n_points;
-    *nsd = n_dims;
-
-    TRI_LOG(*coordinates);
-    TRI_LOG(n_points);
-    TRI_LOG(n_dims);
-
-    return 0;
-    */
-
-    TRI_LOG_STR("VtkReader::getCoordinates()");
     return vtk_read_coordinates<double>(this->dataset, loc, coordinates, nno, nsd);
 }
 
 int VtkReader::getConnectivity(const char *loc, int **connectivity, int *nel, int *ndofs)
 {
-    /*
     TRI_LOG_STR("VtkReader::getConnectivity()");
-
-    int i,j;
-    int n_cells;
-    int n_dofs;
-    int *array = 0;
-
-    if (dataset == 0)
-    {
-        return -1;
-    }
-
-    vtkCell *firstCell = dataset->GetCell(0);
-    n_cells = dataset->GetNumberOfCells();
-    n_dofs  = firstCell->GetNumberOfPoints();   // XXX: assume uniform cell types
-    array = new int[n_cells * n_dofs];
-
-    vtkGenericCell *cell = vtkGenericCell::New();
-    for (i = 0; i < n_cells; i++)
-    {
-        dataset->GetCell(i, cell);
-        for (j = 0; j < n_dofs; j++)
-        {
-            array[i * n_dofs + j] = cell->GetPointIds()->GetId(j);
-        }
-    }
-
-    *connectivity = array;
-    *nel = n_cells;
-    *ndofs = n_dofs;
-
-    TRI_LOG(*connectivity);
-    TRI_LOG(n_cells);
-    TRI_LOG(n_dofs);
-
-    return 0;
-    */
-
-    TRI_LOG_STR("VtkReader::getConnectivity()");
     return vtk_read_connectivity<int>(this->dataset, loc, connectivity, nel, ndofs);
 }
 



More information about the CIG-COMMITS mailing list