yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #10702
[Branch ~yade-pkg/yade/git-trunk] Rev 3901: Get a coordination number from body.
------------------------------------------------------------
revno: 3901
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
timestamp: Wed 2014-04-09 16:03:16 +0200
message:
Get a coordination number from body.
modified:
core/Body.cpp
core/Body.hpp
pkg/dem/VTKRecorder.cpp
--
lp:yade
https://code.launchpad.net/~yade-pkg/yade/git-trunk
Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-pkg/yade/git-trunk/+edit-subscription
=== modified file 'core/Body.cpp'
--- core/Body.cpp 2013-02-19 07:07:27 +0000
+++ core/Body.cpp 2014-04-09 14:03:16 +0000
@@ -21,3 +21,13 @@
return ret;
}
+// return list of interactions of this particle
+unsigned int Body::coordNumber(){
+ unsigned int intrSize = 0;
+ for(Body::MapId2IntrT::iterator it=this->intrs.begin(),end=this->intrs.end(); it!=end; ++it) { //Iterate over all bodie's interactions
+ if(!(*it).second->isReal()) continue;
+ intrSize++;
+ }
+ return intrSize;
+}
+
=== modified file 'core/Body.hpp'
--- core/Body.hpp 2014-04-09 14:03:16 +0000
+++ core/Body.hpp 2014-04-09 14:03:16 +0000
@@ -56,7 +56,7 @@
void setBounded(bool d){ if(d) flags|=FLAG_BOUNDED; else flags&=~(FLAG_BOUNDED); }
bool isAspherical() const {return flags & FLAG_ASPHERICAL; }
void setAspherical(bool d){ if(d) flags|=FLAG_ASPHERICAL; else flags&=~(FLAG_ASPHERICAL); }
-
+
/*! Hook for clump to update position of members when user-forced reposition and redraw (through GUI) occurs.
* This is useful only in cases when engines that do that in every iteration are not active - i.e. when the simulation is paused.
* (otherwise, GLViewer would depend on Clump and therefore Clump would have to go to core...) */
@@ -65,6 +65,7 @@
python::list py_intrs();
Body::id_t getId() const {return id;};
+ unsigned int coordNumber(); // Number of neighboring particles
int getGroupMask() {return groupMask; };
bool maskOk(int mask){return (mask==0 || (groupMask&mask));}
=== modified file 'pkg/dem/VTKRecorder.cpp'
--- pkg/dem/VTKRecorder.cpp 2014-04-09 14:03:16 +0000
+++ pkg/dem/VTKRecorder.cpp 2014-04-09 14:03:16 +0000
@@ -110,6 +110,10 @@
vtkSmartPointer<vtkFloatArray> spheresPressSPH = vtkSmartPointer<vtkFloatArray>::New();
spheresPressSPH->SetNumberOfComponents(1);
spheresPressSPH->SetName("SPH_Press");
+
+ vtkSmartPointer<vtkFloatArray> spheresCoordNumbSPH = vtkSmartPointer<vtkFloatArray>::New();
+ spheresCoordNumbSPH->SetNumberOfComponents(1);
+ spheresCoordNumbSPH->SetName("SPH_Neigh");
#endif
vtkSmartPointer<vtkFloatArray> spheresMask = vtkSmartPointer<vtkFloatArray>::New();
@@ -432,6 +436,7 @@
spheresCsSPH->InsertNextValue(b->Cs);
spheresRhoSPH->InsertNextValue(b->rho);
spheresPressSPH->InsertNextValue(b->press);
+ spheresCoordNumbSPH->InsertNextValue(b->coordNumber());
#endif
if (recActive[REC_MATERIALID]) spheresMaterialId->InsertNextValue(b->material->id);
continue;
@@ -572,6 +577,7 @@
spheresUg->GetPointData()->AddArray(spheresCsSPH);
spheresUg->GetPointData()->AddArray(spheresRhoSPH);
spheresUg->GetPointData()->AddArray(spheresPressSPH);
+ spheresUg->GetPointData()->AddArray(spheresCoordNumbSPH);
#endif
if (recActive[REC_STRESS]){
spheresUg->GetPointData()->AddArray(spheresNormalStressVec);