Search in sources :

Example 1 with ChomboVolumeIndex

use of org.vcell.vis.vismesh.thrift.ChomboVolumeIndex in project vcell by virtualcell.

the class ChomboVtkFileWriter method getVtuMeshData.

public double[] getVtuMeshData(ChomboFiles chomboFiles, OutputContext outputContext, File destinationDirectory, double time, VtuVarInfo var, int timeIndex) throws Exception {
    ChomboDataset chomboDataset = ChomboFileReader.readDataset(chomboFiles, chomboFiles.getTimeIndices().get(timeIndex));
    String domainName = var.domainName;
    ChomboCombinedVolumeMembraneDomain chomboCombinedVolumeMembraneDomain = chomboDataset.getDomainFromVolumeOrMembraneName(domainName);
    ChomboMeshData chomboMeshData = chomboCombinedVolumeMembraneDomain.getChomboMeshData();
    File chomboIndexDataFile = getChomboIndexDataFileName(destinationDirectory, chomboFiles, domainName);
    if (!chomboIndexDataFile.exists()) {
        writeEmptyMeshFiles(chomboFiles, destinationDirectory, null);
    }
    double[] data = null;
    switch(var.variableDomain) {
        case VARIABLEDOMAIN_CONTOUR:
            {
                break;
            }
        case VARIABLEDOMAIN_MEMBRANE:
            {
                ChomboIndexData chomboIndexData = VisMeshUtils.readChomboIndexData(chomboIndexDataFile);
                List<ChomboVisMembraneIndex> cellIndices = new ArrayList<ChomboVisMembraneIndex>();
                for (ChomboSurfaceIndex chomboSurfaceIndex : chomboIndexData.chomboSurfaceIndices) {
                    cellIndices.add(new SimpleChomboVisMembraneIndex(chomboSurfaceIndex.index));
                }
                data = chomboMeshData.getMembraneCellData(var.name, cellIndices);
                break;
            }
        case VARIABLEDOMAIN_NONSPATIAL:
            {
                break;
            }
        case VARIABLEDOMAIN_POSTPROCESSING:
            {
                break;
            }
        case VARIABLEDOMAIN_UNKNOWN:
            {
                break;
            }
        case VARIABLEDOMAIN_VOLUME:
            {
                ChomboIndexData chomboIndexData = VisMeshUtils.readChomboIndexData(chomboIndexDataFile);
                List<ChomboCellIndices> cellIndices = new ArrayList<ChomboCellIndices>();
                for (ChomboVolumeIndex chomboVolIndex : chomboIndexData.getChomboVolumeIndices()) {
                    cellIndices.add(new SimpleChomboCellIndices(chomboVolIndex.getLevel(), chomboVolIndex.getBoxNumber(), chomboVolIndex.getBoxIndex()));
                }
                if (var.functionExpression != null) {
                    data = evaluateFunction(var, chomboMeshData, cellIndices);
                } else {
                    data = chomboMeshData.getVolumeCellData(var.name, cellIndices);
                }
                break;
            }
        default:
            {
                throw new RuntimeException("unsupported variable type " + var.variableDomain.name() + " for variable " + var.name);
            }
    }
    return data;
}
Also used : ChomboSurfaceIndex(org.vcell.vis.vismesh.thrift.ChomboSurfaceIndex) ChomboIndexData(org.vcell.vis.vismesh.thrift.ChomboIndexData) ChomboVolumeIndex(org.vcell.vis.vismesh.thrift.ChomboVolumeIndex) ChomboCombinedVolumeMembraneDomain(org.vcell.vis.chombo.ChomboDataset.ChomboCombinedVolumeMembraneDomain) ChomboMeshData(org.vcell.vis.chombo.ChomboMeshData) ArrayList(java.util.ArrayList) List(java.util.List) File(java.io.File) ChomboDataset(org.vcell.vis.chombo.ChomboDataset)

Example 2 with ChomboVolumeIndex

use of org.vcell.vis.vismesh.thrift.ChomboVolumeIndex in project vcell by virtualcell.

the class ChomboMeshMapping method fromMeshData2D.

