yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #05468
[Branch ~yade-dev/yade/trunk] Rev 2379: 1. Save interaction as vtkPolyData rather than vtkUnstructuredGrid (to allow the Tube filter to o...
------------------------------------------------------------
revno: 2379
committer: Václav Šmilauer <eudoxos@xxxxxxxx>
branch nick: trunk
timestamp: Wed 2010-07-21 15:53:58 +0200
message:
1. Save interaction as vtkPolyData rather than vtkUnstructuredGrid (to allow the Tube filter to operate on it).
modified:
pkg/dem/Engine/GlobalEngine/VTKRecorder.cpp
pkg/dem/Engine/GlobalEngine/VTKRecorder.hpp
--
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-21 08:00:51 +0000
+++ pkg/dem/Engine/GlobalEngine/VTKRecorder.cpp 2010-07-21 13:53:58 +0000
@@ -6,7 +6,9 @@
#include<vtkSmartPointer.h>
#include<vtkFloatArray.h>
#include<vtkUnstructuredGrid.h>
+#include<vtkPolyData.h>
#include<vtkXMLUnstructuredGridWriter.h>
+#include<vtkXMLPolyDataWriter.h>
#include<vtkZLibDataCompressor.h>
#include<vtkXMLMultiBlockDataWriter.h>
#include<vtkMultiBlockDataSet.h>
@@ -172,7 +174,7 @@
if(recActive[REC_INTR]){
// save body positions, referenced by ids by vtkLine
FOREACH(const shared_ptr<Body>& b, *scene->bodies){
- if (!b) continue;
+ if (!b) { /* we must keep ids contiguous */ intrBodyPos->InsertNextPoint(NaN,NaN,NaN); continue; }
const Vector3r& pos=b->state->pos;
intrBodyPos->InsertNextPoint(pos[0],pos[1],pos[2]);
}
@@ -356,18 +358,18 @@
writer->Write();
}
}
- vtkSmartPointer<vtkUnstructuredGrid> intrUg = vtkSmartPointer<vtkUnstructuredGrid>::New();
+ vtkSmartPointer<vtkPolyData> intrPd = vtkSmartPointer<vtkPolyData>::New();
if (recActive[REC_INTR]){
- intrUg->SetPoints(intrBodyPos);
- intrUg->SetCells(VTK_LINE, intrCells);
- intrUg->GetCellData()->AddArray(intrForceN);
- intrUg->GetCellData()->AddArray(intrAbsForceT);
+ intrPd->SetPoints(intrBodyPos);
+ intrPd->SetLines(intrCells);
+ intrPd->GetCellData()->AddArray(intrForceN);
+ intrPd->GetCellData()->AddArray(intrAbsForceT);
if(!multiblock){
- vtkSmartPointer<vtkXMLUnstructuredGridWriter> writer = vtkSmartPointer<vtkXMLUnstructuredGridWriter>::New();
+ vtkSmartPointer<vtkXMLPolyDataWriter> writer = vtkSmartPointer<vtkXMLPolyDataWriter>::New();
if(compress) writer->SetCompressor(compressor);
- string fn=fileName+"intrs."+lexical_cast<string>(scene->currentIteration)+".vtu";
+ string fn=fileName+"intrs."+lexical_cast<string>(scene->currentIteration)+".vtp";
writer->SetFileName(fn.c_str());
- writer->SetInput(intrUg);
+ writer->SetInput(intrPd);
writer->Write();
}
}
@@ -377,7 +379,7 @@
int i=0;
if(recActive[REC_SPHERES]) multiblockDataset->SetBlock(i++,spheresUg);
if(recActive[REC_FACETS]) multiblockDataset->SetBlock(i++,facetsUg);
- if(recActive[REC_INTR]) multiblockDataset->SetBlock(i++,intrUg);
+ if(recActive[REC_INTR]) multiblockDataset->SetBlock(i++,intrPd);
vtkSmartPointer<vtkXMLMultiBlockDataWriter> writer = vtkSmartPointer<vtkXMLMultiBlockDataWriter>::New();
string fn=fileName+lexical_cast<string>(scene->currentIteration)+".vtm";
writer->SetFileName(fn.c_str());
=== modified file 'pkg/dem/Engine/GlobalEngine/VTKRecorder.hpp'
--- pkg/dem/Engine/GlobalEngine/VTKRecorder.hpp 2010-07-21 08:00:51 +0000
+++ pkg/dem/Engine/GlobalEngine/VTKRecorder.hpp 2010-07-21 13:53:58 +0000
@@ -12,11 +12,10 @@
((bool,skipNondynamic,false,"Skip non-dynamic spheres (but not facets)."))
((bool,multiblock,false,"Use multi-block (``.vtm``) files to store data, rather than separate ``.vtu`` files."))
((string,fileName,"","Base file name; it will be appended with {spheres,intrs,facets}-243100.vtu (unless *multiblock* is ``True``) depending on active recorders and step number (243100 in this case). It can contain slashes, but the directory must exist already."))
- ((vector<string>,recorders,,"List of active recorders (as strings). Accepted recorders are:\n\n``all``\n\tSaves all possible parameters, except of specific. Default value.\n``spheres``\n\tSaves positions and radii (``radii``) of :yref:`spherical<Sphere>` particles.\n``id``\n\tSaves id's (field ``id``) of spheres; active only if ``spheres`` is active.\n``clumpId``\n\tSaves id's of clumps to which each sphere belongs (field ``clumpId``); active only if ``spheres`` is active.\n``colors``\n\tSaves colors of :yref:`spheres<Sphere>` and of :yref:`facets<Facet>` (field ``color``); only active if ``spheres`` or ``facets`` are activated.\n``mask``\n\tSaves groupMasks of :yref:`spheres<Sphere>` and of :yref:`facets<Facet>` (field ``mask``); only active if ``spheres`` or ``facets`` are activated.\n``materialId``\n\tSaves materialID of :yref:`spheres<Sphere>` and of :yref:`facets<Facet>`; only active if ``spheres`` or ``facets`` are activated.\n``velocity``\n\tSaves linear and angular velocities of spherical particles as Vector3 and length(fields ``linVelVec``, ``linVelLen`` and ``angVelVec``, ``angVelLen`` respectively``); only effective with ``spheres``.\n``facets``\n\tSave :yref:`facets<Facet>` positions (vertices).\n``stress``\n\tSaves stresses of :yref:`spheres<Sphere>` and of :yref:`facets<Facet>` as Vector3 and length; only active if ``spheres`` or ``facets`` are activated.\n``cpm``\n\tSaves data pertaining to the :yref:`concrete model<Law2_Dem3DofGeom_CpmPhys_Cpm>`: ``cpmDamage`` (normalized residual strength averaged on particle), ``cpmSigma`` (stress on particle, normal components), ``cpmTau`` (shear components of stress on particle), ``cpmSigmaM`` (mean stress around particle); ``intr`` is activated automatically by ``cpm``.\n``intr``\n\tWhen ``cpm`` is used, it saves magnitude of normal (``forceN``) and shear (``absForceT``) forces.\n\n\tWithout ``cpm``, saves [TODO]\n``rpm``\n\tSaves data pertaining to the :yref:`rock particle model<Law2_Dem3DofGeom_RockPMPhys_Rpm>`: ``rpmSpecNum`` shows different pieces of separated stones, only ids.\n ``rpmSpecMass`` shows masses of separated stones.\n\n"))
- ((int,mask,0,"If mask defined, only bodies with corresponding groupMask will be exported. If 0 - all bodies will be exported.")),
+ ((vector<string>,recorders,vector<string>(1,string("all")),"List of active recorders (as strings). ``all`` (the default value) enables all base and generic recorders.\n\n.. admonition:: Base recorders\n\n\tBase recorders save the geometry (unstructured grids) on which other data is defined. They are implicitly activated by many of the other recorders. Each of them creates a new file (or a block, if :yref:`multiblock <VTKRecorder.multiblock>` is set).\n\n\t``spheres``\n\t\tSaves positions and radii (``radii``) of :yref:`spherical<Sphere>` particles.\n\t``facets``\n\t\tSave :yref:`facets<Facet>` positions (vertices).\n\t``intr``\n\t\tStore interactions as lines between nodes at respective particles positions. Additionaly stores magnitude of normal (``forceN``) and shear (``absForceT``) forces on interactions (the :yref:`interactionGeometry<Interaction.interactionGeometry> must be of type :yref:`NormShearPhys`). \n\n.. admonition:: Generic recorders\n\n\tGeneric recorders do not depend on specific model being used and save commonly useful data.\n\n\t``id``\n\t\tSaves id's (field ``id``) of spheres; active only if ``spheres`` is active.\n\t``clumpId``\n\t\tSaves id's of clumps to which each sphere belongs (field ``clumpId``); active only if ``spheres`` is active.\n\t``colors``\n\t\tSaves colors of :yref:`spheres<Sphere>` and of :yref:`facets<Facet>` (field ``color``); only active if ``spheres`` or ``facets`` are activated.\n\t``mask``\n\t\tSaves groupMasks of :yref:`spheres<Sphere>` and of :yref:`facets<Facet>` (field ``mask``); only active if ``spheres`` or ``facets`` are activated.\n\t``materialId``\n\t\tSaves materialID of :yref:`spheres<Sphere>` and of :yref:`facets<Facet>`; only active if ``spheres`` or ``facets`` are activated.\n\t``velocity``\n\t\tSaves linear and angular velocities of spherical particles as Vector3 and length(fields ``linVelVec``, ``linVelLen`` and ``angVelVec``, ``angVelLen`` respectively``); only effective with ``spheres``.\n\t``stress``\n\t\tSaves stresses of :yref:`spheres<Sphere>` and of :yref:`facets<Facet>` as Vector3 and length; only active if ``spheres`` or ``facets`` are activated.\n\n.. admonition:: Specific recorders\n\n\tThe following should only be activated in appropriate cases, otherwise crashes can occur due to violation of type presuppositions.\n\n\t``cpm``\n\t\tSaves data pertaining to the :yref:`concrete model<Law2_Dem3DofGeom_CpmPhys_Cpm>`: ``cpmDamage`` (normalized residual strength averaged on particle), ``cpmSigma`` (stress on particle, normal components), ``cpmTau`` (shear components of stress on particle), ``cpmSigmaM`` (mean stress around particle); ``intr`` is activated automatically by ``cpm``\n\t``rpm``\n\t\tSaves data pertaining to the :yref:`rock particle model<Law2_Dem3DofGeom_RockPMPhys_Rpm>`: ``rpmSpecNum`` shows different pieces of separated stones, only ids. ``rpmSpecMass`` shows masses of separated stones.\n\n"))
+ ((int,mask,0,"If mask defined, only bodies with corresponding groupMask will be exported. If 0, all bodies will be exported.")),
/*ctor*/
initRun=true;
- if (recorders.empty()) {recorders.push_back("all");} //Default value
);
DECLARE_LOGGER;
};