yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #04405
[Branch ~yade-dev/yade/trunk] Rev 2226: Some fixes in VTKRecorder
------------------------------------------------------------
revno: 2226
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
branch nick: trunk
timestamp: Fri 2010-05-14 16:04:31 +0200
message:
Some fixes in VTKRecorder
modified:
pkg/dem/Engine/GlobalEngine/VTKRecorder.cpp
pkg/dem/Engine/GlobalEngine/VTKRecorder.hpp
pkg/dem/Engine/GlobalEngine/VTKRecorder.inc
--
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-05-13 19:49:44 +0000
+++ pkg/dem/Engine/GlobalEngine/VTKRecorder.cpp 2010-05-14 14:04:31 +0000
@@ -38,13 +38,13 @@
else if(rec=="spheres") recActive[REC_SPHERES]=true;
else if(rec=="velocity") recActive[REC_VELOCITY]=true;
else if(rec=="facets") recActive[REC_FACETS]=true;
- else if(rec=="colors") recActive[REC_COLORS]=true;
+ else if((rec=="colors") || (rec=="color"))recActive[REC_COLORS]=true;
else if(rec=="cpm") recActive[REC_CPM]=true;
else if(rec=="intr") recActive[REC_INTR]=true;
else if((rec=="ids") || (rec=="id")) recActive[REC_ID]=true;
else if((rec=="clumpids") || (rec=="clumpId")) recActive[REC_CLUMPID]=true;
else if(rec=="materialId") recActive[REC_MATERIALID]=true;
- else LOG_ERROR("Unknown recorder named `"<<rec<<"' (supported are: all, spheres, velocity, facets, colors, cpm, intr, id, clumpId, materialId). Ignored.");
+ else LOG_ERROR("Unknown recorder named `"<<rec<<"' (supported are: all, spheres, velocity, facets, color, cpm, intr, id, clumpId, materialId). Ignored.");
}
// cpm needs interactions
if(recActive[REC_CPM]) recActive[REC_INTR]=true;
@@ -63,23 +63,27 @@
clumpId->SetName("clumpId");
vtkSmartPointer<vtkFloatArray> spheresColors = vtkSmartPointer<vtkFloatArray>::New();
spheresColors->SetNumberOfComponents(3);
- spheresColors->SetName("colors");
+ spheresColors->SetName("color");
vtkSmartPointer<vtkFloatArray> spheresVelocity = vtkSmartPointer<vtkFloatArray>::New();
spheresVelocity->SetNumberOfComponents(3);
spheresVelocity->SetName("velocity");
vtkSmartPointer<vtkFloatArray> sphAngVel = vtkSmartPointer<vtkFloatArray>::New();
sphAngVel->SetNumberOfComponents(3);
sphAngVel->SetName("angVel");
- vtkSmartPointer<vtkFloatArray> materialId = vtkSmartPointer<vtkFloatArray>::New();
- materialId->SetNumberOfComponents(1);
- materialId->SetName("materialId");
+ vtkSmartPointer<vtkFloatArray> spheresMaterialId = vtkSmartPointer<vtkFloatArray>::New();
+ spheresMaterialId->SetNumberOfComponents(1);
+ spheresMaterialId->SetName("materialId");
+
// facets
vtkSmartPointer<vtkPoints> facetsPos = vtkSmartPointer<vtkPoints>::New();
vtkSmartPointer<vtkCellArray> facetsCells = vtkSmartPointer<vtkCellArray>::New();
vtkSmartPointer<vtkFloatArray> facetsColors = vtkSmartPointer<vtkFloatArray>::New();
facetsColors->SetNumberOfComponents(3);
- facetsColors->SetName("Colors");
+ facetsColors->SetName("color");
+ vtkSmartPointer<vtkFloatArray> facetsMaterialId = vtkSmartPointer<vtkFloatArray>::New();
+ facetsMaterialId->SetNumberOfComponents(1);
+ facetsMaterialId->SetName("materialId");
// interactions
vtkSmartPointer<vtkPoints> intrBodyPos = vtkSmartPointer<vtkPoints>::New();
@@ -170,7 +174,7 @@
spheresUg->GetPointData()->AddArray(cpmSigmaM);
spheresUg->GetPointData()->AddArray(cpmTau);
}
- if (recActive[REC_MATERIALID]) spheresUg->GetPointData()->AddArray(materialId);
+ if (recActive[REC_MATERIALID]) spheresUg->GetPointData()->AddArray(spheresMaterialId);
vtkSmartPointer<vtkXMLUnstructuredGridWriter> writer = vtkSmartPointer<vtkXMLUnstructuredGridWriter>::New();
if(compress) writer->SetCompressor(compressor);
@@ -184,7 +188,7 @@
facetsUg->SetPoints(facetsPos);
facetsUg->SetCells(VTK_TRIANGLE, facetsCells);
if (recActive[REC_COLORS]) facetsUg->GetCellData()->AddArray(facetsColors);
- if (recActive[REC_MATERIALID]) facetsUg->GetPointData()->AddArray(materialId);
+ if (recActive[REC_MATERIALID]) facetsUg->GetCellData()->AddArray(facetsMaterialId);
vtkSmartPointer<vtkXMLUnstructuredGridWriter> writer = vtkSmartPointer<vtkXMLUnstructuredGridWriter>::New();
if(compress) writer->SetCompressor(compressor);
string fn=fileName+"facets."+lexical_cast<string>(scene->currentIteration)+".vtu";
=== modified file 'pkg/dem/Engine/GlobalEngine/VTKRecorder.hpp'
--- pkg/dem/Engine/GlobalEngine/VTKRecorder.hpp 2010-05-13 19:49:44 +0000
+++ pkg/dem/Engine/GlobalEngine/VTKRecorder.hpp 2010-05-14 14:04:31 +0000
@@ -11,7 +11,7 @@
((bool,skipFacetIntr,true,"Skip interactions with facets, when saving interactions"))
((bool,skipNondynamic,false,"Skip non-dynamic spheres (but not facets)."))
((string,fileName,"","Base file name; it will be appended with {spheres,intrs,facets}-243100.vtu 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 ``colors`` spheres and ``Colors`` for facets); only active if ``spheres`` or ``facets`` is activated.\n``materialId``\n\tSaves materialID of :yref:`spheres<Sphere>` and of :yref:`facets<Facet>`; only active if ``spheres`` or ``facets`` is activated.\n``velocity``\n\tSaves linear and angular velocities of spherical particles (fields ``velocity`` and ``angVel`` respectively``); only effective with ``spheres``.\n``facets``\n\tSave :yref:`facets<Facet>` positions (vertices).\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\n"))
+ ((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`` is activated.\n``materialId``\n\tSaves materialID of :yref:`spheres<Sphere>` and of :yref:`facets<Facet>`; only active if ``spheres`` or ``facets`` is activated.\n``velocity``\n\tSaves linear and angular velocities of spherical particles (fields ``velocity`` and ``angVel`` respectively``); only effective with ``spheres``.\n``facets``\n\tSave :yref:`facets<Facet>` positions (vertices).\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\n"))
((std::vector<int>,subscribedBodies,,"List of bodies, which will be exported. If empty - all bodies will be exported.")),
/*ctor*/
initRun=true;
=== modified file 'pkg/dem/Engine/GlobalEngine/VTKRecorder.inc'
--- pkg/dem/Engine/GlobalEngine/VTKRecorder.inc 2010-05-13 19:49:44 +0000
+++ pkg/dem/Engine/GlobalEngine/VTKRecorder.inc 2010-05-14 14:04:31 +0000
@@ -35,7 +35,7 @@
cpmSigmaM->InsertNextValue((ss[0]+ss[1]+ss[2])/3.);
cpmTau->InsertNextTupleValue(t);
}
- if (recActive[REC_MATERIALID]) materialId->InsertNextValue(b->material->id);
+ if (recActive[REC_MATERIALID]) spheresMaterialId->InsertNextValue(b->material->id);
continue;
}
}
@@ -58,7 +58,8 @@
float c[3] = {color[0],color[1],color[2]};
facetsColors->InsertNextTupleValue(c);
}
- if (recActive[REC_MATERIALID]) materialId->InsertNextValue(b->material->id);
+ if (recActive[REC_MATERIALID]) facetsMaterialId->InsertNextValue(b->material->id);
continue;
}
}
+