Vector Mathematics
I'm sure there must be a neater way to do this, but I can't find the documentation and nothing I've tried works. This is just ugly :o
Code:
const vector offset((endCorner_.x() - startCorner_.x())/(nPoints_.x() - 1), And nPoints is an integer vector, which simply contains the number of points I want in each direction. I really just want to say: offset = (endCorner - startCorner)/(nPoints -1) And hopefully C++ would figure that as nPoints is a vector, then when I subtract 1, that should remain a vector. And the subtraction of two vectors should be vector; and dividing one against the other give me my offsets in each direction. But it refused to compile. So the final offset vector should contain the steps I need to take in each principal direction in order to fill a box with a lot of points. Just finishing off my development of LPT btw, that requires points throughout the domain which we're running through waveFOAM. Finally function we're adding to solidParticleCloud.C looks like Code:
void Foam::solidParticleCloud::seed(const dimensionedVector& g) |
Hallo,
I think that the only thing you lack is the Foam::cmptDivide functionality. The vector minus vector and vector minus scalar does already work. Have fun playing with waves2Foam; curious to know how the Lagrangian particles will behave across the free surface. Kind regards, Niels |
Thanks.
Just for the record, I replace: Code:
const vector offset((endCorner_.x() - startCorner_.x())/(nPoints_.x() - 1), Code:
const vector offset(Foam::cmptDivide(endCorner_ - startCorner_, nPoints_ - vector(1,1,1))); Code:
vector pos(startCorner_.x() + offset.x()*i, Code:
vector pos(startCorner_ + Foam::cmptMultiply(offset, vector(i,j,k))); Quote:
As for WaveFoam. Preliminary results look amazing and I think our physical understanding of what we're doing will be greatly enhanced. We're loosing a few particles to the atmosphere, mostly due to wave splashing onto a surface, but that aside it seems acceptable. Will post some pictures when we're happier. |
All times are GMT -4. The time now is 11:16. |