private VisMesh fromMeshData2D(ChomboMeshData chomboMeshData) {
    ChomboMesh chomboMesh = chomboMeshData.getMesh();
    ChomboLevel finestLevel = chomboMesh.getLevel(chomboMesh.getNumLevels() - 1);
    int finestAbsRefinement = finestLevel.getAbsoluteRefinement();
    ISize size = finestLevel.getSize();
    int numX = size.getX();
    int numY = size.getY();
    int numZ = size.getZ();
    int dimension = chomboMeshData.getMesh().getDimension();
    int z = 0;
    // invoke VisMesh() constructor
    VisMesh visMesh = new VisMesh(chomboMesh.getDimension(), toThrift(chomboMesh.getOrigin()), toThrift(chomboMesh.getExtent()));
    int currPointIndex = 0;
    HashMap<String, Integer> pointDict = new HashMap<String, Integer>();
    double originX = chomboMesh.getOrigin().x;
    double originY = chomboMesh.getOrigin().y;
    double originZ = chomboMesh.getOrigin().z;
    double extentX = chomboMesh.getExtent().x;
    double extentY = chomboMesh.getExtent().y;
    double extentZ = chomboMesh.getExtent().z;
    ChomboBoundaries chomboBoundaries = chomboMesh.getBoundaries();
    for (ChomboBoundaries.Point chomboPoint : chomboBoundaries.getPoints()) {
        double px = chomboPoint.x;
        double py = chomboPoint.y;
        double pz = z;
        px = (px - originX) * (numX) / extentX * 2 - 1;
        py = (py - originY) * (numY) / extentY * 2 - 1;
        pz = (pz - originZ) * (numZ) / extentZ * 2 - 1;
        if (dimension == 2) {
            pz = z;
        }
        VisPoint newVisPoint = new VisPoint(px, py, pz);
        String coordKey = toStringKey(newVisPoint);
        pointDict.put(coordKey, currPointIndex);
        visMesh.addToPoints(newVisPoint);
        visMesh.addToSurfacePoints(newVisPoint);
        currPointIndex += 1;
    }
    for (ChomboBoundaries.Segment segment : chomboBoundaries.getSegments()) {
        VisLine newVisLine = new VisLine(segment.getP1(), segment.getP2());
        newVisLine.setChomboSurfaceIndex(new ChomboSurfaceIndex(segment.getChomboIndex()));
        visMesh.addToVisLines(newVisLine);
    }
    for (int levelIndex = 0; levelIndex < chomboMesh.getNumLevels(); levelIndex++) {
        ChomboLevelData chomboLevelData = chomboMeshData.getLevelData(levelIndex);
        ChomboLevel currLevel = chomboMesh.getLevel(levelIndex);
        int currAbsRefinement = currLevel.getAbsoluteRefinement();
        Covering covering = currLevel.getCovering();
        int[] levelMap = covering.getLevelMap();
        int[] boxNumberMap = covering.getBoxNumberMap();
        int[] boxIndexMap = covering.getBoxIndexMap();
        int levelNumX = currLevel.getSize().getX();
        int levelNumY = currLevel.getSize().getY();
        for (int x = 0; x < levelNumX; x++) {
            for (int y = 0; y < levelNumY; y++) {
                int mapIndex = x + y * levelNumX;
                if (levelMap[mapIndex] == levelIndex) {
                    // 
                    // if fraction (volume fraction of element in box) is 0 ... then skip this element
                    // 
                    int boxNumber = boxNumberMap[mapIndex];
                    int boxIndex = boxIndexMap[mapIndex];
                    double fraction = chomboLevelData.getCellFraction(currLevel, boxNumber, boxIndex);
                    if (fraction > 0) {
                        // 
                        // add cell
                        // 
                        ChomboBox chomboBox = new ChomboBox(currLevel, x, x, y, y, z, z, dimension).getProjectedBox(currAbsRefinement, finestAbsRefinement);
                        double minX = 2 * chomboBox.getMinX() - 1;
                        double maxX = 2 * chomboBox.getMaxX() + 1;
                        double minY = 2 * chomboBox.getMinY() - 1;
                        double maxY = 2 * chomboBox.getMaxY() + 1;
                        // 
                        // counter clockwise points for a VisPolygon ... initially a quad ... then may be
                        // 
                        // minX,minY
                        // minX,maxY
                        // maxX,maxY
                        // maxX,minY
                        // 
                        VisPoint p1Coord = new VisPoint(minX, minY, z);
                        String p1Key = toStringKey(p1Coord);
                        Integer i1 = pointDict.get(p1Key);
                        if (i1 == null) {
                            pointDict.put(p1Key, currPointIndex);
                            i1 = currPointIndex;
                            visMesh.addToPoints(p1Coord);
                            currPointIndex++;
                        }
                        VisPoint p2Coord = new VisPoint(minX, maxY, z);
                        String p2Key = toStringKey(p2Coord);
                        Integer i2 = pointDict.get(p2Key);
                        if (i2 == null) {
                            pointDict.put(p2Key, currPointIndex);
                            i2 = currPointIndex;
                            visMesh.addToPoints(p2Coord);
                            currPointIndex++;
                        }
                        VisPoint p3Coord = new VisPoint(maxX, maxY, z);
                        String p3Key = toStringKey(p3Coord);
                        Integer i3 = pointDict.get(p3Key);
                        if (i3 == null) {
                            pointDict.put(p3Key, currPointIndex);
                            i3 = currPointIndex;
                            visMesh.addToPoints(p3Coord);
                            currPointIndex++;
                        }
                        VisPoint p4Coord = new VisPoint(maxX, minY, z);
                        String p4Key = toStringKey(p4Coord);
                        Integer i4 = pointDict.get(p4Key);
                        if (i4 == null) {
                            pointDict.put(p4Key, currPointIndex);
                            i4 = currPointIndex;
                            visMesh.addToPoints(p4Coord);
                            currPointIndex++;
                        }
                        VisPolygon quad = new VisPolygon(Arrays.asList(new Integer[] { i1, i2, i3, i4 }));
                        quad.setChomboVolumeIndex(new ChomboVolumeIndex(levelIndex, boxNumber, boxIndex, fraction));
                        // print('adding a cell at level '+str(currLevel.getLevel())+" from "+str(p1Coord)+" to "+str(p3Coord))
                        visMesh.addToPolygons(quad);
                    }
                }
            }
        }
    }
    cropQuads(visMesh);
    return visMesh;
}
Also used : ChomboSurfaceIndex(org.vcell.vis.vismesh.thrift.ChomboSurfaceIndex) HashMap(java.util.HashMap) ISize(org.vcell.util.ISize) VisLine(org.vcell.vis.vismesh.thrift.VisLine) Covering(org.vcell.vis.chombo.ChomboLevel.Covering) ChomboBoundaries(org.vcell.vis.chombo.ChomboBoundaries) ChomboVolumeIndex(org.vcell.vis.vismesh.thrift.ChomboVolumeIndex) VisPoint(org.vcell.vis.vismesh.thrift.VisPoint) ChomboLevelData(org.vcell.vis.chombo.ChomboLevelData) VisMesh(org.vcell.vis.vismesh.thrift.VisMesh) VisPolygon(org.vcell.vis.vismesh.thrift.VisPolygon) ChomboBox(org.vcell.vis.chombo.ChomboBox) ChomboMesh(org.vcell.vis.chombo.ChomboMesh) ChomboLevel(org.vcell.vis.chombo.ChomboLevel) VisPoint(org.vcell.vis.vismesh.thrift.VisPoint)

