[cig-commits] r11552 - cs/benchmark/cigma/trunk/src/todelete

luis at geodynamics.org luis at geodynamics.org
Wed Mar 26 03:27:25 PDT 2008


Author: luis
Date: 2008-03-26 03:27:25 -0700 (Wed, 26 Mar 2008)
New Revision: 11552

Removed:
   cs/benchmark/cigma/trunk/src/todelete/VtkUgMeshPart.cpp
   cs/benchmark/cigma/trunk/src/todelete/VtkUgMeshPart.h
   cs/benchmark/cigma/trunk/src/todelete/VtkUgReader.cpp
   cs/benchmark/cigma/trunk/src/todelete/VtkUgReader.h
   cs/benchmark/cigma/trunk/src/todelete/VtkUgSimpleWriter.cpp
   cs/benchmark/cigma/trunk/src/todelete/VtkUgSimpleWriter.h
Log:
Deleted old vtk classes


Deleted: cs/benchmark/cigma/trunk/src/todelete/VtkUgMeshPart.cpp
===================================================================
--- cs/benchmark/cigma/trunk/src/todelete/VtkUgMeshPart.cpp	2008-03-26 10:27:24 UTC (rev 11551)
+++ cs/benchmark/cigma/trunk/src/todelete/VtkUgMeshPart.cpp	2008-03-26 10:27:25 UTC (rev 11552)
@@ -1,147 +0,0 @@
-#include <cstdlib>
-#include <cassert>
-#include "VtkUgMeshPart.h"
-
-// ---------------------------------------------------------------------------
-
-cigma::VtkUgMeshPart::
-VtkUgMeshPart()
-{
-    grid = vtkUnstructuredGrid::New();
-    //grid->PrintSelf(std::cout, 0);
-
-    points = 0;
-
-    //nno = 0;
-    //nsd = 0;
-    coordsArray = 0;
-
-    //nel = 0;
-    //ndofs = 0;
-    cellArray = 0;
-}
-
-cigma::VtkUgMeshPart::
-~VtkUgMeshPart()
-{
-}
-
-// ---------------------------------------------------------------------------
-
-void cigma::VtkUgMeshPart::set_coordinates(double *coordinates, int nno, int nsd)
-{
-    assert(coordinates != NULL);
-
-    this->nno = nno;
-    this->nsd = nsd;
-
-    coordsArray = vtkDoubleArray::New();
-    coordsArray->SetNumberOfTuples(nno);
-    coordsArray->SetNumberOfComponents(nsd);
-    coordsArray->SetVoidArray(coordinates, nno*nsd, 1);
-    //coordsArray->PrintSelf(std::cout, 0);
-
-    points = vtkPoints::New();
-    points->SetData(coordsArray);
-    //points->SetDataTypeToDouble(); // XXX:
-    //points->PrintSelf(std::cout, 0);
-
-    grid->SetPoints(points);
-    grid->GetPointData()->SetVectors(coordsArray);
-
-}
-
-void cigma::VtkUgMeshPart::set_connectivity(int *connectivity, int nel, int ndofs)
-{
-    assert(connectivity != NULL);
-
-    this->nel = nel;
-    this->ndofs = ndofs;
-
-    cellArray = vtkCellArray::New();
-    for (int e = 0; e < nel; e++)
-    {
-        cellArray->InsertNextCell(ndofs);
-        for (int i = 0; i < ndofs; i++)
-        {
-            cellArray->InsertCellPoint(connectivity[ndofs*e + i]);
-        }
-    }
-    //cellArray->PrintSelf(std::cout, 0);
-
-    if (ndofs == 4) {
-        std::cout << "VTK_TETRA" << std::endl;
-        grid->SetCells(VTK_TETRA, cellArray);
-    } else if (ndofs == 8) {
-        std::cout << "VTK_HEXAHEDRON" << std::endl;
-        grid->SetCells(VTK_HEXAHEDRON, cellArray);
-    } else {
-        assert(false);
-    }
-}
-// ---------------------------------------------------------------------------
-
-bool cigma::VtkUgMeshPart::
-find_cell(double globalPoint[3], int *cellIndex)
-{
-    /*
-    vtkTetra *cell = vtkTetra::New();
-
-    double tol2 = 1e-6;
-    double weights[4];
-    double pcoords[3];
-    int subId;
-
-    //grid->FindCell(globalPoint, cell, 0, tol2, subId, pcoords, weights);
-
-    std::cout << "ID = " << subId << std::endl;
-    std::cout << "REFCOORDS = " << pcoords[0] << " " << pcoords[0] << " " << pcoords[0] << std::endl;
-
-    // */
-
-    //*
-    const bool verbose = false;
-    if (verbose)
-    {
-        std::cout << "Searching for cell containing (" << globalPoint[0] << ", " << globalPoint[1] << ", " << globalPoint[2] << ") ";
-    }
-
-
-    static int last_e = -1;
-    *cellIndex = -1;
-
-    //*
-    if ((0 <= last_e) && (last_e < nel))
-    {
-        double uvw[3];
-        get_cell_coords(last_e, cell->globverts);
-        cell->xyz2uvw(globalPoint, uvw);
-        if (cell->interior(uvw[0], uvw[1], uvw[2]))
-        {
-            if (verbose) { std::cout << last_e << std::endl; }
-            *cellIndex = last_e;
-            return true;
-        }
-    } // */
-
-    for (int e = 0; e < nel; e++)
-    {
-        double uvw[3];
-        get_cell_coords(e, cell->globverts);
-        cell->xyz2uvw(globalPoint, uvw);
-        if (cell->interior(uvw[0], uvw[1], uvw[2]))
-        {
-            if (verbose) { std::cout << e << std::endl; }
-            *cellIndex = e;
-            last_e = e;
-            return true;
-        }
-    } // */
-    if (verbose) { std::cout << " -> not found!\n"; }
-    return false;
-
-    /*
-    *cellIndex = 0;
-    return true;
-    // */
-}

