Search in sources :

Example 1 with CartesianMeshMovingBoundary

use of cbit.vcell.solvers.CartesianMeshMovingBoundary in project vcell by virtualcell.

the class PDEDataContextPanel method calculateSourceDataInfo.

/**
 * Comment
 */
private SourceDataInfo calculateSourceDataInfo(CartesianMesh mesh, double[] sdiData, VariableType sdiVarType, Range newRange) {
    SourceDataInfo sdi = null;
    // 
    if (sdiVarType.equals(VariableType.VOLUME) || sdiVarType.equals(VariableType.POSTPROCESSING)) {
        // Set data to display
        int yIncr = mesh.getSizeX();
        int zIncr = mesh.getSizeX() * mesh.getSizeY();
        sdi = new SourceDataInfo(SourceDataInfo.RAW_VALUE_TYPE, sdiData, mesh.getExtent(), mesh.getOrigin(), newRange, 0, mesh.getSizeX(), 1, mesh.getSizeY(), yIncr, mesh.getSizeZ(), zIncr);
    } else if (sdiVarType.equals(VariableType.VOLUME_REGION)) {
        // 
        double[] expandedVolumeRegionValues = new double[mesh.getSizeX() * mesh.getSizeY() * mesh.getSizeZ()];
        double[] volumeRegionDataValues = sdiData;
        for (int i = 0; i < expandedVolumeRegionValues.length; i += 1) {
            expandedVolumeRegionValues[i] = volumeRegionDataValues[mesh.getVolumeRegionIndex(i)];
        }
        // 
        int yIncr = mesh.getSizeX();
        int zIncr = mesh.getSizeX() * mesh.getSizeY();
        sdi = new SourceDataInfo(SourceDataInfo.RAW_VALUE_TYPE, expandedVolumeRegionValues, mesh.getExtent(), mesh.getOrigin(), newRange, 0, mesh.getSizeX(), 1, mesh.getSizeY(), yIncr, mesh.getSizeZ(), zIncr);
    } else {
        // Membranes
        // Create placeholder SDI with null data
        sdi = new SourceDataInfo(SourceDataInfo.RAW_VALUE_TYPE, null, mesh.getExtent(), mesh.getOrigin(), newRange, 0, mesh.getSizeX(), 0, mesh.getSizeY(), 0, mesh.getSizeZ(), 0);
    }
    if (mesh.isChomboMesh()) {
        sdi.setIsChombo(true);
    } else if (mesh instanceof CartesianMeshMovingBoundary) {
        sdi.setSolverDataType(SolverDataType.MBSData);
    }
    return sdi;
}
Also used : SourceDataInfo(cbit.image.SourceDataInfo) CartesianMeshMovingBoundary(cbit.vcell.solvers.CartesianMeshMovingBoundary) SinglePoint(cbit.vcell.geometry.SinglePoint)

Aggregations

SourceDataInfo (cbit.image.SourceDataInfo)1 SinglePoint (cbit.vcell.geometry.SinglePoint)1 CartesianMeshMovingBoundary (cbit.vcell.solvers.CartesianMeshMovingBoundary)1