use of cbit.vcell.math.DataGenerator in project vcell by virtualcell.
the class OutputFunctionContext method getEntries.
// public abstract void validateNamingConflicts(String symbolDescription, Class<?> newSymbolClass, String newSymbolName, PropertyChangeEvent e) throws PropertyVetoException ;
public void getEntries(Map<String, SymbolTableEntry> entryMap) {
// add all valid entries (variables) from mathdescription
MathDescription mathDescription = simulationOwner.getMathDescription();
if (mathDescription != null) {
Enumeration<Variable> varEnum = mathDescription.getVariables();
while (varEnum.hasMoreElements()) {
Variable var = varEnum.nextElement();
if (!(var instanceof PseudoConstant) && !(var instanceof Constant)) {
entryMap.put(var.getName(), var);
}
}
for (DataGenerator dataGenerator : mathDescription.getPostProcessingBlock().getDataGeneratorList()) {
entryMap.put(dataGenerator.getName(), dataGenerator);
}
}
entryMap.put(ReservedVariable.TIME.getName(), ReservedVariable.TIME);
int dimension = mathDescription.getGeometry().getDimension();
if (dimension > 0) {
entryMap.put(ReservedVariable.X.getName(), ReservedVariable.X);
if (dimension > 1) {
entryMap.put(ReservedVariable.Y.getName(), ReservedVariable.Y);
if (dimension > 2) {
entryMap.put(ReservedVariable.Z.getName(), ReservedVariable.Z);
}
}
}
// then add list of output functions.
for (SymbolTableEntry ste : outputFunctionsList) {
entryMap.put(ste.getName(), ste);
}
}
use of cbit.vcell.math.DataGenerator in project vcell by virtualcell.
the class Xmlproducer method getXML.
private Element getXML(PostProcessingBlock postProcessingBlock) {
Element element = new Element(XMLTags.PostProcessingBlock);
for (DataGenerator dataGenerator : postProcessingBlock.getDataGeneratorList()) {
if (dataGenerator instanceof ExplicitDataGenerator) {
Element e = new Element(XMLTags.ExplicitDataGenerator);
e.setAttribute(XMLTags.NameAttrTag, mangle(dataGenerator.getName()));
if (dataGenerator.getDomain() != null) {
e.setAttribute(XMLTags.DomainAttrTag, mangle(dataGenerator.getDomain().getName()));
}
e.addContent(mangleExpression(dataGenerator.getExpression()));
element.addContent(e);
} else if (dataGenerator instanceof ProjectionDataGenerator) {
element.addContent(getXML((ProjectionDataGenerator) dataGenerator));
} else if (dataGenerator instanceof ConvolutionDataGenerator) {
element.addContent(getXML((ConvolutionDataGenerator) dataGenerator));
}
}
return element;
}
use of cbit.vcell.math.DataGenerator in project vcell by virtualcell.
the class FiniteVolumeFileWriter method writePostProcessingBlock.
private void writePostProcessingBlock() throws Exception {
// SolverException, ExpressionException and exceptions from roiDataGenerator.getROIDataGeneratorDescription()
PostProcessingBlock postProcessingBlock = simTask.getSimulation().getMathDescription().getPostProcessingBlock();
if (postProcessingBlock.getNumDataGenerators() == 0) {
// to make c++ code write default var statisitcs, without the token it won't write anything
printWriter.println(FVInputFileKeyword.POST_PROCESSING_BLOCK_BEGIN);
printWriter.println(FVInputFileKeyword.POST_PROCESSING_BLOCK_END);
printWriter.println();
return;
}
if (bChomboSolver && postProcessingBlock.getDataGeneratorList().size() > 0) {
throw new Exception("Data generators are not supported by " + simTask.getSimulation().getSolverTaskDescription().getSolverDescription().getDisplayLabel());
}
printWriter.println(" # Post Processing Block");
printWriter.println(FVInputFileKeyword.POST_PROCESSING_BLOCK_BEGIN);
for (DataGenerator dataGenerator : postProcessingBlock.getDataGeneratorList()) {
String varName = dataGenerator.getName();
Domain domain = dataGenerator.getDomain();
String domainName = domain == null ? null : domain.getName();
if (dataGenerator instanceof ProjectionDataGenerator) {
ProjectionDataGenerator pdg = (ProjectionDataGenerator) dataGenerator;
Expression function = subsituteExpression(pdg.getFunction(), VariableDomain.VARIABLEDOMAIN_VOLUME);
printWriter.println(FVInputFileKeyword.PROJECTION_DATA_GENERATOR + " " + varName + " " + domainName + " " + pdg.getAxis() + " " + pdg.getOperation() + " " + function.infix() + ";");
} else if (dataGenerator instanceof ConvolutionDataGenerator) {
ConvolutionDataGenerator convolutionDataGenerator = (ConvolutionDataGenerator) dataGenerator;
ConvolutionDataGeneratorKernel kernel = convolutionDataGenerator.getKernel();
if (kernel instanceof GaussianConvolutionDataGeneratorKernel) {
GaussianConvolutionDataGeneratorKernel gck = (GaussianConvolutionDataGeneratorKernel) kernel;
Expression volFunction = subsituteExpression(convolutionDataGenerator.getVolFunction(), VariableDomain.VARIABLEDOMAIN_VOLUME);
Expression memFunction = subsituteExpression(convolutionDataGenerator.getMemFunction(), VariableDomain.VARIABLEDOMAIN_MEMBRANE);
Expression sigmaXY = subsituteExpression(gck.getSigmaXY_um(), VariableDomain.VARIABLEDOMAIN_VOLUME);
Expression sigmaZ = subsituteExpression(gck.getSigmaZ_um(), VariableDomain.VARIABLEDOMAIN_VOLUME);
String volFuncStr = volFunction.infix();
String memFuncStr = memFunction.infix();
printWriter.println(FVInputFileKeyword.GAUSSIAN_CONVOLUTION_DATA_GENERATOR + " " + varName + " " + domainName + " " + sigmaXY.infix() + " " + sigmaZ.infix() + " " + FVInputFileKeyword.GAUSSIAN_CONVOLUTION_VOL_FUNCTION + " " + volFuncStr + "; " + FVInputFileKeyword.GAUSSIAN_CONVOLUTION_MEM_FUNCTION + " " + memFuncStr + ";");
}
} else if (dataGenerator instanceof cbit.vcell.microscopy.ROIDataGenerator) {
/*
ROI_DATA_GENERATOR_BEGIN roidata
VolumePoints 20
2667 2676 2679 2771 2969 2877 3067 3277 3185 3283 3473 3580 3690 3687 3878 4086 3990 4182 4193 1077 (all points in one line)
SampleImage 9 0 1341426862190 vcField('sumROIData','roiSumDataVar',0.0,'Volume')
StoreEnabled false
SampleImageFile roiSumDataVar 0.0 C:\Users\abcde\VirtualMicroscopy\SimulationData\SimID_1341426862125_0_sumROIData_roiSumDataVar_0_0_Volume.fdat
DATA_PROCESSOR_END
*/
cbit.vcell.microscopy.ROIDataGenerator roiDataGenerator = (cbit.vcell.microscopy.ROIDataGenerator) dataGenerator;
printWriter.println(roiDataGenerator.getROIDataGeneratorDescription(workingDirectory, simTask.getSimulationJob()));
} else if (dataGenerator instanceof org.vcell.vmicro.workflow.data.ROIDataGenerator) {
/*
ROI_DATA_GENERATOR_BEGIN roidata
VolumePoints 20
2667 2676 2679 2771 2969 2877 3067 3277 3185 3283 3473 3580 3690 3687 3878 4086 3990 4182 4193 1077 (all points in one line)
SampleImage 9 0 1341426862190 vcField('sumROIData','roiSumDataVar',0.0,'Volume')
StoreEnabled false
SampleImageFile roiSumDataVar 0.0 C:\Users\abcde\VirtualMicroscopy\SimulationData\SimID_1341426862125_0_sumROIData_roiSumDataVar_0_0_Volume.fdat
DATA_PROCESSOR_END
*/
org.vcell.vmicro.workflow.data.ROIDataGenerator roiDataGenerator = (org.vcell.vmicro.workflow.data.ROIDataGenerator) dataGenerator;
printWriter.println(roiDataGenerator.getROIDataGeneratorDescription(workingDirectory, simTask.getSimulationJob()));
} else {
throw new SolverException(dataGenerator.getClass() + " : data generator not supported yet.");
}
}
printWriter.println(FVInputFileKeyword.POST_PROCESSING_BLOCK_END);
printWriter.println();
}
use of cbit.vcell.math.DataGenerator in project vcell by virtualcell.
the class OutputFunctionContext method getEntry.
public SymbolTableEntry getEntry(java.lang.String identifierString) {
//
// use MathDescription as the primary SymbolTable, just replace the Constants with the overrides.
//
SymbolTableEntry ste = null;
MathDescription mathDescription = simulationOwner.getMathDescription();
if (mathDescription != null) {
ste = mathDescription.getEntry(identifierString);
if (ste != null && !(ste instanceof PseudoConstant) && !(ste instanceof Constant)) {
return ste;
}
ste = mathDescription.getPostProcessingBlock().getDataGenerator(identifierString);
if (ste instanceof DataGenerator) {
return ste;
}
}
// see if it is an output function.
ste = getOutputFunction(identifierString);
return ste;
}
Aggregations