Re: [Yade-dev] [svn] r1651 - in trunk: gui/qt3 pkg/common/Engine/FilterEngine
Sorry to bug with that, but could you, on the wiki or mailing list, briefly explain how filters work, what is their typical usage etc? I think that could be quite useful for everybody. Best, Vaclav 1. SimulationPlayer now allows to reload filters without reloading all simulation. 2. ColorizedVelocityFilter now allows to setup minValue,maxValue without reloading the filter. ___ Mailing list: https://launchpad.net/~yade-dev Post to : yade-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~yade-dev More help : https://help.launchpad.net/ListHelp
Re: [Yade-dev] be carefully with python console and postProcessAttributes
postProcessingAttributes used to initialize attributes _after_ serialization / deserialization a object, but not to initialize the object after it original creation. This is due to the fact that when python-console was lacking, and used only C++ preprocessors, after creation a model in the preprocessor it saved to a file, after which the file loaded in SimulationController, and the simulation runs. Thus, this mechanism allows to initialize the attributes after initial creation an object in the preprocessor. However, with the advent of python-console this save/load step is omited. Therefore, objects that require initialization after its creation, initialized noncorrectly, so for such objects must explicitly call postProcessingAttributes (or do save/load model before run a simulation). Hi, I was aware of this problem, for example utils.facet calls explicitly postProcessAttributes(). Most objects do not do anything substantial in this initialization, but it has to be watched out and I don't know if there is possibly a general solution for that. There is a function to save simulation to a in-memory XML using O.saveTmp('init') and load it immediately afterwards with O.loadTmp('init'). Or is a bad idea to use postProcessingAttributes() to initialize, and better to use the mechanism of action() first call? That's what I do in UniaxialStrainer: there is a non-serializable attribute bool needsInit, which is set to true in the constructor. In action then: if(needsInit) init(); (which sets needsInit=false). Vaclav ___ Mailing list: https://launchpad.net/~yade-dev Post to : yade-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~yade-dev More help : https://help.launchpad.net/ListHelp
Re: [Yade-dev] drawing a color legend
Hello. I want to draw a color legend from ColorizedVelocityFilter engine. :-) there is duplicated code, see Shop::scalarOnColorScale, which uses the algorithm from matplotlib. How to draw from engine? Is there such mechanism? I recently added GL locking which should make it possible, but I give no warranties. You _must_ get a GLLock before manipulating GL, otherwise you get error/crash/hardlock (depending on graphics card and driver). I don't know however, if you will get the scale painted after the whole scene of just before the scene, maybe it is undefined. I was thinking once of using openscenegraph for GL stuff, since we're already got bunch of low-level hacks to get relatively decent 3d. One more hack could be to draw the scale in GLViewer::postDraw, but you must carefully think were you store min/max values (in the engine? and the GLViewer will have to search engines every time? Or in the GLViewer? But what if there is no GLViewer? And so on). If someone needs, god forbid, two scales or three scales, we're lost... Currently, I see an possibility to do so by adding a body with an appropriate GeometricalModel... It would be subject to 3d manipulation of the scene (GL functors for bodies are in local coordinates), whereas here you need something that is bound to the 2d view; maybe do the inverse glMatrix to get to global space. You could also use special kind of interaction, since those are GL-drawn in global space. But the constitutive law must skip such interaction then. Still you need to find camera glMatrix and use its inverse to get from global space to the view space. Eh, ugly. What about creating special kind of objects just for this (like MetaBody::planarWidgets ;-) ), like grid, time displays etc, that would be drawn in the 2d space and add those to the OpenGLRenderingEngine? V. ___ Mailing list: https://launchpad.net/~yade-dev Post to : yade-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~yade-dev More help : https://help.launchpad.net/ListHelp
Re: [Yade-dev] r1649 - graphic display
eudoxos at BerliOS said: (by the date of Sat, 31 Jan 2009 16:28:40 +0100) I am now getting machine hardlocks if I open second view (from the GUI) which used not to happen, AFAIK. Can someone confirm that? Thx. I just did `svn up` and I can confirm that it deadlocks even before opening the 1st display window. Doesn't work at all :p commenting out that lock in GLViewer::paintGL(void) solves the problem. PS: why did you write void there? -- Janek Kozicki | ___ Mailing list: https://launchpad.net/~yade-dev Post to : yade-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~yade-dev More help : https://help.launchpad.net/ListHelp
[Yade-dev] [svn] r1654 - trunk/pkg/dem/Engine/StandAloneEngine
Author: richefeu Date: 2009-02-02 17:25:12 +0100 (Mon, 02 Feb 2009) New Revision: 1654 Added: trunk/pkg/dem/Engine/StandAloneEngine/MGPRecorder.cpp trunk/pkg/dem/Engine/StandAloneEngine/MGPRecorder.hpp Log: Add a DataRecoder that generate MGP files (only for Spheres for the moment). The MGP files can then be read with mgpost. Added: trunk/pkg/dem/Engine/StandAloneEngine/MGPRecorder.cpp === --- trunk/pkg/dem/Engine/StandAloneEngine/MGPRecorder.cpp 2009-02-02 14:25:50 UTC (rev 1653) +++ trunk/pkg/dem/Engine/StandAloneEngine/MGPRecorder.cpp 2009-02-02 16:25:12 UTC (rev 1654) @@ -0,0 +1,96 @@ +/* +* Copyright (C) 2009 by Vincent Richefeu* +* vincent.riche...@hmg.inpg.fr * +** +* 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 MGPRecorder.hpp + +#include yade/core/Omega.hpp +#include yade/core/MetaBody.hpp +#include boost/lexical_cast.hpp + +#include yade/pkg-common/Sphere.hpp + +MGPRecorder::MGPRecorder(): DataRecorder() +{ + outputBase = mgp.out.; + interval = 50; + stateId= 0; +} + + +MGPRecorder::~MGPRecorder () +{ + +} + + +void MGPRecorder::postProcessAttributes(bool deserializing) +{ + if(deserializing) + { + // + } +} + + +void MGPRecorder::registerAttributes() +{ + DataRecorder::registerAttributes(); + REGISTER_ATTRIBUTE(outputBase); + REGISTER_ATTRIBUTE(interval); + REGISTER_ATTRIBUTE(stateId); +} + +bool MGPRecorder::isActivated() +{ + return ((Omega::instance().getCurrentIteration() % interval == 0)); +} + +void MGPRecorder::action(MetaBody * ncb) +{ + shared_ptrBodyContainer bodies = ncb-bodies; + + std::string outputFile = outputBase+lexical_caststring(stateId); + std::ofstream ofs(outputFile.c_str()); + + ofs ?xml version=\1.0\? endl +mgpost mode=\3D\ endl + state id=\ stateId++ + \ time=\ lexical_caststring(Omega::instance().getSimulationTime()) \ endl; + + BodyContainer::iterator bi= bodies-begin(); + BodyContainer::iterator biEnd = bodies-end(); + for(; bi != biEnd ; ++bi) + { + const shared_ptrBody b = *bi; + const RigidBodyParameters* p = YADE_CASTRigidBodyParameters*(b-physicalParameters.get()); + const GeometricalModel* gm = YADE_CASTGeometricalModel*(b-geometricalModel.get()); + + if ( typeid(*gm) == typeid(Sphere) ) + { + ofs body endl; + ofs SPHER id=\ b-getId() \ r=\ YADE_CASTSphere*(b-geometricalModel.get())-radius \ endl; + ofs position x=\ p-se3.position[0] \ y=\ + p-se3.position[1] \ z=\ p-se3.position[2] \/ endl; + ofs velocity x=\ p-velocity[0] \ y=\ + p-velocity[1] \ z=\ p-velocity[2] \/ endl; + ofs /SPHER endl; + ofs /body endl flush; + } + + + + } + + + ofs/state endl +/mgpost endl flush; + + +} + +YADE_PLUGIN(); Added: trunk/pkg/dem/Engine/StandAloneEngine/MGPRecorder.hpp === --- trunk/pkg/dem/Engine/StandAloneEngine/MGPRecorder.hpp 2009-02-02 14:25:50 UTC (rev 1653) +++ trunk/pkg/dem/Engine/StandAloneEngine/MGPRecorder.hpp 2009-02-02 16:25:12 UTC (rev 1654) @@ -0,0 +1,44 @@ +/* +* Copyright (C) 2009 by Vincent Richefeu* +* vincent.riche...@hmg.inpg.fr * +** +* 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/DataRecorder.hpp +#include yade/pkg-common/RigidBodyParameters.hpp +#includeyade/core/GeometricalModel.hpp +//#include set + + +class MGPRecorder : public DataRecorder +{ +private: +//shared_ptrRigidBodyParameters rigidBodyParameters; +//setint body_ids; + + +public : +string outputBase; +int interval; +int stateId; + +MGPRecorder (); +~MGPRecorder (); + +virtual void action(MetaBody*); +bool isActivated(); + +protected : +virtual void postProcessAttributes(bool deserializing); +void registerAttributes(); +REGISTER_CLASS_NAME(MGPRecorder); +REGISTER_BASE_CLASS_NAME(DataRecorder); +}; + +REGISTER_SERIALIZABLE(MGPRecorder); + + ___ Mailing list:
Re: [Yade-dev] be carefully with python console and postProcessAttributes
That's what I do in UniaxialStrainer: there is a non-serializable attribute bool needsInit, which is set to true in the constructor. In action then: if(needsInit) init(); (which sets needsInit=false). It is OK for engines, but what about bodies? May be doing automatically saveTmp/loadTmp before simulation run? -- Best regards, Sergei D. ___ Mailing list: https://launchpad.net/~yade-dev Post to : yade-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~yade-dev More help : https://help.launchpad.net/ListHelp