Example 3 with ChomboVolumeIndex

use of org.vcell.vis.vismesh.thrift.ChomboVolumeIndex in project vcell by virtualcell.

the class ChomboMeshMapping method fromMeshData3D.

private VisMesh fromMeshData3D(ChomboMeshData chomboMeshData, ChomboCombinedVolumeMembraneDomain chomboCombinedVolumeMembraneDomain) {
    int dimension = chomboMeshData.getMesh().getDimension();
    if (dimension != 3) {
        throw new RuntimeException("expecting a 3D mesh");
    }
    ChomboMesh chomboMesh = chomboMeshData.getMesh();
    ChomboLevel finestLevel = chomboMesh.getLevel(chomboMesh.getNumLevels() - 1);
    int finestAbsRefinement = finestLevel.getAbsoluteRefinement();
    ISize size = finestLevel.getSize();
    int numX = size.getX();
    int numY = size.getY();
    int numZ = size.getZ();
    Vect3D origin = new Vect3D(chomboMesh.getOrigin().x, chomboMesh.getOrigin().y, chomboMesh.getOrigin().z);
    Vect3D extent = new Vect3D(chomboMesh.getExtent().x, chomboMesh.getExtent().y, chomboMesh.getExtent().z);
    // invoke VisMesh() constructor
    VisMesh visMesh = new VisMesh(chomboMesh.getDimension(), origin, extent);
    int currPointIndex = 0;
    HashMap<String, Integer> pointDict = new HashMap<String, Integer>();
    double originX = chomboMesh.getOrigin().x;
    double originY = chomboMesh.getOrigin().y;
    double originZ = chomboMesh.getOrigin().z;
    double extentX = chomboMesh.getExtent().x;
    double extentY = chomboMesh.getExtent().y;
    double extentZ = chomboMesh.getExtent().z;
    ChomboBoundaries chomboBoundaries = chomboMesh.getBoundaries();
    for (ChomboBoundaries.Point chomboPoint : chomboBoundaries.getPoints()) {
        double px = chomboPoint.x;
        double py = chomboPoint.y;
        double pz = chomboPoint.z;
        px = (px - originX) * (numX) / extentX * 2 - 1;
        py = (py - originY) * (numY) / extentY * 2 - 1;
        pz = (pz - originZ) * (numZ) / extentZ * 2 - 1;
        VisPoint newVisPoint = new VisPoint(px, py, pz);
        String coordKey = toStringKey(newVisPoint);
        pointDict.put(coordKey, currPointIndex);
        visMesh.addToPoints(newVisPoint);
        visMesh.addToSurfacePoints(newVisPoint);
        currPointIndex += 1;
    }
    for (ChomboBoundaries.SurfaceTriangle surfaceTriangle : chomboBoundaries.getSurfaceTriangles()) {
        List<Integer> vertices = Arrays.asList(new Integer[] { surfaceTriangle.getP1(), surfaceTriangle.getP2(), surfaceTriangle.getP3() });
        org.vcell.vis.vismesh.thrift.Face face = org.vcell.vis.vismesh.thrift.Face.valueOf(surfaceTriangle.getFace().name());
        VisSurfaceTriangle newVisSurfaceTriangle = new VisSurfaceTriangle(vertices, face);
        newVisSurfaceTriangle.setChomboSurfaceIndex(new ChomboSurfaceIndex(surfaceTriangle.getChomboIndex()));
        visMesh.addToSurfaceTriangles(newVisSurfaceTriangle);
    }
    for (int levelIndex = 0; levelIndex < chomboMesh.getNumLevels(); levelIndex++) {
        ChomboLevelData chomboLevelData = chomboMeshData.getLevelData(levelIndex);
        ChomboLevel currLevel = chomboMesh.getLevel(levelIndex);
        int currAbsRefinement = currLevel.getAbsoluteRefinement();
        Covering covering = currLevel.getCovering();
        int[] levelMap = covering.getLevelMap();
        int[] boxNumberMap = covering.getBoxNumberMap();
        int[] boxIndexMap = covering.getBoxIndexMap();
        int levelNumX = currLevel.getSize().getX();
        int levelNumY = currLevel.getSize().getY();
        int levelNumZ = currLevel.getSize().getZ();
        for (int x = 0; x < levelNumX; x++) {
            for (int y = 0; y < levelNumY; y++) {
                for (int z = 0; z < levelNumZ; z++) {
                    int mapIndex = x + y * levelNumX + z * levelNumX * levelNumY;
                    if (levelMap[mapIndex] == levelIndex) {
                        // 
                        // if fraction (volume fraction of element in box) is 0 ... then skip this element
                        // 
                        int boxNumber = boxNumberMap[mapIndex];
                        int boxIndex = boxIndexMap[mapIndex];
                        double fraction = chomboLevelData.getCellFraction(currLevel, boxNumber, boxIndex);
                        if (fraction > 0) {
                            // 
                            // add cell
                            // 
                            ChomboBox chomboBox = new ChomboBox(currLevel, x, x, y, y, z, z, dimension).getProjectedBox(currAbsRefinement, finestAbsRefinement);
                            double minX = 2 * chomboBox.getMinX() - 1;
                            double maxX = 2 * chomboBox.getMaxX() + 1;
                            double minY = 2 * chomboBox.getMinY() - 1;
                            double maxY = 2 * chomboBox.getMaxY() + 1;
                            double minZ = 2 * chomboBox.getMinZ() - 1;
                            double maxZ = 2 * chomboBox.getMaxZ() + 1;
                            // 
                            // points for a VisPolyhedra ... initially a hex ... then may be clipped
                            // 
                            // p6-------------------p7
                            // /|                   /|
                            // / |                  / |
                            // p4-------------------p5  |
                            // |  |                 |  |
                            // |  |                 |  |
                            // |  |                 |  |         z   y
                            // |  p2................|..p3        |  /
                            // | /                  | /          | /
                            // |/                   |/           |/
                            // p0-------------------p1            O----- x
                            // 
                            // p0 = (X-,Y-,Z-)
                            // p1 = (X+,Y-,Z-)
                            // p2 = (X-,Y+,Z-)
                            // p3 = (X+,Y+,Z-)
                            // p4 = (X-,Y-,Z+)
                            // p5 = (X+,Y-,Z+)
                            // p6 = (X-,Y+,Z+)
                            // p7 = (X+,Y+,Z+)
                            // 
                            VisPoint[] visPoints = { // p0
                            new VisPoint(minX, minY, minZ), // p1
                            new VisPoint(maxX, minY, minZ), // p2
                            new VisPoint(minX, maxY, minZ), // p3
                            new VisPoint(maxX, maxY, minZ), // p4
                            new VisPoint(minX, minY, maxZ), // p5
                            new VisPoint(maxX, minY, maxZ), // p6
                            new VisPoint(minX, maxY, maxZ), // p7
                            new VisPoint(maxX, maxY, maxZ) };
                            Integer[] indices = new Integer[8];
                            for (int v = 0; v < 8; v++) {
                                VisPoint visPoint = visPoints[v];
                                String key = toStringKey(visPoint);
                                Integer i = pointDict.get(key);
                                if (i == null) {
                                    pointDict.put(key, currPointIndex);
                                    i = currPointIndex;
                                    visMesh.addToPoints(visPoint);
                                    currPointIndex++;
                                }
                                indices[v] = i;
                            }
                            VisVoxel voxel = new VisVoxel(Arrays.asList(indices));
                            voxel.setChomboVolumeIndex(new ChomboVolumeIndex(levelIndex, boxNumber, boxIndex, fraction));
                            // print('adding a cell at level '+str(currLevel.getLevel())+" from "+str(p1Coord)+" to "+str(p3Coord))
                            visMesh.addToVisVoxels(voxel);
                        }
                    }
                }
            }
        }
    }
    cropVoxels(visMesh, chomboBoundaries, chomboCombinedVolumeMembraneDomain);
    return visMesh;
}
Also used : HashMap(java.util.HashMap) ISize(org.vcell.util.ISize) Covering(org.vcell.vis.chombo.ChomboLevel.Covering) ChomboBoundaries(org.vcell.vis.chombo.ChomboBoundaries) ChomboVolumeIndex(org.vcell.vis.vismesh.thrift.ChomboVolumeIndex) Vect3D(org.vcell.vis.vismesh.thrift.Vect3D) ChomboMesh(org.vcell.vis.chombo.ChomboMesh) ChomboLevel(org.vcell.vis.chombo.ChomboLevel) VisPoint(org.vcell.vis.vismesh.thrift.VisPoint) ChomboSurfaceIndex(org.vcell.vis.vismesh.thrift.ChomboSurfaceIndex) VisVoxel(org.vcell.vis.vismesh.thrift.VisVoxel) VisPoint(org.vcell.vis.vismesh.thrift.VisPoint) ChomboLevelData(org.vcell.vis.chombo.ChomboLevelData) VisMesh(org.vcell.vis.vismesh.thrift.VisMesh) VisSurfaceTriangle(org.vcell.vis.vismesh.thrift.VisSurfaceTriangle) ChomboBox(org.vcell.vis.chombo.ChomboBox) Face(org.vcell.vis.vismesh.thrift.Face)