Deleted: cs/benchmark/cigma/trunk/src/todelete/VtkUgMeshPart.h
===================================================================
--- cs/benchmark/cigma/trunk/src/todelete/VtkUgMeshPart.h	2008-03-26 10:27:24 UTC (rev 11551)
+++ cs/benchmark/cigma/trunk/src/todelete/VtkUgMeshPart.h	2008-03-26 10:27:25 UTC (rev 11552)
@@ -1,45 +0,0 @@
-#ifndef __VTK_UG_MESH_PART_H__
-#define __VTK_UG_MESH_PART_H__
-
-#include "MeshPart.h"
-
-#include "vtkUnstructuredGrid.h"
-#include "vtkPoints.h"
-#include "vtkCellType.h"
-#include "vtkCellArray.h"
-#include "vtkPointData.h"
-#include "vtkDoubleArray.h"
-
-#include "vtkTetra.h"
-#include "vtkHexahedron.h"
-
-
-namespace cigma
-{
-    class VtkUgMeshPart;
-}
-
-
-class cigma::VtkUgMeshPart : public MeshPart
-{
-public:
-    VtkUgMeshPart();
-    ~VtkUgMeshPart();
-
-public:
-    void initialize();
-    void set_coordinates(double *coordinates, int nno, int nsd);
-    void set_connectivity(int *connectivity, int nel, int ndofs);
-
-public:
-    bool find_cell(double globalPoint[3], int *cellIndex);
-
-public:
-    vtkUnstructuredGrid *grid;
-    vtkPoints *points;
-    vtkDoubleArray *coordsArray;
-    vtkCellArray *cellArray;
-};
-
-
-#endif

