← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 2378: 1. Fix ForceN and ForceT export in VTKRecorder

 

------------------------------------------------------------
revno: 2378
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
branch nick: trunk
timestamp: Tue 2010-07-20 21:58:12 +0200
message:
  1. Fix ForceN and ForceT export in VTKRecorder
modified:
  pkg/dem/Engine/GlobalEngine/VTKRecorder.cpp


--
lp:yade
https://code.launchpad.net/~yade-dev/yade/trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-dev/yade/trunk/+edit-subscription
=== modified file 'pkg/dem/Engine/GlobalEngine/VTKRecorder.cpp'
--- pkg/dem/Engine/GlobalEngine/VTKRecorder.cpp	2010-07-08 14:58:21 +0000
+++ pkg/dem/Engine/GlobalEngine/VTKRecorder.cpp	2010-07-20 19:58:12 +0000
@@ -135,9 +135,13 @@
 	vtkSmartPointer<vtkPoints> intrBodyPos = vtkSmartPointer<vtkPoints>::New();
 	vtkSmartPointer<vtkCellArray> intrCells = vtkSmartPointer<vtkCellArray>::New();
 	vtkSmartPointer<vtkFloatArray> intrForceN = vtkSmartPointer<vtkFloatArray>::New();
-	intrForceN->SetNumberOfComponents(1);
+	vtkSmartPointer<vtkFloatArray> intrAbsForceT = vtkSmartPointer<vtkFloatArray>::New();
+	if(recActive[REC_CPM]) {
+		intrForceN->SetNumberOfComponents(1);
+	} else {
+		intrForceN->SetNumberOfComponents(3);
+	}
 	intrForceN->SetName("forceN");
-	vtkSmartPointer<vtkFloatArray> intrAbsForceT = vtkSmartPointer<vtkFloatArray>::New();
 	intrAbsForceT->SetNumberOfComponents(3);
 	intrAbsForceT->SetName("absForceT");
 
@@ -356,8 +360,11 @@
 		intrUg->SetPoints(intrBodyPos);
 		intrUg->SetCells(VTK_LINE, intrCells);
 		if (recActive[REC_CPM]){
-			 intrUg->GetCellData()->AddArray(intrForceN);
-			 intrUg->GetCellData()->AddArray(intrAbsForceT);
+			intrUg->GetCellData()->AddArray(intrForceN);
+			intrUg->GetCellData()->AddArray(intrAbsForceT);
+		} else {
+			intrUg->GetPointData()->AddArray(intrForceN);
+			intrUg->GetPointData()->AddArray(intrAbsForceT);
 		}
 		vtkSmartPointer<vtkXMLUnstructuredGridWriter> writer = vtkSmartPointer<vtkXMLUnstructuredGridWriter>::New();
 		if(compress) writer->SetCompressor(compressor);


Follow ups