Example 4 with ChomboVolumeIndex

use of org.vcell.vis.vismesh.thrift.ChomboVolumeIndex in project vcell by virtualcell.

the class ChomboMeshMapping method createClippedPolyhedron.

private VisIrregularPolyhedron createClippedPolyhedron(ClippedVoxel clippedVoxel, VisMesh visMesh, VisVoxel oldVoxel) {
    VisIrregularPolyhedron visIrregularPolyhedron = new VisIrregularPolyhedron();
    visIrregularPolyhedron.setChomboVolumeIndex(new ChomboVolumeIndex(oldVoxel.getChomboVolumeIndex()));
    // 
    for (VisSurfaceTriangle triangle : clippedVoxel.surfaceTriangles) {
        List<Integer> triangleIndices = triangle.getPointIndices();
        PolyhedronFace polyhedronFace = new PolyhedronFace(triangleIndices);
        visIrregularPolyhedron.addToPolyhedronFaces(polyhedronFace);
    }
    VoxelFace[] voxelFaces = new VoxelFace[] { clippedVoxel.f0, clippedVoxel.f1, clippedVoxel.f2, clippedVoxel.f3, clippedVoxel.f4, clippedVoxel.f5 };
    for (VoxelFace voxelFace : voxelFaces) {
        VisSurfaceTriangle triangleForThisFace = clippedVoxel.getSurfaceTriangle(voxelFace.face);
        List<Integer> triangleIndices = null;
        VisPoint[] trianglePoints = null;
        if (triangleForThisFace != null) {
            triangleIndices = triangleForThisFace.getPointIndices();
            trianglePoints = new VisPoint[] { visMesh.getPoints().get(triangleIndices.get(0)), visMesh.getPoints().get(triangleIndices.get(1)), visMesh.getPoints().get(triangleIndices.get(2)) };
        }
        ArrayList<Integer> indices = new ArrayList<Integer>();
        if (voxelFace.p0.bIncluded) {
            indices.add(voxelFace.p0.p);
        }
        if (triangleIndices != null) {
            for (int i = 0; i < 3; i++) {
                if (isColinear(voxelFace.p0.vp, trianglePoints[i], voxelFace.p1.vp)) {
                    indices.add(triangleIndices.get(i));
                }
            }
        }
        if (voxelFace.p1.bIncluded) {
            indices.add(voxelFace.p1.p);
        }
        if (triangleIndices != null) {
            for (int i = 0; i < 3; i++) {
                if (isColinear(voxelFace.p1.vp, trianglePoints[i], voxelFace.p2.vp)) {
                    indices.add(triangleIndices.get(i));
                }
            }
        }
        if (voxelFace.p2.bIncluded) {
            indices.add(voxelFace.p2.p);
        }
        if (triangleIndices != null) {
            for (int i = 0; i < 3; i++) {
                if (isColinear(voxelFace.p2.vp, trianglePoints[i], voxelFace.p3.vp)) {
                    indices.add(triangleIndices.get(i));
                }
            }
        }
        if (voxelFace.p3.bIncluded) {
            indices.add(voxelFace.p3.p);
        }
        if (triangleIndices != null) {
            for (int i = 0; i < 3; i++) {
                if (isColinear(voxelFace.p3.vp, trianglePoints[i], voxelFace.p0.vp)) {
                    indices.add(triangleIndices.get(i));
                }
            }
        }
        // indices.add(voxelFace.p3.p);
        if (indices.size() >= 3) {
            ArrayList<Integer> indexArray = new ArrayList<Integer>(indices);
            PolyhedronFace polyFace = new PolyhedronFace(indexArray);
            visIrregularPolyhedron.addToPolyhedronFaces(polyFace);
        }
    }
    return visIrregularPolyhedron;
}
Also used : PolyhedronFace(org.vcell.vis.vismesh.thrift.PolyhedronFace) ArrayList(java.util.ArrayList) ChomboVolumeIndex(org.vcell.vis.vismesh.thrift.ChomboVolumeIndex) VisPoint(org.vcell.vis.vismesh.thrift.VisPoint) VisSurfaceTriangle(org.vcell.vis.vismesh.thrift.VisSurfaceTriangle) VisPoint(org.vcell.vis.vismesh.thrift.VisPoint) VisIrregularPolyhedron(org.vcell.vis.vismesh.thrift.VisIrregularPolyhedron)