Deleted: cs/benchmark/cigma/trunk/src/todelete/VtkUgReader.cpp
===================================================================
--- cs/benchmark/cigma/trunk/src/todelete/VtkUgReader.cpp	2008-03-26 10:27:24 UTC (rev 11551)
+++ cs/benchmark/cigma/trunk/src/todelete/VtkUgReader.cpp	2008-03-26 10:27:25 UTC (rev 11552)
@@ -1,177 +0,0 @@
-#include <iostream>
-#include <cstdlib>
-#include <cassert>
-
-#include "VtkUgReader.h"
-
-#include "vtkCellArray.h"
-#include "vtkPointData.h"
-#include "vtkDoubleArray.h"
-#include "vtkFloatArray.h"
-
-
-// ---------------------------------------------------------------------------
-
-cigma::VtkUgReader::VtkUgReader()
-{
-    reader = 0;
-    grid = 0;
-}
-
-cigma::VtkUgReader::~VtkUgReader()
-{
-    if (reader != 0)
-        reader->Delete();
-}
-
-
-// ---------------------------------------------------------------------------
-
-void cigma::VtkUgReader::open(std::string filename)
-{
-    /* XXX: throw exception if file doesn't exist */
-    reader = vtkUnstructuredGridReader::New();
-    reader->SetFileName(filename.c_str());
-    reader->Update();
-    //reader->PrintSelf(std::cout, 0);
-
-    grid = reader->GetOutput();
-    //grid->PrintSelf(std::cout, 4);
-}
-
-
-// ---------------------------------------------------------------------------
-
-void cigma::VtkUgReader::
-get_coordinates(double **coordinates, int *nno, int *nsd)
-{
-    assert(grid != 0);
-
-    vtkPoints *points = grid->GetPoints();
-    //points->PrintSelf(std::cout, 0);
-
-    int dims[2];
-    dims[0] = points->GetNumberOfPoints();
-    dims[1] = 3;
-
-    int size = dims[0] * dims[1];
-    int dataType = points->GetDataType();
-    double *coords = new double[size];
-
-    if (dataType == VTK_DOUBLE)
-    {
-        double *ptr = static_cast<double*>(points->GetVoidPointer(0));
-        for (int i = 0; i < size; i++)
-        {
-            coords[i] = ptr[i];
-        }
-    }
-    else if (dataType == VTK_FLOAT)
-    {
-        float *ptr = static_cast<float*>(points->GetVoidPointer(0));
-        for (int i = 0; i < size; i++)
-        {
-            coords[i] = ptr[i];
-        }
-    }
-    else
-    {
-        assert(false);
-    }
-
-    *coordinates = coords;
-    *nno = dims[0];
-    *nsd = dims[1];
-}
-
-void cigma::VtkUgReader::
-get_connectivity(int **connectivity, int *nel, int *ndofs)
-{
-    assert(grid != 0);
-
-    vtkCellArray *cellArray = grid->GetCells();
-    //cellArray->PrintSelf(std::cout, 0);
-
-    vtkIdType numCells = grid->GetNumberOfCells();
-    vtkIdType *cellArrayPtr = cellArray->GetPointer();
-
-    int dofs_per_elt = cellArrayPtr[0];
-    int offset = dofs_per_elt + 1;
-    int *connect = new int[numCells * dofs_per_elt];
-    
-    for (int e = 0; e < numCells; ++e)
-    {
-        for (int i = 1; i <= dofs_per_elt; ++i)
-        {
-            connect[dofs_per_elt * e + (i-1)] = cellArrayPtr[offset*e + i];
-        }
-    }
-
-    *connectivity = connect;
-    *nel = numCells;
-    *ndofs = dofs_per_elt;
-}
-
-
-void cigma::VtkUgReader::
-get_vector_point_data(const char *name, double **vectors, int *num, int *dim)
-{
-    assert(grid != 0);
-
-    vtkPointData *pointData = grid->GetPointData();
-    //pointData->PrintSelf(std::cout, 0);
-
-    vtkDataArray *dataArray;
-    if (name != 0) {
-        assert(pointData->HasArray(name) == 1);
-        dataArray = pointData->GetVectors(name);
-    } else {
-        dataArray = pointData->GetScalars();
-    }
-    //dataArray->PrintSelf(std::cout, 0);
-
-    int dataType = dataArray->GetDataType();
-    assert(dataType == VTK_DOUBLE);
-    double *ptr = static_cast<double*>(dataArray->GetVoidPointer(0));
-
-    // XXX: copy the data, or keep the reference?
-    // if dataType from the file is float, then we'd need to copy anyway
-    // perhaps we need a void pointer and a type
-    // new function signature would be
-    //  void get_vector_point_data(const char *name, void **vectors, int *num, int *dim, int *type)
-
-    *vectors = ptr;
-    *num = dataArray->GetNumberOfTuples();
-    *dim = dataArray->GetNumberOfComponents();
-}
-
-void cigma::VtkUgReader::
-get_scalar_point_data(const char *name, double **scalars, int *num, int *dim)
-{
-    assert(grid != 0);
-
-    vtkPointData *pointData = grid->GetPointData();
-    //pointData->PrintSelf(std::cout, 0);
-
-    vtkDataArray *dataArray;
-    if (name != 0) {
-        assert(pointData->HasArray(name) == 1);
-        dataArray = pointData->GetScalars(name);
-    } else {
-        dataArray = pointData->GetScalars();
-    }
-    //dataArray->PrintSelf(std::cout, 0);
-
-
-    int dataType = dataArray->GetDataType();
-    assert(dataType == VTK_DOUBLE);
-    double *ptr = static_cast<double*>(dataArray->GetVoidPointer(0));
-
-    // XXX: see comment in get_vector_point_data()
-
-    *scalars = ptr;
-    *num = dataArray->GetNumberOfTuples();
-    *dim = dataArray->GetNumberOfComponents();
-}
-
-// ---------------------------------------------------------------------------

