looking for the InCylinder folder
Hi All,
I am new at Yade and i try to insert a InCone-subclass, but i don't to find the correct direction in the yade-folders, where every In-subclass is saved.
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- Yade Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Christian Sommerfeld
- Solved:
- Last query:
- Last reply:
Revision history for this message
|
#1 |
Hi Christian,
you want to create one more facet-geometry like facetBox or facetCylinder, or you want to create a new geometry of body like box or cylinders?
Anton
Revision history for this message
|
#2 |
Hi Anton,
Sorry that I answer so late! I need a new geometry like a box or a cylinder and it should be a cone.
Revision history for this message
|
#3 |
You will have to implement this. It would an interesting feature!
It needs to define normal, penetration depth, contact point, and shear velocity at contacts between cone and spheres.
Revision history for this message
|
#4 |
Hi,
i already implemented some code into the _pack Predicates.
Revision history for this message
|
#5 |
To start with that, you can take an example of shape and see how it is
defined. Let us consider boxes:
- Box.hpp/cpp
- Bo1_Box_Aabb.*
Then interactions with boxes:
- Ig2_Box_
Basically, you need to write the same code for cones. There is no
obligation to split in three files, you can write everything in one hpp
and one cpp if it is more convenient.
A few other things can be also in separate functions, like computing the
mass and inertia matrix of arbitrary cone, but it is not required for
testing (you can always assign inertia in the testing script).
Revision history for this message
|
#6 |
Thank you! I will try to create it. Afterwards i will give a response if it works
Revision history for this message
|
#7 |
Good luck!
You may start with paper and pen, to define unit normal, contact point, penetration depth and shear velocity at sphere-cone contacts.
The rest is only implementation, we can assist you for this last step.
Revision history for this message
|
#8 |
First of all i created a new hpp and a new cpp file named cone.hpp and cone.cpp with the same code like in the cylinder.hpp and cylinder.cpp to check if it is still working, when i only changed the name. Furthermore, i implemented the following code into the _packPredicates.cpp file:
class inCone: public Predicate{
Vector3r c1,c2,c12; Real radius,ht;
public:
inCone(const Vector3r& _c1, const Vector3r& _c2, Real _radius){c1=_c1; c2=_c2; c12=c2-c1; radius=_radius; ht=c12.norm(); }
bool operator()(const Vector3r& pt, Real pad=0.) const {
Real u=(pt.dot(
if((u*ht<0+pad) || (u*ht>ht-pad)) return false; // out of cylinder along the axis
Real axisDist=
if(axisDist>
return true;
}
py::tuple aabb() const {
// see http://
const Vector3r& A(c1); const Vector3r& B(c2);
Vector3r k(
sqrt(
sqrt(
sqrt(
Vector3r mn=A.cwise(
return vvec2tuple(
}
};
py::class_
what is the same code as for inCylinder
But when i want to create an inCone with the following code:
from yade import pack
pred=pack.
i get the following error:
AttributeError Traceback (most recent call last)
/usr/lib/
----> 1
2
3
4
5
AttributeError: 'module' object has no attribute 'inCone'
and iḿ not sure what i have to do, because there isnt any direction and file like this
/usr/lib/
which is
Revision history for this message
|
#9 |
Just short comments before looking the details:
1- there is no need to implement anything in packPredicates in order to add a new shape. The classes I listed above are enough.
2- the word "cylinder" in packPredicates does not refer to the class defined in Cylinder.hpp/cpp, they are really independant things. So, if you want to test that simple renaming of "cylinder" shape works, better don't play with predicates at all.
For the error you get: did you declare a python binding as in _packPredicates
python:
If yes, does is work if you type:
pred=pack.
Else, you maybe forgot to import the relevant module.
Revision history for this message
|
#10 |
Thank you for your fast answer,
yes i declared a phyton binding like the phyton binding for cylinder:
py::class_
py::class_
and when i type:
pred=pack.
Ah ok, when there is not a need to implement it in packPredicate, is there another command what i can use?
Revision history for this message
|
#11 |
For the error, you should double check names, make sure you run the version you just compiled, etc. There must be a small mistake somewhere.
For the "another command" part. Just don't use predicates. Create a cone, place a sphere inside it, add gravity, run. This would be your test script for testing the cone shape.
Revision history for this message
|
#12 |
Is it possible, that i can not create new code because i use yade-daily? Or is there a command, which i have to type inside the terminal to compile the new code? i took a look for a command at the manual and the homepage, but i can not find anything.
Revision history for this message
|
#13 |
If you don't compile it cannot work...
How did you obtain the source code files you are modifying?
Check this: https:/
Revision history for this message
|
#14 |
i followed the installation advice and downloaded all prerequisites. Afterwards i wrote into the terminal:
sudo apt-get install scons freeglut3-dev libloki-dev \
libboost-
libboost-regex-dev fakeroot dpkg-dev build-essential g++ \
libboost-
python-matplotlib libsqlite3-dev python-numpy python-tk gnuplot doxygen \
libgts-dev python-pygraphviz libvtk5-dev python-scientific bzr bzrtools libeigen2-dev \
binutils-gold python-xlib python-qt4 pyqt4-dev-tools \
libqglviewer-
and it was still working.
Revision history for this message
|
#15 |
Now i am a little bit confused because i read:
If you prefer to use the newest yade version and you do not "hack" the code, yade-daily is the best choice for you.
Installed once, you will get the updates automatically without recompiling the code.
Yade-daily is compiled automatically on build-servers of Launchpad, getting the code from the latest trunk version.
Or is there also a possibility to compile it an my computer?
Revision history for this message
|
#16 |
>If you prefer to use the newest yade version and you do not "hack" the code
You ARE hacking the code. You need to read the "source code" paragraph that I linked above.
Revision history for this message
|
#17 |
Hi,
now I tried t install yade-0.70.0 with the following comment:
scons PREFIX=
scons: Reading SConscript files ...
@@@ Using profile default (scons.
Eigen 2 math library will be used
Yade version is `0.70.0' (0.70.0), installed files will be suffixed with `-0.70.0'.
All intermediary files will be in `/home/
Checking whether c++ compiler "g++" works...yes
Finding libstdc++ library... (cached) /usr/lib/
Checking for pthread_exit(NULL) in C library pthread... yes
Checking for Python development files... ok
Checking for C++ header file numpy/ndarrayob
Checking for required python modules... (cached) all ok
Checking boost libraries... Failures: boost_program_
Checking for C++ header file boost/foreach.
Checking for C++ header file Eigen/Core... yes
Checking for C++ header file loki/NullType.h... yes
One of the essential libraries above was not found, unable to continue.
Check `/home/
Afterwards I downloaded different versions of boost, because there are some problems with boost, but I can not handle it in this way. Is there a special way to fix the problem with boost?
Revision history for this message
|
#18 |
How did you install boost? From packages or by compiling from the source?
Anton
Revision history for this message
|
#19 |
After I downloaded it I installed boost from packages for yade-daily first.
Revision history for this message
|
#20 |
Is there no possibility to handle this problem?
Revision history for this message
|
#21 |
if it is helpful i can add the error message from the config.log :
|#include<
|int main(void)
g++ -o /home/ubuntu/
g++ -o /home/ubuntu/
/usr/bin/ld: error: cannot find -lboost_
/home/ubuntu/
/home/ubuntu/
/home/ubuntu/
collect2: ld returned 1 exit status
/home/ubuntu/
|#include<
|int main(void)
g++ -o /home/ubuntu/
g++ -o /home/ubuntu/
scons: Configure: Failures: boost_program_
scons: Configure: Checking for C++ header file boost/foreach.
/home/ubuntu/
|
/home/ubuntu/
|#include<
|int main(void)
g++ -o /home/ubuntu/
g++ -o /home/ubuntu/
scons: Configure: Failures: boost_program_
scons: Configure: Checking for C++ header file boost/foreach.
/home/ubuntu/
|
Revision history for this message
|
#22 |
It seems that there is a problem with boost program-options
Revision history for this message
|
#23 |
The problem is here:
/usr/bin/ld: error: cannot find -lboost_
I googled your problem, maybe this can help you:
http://
it has something to do with libboost ... I dont know, just guessing ...
If it helps, I can send you output from "aptitude search libboost", but i am using debian, so package names can be different on your ubuntu linux ...
me@debian ~/YADE/trunk >aptitude search libboost
i libboost-all-dev - Boost C++ Libraries development files (ALL, default version)
i libboost-
i A libboost-
i A libboost-
p libboost-dbg - Boost C++ Libraries with debug symbols
i libboost-dev - Boost C++ Libraries development files (default version)
p libboost-doc - Boost C++ Libraries documentation (default version)
i libboost-
i A libboost-
i A libboost-
i A libboost-graph-dev - generic graph components and algorithms in C++ (default version)
i A libboost-
i A libboost-
i A libboost-
i A libboost-
i A libboost-
i libboost-
i A libboost-
i libboost-
i A libboost-math-dev - Boost.Math Library development files (default version)
i A libboost-
i A libboost-math1.42.0 - Bibliothek Boost.Math
i A libboost-mpi-dev - C++ interface to the Message Passing Interface (MPI) (default version)
i A libboost-
p libboost-
p libboost-
i A libboost-
i A libboost-mpi1.42.0 - C++ interface to the Message Passing Interface (MPI)
i A libboost-
i A libboost-
i A libboost-
i libboost-python-dev - Boost.Python Library development files (default version)
i A libboost-
i A libboost-
i libboost-regex-dev - regular expression library for C++ (default version)
i A libboost-
i A libboost-
i A libboost-
i A libboost-
i A libboost-
i A libboost-
i A libboost-
i A libboost-
i A libboost-system-dev - Operating system (e.g. diagnostics support) library (default version)
i A libboost-
i A libboost-
i A libboost-test-dev - components for writing and executing test suites (default version)
i A libboost-
i A libboost-test1.42.0 - components for writing and executing test suites
i libboost-thread-dev - portable C++ multi-threading (default version)
i A libboost-
i A libboost-
i A libboost-wave-dev - C99/C++ preprocessor library (default version)
i A libboost-
i A libboost-wave1.42.0 - C99/C++ preprocessor library
p libboost1.
p libboost1.42-dbg - Boost C++ Libraries with debug symbols
i A libboost1.42-dev - Boost C++ Libraries development files
p libboost1.42-doc - Boost.org libraries documentation
hope it helps,
christian
Revision history for this message
|
#24 |
Now i solved my problem. Thank you for your help!