@@ -242,7 +242,7 @@ def read_cell_bbox(self, proc=None, calc_volume=False):
242242 if calc_volume :
243243 VolCell_all = np .empty (owner .nb_cell , dtype = float )
244244
245- # bounds of each cell, xxyyzz
245+ # bounds of each cell, xxyyzz, in original OF reference frame
246246 cell_bounds = np .full ( (owner .nb_cell ,6 ), np .nan )
247247
248248 for i in range (owner .nb_cell ):
@@ -267,8 +267,10 @@ def read_cell_bbox(self, proc=None, calc_volume=False):
267267
268268 def set_raster_parameters (self ,dx ,dy = None ,xxyy = None ):
269269 if xxyy is None :
270+ # Note this pulls the z coordinate for bounds which
271+ # we implicitly convert to y.
270272 xxyy = [self .bboxes [:,0 ].min (),self .bboxes [:,1 ].max (),
271- self .bboxes [:,2 ].min (),self .bboxes [:,3 ].max ()]
273+ self .bboxes [:,4 ].min (),self .bboxes [:,5 ].max ()]
272274 self .raster_xxyy = xxyy
273275 if dx < 0 :
274276 dx = int ((xxyy [1 ] - xxyy [0 ])/ - dx )
@@ -310,6 +312,7 @@ def precalc_raster_info_bbox(self,fld):
310312 for row in utils .progress (range (fld .shape [0 ])):
311313 ymin = fld_y [row ]- fld .dy / 2
312314 ymax = fld_y [row ]+ fld .dy / 2
315+ # Note implicit z->y change of coodinates
313316 dy = (np .minimum (ymax ,self .bboxes [:,5 ]) - np .maximum (ymin ,self .bboxes [:,4 ])).clip (0 )
314317 for col in range (fld .shape [1 ]):
315318 pix = row * fld .shape [1 ] + col # row-major ordering of pixels
@@ -673,7 +676,7 @@ def precalc_raster_weights_proc(meshpath, fld, precision=15, force=False):
673676 pnts [:,1 ].max (),
674677 pnts [:,2 ].min (),
675678 pnts [:,2 ].max ()]
676- bboxes [cIdx ] = xxyyzz
679+ bboxes [cIdx ] = xxyyzz # OF native reference frame
677680
678681 raster_weights = sparse .dok_matrix ((fld .F .shape [0 ]* fld .F .shape [1 ],
679682 bboxes .shape [0 ]),
@@ -740,6 +743,22 @@ def cell_as_edges(cIdx, cell_faces, facefile, pointfile):
740743 return edges
741744
742745
746+ def cell_center_py (cell_faces , facefile , pointfile ):
747+ assert False ,"Not ready"
748+ # HERE - process as full mesh, not one cell at a time
749+ # facefile....
750+ # replicate cell center calculation
751+ xyz = pointfile .values .reshape ([- 1 ,3 ])
752+ faces = [] # [N,{xyz}] array per face
753+ for fIdx in cell_faces [cIdx ]:
754+ face_nodes = facefile .faces [fIdx ]["id_pts" ][:]
755+ face = xyz [list (face_nodes )]
756+ faces .append (face )
757+
758+ # HERE:
759+ return
760+
761+
743762
744763if __name__ == '__main__' :
745764 import matplotlib .pyplot as plt
0 commit comments