PtrList<PtrList<dimesionedScalar> >
I want to define binary interaction parameters in a mixture. For example I need to determine the interaction diameter as a matrix-like variable, d_ij.
It seems that a variable of type PtrList<PtrList<dimesionedScalar> > is suitable. But I don't know how to apply a relation like : d_ij[i][j]=(d[i]+d[j])/2 to initialize that. Can anybody help me on this or refer to part of O.F. code for something similar? Thanks. |
Would this do it
Code:
|
I just realized, no it wont...
|
Thanks,
I managed it in a different way. I used a PtrList<dimensionedScalar> of size N^2 insted of a N*N matrix. Something like this: PtrList<dimensionedScalar> d(specieName.size()); forAll(specieName, i) { d[i]= .... ; } PtrList<dimensionedScalar> d_ij(specieName.size()*specieName.size()); forAll(specieName, i) { forAll(specieName, j) { label k=i*specieName.size()+j; d_ij[k]=(d[i]+d[j])/2; } } |
Hi
You can also use List< List < scalar > > Code:
typedef List< List < scalar > > myMatrix; Code:
myMatrix d_ij; Code:
d_ij[0][3] = 6; Hisham |
All times are GMT -4. The time now is 12:42. |