[vtkusers] Java EXCEPTION_ACCESS_VIOLATION
William E Lucarell
welucarell at equityeng.com
Thu Apr 10 10:29:53 EDT 2008
I have a relatively large 2D mesh with 2000-5000 nodes and 4000-9000
elements. Each node and each element has a vtkFollower with vtkVectorText.
It may be a memory dump in vtk. The following is my code for developing the
element and node numbers in the mesh. The mesh has a vtkPointPicker, too.
public void setNodeNumbers (boolean node) {
TestMesh.Update();
if (!node) {
for (int i = 0; i < NumberOfNodes; i++)
renWin.GetRenderer().RemoveActor(nodeActor[i]);
}
else {
nodeMapper = new vtkPolyDataMapper[NumberOfNodes];
nodeActor = new vtkFollower[NumberOfNodes];
nodeText = new vtkVectorText[NumberOfNodes];
nodeScale = TestMesh.GetLength() / 500;
for (int i = 0; i < NumberOfNodes; i++) {
nodeText[i] = new vtkVectorText();
nodeMapper[i] = new vtkPolyDataMapper();
nodeActor[i] = new vtkFollower();
nodeActor[i].PickableOff();
nodeText[i].SetText(Integer.toString(i));
nodeMapper[i].SetInput(nodeText[i].GetOutput());
nodeActor[i].SetMapper(nodeMapper[i]);
nodeActor[i].SetScale(nodeScale, nodeScale, nodeScale);
nodeActor[i].SetPosition(TestMesh.GetPoints().GetPoint(i));
nodeActor[i].GetProperty().SetColor(0.14, 0.21, 0.09);
renWin.GetRenderer().AddActor(nodeActor[i]);
}
}
renWin.Render();
}
public void setElementNumbers (boolean element) {
TestMesh.Update();
if (!element) {
for (int i = 0; i < NumberOfElements; i++)
renWin.GetRenderer().RemoveActor(elementActor[i]);
}
else {
elementMapper = new vtkPolyDataMapper[NumberOfElements];
elementActor = new vtkFollower[NumberOfElements];
elementText = new vtkVectorText[NumberOfElements];
elementScale = TestMesh.GetLength() / 500;
for (int i = 0; i < NumberOfElements; i++) {
elementText[i] = new vtkVectorText();
elementMapper[i] = new vtkPolyDataMapper();
elementActor[i] = new vtkFollower();
elementActor[i].PickableOff();
elementText[i].SetText(Integer.toString(i));
elementMapper[i].SetInput(elementText[i].GetOutput());
elementActor[i].SetMapper(elementMapper[i]);
elementActor[i].SetScale(elementScale, elementScale,
elementScale);
centroidx1 = TestMesh.GetCell(i).GetPoints().GetPoint(0)[0];
centroidy1 = TestMesh.GetCell(i).GetPoints().GetPoint(0)[1];
centroidx2 = TestMesh.GetCell(i).GetPoints().GetPoint(1)[0];
centroidy2 = TestMesh.GetCell(i).GetPoints().GetPoint(1)[1];
centroidx3 = TestMesh.GetCell(i).GetPoints().GetPoint(2)[0];
centroidy3 = TestMesh.GetCell(i).GetPoints().GetPoint(2)[1];
if (TestMesh.GetCell(i).GetCellType() == 9) {
centroidx4 =
TestMesh.GetCell(i).GetPoints().GetPoint(3)[0];
centroidy4 =
TestMesh.GetCell(i).GetPoints().GetPoint(3)[1];
}
centroidx = ((centroidx1 + centroidx2 + centroidx3) / 3) -
(elementActor[i].GetLength() / 2);
centroidy = ((centroidy1 + centroidy2 + centroidy3) / 3);
if (TestMesh.GetCell(i).GetCellType() == 9) {
centroidx = ((centroidx1 + centroidx2 + centroidx3 +
centroidx4) / 4)
- (elementActor[i].GetLength() / 2);
centroidy = ((centroidy1 + centroidy2 + centroidy3 +
centroidy4) / 4);
}
elementActor[i].SetPosition(centroidx, centroidy, 0);
elementActor[i].GetProperty().SetColor(1.0, 1.0, 0.0);
renWin.GetRenderer().AddActor(elementActor[i]);
}
}
renWin.Render();
}
The node numbers are placed at the point locations. However, the element
numbers are placed in the center of the elements. When each element text
object is created, the position to place the object is the centroid of the
triangle or quadrilateral in the mesh. On larger meshes, I often get an
EXCEPTION_ACCESS_VIOLATION when I run it in NetBeans. I set the maximum
memory to the highest possible value and I get:
# An unexpected error has been detected by Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0dea2340, pid=2596,
tid=2868
#
# Java VM: Java HotSpot(TM) Client VM (1.6.0_02-b06 mixed mode)
# Problematic frame:
# C [vtkCommon.dll+0x32340]
#
# An error report file with more information is saved as hs_err_pid2596.log
#
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
#
Java Result: 1
BUILD SUCCESSFUL (total time: 1 minute 44 seconds)
Does anyone know what is causing this? Any help would be greatly
appreciated!
Bill Lucarell
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080410/9f3aa671/attachment.htm>
More information about the vtkusers
mailing list