Author: orestis Hello,
the get(iX,iY) method returns a cell. A cell is made of different
things. Among them the f_i’s are stored there. I guess that what you
want to do is to assign a random number to each f_i. TO access them
you have to use the brackets :lattice.get(iX,iY)[iPop]
returns f[iPop]. Then you can assign the random number to each f_i.
I hope it helps.
Orestis
Author: orestis
Hello, As I told you in a preceding post. lattice.get(iX,iY) return a Cell object. The cell object contains the
f_i, a pointer to a dynamic, and different other methods.You therefore cannot give a integer value to a cell :
lattice.get(iX,iY) = 1
will not compile since 1 is not of type cell but of type integer.
Four your purpose you should simply write some thing like :
for (int iX=0; iX<nx; ++iX) {
for (int iY=0; iY<ny; ++iY) {if ( (rand()%10)+1 < 8)
lattice node. {
lattice.defineDynamics( iX,iX,iY,iY,
&instances::getBounceBack<T,DESCRIPTOR>() );
} }}
Good luck.
写数据处理器时,我们一般都定义一个cell=lattice.get(iX,iY)。
这里Orestis提到也可以用lattice.get(iX,iY)[iPop]返回f’s。
后面的 lattice.defineDynamics( iX,iX,iY,iY, &instances::getBounceBack<T,DESCRIPTOR>() );
是将目标格点的Dynamics设置为BounceBack。
提问者的想法是在一片随机区域随机生成一些反弹格式的点(就像多孔介质一样)。