yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #16890
Re: [Question #665341]: iterations in c++
Question #665341 on Yade changed:
https://answers.launchpad.net/yade/+question/665341
Status: Needs information => Open
JOHN gave more information on the question:
I have explained what i wanted very badly, let me try again.
I have a library (so) of c++ helper functions with the approporiate boost wrappers to python.
Ideally, i would like to include there all the yade parts that require iteration through all the Yadebodies component. Like this function
def checkAndDelete(boundaries):
for b in O.bodies:
if isinstance(b.shape,Sphere):
x,y,z = b.state.pos
if (x<boundaries[0] or x>boundaries[1] or y<boundaries[2] or
y>boundaries[3] or z<boundaries[4] or z>boundaries[5]): # modify this
condition to your needs
loc2glob.remove(b.id)
O.bodies.erase(b.id)
then i would ideally like to import the library to the yade script and instead of calling a python function call something like
helper.searchanddelete(O.bodies)
Unfortunately, to do this i need to somehow define what a body is. I searched my computer for the body.cpp etc, but since i installed it using sudo-apt-get install i didnt get the git content but rather some library and python files.
I then tried downloading the core folder from git and used the following very simple c++ code to see if i can import the cpp files.
#include<iostream>
#include</home/john/Desktop/bodies/Body.hpp>
using namespace std;
int main(){
cout<<"imported"<<endl;
return 0;}
which promptly returned
In file included from /usr/include/boost/python/detail/prefix.hpp:13:0,
from /usr/include/boost/python/args.hpp:8,
from /usr/include/boost/python.hpp:11,
from /home/john/Desktop/bodies/lib/base/Math.hpp:54,
from /home/john/Desktop/bodies/lib/serialization/Serializable.hpp:15,
from /home/john/Desktop/bodies/Shape.hpp:11,
from /home/john/Desktop/bodies/Body.hpp:12,
from include.cpp:2:
/usr/include/boost/python/detail/wrap_python.hpp:50:23: fatal error: pyconfig.h: No such file or directory
compilation terminated.
And right now I am at a loss.I do not want to modify the source code
Perhaps instead of using the body container, is there a way to pass as a (vector, list,anything) all the positions of the particles for example and handle them as a vector in the c++ code? And similarly return them as vector and integrade them in the body container without much overhead?
--
You received this question notification because your team yade-users is
an answer contact for Yade.