Dear support,
I often come into issues in python calculators (or in programmable filters) when working with composite datasets (typically from multiblock grids) where the data is distributed among many datasets (each one represented by a block) where you can find the data arrays in each bock. I am familiar with using the basic commands like:
- inputs[0].Points → To get the dataset coordinates with shape (Npts,3)
- inputs[0].GetNumberOfBlocks() → Total number of blocks
- inputs[0].GetNumberOfPoints() → Total number of points
- inputs[0].GetBlock(i).GetPointData().GetNumberOfArrays() → Number of arrays in the block
- inputs[0].GetBlock(i).points → Points in the ith block
- inputs[0].PointData[‘pressure’] → “pressure” data array
- inputs[0].GetBlock(i).GetPointData().GetArray(‘pressure’) → “pressure” data array from the ith block
These commands are useful to explore the dimensions of the dataset and do basic querys of the data. However I normally struggle if I have so operations between 2 datasets which do not share the same structure. One example could be computing the moments around an axis where one dataset is a surface (CompositeDataSet with Npts) and another is a simple geometry (PolyData). I also understand that this is a complex topic because the data is also distributed among different ranks (CPUs) and each one can only perform operations within the points that are available localy.
My issue comes when I try to broadcast operations with the data from the simple geometry into the large one. I would appreciate if someone could share more info about this topics specially in:
-
Broadcasting operations from a smaller dataset into a larger one (i.e. substract the same coordinates to every point).
-
Initialize CompositeDataArray or copy their structure to create new variables.
3 ) Performing operations with external libraries or “if“ conditions pointwise.
Thank you in advance for your time!