def aglomerate(t, vr, vm): nb_cells0 = nb_cells(t) carry_on = 1 i = 0 while (carry_on == 1): print "iter %s" % i t = XOR.agglomerateSmallCells(t, vmin=vm, vratio=vr) nb_cells1 = nb_cells(t) if (nb_cells1 == nb_cells0): carry_on = 0 if (carry_on == 0): print "no cell found." if (nb_cells1 != nb_cells0): print "%d cells have been aglomerated" % (nb_cells0 - nb_cells1) nb_cells0 = nb_cells1 i = i + 1 #if (i == 3) : carry_on=0 return t
# octree s = D.sphere((0, 0, 0), 1., 100) snear = 0.1 t = G.octree([s], [snear], dfar=5., balancing=1, ratio=2) # ngon converion t = C.convertArray2NGon(t) # ngon conformization t = C.conformizeNGon(t) t = G.close(t) # ngon close cells t = XOR.closeOctalCells(t) #t = XOR.reorientExternalFaces(t) # ngon converion of the sphere s = C.convertArray2NGon(s) # ngon converion to the nuga format s = XOR.convertNGON2DToNGON3D(s) #s = XOR.reorientExternalFaces(s) # Boolean operation x = XOR.diffSurf(t, s, tol=0., preserve_right=1, agg_mode=2) # agg_mode=2 : full mode aggregation x = XOR.agglomerateSmallCells(x, 0., 10.) t = C.newPyTree(['Base', 2]) t[2][1][2].append(x) C.convertPyTree2File(t, 'diffs.cgns')