Example 5 with ChomboVolumeIndex

use of org.vcell.vis.vismesh.thrift.ChomboVolumeIndex in project vcell by virtualcell.

the class DebugWriteProblem method main.

/**
 * @param args
 */
public static void main(String[] args) {
    try {
        VisMesh visMesh = new VisMesh(3, new Vect3D(0, 0, 0), new Vect3D(3, 1, 1));
        VisPoint[] points0 = new VisPoint[] { new VisPoint(0, 0, 0), new VisPoint(1, 0, 0), new VisPoint(0, 1, 0), new VisPoint(0, 0, 1) };
        visMesh.addToPoints(points0[0]);
        visMesh.addToPoints(points0[1]);
        visMesh.addToPoints(points0[2]);
        visMesh.addToPoints(points0[3]);
        List<PolyhedronFace> faces0 = Arrays.asList(new PolyhedronFace(Arrays.asList(0, 1, 3)), new PolyhedronFace(Arrays.asList(0, 3, 2)), new PolyhedronFace(Arrays.asList(0, 2, 1)), new PolyhedronFace(Arrays.asList(1, 3, 2)));
        int level = 0;
        int boxNumber = 0;
        int boxIndex = 0;
        int fraction = 0;
        VisIrregularPolyhedron genPolyhedra0 = new VisIrregularPolyhedron(faces0);
        genPolyhedra0.setChomboVolumeIndex(new ChomboVolumeIndex(level, boxNumber, boxIndex, fraction));
        visMesh.addToIrregularPolyhedra(genPolyhedra0);
    // VisPoint[] points1 = new VisPoint[] {
    // new VisPoint(2+0, 0, 0),
    // new VisPoint(2+1, 0, 0),
    // new VisPoint(2+0, 1, 0),
    // new VisPoint(2+0, 0, 1)
    // };
    // 
    // visMesh.addPoint(points1[0]);
    // visMesh.addPoint(points1[1]);
    // visMesh.addPoint(points1[2]);
    // visMesh.addPoint(points1[3]);
    // 
    // vtkUnstructuredGrid vtkgrid = VtkGridUtils.getVolumeVtkGrid(visMesh);
    // String filenameASCII = "testASCII.vtk";
    // String filenameBinary = "testBinary.vtk";
    // VtkGridUtils.writeXML(vtkgrid, filenameASCII, true);
    // VtkGridUtils.writeXML(vtkgrid, filenameBinary, false);
    // vtkgrid = VtkGridUtils.read(filenameBinary);
    // vtkgrid.BuildLinks();
    // SimpleVTKViewer simpleViewer = new SimpleVTKViewer();
    // String[] varNames = visDomain.getVisMeshData().getVarNames();
    // simpleViewer.showGrid(vtkgrid, varNames[0], varNames[1]);
    } catch (Exception e) {
        e.printStackTrace(System.out);
    }
}
Also used : VisMesh(org.vcell.vis.vismesh.thrift.VisMesh) PolyhedronFace(org.vcell.vis.vismesh.thrift.PolyhedronFace) VisPoint(org.vcell.vis.vismesh.thrift.VisPoint) VisIrregularPolyhedron(org.vcell.vis.vismesh.thrift.VisIrregularPolyhedron) ChomboVolumeIndex(org.vcell.vis.vismesh.thrift.ChomboVolumeIndex) VisPoint(org.vcell.vis.vismesh.thrift.VisPoint) Vect3D(org.vcell.vis.vismesh.thrift.Vect3D)