Deleted: cs/benchmark/cigma/trunk/src/todelete/VtkUgReader.h
===================================================================
--- cs/benchmark/cigma/trunk/src/todelete/VtkUgReader.h	2008-03-26 10:27:24 UTC (rev 11551)
+++ cs/benchmark/cigma/trunk/src/todelete/VtkUgReader.h	2008-03-26 10:27:25 UTC (rev 11552)
@@ -1,42 +0,0 @@
-#ifndef __VTK_UG_READER_H__
-#define __VTK_UG_READER_H__
-
-#include <string> 
-
-#include "Reader.h"
-
-#include "vtkUnstructuredGridReader.h"
-#include "vtkUnstructuredGrid.h"
-
-namespace cigma
-{
-    class VtkUgReader;
-}
-
-class cigma::VtkUgReader : cigma::Reader
-{
-public:
-    VtkUgReader();
-    ~VtkUgReader();
-
-public:
-    ReaderType getType() { return VTK_READER; }
-
-public:
-    void open(std::string filename);
-    void close();
-
-public:
-    void get_coordinates(double **coordinates, int *nno, int *nsd);
-    void get_connectivity(int **connectivity, int *nel, int *ndofs);
-    void get_vector_point_data(const char *name, double **vectors, int *num, int *dim);
-    void get_scalar_point_data(const char *name, double **scalars, int *num, int *dim);
-
-public:
-    vtkUnstructuredGridReader *reader;
-    vtkUnstructuredGrid *grid;
-};
-
-// ---------------------------------------------------------------------------
-
-#endif

