use of org.vcell.util.CoordinateIndex in project vcell by virtualcell.
the class CartesianMesh method getVolumeSliceIndices.
/**
* This method was created in VisualAge.
* @return java.lang.String
* @param variable java.lang.String
* @param time double
*/
public int[] getVolumeSliceIndices(int normalAxis, int sliceNumber) {
Coordinate normalAxisDimension = Coordinate.convertAxisFromStandardXYZToNormal(getSizeX(), getSizeY(), getSizeZ(), normalAxis);
int[] indices = new int[(int) normalAxisDimension.getX() * (int) normalAxisDimension.getY()];
int counter = 0;
CoordinateIndex coordIndex = new CoordinateIndex();
for (int y = 0; y < normalAxisDimension.getY(); y += 1) {
for (int x = 0; x < normalAxisDimension.getX(); x += 1) {
//
// indexing through "normal" slice, converting each X,Y pair into equivalent
// (X,Y,Z) in mesh coordinates.
//
coordIndex.x = x;
coordIndex.y = y;
coordIndex.z = sliceNumber;
Coordinate.convertCoordinateIndexFromNormalToStandardXYZ(coordIndex, normalAxis);
//
// store mesh coordinates in "normal" slice sample array.
//
indices[counter] = getVolumeIndex(coordIndex.x, coordIndex.y, coordIndex.z);
counter += 1;
}
}
return indices;
}
use of org.vcell.util.CoordinateIndex in project vcell by virtualcell.
the class CartesianMesh method calculateMeshElementVolumeFromVolumeIndex.
/**
* Insert the method's description here.
* Creation date: (2/23/2006 12:52:44 PM)
*/
public double calculateMeshElementVolumeFromVolumeIndex(int volumeIndex) {
CoordinateIndex ci = getCoordinateIndexFromVolumeIndex(volumeIndex);
double fxMESize = (ci.x == 0 || ci.x == (getSizeX() - 1) ? .5 : 1);
double fyMESize = (getGeometryDimension() >= 2 ? (ci.y == 0 || ci.y == (getSizeY() - 1) ? .5 : 1) : 0);
double fzMESize = (getGeometryDimension() == 3 ? (ci.z == 0 || ci.z == (getSizeZ() - 1) ? .5 : 1) : 0);
return (fxMESize != 0 ? fxMESize * (getExtent().getX() / (getSizeX() - 1)) : 1) * (fyMESize != 0 ? fyMESize * (getExtent().getY() / (getSizeY() - 1)) : 1) * (fzMESize != 0 ? fzMESize * (getExtent().getZ() / (getSizeZ() - 1)) : 1);
}
use of org.vcell.util.CoordinateIndex in project vcell by virtualcell.
the class CartesianMeshChombo method findMembraneIndexFromVolumeCoordinate.
public int findMembraneIndexFromVolumeCoordinate(Coordinate wc) {
if (dx == null) {
dx = new double[3];
dx[0] = getExtent().getX() / getSizeX();
dx[1] = getExtent().getY() / getSizeY();
dx[2] = getExtent().getZ() / getSizeZ();
}
int i = (int) ((wc.getX() - getOrigin().getX()) / dx[0]);
int j = (int) ((wc.getY() - getOrigin().getY()) / dx[1]);
int k = dimension < 3 ? 0 : (int) ((wc.getZ() - getOrigin().getZ()) / dx[2]);
return findMembraneIndexFromVolumeIndex(new CoordinateIndex(i, j, k));
}
use of org.vcell.util.CoordinateIndex in project vcell by virtualcell.
the class CartesianMeshChombo method findMembraneIndexFromVolumeIndex.
public int findMembraneIndexFromVolumeIndex(CoordinateIndex ci) {
for (MembraneElementMetricsEntry me : membraneElementMetrics) {
CoordinateIndex ci0 = new CoordinateIndex(me.i, me.j, me.k);
CoordinateIndex ci1 = ci;
if (me.level < viewLevel) {
ci1 = convertDownToLevel(ci1, me.level, viewLevel);
} else if (me.level > viewLevel) {
// we will worry about this later.
return -1;
}
if (ci0.x == ci1.x && ci0.y == ci1.y && (dimension == 2 || ci0.z == ci1.z)) {
return me.index;
}
}
return -1;
}
use of org.vcell.util.CoordinateIndex in project vcell by virtualcell.
the class MeshDisplayAdapter method isMembraneElementVisible.
/**
* Insert the method's description here.
* Creation date: (8/30/00 6:25:14 PM)
* @return cbit.vcell.geometry.Line
*/
private boolean isMembraneElementVisible(MembraneElement membraneElement, int normalAxis, int slice) {
int membranePlane = getNormalAxis(membraneElement);
if (membranePlane == normalAxis) {
// MembraneElement perpendicular to our view
return false;
}
CoordinateIndex insideCI = mesh.getCoordinateIndexFromVolumeIndex(membraneElement.getInsideVolumeIndex());
// MembraneElement not visible in slice
if (normalAxis == Coordinate.Z_AXIS && insideCI.z != slice) {
return false;
} else if (normalAxis == Coordinate.Y_AXIS && insideCI.y != slice) {
return false;
} else if (normalAxis == Coordinate.X_AXIS && insideCI.x != slice) {
return false;
}
return true;
}
Aggregations