use of org.vcell.util.DataAccessException in project vcell by virtualcell.
the class ClientDocumentManager method save.
/**
* Insert the method's description here.
* Creation date: (10/28/00 12:08:30 AM)
*/
public Geometry save(Geometry geometry) throws DataAccessException {
try {
String geometryXML = null;
try {
geometryXML = XmlHelper.geometryToXML(geometry);
} catch (XmlParseException e) {
e.printStackTrace(System.out);
throw new DataAccessException(e.getMessage());
}
String savedGeometryXML = sessionManager.getUserMetaDbServer().saveGeometry(new BigString(geometryXML)).toString();
Geometry savedGeometry = getGeometryFromDatabaseXML(savedGeometryXML);
KeyValue savedKey = savedGeometry.getVersion().getVersionKey();
if (xmlHash.get(savedKey) == null) {
xmlHash.put(savedKey, savedGeometryXML);
}
updateGeometryRelatedHashes(savedGeometry);
return savedGeometry;
} catch (RemoteProxyException e) {
e.printStackTrace(System.out);
throw new DataAccessException(VCellErrorMessages.FAIL_SAVE_MESSAGE + "\n\n" + e.getMessage());
}
}
use of org.vcell.util.DataAccessException in project vcell by virtualcell.
the class ClientDocumentManager method substituteFieldFuncNames.
public void substituteFieldFuncNames(VCDocument vcDocument, VersionableTypeVersion originalOwner) throws DataAccessException, MathException, ExpressionException {
Vector<ExternalDataIdentifier> errorCleanupExtDataIDV = new Vector<ExternalDataIdentifier>();
try {
if (originalOwner == null || originalOwner.getVersion().getOwner().compareEqual(getUser())) {
// Substitution for FieldFunc not needed for new doc or if we own doc
return;
}
// Get Objects from Document that might need to have FieldFuncs replaced
Vector<Object> fieldFunctionContainer_mathDesc_or_simContextV = new Vector<Object>();
if (vcDocument instanceof MathModel) {
fieldFunctionContainer_mathDesc_or_simContextV.add(((MathModel) vcDocument).getMathDescription());
} else if (vcDocument instanceof BioModel) {
SimulationContext[] simContextArr = ((BioModel) vcDocument).getSimulationContexts();
for (int i = 0; i < simContextArr.length; i += 1) {
fieldFunctionContainer_mathDesc_or_simContextV.add(simContextArr[i]);
}
}
// Get original Field names
Vector<String> origFieldFuncNamesV = new Vector<String>();
for (int i = 0; i < fieldFunctionContainer_mathDesc_or_simContextV.size(); i += 1) {
Object fieldFunctionContainer = fieldFunctionContainer_mathDesc_or_simContextV.elementAt(i);
FieldFunctionArguments[] fieldFuncArgsArr = null;
if (fieldFunctionContainer instanceof MathDescription) {
fieldFuncArgsArr = FieldUtilities.getFieldFunctionArguments((MathDescription) fieldFunctionContainer);
} else if (fieldFunctionContainer instanceof SimulationContext) {
fieldFuncArgsArr = ((SimulationContext) fieldFunctionContainer).getFieldFunctionArguments();
}
for (int j = 0; j < fieldFuncArgsArr.length; j += 1) {
if (!origFieldFuncNamesV.contains(fieldFuncArgsArr[j].getFieldName())) {
origFieldFuncNamesV.add(fieldFuncArgsArr[j].getFieldName());
}
}
}
if (origFieldFuncNamesV.size() == 0) {
// No FieldFunctions to substitute
return;
}
FieldDataDBOperationResults copyNamesFieldDataOpResults = fieldDataDBOperation(FieldDataDBOperationSpec.createCopyNoConflictExtDataIDsSpec(getUser(), origFieldFuncNamesV.toArray(new String[0]), originalOwner));
errorCleanupExtDataIDV.addAll(copyNamesFieldDataOpResults.oldNameNewIDHash.values());
// Copy Field Data on Data Server FileSystem
for (String fieldname : origFieldFuncNamesV) {
KeyValue sourceSimDataKey = copyNamesFieldDataOpResults.oldNameOldExtDataIDKeyHash.get(fieldname);
if (sourceSimDataKey == null) {
throw new DataAccessException("Couldn't find original data key for FieldFunc " + fieldname);
}
ExternalDataIdentifier newExtDataID = copyNamesFieldDataOpResults.oldNameNewIDHash.get(fieldname);
getSessionManager().fieldDataFileOperation(FieldDataFileOperationSpec.createCopySimFieldDataFileOperationSpec(newExtDataID, sourceSimDataKey, originalOwner.getVersion().getOwner(), FieldDataFileOperationSpec.JOBINDEX_DEFAULT, getUser()));
}
// Finally substitute new Field names
for (int i = 0; i < fieldFunctionContainer_mathDesc_or_simContextV.size(); i += 1) {
Object fieldFunctionContainer = fieldFunctionContainer_mathDesc_or_simContextV.elementAt(i);
if (fieldFunctionContainer instanceof MathDescription) {
MathDescription mathDesc = (MathDescription) fieldFunctionContainer;
FieldUtilities.substituteFieldFuncNames(mathDesc, copyNamesFieldDataOpResults.oldNameNewIDHash);
} else if (fieldFunctionContainer instanceof SimulationContext) {
SimulationContext simContext = (SimulationContext) fieldFunctionContainer;
simContext.substituteFieldFuncNames(copyNamesFieldDataOpResults.oldNameNewIDHash);
}
}
fireFieldDataDB(new FieldDataDBEvent(this));
} catch (Exception e) {
e.printStackTrace();
// Cleanup
for (int i = 0; i < errorCleanupExtDataIDV.size(); i += 1) {
try {
fieldDataDBOperation(FieldDataDBOperationSpec.createDeleteExtDataIDSpec(errorCleanupExtDataIDV.elementAt(i)));
} catch (Exception e2) {
// ignore, we tried to cleanup
}
try {
fieldDataFileOperation(FieldDataFileOperationSpec.createDeleteFieldDataFileOperationSpec(errorCleanupExtDataIDV.elementAt(i)));
} catch (Exception e1) {
// ignore, we tried to cleanup
}
}
throw new RuntimeException("Error copying Field Data \n" + e.getMessage());
}
}
use of org.vcell.util.DataAccessException in project vcell by virtualcell.
the class RasterExporter method exportPDEData.
private NrrdInfo[] exportPDEData(OutputContext outputContext, long jobID, User user, DataServerImpl dataServerImpl, VCDataIdentifier vcdID, VariableSpecs variableSpecs, TimeSpecs timeSpecs2, GeometrySpecs geometrySpecs, RasterSpecs rasterSpecs, FileDataContainerManager fileDataContainerManager) throws RemoteException, DataAccessException, IOException {
CartesianMesh mesh = dataServerImpl.getMesh(user, vcdID);
DataProcessingOutputInfo dataProcessingOutputInfo = null;
// check if any of export variables are PostProcess and if so try to get PostProcessOutputInfo
exportServiceImpl.fireExportProgress(jobID, vcdID, "Check PostProcess", 0.0);
DataIdentifier[] dataIdentifiers = dataServerImpl.getDataIdentifiers(outputContext, user, vcdID);
for (int i = 0; i < dataIdentifiers.length; i++) {
for (int j = 0; j < variableSpecs.getVariableNames().length; j++) {
if (variableSpecs.getVariableNames()[j].equals(dataIdentifiers[i].getName()) && VariableType.POSTPROCESSING.equals(dataIdentifiers[i].getVariableType())) {
try {
// we need PostProcessOutputInfo
exportServiceImpl.fireExportProgress(jobID, vcdID, "Read PostProcess", 0.0);
dataProcessingOutputInfo = (DataProcessingOutputInfo) dataServerImpl.doDataOperation(user, new DataOperation.DataProcessingOutputInfoOP(vcdID, false, outputContext));
break;
} catch (Exception e) {
throw new DataAccessException("Export variable '" + variableSpecs.getVariableNames()[j] + "' is PostProcessing type. Error reading PostProcessing data: " + e.getClass().getName() + " " + e.getMessage());
}
}
}
}
long lastUpdateTime = 0;
switch(rasterSpecs.getFormat()) {
case NRRD_SINGLE:
{
switch(geometrySpecs.getModeID()) {
case GEOMETRY_FULL:
{
NrrdInfo nrrdInfo = NRRDHelper.getSizeCheckedNrrdHelper(variableSpecs, mesh.getISize(), mesh.getExtent(), dataProcessingOutputInfo).createSingleFullNrrdInfo(fileDataContainerManager, vcdID, variableSpecs, rasterSpecs, timeSpecs2);
int progressIndex = 1;
int progressEnd = variableSpecs.getVariableNames().length * (timeSpecs2.getEndTimeIndex() - timeSpecs2.getBeginTimeIndex() + 1);
for (int i = 0; i < variableSpecs.getVariableNames().length; i++) {
for (int j = timeSpecs2.getBeginTimeIndex(); j <= timeSpecs2.getEndTimeIndex(); j++) {
lastUpdateTime = fireThrottledProgress(exportServiceImpl, lastUpdateTime, "NRRD-snglfull", jobID, vcdID, progressIndex, progressEnd);
progressIndex++;
double[] data = dataServerImpl.getSimDataBlock(outputContext, user, vcdID, variableSpecs.getVariableNames()[i], timeSpecs2.getAllTimes()[j]).getData();
NRRDHelper.appendDoubleData(nrrdInfo, fileDataContainerManager, data, variableSpecs.getVariableNames()[i]);
}
}
nrrdInfo = NrrdWriter.writeNRRD(nrrdInfo, fileDataContainerManager);
return new NrrdInfo[] { nrrdInfo };
}
case GEOMETRY_SLICE:
{
NrrdInfo sliceNrrdInfo = createSliceNrrdHelper(mesh, dataProcessingOutputInfo, vcdID, variableSpecs, timeSpecs2, geometrySpecs, rasterSpecs, fileDataContainerManager).createSingleFullNrrdInfo(fileDataContainerManager, vcdID, variableSpecs, rasterSpecs, timeSpecs2);
int progressIndex = 1;
int progressEnd = variableSpecs.getVariableNames().length * (timeSpecs2.getEndTimeIndex() - timeSpecs2.getBeginTimeIndex() + 1);
for (int i = 0; i < variableSpecs.getVariableNames().length; i++) {
for (int j = timeSpecs2.getBeginTimeIndex(); j <= timeSpecs2.getEndTimeIndex(); j++) {
lastUpdateTime = fireThrottledProgress(exportServiceImpl, lastUpdateTime, "NRRD-snglslice", jobID, vcdID, progressIndex, progressEnd);
progressIndex++;
double[] data = dataServerImpl.getSimDataBlock(outputContext, user, vcdID, variableSpecs.getVariableNames()[i], timeSpecs2.getAllTimes()[j]).getData();
appendSlice(variableSpecs.getVariableNames()[i], data, sliceNrrdInfo, mesh, geometrySpecs, fileDataContainerManager);
}
}
sliceNrrdInfo = NrrdWriter.writeNRRD(sliceNrrdInfo, fileDataContainerManager);
return new NrrdInfo[] { sliceNrrdInfo };
}
default:
{
throw new DataAccessException("NRRD export from slice not yet supported");
}
}
}
case NRRD_BY_TIME:
{
switch(geometrySpecs.getModeID()) {
case GEOMETRY_FULL:
{
NRRDHelper nrrdHelper = NRRDHelper.getSizeCheckedNrrdHelper(variableSpecs, mesh.getISize(), mesh.getExtent(), dataProcessingOutputInfo);
Vector<NrrdInfo> nrrdinfoV = new Vector<NrrdInfo>();
int progressIndex = 1;
int progressEnd = (timeSpecs2.getEndTimeIndex() - timeSpecs2.getBeginTimeIndex() + 1);
for (int j = timeSpecs2.getBeginTimeIndex(); j <= timeSpecs2.getEndTimeIndex(); j++) {
lastUpdateTime = fireThrottledProgress(exportServiceImpl, lastUpdateTime, "NRRD-timefull", jobID, vcdID, progressIndex, progressEnd);
progressIndex++;
NrrdInfo nrrdInfo = nrrdHelper.createTimeFullNrrdInfo(fileDataContainerManager, vcdID, variableSpecs, timeSpecs2.getAllTimes()[j], rasterSpecs);
nrrdinfoV.add(nrrdInfo);
for (int i = 0; i < variableSpecs.getVariableNames().length; i++) {
double[] data = dataServerImpl.getSimDataBlock(outputContext, user, vcdID, variableSpecs.getVariableNames()[i], timeSpecs2.getAllTimes()[j]).getData();
NRRDHelper.appendDoubleData(nrrdInfo, fileDataContainerManager, data, variableSpecs.getVariableNames()[i]);
}
NrrdWriter.writeNRRD(nrrdInfo, fileDataContainerManager);
}
if (nrrdinfoV.size() > 0) {
NrrdInfo[] nrrdinfoArr = new NrrdInfo[nrrdinfoV.size()];
nrrdinfoV.copyInto(nrrdinfoArr);
return nrrdinfoArr;
}
return null;
}
case GEOMETRY_SLICE:
{
Vector<NrrdInfo> nrrdinfoV = new Vector<NrrdInfo>();
int progressIndex = 1;
int progressEnd = (timeSpecs2.getEndTimeIndex() - timeSpecs2.getBeginTimeIndex() + 1);
for (int j = timeSpecs2.getBeginTimeIndex(); j <= timeSpecs2.getEndTimeIndex(); j++) {
lastUpdateTime = fireThrottledProgress(exportServiceImpl, lastUpdateTime, "NRRD-timeslice", jobID, vcdID, progressIndex, progressEnd);
progressIndex++;
NrrdInfo sliceNrrdInfo = createSliceNrrdHelper(mesh, dataProcessingOutputInfo, vcdID, variableSpecs, timeSpecs2, geometrySpecs, rasterSpecs, fileDataContainerManager).createTimeFullNrrdInfo(fileDataContainerManager, vcdID, variableSpecs, timeSpecs2.getAllTimes()[j], rasterSpecs);
nrrdinfoV.add(sliceNrrdInfo);
for (int i = 0; i < variableSpecs.getVariableNames().length; i++) {
double[] data = dataServerImpl.getSimDataBlock(outputContext, user, vcdID, variableSpecs.getVariableNames()[i], timeSpecs2.getAllTimes()[j]).getData();
appendSlice(variableSpecs.getVariableNames()[i], data, sliceNrrdInfo, mesh, geometrySpecs, fileDataContainerManager);
}
NrrdWriter.writeNRRD(sliceNrrdInfo, fileDataContainerManager);
}
if (nrrdinfoV.size() > 0) {
NrrdInfo[] nrrdinfoArr = new NrrdInfo[nrrdinfoV.size()];
nrrdinfoV.copyInto(nrrdinfoArr);
return nrrdinfoArr;
}
return null;
}
default:
{
throw new DataAccessException("NRRD export from slice not yet supported");
}
}
}
case NRRD_BY_VARIABLE:
{
switch(geometrySpecs.getModeID()) {
case GEOMETRY_FULL:
{
Vector<NrrdInfo> nrrdinfoV = new Vector<NrrdInfo>();
int progressIndex = 1;
int progressEnd = variableSpecs.getVariableNames().length * (timeSpecs2.getEndTimeIndex() - timeSpecs2.getBeginTimeIndex() + 1);
for (int i = 0; i < variableSpecs.getVariableNames().length; i++) {
NRRDHelper nrrdhelHelper = new NRRDHelper(variableSpecs.getVariableNames()[i], mesh.getISize(), mesh.getExtent(), dataProcessingOutputInfo);
NrrdInfo nrrdInfo = nrrdhelHelper.createVariableFullNrrdInfo(fileDataContainerManager, vcdID, variableSpecs.getVariableNames()[i], timeSpecs2, rasterSpecs);
nrrdinfoV.add(nrrdInfo);
for (int j = timeSpecs2.getBeginTimeIndex(); j <= timeSpecs2.getEndTimeIndex(); j++) {
lastUpdateTime = fireThrottledProgress(exportServiceImpl, lastUpdateTime, "NRRD-varsfull", jobID, vcdID, progressIndex, progressEnd);
progressIndex++;
double[] data = dataServerImpl.getSimDataBlock(outputContext, user, vcdID, variableSpecs.getVariableNames()[i], timeSpecs2.getAllTimes()[j]).getData();
NRRDHelper.appendDoubleData(nrrdInfo, fileDataContainerManager, data, variableSpecs.getVariableNames()[i]);
}
nrrdInfo = NrrdWriter.writeNRRD(nrrdInfo, fileDataContainerManager);
}
if (nrrdinfoV.size() > 0) {
NrrdInfo[] nrrdinfoArr = new NrrdInfo[nrrdinfoV.size()];
nrrdinfoV.copyInto(nrrdinfoArr);
return nrrdinfoArr;
}
return null;
}
case GEOMETRY_SLICE:
{
Vector<NrrdInfo> nrrdinfoV = new Vector<NrrdInfo>();
int progressIndex = 1;
int progressEnd = variableSpecs.getVariableNames().length * (timeSpecs2.getEndTimeIndex() - timeSpecs2.getBeginTimeIndex() + 1);
for (int i = 0; i < variableSpecs.getVariableNames().length; i++) {
NrrdInfo sliceNrrdInfo = createSliceNrrdHelper(mesh, dataProcessingOutputInfo, vcdID, variableSpecs, timeSpecs2, geometrySpecs, rasterSpecs, fileDataContainerManager).createVariableFullNrrdInfo(fileDataContainerManager, vcdID, variableSpecs.getVariableNames()[i], timeSpecs2, rasterSpecs);
nrrdinfoV.add(sliceNrrdInfo);
for (int j = timeSpecs2.getBeginTimeIndex(); j <= timeSpecs2.getEndTimeIndex(); j++) {
lastUpdateTime = fireThrottledProgress(exportServiceImpl, lastUpdateTime, "NRRD-varsfull", jobID, vcdID, progressIndex, progressEnd);
progressIndex++;
double[] data = dataServerImpl.getSimDataBlock(outputContext, user, vcdID, variableSpecs.getVariableNames()[i], timeSpecs2.getAllTimes()[j]).getData();
appendSlice(variableSpecs.getVariableNames()[i], data, sliceNrrdInfo, mesh, geometrySpecs, fileDataContainerManager);
}
NrrdWriter.writeNRRD(sliceNrrdInfo, fileDataContainerManager);
}
if (nrrdinfoV.size() > 0) {
NrrdInfo[] nrrdinfoArr = new NrrdInfo[nrrdinfoV.size()];
nrrdinfoV.copyInto(nrrdinfoArr);
return nrrdinfoArr;
}
return null;
}
default:
{
throw new DataAccessException("NRRD export from slice not yet supported");
}
}
}
default:
{
throw new DataAccessException("Multiple NRRD file export not yet supported");
}
}
}
use of org.vcell.util.DataAccessException in project vcell by virtualcell.
the class FVSolverStandalone method writeVCGAndResampleFieldData.
protected void writeVCGAndResampleFieldData() throws SolverException {
fireSolverStarting(SimulationMessage.MESSAGE_SOLVEREVENT_STARTING_PROC_GEOM);
try {
// write subdomains file
SubdomainInfo.write(new File(getSaveDirectory(), baseName + SimDataConstants.SUBDOMAINS_FILE_SUFFIX), simTask.getSimulation().getMathDescription());
PrintWriter pw = new PrintWriter(new FileWriter(new File(getSaveDirectory(), baseName + SimDataConstants.VCG_FILE_EXTENSION)));
GeometryFileWriter.write(pw, getResampledGeometry());
pw.close();
FieldDataIdentifierSpec[] argFieldDataIDSpecs = simTask.getSimulationJob().getFieldDataIdentifierSpecs();
if (argFieldDataIDSpecs != null && argFieldDataIDSpecs.length > 0) {
fireSolverStarting(SimulationMessage.MESSAGE_SOLVEREVENT_STARTING_RESAMPLE_FD);
FieldFunctionArguments psfFieldFunc = null;
Variable var = simTask.getSimulationJob().getSimulationSymbolTable().getVariable(Simulation.PSF_FUNCTION_NAME);
if (var != null) {
FieldFunctionArguments[] ffas = FieldUtilities.getFieldFunctionArguments(var.getExpression());
if (ffas == null || ffas.length == 0) {
throw new DataAccessException("Point Spread Function " + Simulation.PSF_FUNCTION_NAME + " can only be a single field function.");
} else {
Expression newexp;
try {
newexp = new Expression(ffas[0].infix());
if (!var.getExpression().compareEqual(newexp)) {
throw new DataAccessException("Point Spread Function " + Simulation.PSF_FUNCTION_NAME + " can only be a single field function.");
}
psfFieldFunc = ffas[0];
} catch (ExpressionException e) {
e.printStackTrace();
throw new DataAccessException(e.getMessage());
}
}
}
boolean[] bResample = new boolean[argFieldDataIDSpecs.length];
Arrays.fill(bResample, true);
for (int i = 0; i < argFieldDataIDSpecs.length; i++) {
argFieldDataIDSpecs[i].getFieldFuncArgs().getTime().bindExpression(simTask.getSimulationJob().getSimulationSymbolTable());
if (argFieldDataIDSpecs[i].getFieldFuncArgs().equals(psfFieldFunc)) {
bResample[i] = false;
}
}
int numMembraneElements = getResampledGeometry().getGeometrySurfaceDescription().getSurfaceCollection().getTotalPolygonCount();
CartesianMesh simpleMesh = CartesianMesh.createSimpleCartesianMesh(getResampledGeometry().getOrigin(), getResampledGeometry().getExtent(), simTask.getSimulation().getMeshSpecification().getSamplingSize(), getResampledGeometry().getGeometrySurfaceDescription().getRegionImage());
String secondarySimDataDir = PropertyLoader.getProperty(PropertyLoader.secondarySimDataDirInternalProperty, null);
DataSetControllerImpl dsci = new DataSetControllerImpl(null, getSaveDirectory().getParentFile(), secondarySimDataDir == null ? null : new File(secondarySimDataDir));
dsci.writeFieldFunctionData(null, argFieldDataIDSpecs, bResample, simpleMesh, simResampleInfoProvider, numMembraneElements, HESM_OVERWRITE_AND_CONTINUE);
}
} catch (Exception e) {
throw new SolverException(e.getMessage());
}
}
use of org.vcell.util.DataAccessException in project vcell by virtualcell.
the class FiniteVolumeFileWriter method writeFieldData.
/**
* # Field Data
* FIELD_DATA_BEGIN
* #id, name, varname, time filename
* 0 _VCell_FieldData_0 FRAP_binding_ALPHA rfB 0.1 \\users\\fgao\\SimID_22489731_0_FRAP_binding_ALPHA_rfB_0_1.fdat
* FIELD_DATA_END
* @throws FileNotFoundException
* @throws ExpressionException
* @throws DataAccessException
*/
private void writeFieldData() throws FileNotFoundException, ExpressionException, DataAccessException {
FieldDataIdentifierSpec[] fieldDataIDSpecs = simTask.getSimulationJob().getFieldDataIdentifierSpecs();
if (fieldDataIDSpecs == null || fieldDataIDSpecs.length == 0) {
return;
}
String secondarySimDataDir = PropertyLoader.getProperty(PropertyLoader.secondarySimDataDirInternalProperty, null);
DataSetControllerImpl dsci = new DataSetControllerImpl(null, workingDirectory.getParentFile(), secondarySimDataDir == null ? null : new File(secondarySimDataDir));
printWriter.println("# Field Data");
printWriter.println("FIELD_DATA_BEGIN");
printWriter.println("#id, type, new name, name, varname, time, filename");
FieldFunctionArguments psfFieldFunc = null;
Variable var = simTask.getSimulationJob().getSimulationSymbolTable().getVariable(Simulation.PSF_FUNCTION_NAME);
if (var != null) {
FieldFunctionArguments[] ffas = FieldUtilities.getFieldFunctionArguments(var.getExpression());
if (ffas == null || ffas.length == 0) {
throw new DataAccessException("Point Spread Function " + Simulation.PSF_FUNCTION_NAME + " can only be a single field function.");
} else {
Expression newexp = new Expression(ffas[0].infix());
if (!var.getExpression().compareEqual(newexp)) {
throw new DataAccessException("Point Spread Function " + Simulation.PSF_FUNCTION_NAME + " can only be a single field function.");
}
psfFieldFunc = ffas[0];
}
}
int index = 0;
HashSet<FieldDataIdentifierSpec> uniqueFieldDataIDSpecs = new HashSet<FieldDataIdentifierSpec>();
uniqueFieldDataNSet = new HashSet<FieldDataNumerics>();
for (int i = 0; i < fieldDataIDSpecs.length; i++) {
if (!uniqueFieldDataIDSpecs.contains(fieldDataIDSpecs[i])) {
FieldFunctionArguments ffa = fieldDataIDSpecs[i].getFieldFuncArgs();
File newResampledFieldDataFile = new File(workingDirectory, SimulationData.createCanonicalResampleFileName((VCSimulationDataIdentifier) simTask.getSimulationJob().getVCDataIdentifier(), fieldDataIDSpecs[i].getFieldFuncArgs()));
uniqueFieldDataIDSpecs.add(fieldDataIDSpecs[i]);
VariableType varType = fieldDataIDSpecs[i].getFieldFuncArgs().getVariableType();
SimDataBlock simDataBlock = dsci.getSimDataBlock(null, fieldDataIDSpecs[i].getExternalDataIdentifier(), fieldDataIDSpecs[i].getFieldFuncArgs().getVariableName(), fieldDataIDSpecs[i].getFieldFuncArgs().getTime().evaluateConstant());
VariableType dataVarType = simDataBlock.getVariableType();
if (varType.equals(VariableType.UNKNOWN)) {
varType = dataVarType;
} else if (!varType.equals(dataVarType)) {
throw new IllegalArgumentException("field function variable type (" + varType.getTypeName() + ") doesn't match real variable type (" + dataVarType.getTypeName() + ")");
}
if (psfFieldFunc != null && psfFieldFunc.equals(ffa)) {
psfFieldIndex = index;
}
String fieldDataID = "_VCell_FieldData_" + index;
printWriter.println(index + " " + varType.getTypeName() + " " + fieldDataID + " " + ffa.getFieldName() + " " + ffa.getVariableName() + " " + ffa.getTime().infix() + " " + newResampledFieldDataFile);
uniqueFieldDataNSet.add(new FieldDataNumerics(SimulationData.createCanonicalFieldFunctionSyntax(ffa.getFieldName(), ffa.getVariableName(), ffa.getTime().evaluateConstant(), ffa.getVariableType().getTypeName()), fieldDataID));
index++;
}
}
if (psfFieldIndex >= 0) {
printWriter.println("PSF_FIELD_DATA_INDEX " + psfFieldIndex);
}
printWriter.println("FIELD_DATA_END");
printWriter.println();
}
Aggregations