Deleted: cs/benchmark/cigma/trunk/src/todelete/VtkUgSimpleWriter.cpp
===================================================================
--- cs/benchmark/cigma/trunk/src/todelete/VtkUgSimpleWriter.cpp	2008-03-26 10:27:24 UTC (rev 11551)
+++ cs/benchmark/cigma/trunk/src/todelete/VtkUgSimpleWriter.cpp	2008-03-26 10:27:25 UTC (rev 11552)
@@ -1,209 +0,0 @@
-#include "VtkUgSimpleWriter.h"
-#include <cassert>
-
-
-// ---------------------------------------------------------------------------
-
-cigma::VtkUgSimpleWriter::VtkUgSimpleWriter()
-{
-    fp = NULL;
-}
-
-cigma::VtkUgSimpleWriter::~VtkUgSimpleWriter()
-{
-}
-
-
-// ---------------------------------------------------------------------------
-
-void cigma::VtkUgSimpleWriter::
-open(std::string filename)
-{
-    fp = fopen(filename.c_str(), "w");
-    assert(fp != NULL);
-}
-
-void cigma::VtkUgSimpleWriter::
-close()
-{
-    if (fp != NULL)
-    {
-        fclose(fp);
-    }
-}
-
-
-// ---------------------------------------------------------------------------
-
-void cigma::VtkUgSimpleWriter::
-write_header()
-{
-    assert(fp != NULL);
-    fprintf(fp, "# vtk DataFile Version 3.0\n");
-    fprintf(fp, "This line is a comment\n");
-    fprintf(fp, "ASCII\n");
-    fprintf(fp, "DATASET UNSTRUCTURED_GRID\n");
-}
-
-
-void cigma::VtkUgSimpleWriter::
-write_points(double *points, int npts, int ndim)
-{
-    assert(fp != NULL);
-    assert(ndim > 1);
-
-    fprintf(fp, "POINTS %d double\n", npts);
-    for (int i = 0; i < npts; i++)
-    {
-        fprintf(fp, " %g", points[ndim*i + 0]);
-        fprintf(fp, " %g", points[ndim*i + 1]);
-        if (ndim == 3)
-            fprintf(fp, " %g", points[ndim*i + 2]);
-        else
-            fprintf(fp, " 0.0");
-        fprintf(fp, "\n");
-    }
-}
-
-void cigma::VtkUgSimpleWriter::
-write_cells(int *cells, int nel, int ndofs)
-{
-    assert(fp != NULL);
-
-    fprintf(fp, "CELLS %d %d\n", nel, nel*(1 + ndofs));
-    for (int i = 0; i < nel; i++)
-    {
-        fprintf(fp, " %d", ndofs);
-        for (int j = 0; j < ndofs; j++)
-        {
-            fprintf(fp, " %d", cells[ndofs*i + j]);
-        }
-        fprintf(fp, "\n");
-    }
-}
-
-
-void cigma::VtkUgSimpleWriter::
-write_cell_types(int nsd, int nel, int ndofs)
-{
-    assert(fp != NULL);
-
-    fprintf(fp, "CELL_TYPES %d\n", nel);
-
-    int vtkType = 0;
-    if (nsd == 3)
-    {
-        switch (ndofs)
-        {
-        case  4: vtkType = 10; break; // VTK_TETRA=10
-        case  8: vtkType = 12; break; // VTK_HEXAHEDRON=12
-        case  6: vtkType = 13; break; // VTK_WEDGE=13
-        case  5: vtkType = 14; break; // VTK_PYRAMID=14
-        case 10: vtkType = 24; break; // VTK_QUADRATIC_TETRA=24
-        case 20: vtkType = 25; break; // VTK_QUADRATIC_HEXAHEDRON=25
-        }
-    }
-    else if (nsd == 2)
-    {
-        switch (ndofs)
-        {
-        case 3: vtkType =  5; break; // VTK_TRIANGLE=5
-        case 4: vtkType =  9; break; // VTK_QUAD=9
-        case 6: vtkType = 22; break; // VTK_QUADRATIC_TRIANGLE=22
-        case 8: vtkType = 23; break; // VTK_QUADRATIC_QUAD=23
-        }
-    }
-    assert(vtkType > 0);
-
-    for (int i = 0; i < nel; i++)
-    {
-        fprintf(fp, "%d\n", vtkType);
-    }
-}
-
-void cigma::VtkUgSimpleWriter::
-write_point_data(const char *name, double *data, int nno, int ndim)
-{
-    assert(fp != NULL);
-
-    fprintf(fp, "POINT_DATA %d\n", nno);
-
-    if (ndim == 1)
-    {
-        fprintf(fp, "SCALARS %s double 1\n", name);
-        fprintf(fp, "LOOKUP_TABLE default\n");
-        for (int i = 0; i < nno; i++)
-        {
-            fprintf(fp, "%g\n", data[i]);
-        }
-        return;
-    }
-    else if ((ndim == 2) || (ndim == 3))
-    {
-        fprintf(fp, "VECTORS %s double\n", name);
-        for (int i = 0; i < nno; i++)
-        {
-            fprintf(fp, " %g", data[ndim*i + 0]);
-            fprintf(fp, " %g", data[ndim*i + 1]);
-            if (ndim == 3)
-                fprintf(fp, " %g\n", data[ndim*i + 2]);
-            else
-                fprintf(fp, " 0.0\n");
-        }
-    }
-    else if (ndim == 9)
-    {
-        fprintf(fp, "TENSORS %s double\n", name);
-        for (int i = 0; i < nno; i++)
-        {
-            for (int j = 0; j < ndim; j++)
-            {
-                fprintf(fp, " %g", data[ndim*i + j]);
-            }
-            fprintf(fp, "\n");
-        }
-    }
-}
-
-void cigma::VtkUgSimpleWriter::
-write_cell_data(const char *name, double *data, int nel, int ndim)
-{
-    assert(fp != NULL);
-
-    fprintf(fp, "CELL_DATA %d\n", nel);
-
-    if (ndim == 1)
-    {
-        fprintf(fp, "SCALARS %s float 1\n", name);
-        fprintf(fp, "LOOKUP_TABLE default\n");
-        for (int i = 0; i < nel; i++)
-            fprintf(fp, "%g\n", data[i]);
-    }
-    else if ((ndim == 2) || (ndim == 3))
-    {
-        fprintf(fp, "VECTORS %s float\n", name);
-        for (int i = 0; i < nel; i++)
-        {
-            fprintf(fp, " %g", data[ndim*i + 0]);
-            fprintf(fp, " %g", data[ndim*i + 1]);
-            if (ndim == 3)
-                fprintf(fp, " %g\n", data[ndim*i + 2]);
-            else
-                fprintf(fp, " 0.0\n");
-        }
-    }
-    else if (ndim == 9)
-    {
-        fprintf(fp, "TENSORS %s float\n", name);
-        for (int i = 0; i < nel; i++)
-        {
-            for (int j = 0; j < ndim; j++)
-            {
-                fprintf(fp, " %g", data[ndim*i + j]);
-            }
-            fprintf(fp, "\n");
-        }
-    }
-}
-
-// ---------------------------------------------------------------------------

