loop over cells in PFV using id

Asked by Christian Jakob on 2014-01-30

Hi,

How can I loop over all cells in PFV method?
I noticed there is an id of each cell, but how can I find out all ids?

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Bruno Chareyre
Solved:
2014-01-31
Last query:
2014-01-31
Last reply:
2014-01-31

> Hi,
>
> How can I loop over all cells in PFV method?
> I noticed there is an id of each cell, but how can I find out all ids?
>

We added recently flow.nCells(), exactly for this purpose, yet it will
need more functions to be really useful. We discover what is missing
from users feedback.

One (the only) thing you can do a.t.m is:
for i in range(flow.nCells()):
   print flow.getVertices(i)

There is no python wrapping of the cell objects, hence we need one
getter per variable.
You could add additional functions depending on what you need
(getPosition, getPressure, etc.), very easy to do if you look how
getVertices work.
I suspect Thomas may have add getPressure() already (uncommited). If so,
we better include your version Thomas to not end up with multiple
implementations of the same feature (which would lead to git conflicts).

Bruno

--
_______________
Bruno Chareyre
Associate Professor
ENSE³ - Grenoble INP
Lab. 3SR
BP 53
38041 Grenoble cedex 9
Tél : +33 4 56 52 86 21
Fax : +33 4 76 82 70 43
________________

Christian Jakob (jakob-ifgt) said : #2

> There is no python wrapping of the cell objects
> , hence we need one getter per variable.

wouldnt it be better create wrapper for cell objects, so that users can do something like:

for c in O.flowCells:
  print c.pressure

c

Thomas Sweijen (thomassweijen) said : #3

Hello,

Indeed, I have getCellPressure(id) which is pretty easy to make as Bruno indicates.
I don't have other functions added in the python wrapper, yet. It might be nice to add some more functions on the cell information in the python wrapper.

I will soon upload a series of functions such that you can access them Bruno. For now it might be easier if I send you a few lines for this single function?

Cheers,
Thomas

> wouldnt it be better create wrapper for cell objects

It would be better of course. It only needs somebody to work on that.
Actually, wrapping the info types would be good enough.

B

Christian Jakob (jakob-ifgt) said : #5

Thanks Bruno Chareyre, that solved my question.