use of maspack.util.InternalErrorException in project artisynth_core by artisynth.
the class ReadlinePanel method getLineText.
String getLineText() {
int begOff = getLineStart();
int endOff = getLineEnd();
try {
return getText(begOff, endOff - begOff);
} catch (BadLocationException e) {
throw new InternalErrorException("bad location");
}
}
use of maspack.util.InternalErrorException in project artisynth_core by artisynth.
the class FemModel3d method computeNodalIncompressibility.
private void computeNodalIncompressibility(IncompressibleMaterial imat, Matrix6d D) {
for (FemNode3d n : myNodes) {
if (volumeIsControllable(n)) {
double restVol = n.myRestVolume;
myKp[0] = imat.getEffectiveModulus(n.myVolume / restVol) / restVol;
// myKp[0] = 1;
if (myKp[0] != 0) {
for (FemNodeNeighbor nbr_i : getNodeNeighbors(n)) {
int bi = nbr_i.myNode.getSolveIndex();
for (FemNodeNeighbor nbr_j : getNodeNeighbors(n)) {
int bj = nbr_j.myNode.getSolveIndex();
if (!mySolveMatrixSymmetricP || bj >= bi) {
FemNodeNeighbor nbr = nbr_i.myNode.getNodeNeighbor(nbr_j.myNode);
if (nbr == null) {
nbr = nbr_i.myNode.getIndirectNeighbor(nbr_j.myNode);
}
if (nbr == null) {
throw new InternalErrorException("No neighbor block at bi=" + bi + ", bj=" + bj);
} else {
nbr.addDilationalStiffness(myKp, nbr_i.myDivBlk, nbr_j.myDivBlk);
}
}
}
}
}
}
}
}
use of maspack.util.InternalErrorException in project artisynth_core by artisynth.
the class NumericProbeRangeSelectorDialog method actionPerformed.
public void actionPerformed(ActionEvent e) {
String nameOfAction = e.getActionCommand();
if (nameOfAction.equals("OK")) {
display.setDefaultRange(minYField.getDoubleValue(), maxYField.getDoubleValue());
// display.setDisplayRange(
// minYField.getDoubleValue(), maxYField.getDoubleValue());
// set new display range in probe
display.myProbe.setDefaultDisplayRange(minYField.getDoubleValue(), maxYField.getDoubleValue());
display.repaint();
setVisible(false);
} else if (nameOfAction.equals("Cancel")) {
display.setDisplayRange(minYRange, maxYRange);
// set auto-ranging last because setDisplayRange will clear it
display.setAutoRanging(autoRanging);
display.repaint();
setVisible(false);
} else {
throw new InternalErrorException("Unknown action: " + nameOfAction);
}
}
use of maspack.util.InternalErrorException in project artisynth_core by artisynth.
the class PropertyWidgetDialog method updateRange.
private void updateRange(ModelComponent comp, PropertyInfo info) {
Property prop = comp.getProperty(info.getName());
if (prop == null) {
throw new InternalErrorException("Cannot create property '" + info.getName() + " for component type " + comp.getClass());
}
DoubleInterval newRange = getDefaultRange(prop);
double currentValue = ((Number) prop.get()).doubleValue();
if (currentValue < newRange.getLowerBound()) {
newRange.setLowerBound(currentValue);
} else if (currentValue > newRange.getUpperBound()) {
newRange.setUpperBound(currentValue);
}
myRangeField.setValue(newRange);
}
use of maspack.util.InternalErrorException in project artisynth_core by artisynth.
the class PropertyWidgetDialog method createEditingProperty.
private EditingProperty createEditingProperty(Property prop) {
if (prop.getHost() == null) {
throw new InternalErrorException("Property " + prop.getName() + " does not have host");
}
HostList hostList = new HostList(1);
hostList.addHost(prop.getHost());
// get single property from host list
String[] restricted = new String[] { prop.getName() };
String[] excluded = null;
PropTreeCell tree = hostList.commonProperties(null, /* allowReadonly= */
false, restricted, excluded);
if (tree.numChildren() == 0) {
throw new InternalErrorException("Property " + prop.getName() + " not found in host");
}
// expand save data in hostList down one level ...
hostList.saveBackupValues(tree);
return new EditingProperty(tree.getFirstChild(), hostList, /* live= */
true);
}
Aggregations