Deleted: cs/benchmark/cigma/trunk/src/todelete/VtkUgSimpleWriter.h
===================================================================
--- cs/benchmark/cigma/trunk/src/todelete/VtkUgSimpleWriter.h	2008-03-26 10:27:24 UTC (rev 11551)
+++ cs/benchmark/cigma/trunk/src/todelete/VtkUgSimpleWriter.h	2008-03-26 10:27:25 UTC (rev 11552)
@@ -1,34 +0,0 @@
-#ifndef __VTK_UG_SIMPLE_WRITER_H__
-#define __VTK_UG_SIMPLE_WRITER_H__
-
-#include <cstdio>
-#include <string>
-
-namespace cigma
-{
-    class VtkUgSimpleWriter;
-}
-
-class cigma::VtkUgSimpleWriter
-{
-public:
-    VtkUgSimpleWriter();
-    ~VtkUgSimpleWriter();
-
-public:
-    void open(std::string filename);
-    void close();
-
-public:
-    void write_header();
-    void write_points(double *points, int npts, int ndim);
-    void write_cells(int *cells, int nel, int ndofs);
-    void write_cell_types(int nsd, int nel, int ndofs);
-    void write_point_data(const char *name, double *data, int nno, int ndim);
-    void write_cell_data(const char *name, double *data, int nel, int ndim);
-
-public:
-    FILE *fp;
-};
-
-#endif



More information about the cig-commits mailing list