Aggregations

ChomboVolumeIndex (org.vcell.vis.vismesh.thrift.ChomboVolumeIndex)5 VisPoint (org.vcell.vis.vismesh.thrift.VisPoint)4 ChomboSurfaceIndex (org.vcell.vis.vismesh.thrift.ChomboSurfaceIndex)3 VisMesh (org.vcell.vis.vismesh.thrift.VisMesh)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 ISize (org.vcell.util.ISize)2 ChomboBoundaries (org.vcell.vis.chombo.ChomboBoundaries)2 ChomboBox (org.vcell.vis.chombo.ChomboBox)2 ChomboLevel (org.vcell.vis.chombo.ChomboLevel)2 Covering (org.vcell.vis.chombo.ChomboLevel.Covering)2 ChomboLevelData (org.vcell.vis.chombo.ChomboLevelData)2 ChomboMesh (org.vcell.vis.chombo.ChomboMesh)2 PolyhedronFace (org.vcell.vis.vismesh.thrift.PolyhedronFace)2 Vect3D (org.vcell.vis.vismesh.thrift.Vect3D)2 VisIrregularPolyhedron (org.vcell.vis.vismesh.thrift.VisIrregularPolyhedron)2 VisSurfaceTriangle (org.vcell.vis.vismesh.thrift.VisSurfaceTriangle)2 File (java.io.File)1 List (java.util.List)1 ChomboDataset (org.vcell.vis.chombo.ChomboDataset)1