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;
}
Aggregations