← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 1988: 1. Fix body_id_t typedef (add includes)

 

------------------------------------------------------------
revno: 1988
committer: Václav Šmilauer <eudoxos@xxxxxxxx>
branch nick: trunk
timestamp: Sat 2010-01-23 16:40:06 +0100
message:
  1. Fix body_id_t typedef (add includes)
  2. Check body id when accessing ForceContainer from python
  3. Override prefix in config.py already if YADE_PREFIX is set
modified:
  core/Collider.hpp
  pkg/common/Engine/PartialEngine/GravityEngines.hpp
  pkg/dem/Engine/GlobalEngine/FacetTopologyAnalyzer.hpp
  pkg/dem/Engine/GlobalEngine/NewtonIntegrator.hpp
  py/config.py.in
  py/yadeWrapper/yadeWrapper.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 'core/Collider.hpp'
--- core/Collider.hpp	2009-12-25 14:46:48 +0000
+++ core/Collider.hpp	2010-01-23 15:40:06 +0000
@@ -8,8 +8,9 @@
 
 #pragma once
 
-#include <yade/core/Bound.hpp>
-#include "GlobalEngine.hpp"
+#include<yade/core/Bound.hpp>
+#include<yade/core/Interaction.hpp>
+#include<yade/core/GlobalEngine.hpp>
 
 class Collider : public GlobalEngine
 {

=== modified file 'pkg/common/Engine/PartialEngine/GravityEngines.hpp'
--- pkg/common/Engine/PartialEngine/GravityEngines.hpp	2010-01-22 21:07:37 +0000
+++ pkg/common/Engine/PartialEngine/GravityEngines.hpp	2010-01-23 15:40:06 +0000
@@ -2,6 +2,7 @@
 // 2007,2008 © Václav Šmilauer <eudoxos@xxxxxxxx> 
 #pragma once
 #include<yade/core/GlobalEngine.hpp>
+#include<yade/core/Interaction.hpp>
 
 /*! Homogeneous gravity field; applies gravity×mass force on all bodies. */
 class GravityEngine: public GlobalEngine{

=== modified file 'pkg/dem/Engine/GlobalEngine/FacetTopologyAnalyzer.hpp'
--- pkg/dem/Engine/GlobalEngine/FacetTopologyAnalyzer.hpp	2009-12-13 20:30:13 +0000
+++ pkg/dem/Engine/GlobalEngine/FacetTopologyAnalyzer.hpp	2010-01-23 15:40:06 +0000
@@ -1,6 +1,7 @@
 // 2009 © Václav Šmilauer <eudoxos@xxxxxxxx>
 #pragma once
 #include<yade/core/GlobalEngine.hpp>
+#include<yade/core/Interaction.hpp>
 /*! Initializer for filling adjacency geometry data for facets.
  *
  * Common vertices and common edges are identified and mutual angle between facet faces

=== modified file 'pkg/dem/Engine/GlobalEngine/NewtonIntegrator.hpp'
--- pkg/dem/Engine/GlobalEngine/NewtonIntegrator.hpp	2010-01-23 10:53:12 +0000
+++ pkg/dem/Engine/GlobalEngine/NewtonIntegrator.hpp	2010-01-23 15:40:06 +0000
@@ -8,6 +8,7 @@
 #pragma once
 
 #include<yade/core/GlobalEngine.hpp>
+#include<yade/core/Interaction.hpp>
 #include<Wm3Vector3.h>
 #ifdef YADE_OPENMP
 	#include<omp.h>

=== modified file 'py/config.py.in'
--- py/config.py.in	2010-01-09 17:26:41 +0000
+++ py/config.py.in	2010-01-23 15:40:06 +0000
@@ -4,7 +4,7 @@
 Template file is processed by scons to create the actual configuration at build-time.
 """
 import os
-prefix='${runtimePREFIX}' 
+prefix='${runtimePREFIX}' if not os.environ.has_key('YADE_PREFIX') else os.environ['YADE_PREFIX']
 suffix='${SUFFIX}'
 libstdcxx='${libstdcxx}'
 features='${features}'.split(',')

=== modified file 'py/yadeWrapper/yadeWrapper.cpp'
--- py/yadeWrapper/yadeWrapper.cpp	2010-01-22 21:07:37 +0000
+++ py/yadeWrapper/yadeWrapper.cpp	2010-01-23 15:40:06 +0000
@@ -214,14 +214,15 @@
 		shared_ptr<Scene> scene;
 	public:
 		pyForceContainer(shared_ptr<Scene> _scene): scene(_scene) { }
-		Vector3r force_get(long id){  scene->forces.sync(); return scene->forces.getForce(id); }
-		Vector3r torque_get(long id){ scene->forces.sync(); return scene->forces.getTorque(id); }
-		Vector3r move_get(long id){   scene->forces.sync(); return scene->forces.getMove(id); }
-		Vector3r rot_get(long id){    scene->forces.sync(); return scene->forces.getRot(id); }
-		void force_add(long id, const Vector3r& f){  scene->forces.addForce (id,f); }
-		void torque_add(long id, const Vector3r& t){ scene->forces.addTorque(id,t);}
-		void move_add(long id, const Vector3r& t){   scene->forces.addMove(id,t);}
-		void rot_add(long id, const Vector3r& t){    scene->forces.addRot(id,t);}
+		void checkId(long id){ if(id<0 || id>=scene->bodies->size()){ PyErr_SetString(PyExc_IndexError, "Body id out of range."); python::throw_error_already_set(); /* never reached */ throw; } }
+		Vector3r force_get(long id){  checkId(id); scene->forces.sync(); return scene->forces.getForce(id); }
+		Vector3r torque_get(long id){ checkId(id); scene->forces.sync(); return scene->forces.getTorque(id); }
+		Vector3r move_get(long id){   checkId(id); scene->forces.sync(); return scene->forces.getMove(id); }
+		Vector3r rot_get(long id){    checkId(id); scene->forces.sync(); return scene->forces.getRot(id); }
+		void force_add(long id, const Vector3r& f){  checkId(id); scene->forces.addForce (id,f); }
+		void torque_add(long id, const Vector3r& t){ checkId(id); scene->forces.addTorque(id,t);}
+		void move_add(long id, const Vector3r& t){   checkId(id); scene->forces.addMove(id,t);}
+		void rot_add(long id, const Vector3r& t){    checkId(id); scene->forces.addRot(id,t);}
 		long syncCount_get(){ return scene->forces.syncCount;}
 		void syncCount_set(long count){ scene->forces.syncCount=count;}
 };