use of cbit.vcell.mapping.CurrentDensityClampStimulus in project vcell by virtualcell.
the class XmlReader method getElectricalStimulus.
/**
* This method process Electrical Stimulus, also called Clamps.
* Creation date: (6/6/2002 4:46:18 PM)
* @return cbit.vcell.mapping.ElectricalStimulus
* @param param org.jdom.Element
*/
private ElectricalStimulus getElectricalStimulus(Element param, SimulationContext currentSimulationContext) throws XmlParseException {
ElectricalStimulus clampStimulus = null;
// get name
// String name = unMangle( param.getAttributeValue(XMLTags.NameAttrTag) );
// get Electrode
Electrode electrode = getElectrode(param.getChild(XMLTags.ElectrodeTag, vcNamespace), currentSimulationContext);
if (param.getAttributeValue(XMLTags.TypeAttrTag).equalsIgnoreCase(XMLTags.VoltageClampTag)) {
// is a voltage clamp
clampStimulus = new VoltageClampStimulus(electrode, "voltClampElectrode", new Expression(0.0), currentSimulationContext);
} else if (param.getAttributeValue(XMLTags.TypeAttrTag).equalsIgnoreCase(XMLTags.CurrentDensityClampTag) || param.getAttributeValue(XMLTags.TypeAttrTag).equalsIgnoreCase(XMLTags.CurrentDensityClampTag_oldName)) {
// is a current density clamp
clampStimulus = new CurrentDensityClampStimulus(electrode, "currDensityClampElectrode", new Expression(0.0), currentSimulationContext);
} else if (param.getAttributeValue(XMLTags.TypeAttrTag).equalsIgnoreCase(XMLTags.TotalCurrentClampTag)) {
// is a "total" current clamp
clampStimulus = new TotalCurrentClampStimulus(electrode, "totalCurrClampElectrode", new Expression(0.0), currentSimulationContext);
}
try {
// transaction begin flag ... yeah, this is a hack
clampStimulus.reading(true);
// Read all of the parameters
List<Element> list = param.getChildren(XMLTags.ParameterTag, vcNamespace);
// add constants that may be used in the electrical stimulus.
VariableHash varHash = new VariableHash();
Model model = currentSimulationContext.getModel();
addResevedSymbols(varHash, model);
//
for (Element xmlParam : list) {
String paramName = unMangle(xmlParam.getAttributeValue(XMLTags.NameAttrTag));
String role = xmlParam.getAttributeValue(XMLTags.ParamRoleAttrTag);
String paramExpStr = xmlParam.getText();
Expression paramExp = unMangleExpression(paramExpStr);
try {
if (varHash.getVariable(paramName) == null) {
Domain domain = null;
varHash.addVariable(new Function(paramName, paramExp, domain));
} else {
if (model.getReservedSymbolByName(paramName) != null) {
varHash.removeVariable(paramName);
Domain domain = null;
varHash.addVariable(new Function(paramName, paramExp, domain));
}
}
} catch (MathException e) {
e.printStackTrace(System.out);
throw new XmlParseException("error reordering parameters according to dependencies:", e);
}
LocalParameter tempParam = null;
if (!role.equals(XMLTags.ParamRoleUserDefinedTag)) {
if (role.equals(XMLTags.ParamRoleTotalCurrentTag)) {
if (clampStimulus instanceof TotalCurrentClampStimulus) {
tempParam = ((TotalCurrentClampStimulus) clampStimulus).getCurrentParameter();
} else {
varHash.removeVariable(paramName);
continue;
}
} else if (role.equals(XMLTags.ParamRoleTotalCurrentDensityTag) || role.equals(XMLTags.ParamRoleTotalCurrentDensityOldNameTag)) {
if (clampStimulus instanceof CurrentDensityClampStimulus) {
tempParam = ((CurrentDensityClampStimulus) clampStimulus).getCurrentDensityParameter();
} else {
varHash.removeVariable(paramName);
continue;
}
} else if (role.equals(XMLTags.ParamRolePotentialDifferenceTag)) {
if (clampStimulus instanceof VoltageClampStimulus) {
tempParam = ((VoltageClampStimulus) clampStimulus).getVoltageParameter();
} else {
varHash.removeVariable(paramName);
continue;
}
}
} else {
continue;
}
if (tempParam == null) {
throw new XmlParseException("parameter with role '" + role + "' not found in electricalstimulus");
}
//
if (!tempParam.getName().equals(paramName)) {
LocalParameter multNameParam = clampStimulus.getLocalParameter(paramName);
int n = 0;
while (multNameParam != null) {
String tempName = paramName + "_" + n++;
clampStimulus.renameParameter(paramName, tempName);
multNameParam = clampStimulus.getLocalParameter(tempName);
}
clampStimulus.renameParameter(tempParam.getName(), paramName);
}
}
//
// create unresolved parameters for all unresolved symbols
//
String unresolvedSymbol = varHash.getFirstUnresolvedSymbol();
while (unresolvedSymbol != null) {
try {
Domain domain = null;
// will turn into an UnresolvedParameter.
varHash.addVariable(new Function(unresolvedSymbol, new Expression(0.0), domain));
} catch (MathException e) {
e.printStackTrace(System.out);
throw new XmlParseException(e.getMessage());
}
clampStimulus.addUnresolvedParameter(unresolvedSymbol);
unresolvedSymbol = varHash.getFirstUnresolvedSymbol();
}
Variable[] sortedVariables = varHash.getTopologicallyReorderedVariables();
ModelUnitSystem modelUnitSystem = model.getUnitSystem();
for (int i = sortedVariables.length - 1; i >= 0; i--) {
if (sortedVariables[i] instanceof Function) {
Function paramFunction = (Function) sortedVariables[i];
Element xmlParam = null;
for (int j = 0; j < list.size(); j++) {
Element tempParam = (Element) list.get(j);
if (paramFunction.getName().equals(unMangle(tempParam.getAttributeValue(XMLTags.NameAttrTag)))) {
xmlParam = tempParam;
break;
}
}
if (xmlParam == null) {
// must have been an unresolved parameter
continue;
}
String symbol = xmlParam.getAttributeValue(XMLTags.VCUnitDefinitionAttrTag);
VCUnitDefinition unit = null;
if (symbol != null) {
unit = modelUnitSystem.getInstance(symbol);
}
LocalParameter tempParam = clampStimulus.getLocalParameter(paramFunction.getName());
if (tempParam == null) {
clampStimulus.addUserDefinedParameter(paramFunction.getName(), paramFunction.getExpression(), unit);
} else {
if (tempParam.getExpression() != null) {
// if the expression is null, it should remain null.
clampStimulus.setParameterValue(tempParam, paramFunction.getExpression());
}
tempParam.setUnitDefinition(unit);
}
}
}
} catch (java.beans.PropertyVetoException e) {
e.printStackTrace(System.out);
throw new XmlParseException("Exception while setting parameters for simContext : " + currentSimulationContext.getName(), e);
} catch (ExpressionException e) {
e.printStackTrace(System.out);
throw new XmlParseException("Exception while settings parameters for simContext : " + currentSimulationContext.getName(), e);
} finally {
clampStimulus.reading(false);
}
return clampStimulus;
}
use of cbit.vcell.mapping.CurrentDensityClampStimulus in project vcell by virtualcell.
the class Xmlproducer method getXML.
/**
* This method returns a XML representation of an Electrode.
* Creation date: (6/6/2002 2:32:56 PM)
* @return Element
* @param param cbit.vcell.mapping.Electrode
*/
private Element getXML(ElectricalStimulus param) {
String electricalStimulusType = null;
if (param instanceof VoltageClampStimulus) {
// process a VoltageClampStimulus object
electricalStimulusType = XMLTags.VoltageClampTag;
} else if (param instanceof CurrentDensityClampStimulus) {
// Process a CurrentClampStimulus
electricalStimulusType = XMLTags.CurrentDensityClampTag;
} else if (param instanceof TotalCurrentClampStimulus) {
// Process a CurrentClampStimulus
electricalStimulusType = XMLTags.TotalCurrentClampTag;
}
Element electricalStimulus = new Element(XMLTags.ClampTag);
// Need to add electrode ??
Element electrode = getXML(param.getElectrode());
electricalStimulus.addContent(electrode);
// Add attributes
electricalStimulus.setAttribute(XMLTags.TypeAttrTag, electricalStimulusType);
// Add Kinetics Parameters
LocalParameter[] parameters = param.getLocalParameters();
for (int i = 0; i < parameters.length; i++) {
LocalParameter parm = parameters[i];
Element tempparameter = new Element(XMLTags.ParameterTag);
// Get parameter attributes
tempparameter.setAttribute(XMLTags.NameAttrTag, mangle(parm.getName()));
tempparameter.setAttribute(XMLTags.ParamRoleAttrTag, ((ElectricalStimulusParameterType) parm.getRole()).roleDescription);
VCUnitDefinition unit = parm.getUnitDefinition();
if (unit != null) {
tempparameter.setAttribute(XMLTags.VCUnitDefinitionAttrTag, unit.getSymbol());
}
tempparameter.addContent(mangleExpression(parm.getExpression()));
// Add the parameter to the general electricalstimulus object
electricalStimulus.addContent(tempparameter);
}
return electricalStimulus;
}
use of cbit.vcell.mapping.CurrentDensityClampStimulus in project vcell by virtualcell.
the class ElectricalCircuitGraph method getCircuitGraph.
/**
* Insert the method's description here.
* Creation date: (2/19/2002 11:24:04 AM)
* @return cbit.vcell.mapping.potential.Graph
* @param simContext cbit.vcell.mapping.SimulationContext
*/
public static Graph getCircuitGraph(SimulationContext simContext, AbstractMathMapping mathMapping) throws ExpressionException {
Graph graph = new Graph();
Model model = simContext.getModel();
//
// add nodes to the graph (one for each Feature)
//
Structure[] structures = model.getStructures();
for (int i = 0; i < structures.length; i++) {
if (structures[i] instanceof Feature) {
graph.addNode(new Node(structures[i].getName(), structures[i]));
}
}
//
// add edges for all current clamp electrodes (always have dependent voltages)
//
ElectricalStimulus[] stimuli = simContext.getElectricalStimuli();
Electrode groundElectrode = simContext.getGroundElectrode();
for (int i = 0; i < stimuli.length; i++) {
ElectricalStimulus stimulus = stimuli[i];
//
// get electrodes
//
Electrode probeElectrode = stimulus.getElectrode();
if (probeElectrode == null) {
throw new RuntimeException("null electrode for electrical stimulus");
}
if (groundElectrode == null) {
throw new RuntimeException("null ground electrode for electrical stimulus");
}
// if (!membraneMapping.getResolved()){
Node groundNode = graph.getNode(groundElectrode.getFeature().getName());
Node probeNode = graph.getNode(probeElectrode.getFeature().getName());
if (stimulus instanceof CurrentDensityClampStimulus) {
CurrentDensityClampStimulus ccStimulus = (CurrentDensityClampStimulus) stimulus;
ElectricalDevice device = new CurrentClampElectricalDevice(ccStimulus, mathMapping);
Edge edge = new Edge(probeNode, groundNode, device);
graph.addEdge(edge);
} else if (stimulus instanceof TotalCurrentClampStimulus) {
TotalCurrentClampStimulus ccStimulus = (TotalCurrentClampStimulus) stimulus;
ElectricalDevice device = new CurrentClampElectricalDevice(ccStimulus, mathMapping);
Edge edge = new Edge(probeNode, groundNode, device);
graph.addEdge(edge);
}
// }
}
//
// add edges for all membranes
//
ElectricalTopology electricalTopology = simContext.getModel().getElectricalTopology();
for (int i = 0; i < structures.length; i++) {
if (structures[i] instanceof Membrane) {
Membrane membrane = (Membrane) structures[i];
MembraneMapping membraneMapping = (MembraneMapping) simContext.getGeometryContext().getStructureMapping(membrane);
Feature positiveFeature = electricalTopology.getPositiveFeature(membrane);
Feature negativeFeature = electricalTopology.getNegativeFeature(membrane);
if (positiveFeature != null && negativeFeature != null) {
Node insideNode = graph.getNode(positiveFeature.getName());
Node outsideNode = graph.getNode(negativeFeature.getName());
//
// getTotalMembraneCurrent() already converts to "outwardCurrent" so that same convention as voltage
//
Expression currentSource = getTotalMembraneCurrent(simContext, membrane, mathMapping);
MembraneElectricalDevice device = new MembraneElectricalDevice(membraneMapping, mathMapping);
device.getParameterFromRole(ElectricalDevice.ROLE_TransmembraneCurrent).setExpression(currentSource);
Edge edge = new Edge(insideNode, outsideNode, device);
graph.addEdge(edge);
}
}
}
//
for (int i = 0; i < stimuli.length; i++) {
ElectricalStimulus stimulus = stimuli[i];
//
// get electrodes
//
Electrode probeElectrode = stimulus.getElectrode();
if (probeElectrode == null) {
throw new RuntimeException("null electrode for electrical stimulus");
}
if (groundElectrode == null) {
throw new RuntimeException("null ground electrode for electrical stimulus");
}
// if (!membraneMapping.getResolved()){
Node groundNode = graph.getNode(groundElectrode.getFeature().getName());
Node probeNode = graph.getNode(probeElectrode.getFeature().getName());
if (stimulus instanceof VoltageClampStimulus) {
VoltageClampStimulus vcStimulus = (VoltageClampStimulus) stimulus;
ElectricalDevice device = new VoltageClampElectricalDevice(vcStimulus, mathMapping);
Edge edge = new Edge(probeNode, groundNode, device);
graph.addEdge(edge);
}
// }
}
// System.out.println(graph);
return graph;
}
use of cbit.vcell.mapping.CurrentDensityClampStimulus in project vcell by virtualcell.
the class ITextWriter method writeMembraneMapping.
protected void writeMembraneMapping(Section simContextSection, SimulationContext simContext) throws DocumentException {
GeometryContext geoContext = simContext.getGeometryContext();
if (geoContext == null) {
return;
}
Section memMapSection = null;
Table memMapTable = null;
StructureMapping[] structMappings = geoContext.getStructureMappings();
for (int i = 0; i < structMappings.length; i++) {
MembraneMapping memMapping = null;
if (structMappings[i] instanceof FeatureMapping) {
continue;
} else {
memMapping = (MembraneMapping) structMappings[i];
}
String structName = memMapping.getStructure().getName();
String initVoltage = "";
Expression tempExp = memMapping.getInitialVoltageParameter().getExpression();
VCUnitDefinition tempUnit = memMapping.getInitialVoltageParameter().getUnitDefinition();
if (tempExp != null) {
initVoltage = tempExp.infix();
if (tempUnit != null) {
initVoltage += " " + tempUnit.getSymbolUnicode();
}
}
String spCap = "";
tempExp = memMapping.getSpecificCapacitanceParameter().getExpression();
tempUnit = memMapping.getSpecificCapacitanceParameter().getUnitDefinition();
if (tempExp != null) {
spCap = tempExp.infix();
if (tempUnit != null) {
spCap += " " + tempUnit.getSymbolUnicode();
}
}
if (memMapTable == null) {
memMapTable = getTable(4, 100, 1, 3, 3);
memMapTable.addCell(createCell("Electrical Mapping - Membrane Potential", getBold(DEF_HEADER_FONT_SIZE), 4, 1, Element.ALIGN_CENTER, true));
memMapTable.addCell(createHeaderCell("Membrane", getBold(), 1));
memMapTable.addCell(createHeaderCell("Calculate V (T/F)", getBold(), 1));
memMapTable.addCell(createHeaderCell("V initial", getBold(), 1));
memMapTable.addCell(createHeaderCell("Specific Capacitance", getBold(), 1));
memMapTable.endHeaders();
}
memMapTable.addCell(createCell(structName, getFont()));
memMapTable.addCell(createCell((memMapping.getCalculateVoltage() ? " T " : " F "), getFont()));
memMapTable.addCell(createCell(initVoltage, getFont()));
memMapTable.addCell(createCell(spCap, getFont()));
}
if (memMapTable != null) {
memMapSection = simContextSection.addSection("Membrane Mapping For " + simContext.getName(), simContextSection.numberDepth() + 1);
memMapSection.add(memMapTable);
}
int[] widths = { 1, 1, 1, 5, 8 };
Table electTable = null;
ElectricalStimulus[] electricalStimuli = simContext.getElectricalStimuli();
for (int j = 0; j < electricalStimuli.length; j++) {
if (j == 0) {
electTable = getTable(5, 100, 1, 3, 3);
electTable.addCell(createCell("Electrical Mapping - Electrical Stimulus", getBold(DEF_HEADER_FONT_SIZE), 5, 1, Element.ALIGN_CENTER, true));
electTable.addCell(createHeaderCell("Stimulus Name", getBold(), 1));
electTable.addCell(createHeaderCell("Current Name", getBold(), 1));
electTable.addCell(createHeaderCell("Clamp Type", getBold(), 1));
electTable.addCell(createHeaderCell("Voltage/Current Density", getBold(), 1));
electTable.addCell(createHeaderCell("Clamp Device", getBold(), 1));
electTable.endHeaders();
}
String stimName = electricalStimuli[j].getName();
String currName = "";
String clampType = "", expStr = "";
Expression tempExp = null;
VCUnitDefinition tempUnit = null;
if (electricalStimuli[j] instanceof CurrentDensityClampStimulus) {
CurrentDensityClampStimulus stimulus = (CurrentDensityClampStimulus) electricalStimuli[j];
LocalParameter currentDensityParameter = stimulus.getCurrentDensityParameter();
tempExp = currentDensityParameter.getExpression();
tempUnit = currentDensityParameter.getUnitDefinition();
clampType = "Current Density (deprecated)";
} else if (electricalStimuli[j] instanceof TotalCurrentClampStimulus) {
TotalCurrentClampStimulus stimulus = (TotalCurrentClampStimulus) electricalStimuli[j];
LocalParameter totalCurrentParameter = stimulus.getCurrentParameter();
tempExp = totalCurrentParameter.getExpression();
tempUnit = totalCurrentParameter.getUnitDefinition();
clampType = "Current";
} else if (electricalStimuli[j] instanceof VoltageClampStimulus) {
VoltageClampStimulus stimulus = (VoltageClampStimulus) electricalStimuli[j];
Parameter voltageParameter = stimulus.getVoltageParameter();
tempExp = voltageParameter.getExpression();
tempUnit = voltageParameter.getUnitDefinition();
clampType = "Voltage";
}
if (tempExp != null) {
expStr = tempExp.infix();
if (tempUnit != null) {
expStr += " " + tempUnit.getSymbolUnicode();
}
}
electTable.addCell(createCell(stimName, getFont()));
electTable.addCell(createCell(currName, getFont()));
electTable.addCell(createCell(clampType, getFont()));
electTable.addCell(createCell(expStr, getFont()));
// add electrode info
Electrode electrode = electricalStimuli[j].getElectrode();
if (electrode == null) {
electTable.addCell(createCell("N/A", getFont()));
} else {
Coordinate c = electrode.getPosition();
String location = c.getX() + ", " + c.getY() + ", " + c.getZ();
String featureName = electrode.getFeature().getName();
electTable.addCell(createCell("(" + location + ") in " + featureName, getFont()));
}
}
if (electTable != null) {
if (memMapSection == null) {
memMapSection = simContextSection.addSection("Membrane Mapping For " + simContext.getName(), 1);
}
electTable.setWidths(widths);
memMapSection.add(electTable);
}
// add temperature
Table tempTable = getTable(1, 75, 1, 3, 3);
tempTable.setAlignment(Table.ALIGN_LEFT);
tempTable.addCell(createCell("Temperature: " + simContext.getTemperatureKelvin() + " K", getFont()));
if (memMapSection != null) {
memMapSection.add(tempTable);
}
}
use of cbit.vcell.mapping.CurrentDensityClampStimulus in project vcell by virtualcell.
the class ElectricalStimulusPanel method newStimulus.
/**
* Comment
*/
private void newStimulus() {
try {
SimulationContext simContext = getSimulationContext();
if (simContext == null) {
return;
}
//
// When the voltage and current clamp radio buttons is deselected within the same simulation context (application),
// display a warning saying that the present clamp settings will be lost (not applicable when the 'no clamp'
// radiobutton is deselected.
//
ElectricalStimulus currElectricalStimulus = null;
if (simContext.getElectricalStimuli() != null && simContext.getElectricalStimuli().length > 0) {
currElectricalStimulus = simContext.getElectricalStimuli()[0];
}
//
// ignore selection if already selected
// warn upon deselect if about to loose edits
//
Clamp selectedClamp = (Clamp) clampComboBox.getSelectedItem();
if (currElectricalStimulus instanceof VoltageClampStimulus) {
if (selectedClamp == Clamp.Voltage_Clamp) {
return;
}
String response = PopupGenerator.showWarningDialog(this, "warning: the present voltage clamp settings will be lost", new String[] { UserMessage.OPTION_CONTINUE, UserMessage.OPTION_CANCEL }, UserMessage.OPTION_CONTINUE);
if (response == null || response.equals(UserMessage.OPTION_CANCEL)) {
// revert back to Voltage Clamp
clampComboBox.setSelectedItem(Clamp.Voltage_Clamp);
return;
}
}
if (currElectricalStimulus instanceof TotalCurrentClampStimulus) {
if (selectedClamp == Clamp.Total_Current_Clamp) {
return;
}
String response = PopupGenerator.showWarningDialog(this, "warning: the present current clamp settings will be lost", new String[] { UserMessage.OPTION_CONTINUE, UserMessage.OPTION_CANCEL }, UserMessage.OPTION_CONTINUE);
if (response == null || response.equals(UserMessage.OPTION_CANCEL)) {
// revert back to Current Clamp
clampComboBox.setSelectedItem(Clamp.Total_Current_Clamp);
return;
}
}
if (currElectricalStimulus instanceof CurrentDensityClampStimulus) {
if (selectedClamp == Clamp.Current_Density_Clamp) {
return;
}
String response = PopupGenerator.showWarningDialog(this, "warning: the present current clamp settings will be lost", new String[] { UserMessage.OPTION_CONTINUE, UserMessage.OPTION_CANCEL }, UserMessage.OPTION_CONTINUE);
if (response == null || response.equals(UserMessage.OPTION_CANCEL)) {
// revert back to Current Clamp
clampComboBox.setSelectedItem(Clamp.Current_Density_Clamp);
return;
}
}
if (currElectricalStimulus == null && selectedClamp == Clamp.No_Clamp) {
return;
}
StructureTopology structTopology = getSimulationContext().getModel().getStructureTopology();
Structure[] structures = getSimulationContext().getModel().getStructures();
ArrayList<Feature> features = new ArrayList<Feature>();
for (Structure structure : structures) {
if (structure instanceof Feature) {
features.add((Feature) structure);
}
}
if (features.size() < 2) {
PopupGenerator.showErrorDialog(this, "error: electrodes must be placed in distinct volumetric structures, found " + features.size() + " volumetric structures in model");
return;
}
Feature groundFeature = features.get(0);
Feature clampedFeature = features.get(1);
//
if (selectedClamp == Clamp.Total_Current_Clamp) {
if (simContext.getElectricalStimuli().length == 0 || !(simContext.getElectricalStimuli()[0] instanceof TotalCurrentClampStimulus)) {
Electrode probeElectrode = new Electrode(clampedFeature, new Coordinate(0, 0, 0));
TotalCurrentClampStimulus ccStimulus = new TotalCurrentClampStimulus(probeElectrode, "ccElectrode", new Expression(0.0), simContext);
System.out.println(" Geo's dim = " + simContext.getGeometry().getDimension());
simContext.setElectricalStimuli(new ElectricalStimulus[] { ccStimulus });
simContext.setGroundElectrode(new Electrode(groundFeature, new Coordinate(0, 0, 0)));
}
}
//
if (selectedClamp == Clamp.Current_Density_Clamp) {
if (simContext.getElectricalStimuli().length == 0 || !(simContext.getElectricalStimuli()[0] instanceof CurrentDensityClampStimulus)) {
Electrode probeElectrode = new Electrode(clampedFeature, new Coordinate(0, 0, 0));
CurrentDensityClampStimulus ccStimulus = new CurrentDensityClampStimulus(probeElectrode, "ccElectrode", new Expression(0.0), simContext);
System.out.println(" Geo's dim = " + simContext.getGeometry().getDimension());
simContext.setElectricalStimuli(new ElectricalStimulus[] { ccStimulus });
simContext.setGroundElectrode(new Electrode(groundFeature, new Coordinate(0, 0, 0)));
}
}
//
if (selectedClamp == Clamp.No_Clamp) {
if (simContext.getElectricalStimuli().length > 0) {
simContext.setElectricalStimuli(new ElectricalStimulus[0]);
}
}
//
if (selectedClamp == Clamp.Voltage_Clamp) {
if (simContext.getElectricalStimuli().length == 0 || !(simContext.getElectricalStimuli()[0] instanceof VoltageClampStimulus)) {
Electrode probeElectrode = new Electrode(clampedFeature, new Coordinate(0, 0, 0));
VoltageClampStimulus vcStimulus = new VoltageClampStimulus(probeElectrode, "vcElectrode", new Expression(0.0), simContext);
System.out.println(" Geo's dim = " + simContext.getGeometry().getDimension());
simContext.setElectricalStimuli(new ElectricalStimulus[] { vcStimulus });
simContext.setGroundElectrode(new Electrode(groundFeature, new Coordinate(0, 0, 0)));
}
}
} catch (java.beans.PropertyVetoException e) {
PopupGenerator.showErrorDialog(this, "Error setting electrical stimulus: " + e.getMessage());
}
}
Aggregations