yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #03124
[Branch ~yade-dev/yade/trunk] Rev 1983: 1. Some changes for Eigen migration
------------------------------------------------------------
revno: 1983
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
branch nick: trunk
timestamp: Thu 2010-01-21 17:39:18 +0100
message:
1. Some changes for Eigen migration
2. TranslationEngineEigen to test Eigen library
added:
pkg/common/Engine/PartialEngine/TranslationEngineEigen.cpp
pkg/common/Engine/PartialEngine/TranslationEngineEigen.hpp
modified:
lib/base/yadeEigen.hpp
lib/base/yadeWm3.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 'lib/base/yadeEigen.hpp'
--- lib/base/yadeEigen.hpp 2010-01-21 13:55:07 +0000
+++ lib/base/yadeEigen.hpp 2010-01-21 16:39:18 +0000
@@ -3,5 +3,5 @@
#include <Eigen/Core>
#include <Eigen/Geometry>
-template<class T> class Eigen::Vector3f; typedef Eigen::Vector3f<Real> Vector3r;
+typedef Eigen::Vector3f Vector3r;
=== modified file 'lib/base/yadeWm3.hpp'
--- lib/base/yadeWm3.hpp 2009-01-27 02:19:40 +0000
+++ lib/base/yadeWm3.hpp 2010-01-21 16:39:18 +0000
@@ -104,7 +104,6 @@
template<class T> class DistVector3Segment3; typedef DistVector3Segment3<Real> DistVector3Segment3r;
template<class T> class DistVector3Tetrahedron3; typedef DistVector3Tetrahedron3<Real> DistVector3Tetrahedron3r;
template<class T> class DistVector3Triangle3; typedef DistVector3Triangle3<Real> DistVector3Triangle3r;
- template<class T> class Eigen; typedef Eigen<Real> Eigenr;
template<class T> class Ellipse2; typedef Ellipse2<Real> Ellipse2r;
template<class T> class Ellipsoid3; typedef Ellipsoid3<Real> Ellipsoid3r;
template<class T> class EllipsoidGeodesic; typedef EllipsoidGeodesic<Real> EllipsoidGeodesicr;
=== added file 'pkg/common/Engine/PartialEngine/TranslationEngineEigen.cpp'
--- pkg/common/Engine/PartialEngine/TranslationEngineEigen.cpp 1970-01-01 00:00:00 +0000
+++ pkg/common/Engine/PartialEngine/TranslationEngineEigen.cpp 2010-01-21 16:39:18 +0000
@@ -0,0 +1,24 @@
+/*************************************************************************
+* Copyright (C) 2004 by Olivier Galizzi *
+* olivier.galizzi@xxxxxxx *
+* *
+* This program is free software; it is licensed under the terms of the *
+* GNU General Public License v2 or later. See file LICENSE for details. *
+*************************************************************************/
+
+#include"TranslationEngineEigen.hpp"
+#include<yade/core/Scene.hpp>
+
+void TranslationEngineEigen::applyCondition(Scene * ncb){
+ Real dt=Omega::instance().getTimeStep();
+ FOREACH(body_id_t id,subscribedBodies){
+ assert(id<(body_id_t)ncb->bodies->size());
+ Body* b=Body::byId(id,ncb).get();
+ if(!b) continue;
+ b->state->pos+=dt*velocity*translationAxis;
+ b->state->vel=velocity*translationAxis;
+ }
+}
+
+YADE_PLUGIN((TranslationEngineEigen));
+YADE_REQUIRE_FEATURE(eigen)
=== added file 'pkg/common/Engine/PartialEngine/TranslationEngineEigen.hpp'
--- pkg/common/Engine/PartialEngine/TranslationEngineEigen.hpp 1970-01-01 00:00:00 +0000
+++ pkg/common/Engine/PartialEngine/TranslationEngineEigen.hpp 2010-01-21 16:39:18 +0000
@@ -0,0 +1,26 @@
+/*************************************************************************
+* Copyright (C) 2004 by Olivier Galizzi *
+* olivier.galizzi@xxxxxxx *
+* *
+* This program is free software; it is licensed under the terms of the *
+* GNU General Public License v2 or later. See file LICENSE for details. *
+*************************************************************************/
+
+#pragma once
+
+#include<yade/core/PartialEngine.hpp>
+#include<yade/lib-base/yadeWm3.hpp>
+
+class TranslationEngineEigen : public PartialEngine {
+ public:
+ Real velocity;
+ Vector3r translationAxis;
+ virtual void applyCondition(Scene *);
+ virtual void postProcessAttributes(bool deserializing){ if(deserializing) translationAxis.Normalize(); }
+ REGISTER_ATTRIBUTES(PartialEngine,(velocity)(translationAxis));
+ REGISTER_CLASS_AND_BASE(TranslationEngineEigen,PartialEngine);
+};
+REGISTER_SERIALIZABLE(TranslationEngineEigen);
+
+YADE_REQUIRE_FEATURE(eigen)
+
Follow ups