Anush Krishnan <[email protected]> writes:

> Around each body point, I choose a small rectangular region of velocity
> grid points and perform an interpolation with these values to obtain the
> velocity at the body point. 

How large are these rectangular regions?

> This can be represented as: [C][u] = [b]
>
> where [C] contains the interpolation coefficients, [u] contains velocity
> values from the small rectangular region and [b] is the velocity at the
> body point. These matrices can be expanded to include the entire velocity
> field and all the body points.

What are you doing with the C once it is built?

Depending on the distribution and access pattern, it could make sense to
assemble C^T instead, but it likely doesn't matter.

> Currently, my fix is to loop over all the velocity grid points, check if
> they come under the influence of any of the body points, and
> correspondingly set the interpolation coefficient value in the matrix. But
> this procedure requires a double loop.

I would loop over the body points and classify them as being "within
range" of the grid points that you own.  Ignore the points that are out
of range.  From the interpolation patch size, you know analytically
which owned grid points need to contribute values.  Call MatSetValues()
or MatSetValuesLocal() for that partial row of C.  (Don't worry about
whether you own the body point or not, and only set entries for velocity
points that you own---because the other process will be setting the
entries for the points they own.)

Attachment: pgpmmmCa2tAxf.pgp
Description: PGP signature

Reply via email to