Beispiel #1
0
 def pick_hex(self, list_hex=None, volume=None):
     if self.cubit_skew > 0:
         command = "del group skew_top"
         cubit.cmd(command)
         command = "group 'skew_top' add quality volume all skew low " + str(self.cubit_skew)
         cubit.silent_cmd(command)
         group = cubit.get_id_from_name("skew_top")
         self.list_hex = cubit.get_group_hexes(group)
     elif list_hex is not None:
         self.list_hex = list_hex
     elif volume is not None:
         command = "group 'hextmp' add hex in volume " + str(volume)
         cubit.silent_cmd(command)
         group = cubit.get_id_from_name("hextmp")
         self.list_hex = cubit.get_group_hexes(group)
         command = "del group hextmp"
         cubit.silent_cmd(command)
     elif self.volume is not None:
         command = "group 'hextmp' add hex in volume " + str(self.volume)
         cubit.silent_cmd(command)
         group = cubit.get_id_from_name("hextmp")
         self.list_hex = cubit.get_group_hexes(group)
         command = "del group hextmp"
         cubit.silent_cmd(command)
     elif list_hex is None and self.list_hex is None:
         self.list_hex = cubit.parse_cubit_list("hex", "all")
     print "list_hex: ", len(self.list_hex), " hexes"
Beispiel #2
0
 def pick_hex(self, list_hex=None, volume=None):
     if self.cubit_skew > 0:
         command = "del group skew_top"
         cubit.cmd(command)
         command = "group 'skew_top' add quality volume all skew low " + str(
             self.cubit_skew)
         cubit.silent_cmd(command)
         group = cubit.get_id_from_name("skew_top")
         self.list_hex = cubit.get_group_hexes(group)
     elif list_hex is not None:
         self.list_hex = list_hex
     elif volume is not None:
         command = "group 'hextmp' add hex in volume " + str(volume)
         cubit.silent_cmd(command)
         group = cubit.get_id_from_name("hextmp")
         self.list_hex = cubit.get_group_hexes(group)
         command = "del group hextmp"
         cubit.silent_cmd(command)
     elif self.volume is not None:
         command = "group 'hextmp' add hex in volume " + str(self.volume)
         cubit.silent_cmd(command)
         group = cubit.get_id_from_name("hextmp")
         self.list_hex = cubit.get_group_hexes(group)
         command = "del group hextmp"
         cubit.silent_cmd(command)
     elif list_hex is None and self.list_hex is None:
         self.list_hex = cubit.parse_cubit_list('hex', 'all')
     print 'list_hex: ', len(self.list_hex), ' hexes'
Beispiel #3
0
 def select_cpml(self):
     xmin,xmax=self.check_cmpl_size(case='x')
     ymin,ymax=self.check_cmpl_size(case='y')
     zmin,zmax=self.check_cmpl_size(case='z')
     #
     if xmin is False or xmax is False or ymin is False or ymax is False or zmin is False or zmax is False:
         return False
     else:
         txt="group 'hxmin' add hex  with X_coord < "+str(xmin)
         cubit.cmd(txt)
         txt="group 'hxmax' add hex  with X_coord > "+str(xmax)
         cubit.cmd(txt)
         txt="group 'hymin' add hex  with Y_coord < "+str(ymin)
         cubit.cmd(txt)
         txt="group 'hymax' add hex  with Y_coord > "+str(ymax)
         cubit.cmd(txt)
         txt="group 'hzmin' add hex  with Z_coord < "+str(zmin)
         cubit.cmd(txt)
         txt="group 'hzmax' add hex  with Z_coord > "+str(zmax)
         cubit.cmd(txt)
         from sets import Set
         group1 = cubit.get_id_from_name("hxmin")
         cpml_xmin =Set(list(cubit.get_group_hexes(group1)))
         group1 = cubit.get_id_from_name("hymin")
         cpml_ymin =Set(list(cubit.get_group_hexes(group1)))
         group1 = cubit.get_id_from_name("hxmax")
         cpml_xmax =Set(list(cubit.get_group_hexes(group1)))
         group1 = cubit.get_id_from_name("hymax")
         cpml_ymax =Set(list(cubit.get_group_hexes(group1)))
         group1 = cubit.get_id_from_name("hzmin")
         cpml_zmin =Set(list(cubit.get_group_hexes(group1)))
         if self.top_absorbing:
             group1 = cubit.get_id_from_name("hzmax")
             cpml_zmax =Set(list(cubit.get_group_hexes(group1)))
         else:
             cpml_zmax =Set([])
         cpml_all=cpml_ymin | cpml_ymax | cpml_xmin | cpml_xmax | cpml_zmin | cpml_zmax
         cpml_x=cpml_all-cpml_zmin-cpml_ymin-cpml_ymax-cpml_zmax
         cpml_y=cpml_all-cpml_zmin-cpml_xmin-cpml_xmax-cpml_zmax
         cpml_xy=cpml_all-cpml_zmin-cpml_y-cpml_x-cpml_zmax
         cpml_z=cpml_all-cpml_xmin-cpml_ymin-cpml_ymax-cpml_xmax
         cpml_xz=cpml_zmin-cpml_ymin-cpml_ymax-cpml_z
         cpml_yz=cpml_zmin-cpml_xmin-cpml_xmax-cpml_z
         cpml_xyz=cpml_zmin-cpml_xz-cpml_yz-cpml_z
         txt=' '.join(str(h) for h in cpml_x)
         cubit.cmd("group 'x_cpml' add hex "+txt)
         txt=' '.join(str(h) for h in cpml_y)
         cubit.cmd("group 'y_cpml' add hex "+txt)
         txt=' '.join(str(h) for h in cpml_z)
         cubit.cmd("group 'z_cpml' add hex "+txt)
         txt=' '.join(str(h) for h in cpml_xy)
         cubit.cmd("group 'xy_cpml' add hex "+txt)
         txt=' '.join(str(h) for h in cpml_xz)
         cubit.cmd("group 'xz_cpml' add hex "+txt)
         txt=' '.join(str(h) for h in cpml_yz)
         cubit.cmd("group 'yz_cpml' add hex "+txt)
         txt=' '.join(str(h) for h in cpml_xyz)
         cubit.cmd("group 'xyz_cpml' add hex "+txt)
         return cpml_x,cpml_y,cpml_z,cpml_xy,cpml_xz,cpml_yz,cpml_xyz
Beispiel #4
0
 def select_cpml(self):
     xmin,xmax=self.check_cmpl_size(case='x')
     ymin,ymax=self.check_cmpl_size(case='y')
     zmin,zmax=self.check_cmpl_size(case='z')
     #
     if xmin is False or xmax is False or ymin is False or ymax is False or zmin is False or zmax is False:
         return False
     else:
         txt="group 'hxmin' add hex  with X_coord < "+str(xmin)
         cubit.cmd(txt)
         txt="group 'hxmax' add hex  with X_coord > "+str(xmax)
         cubit.cmd(txt)
         txt="group 'hymin' add hex  with Y_coord < "+str(ymin)
         cubit.cmd(txt)
         txt="group 'hymax' add hex  with Y_coord > "+str(ymax)
         cubit.cmd(txt)
         txt="group 'hzmin' add hex  with Z_coord < "+str(zmin)
         cubit.cmd(txt)
         txt="group 'hzmax' add hex  with Z_coord > "+str(zmax)
         cubit.cmd(txt)
         from sets import Set
         group1 = cubit.get_id_from_name("hxmin")
         cpml_xmin =Set(list(cubit.get_group_hexes(group1)))
         group1 = cubit.get_id_from_name("hymin")
         cpml_ymin =Set(list(cubit.get_group_hexes(group1)))
         group1 = cubit.get_id_from_name("hxmax")
         cpml_xmax =Set(list(cubit.get_group_hexes(group1)))
         group1 = cubit.get_id_from_name("hymax")
         cpml_ymax =Set(list(cubit.get_group_hexes(group1)))
         group1 = cubit.get_id_from_name("hzmin")
         cpml_zmin =Set(list(cubit.get_group_hexes(group1)))
         if self.top_absorbing:
             group1 = cubit.get_id_from_name("hzmax")
             cpml_zmax =Set(list(cubit.get_group_hexes(group1)))
         else:
             cpml_zmax =Set([])
         cpml_all=cpml_ymin | cpml_ymax | cpml_xmin | cpml_xmax | cpml_zmin | cpml_zmax
         cpml_x=cpml_all-cpml_zmin-cpml_ymin-cpml_ymax-cpml_zmax
         cpml_y=cpml_all-cpml_zmin-cpml_xmin-cpml_xmax-cpml_zmax
         cpml_xy=cpml_all-cpml_zmin-cpml_y-cpml_x-cpml_zmax
         cpml_z=cpml_all-cpml_xmin-cpml_ymin-cpml_ymax-cpml_xmax
         cpml_xz=cpml_zmin-cpml_ymin-cpml_ymax-cpml_z
         cpml_yz=cpml_zmin-cpml_xmin-cpml_xmax-cpml_z
         cpml_xyz=cpml_zmin-cpml_xz-cpml_yz-cpml_z
         txt=' '.join(str(h) for h in cpml_x)
         cubit.cmd("group 'x_cpml' add hex "+txt)
         txt=' '.join(str(h) for h in cpml_y)
         cubit.cmd("group 'y_cpml' add hex "+txt)
         txt=' '.join(str(h) for h in cpml_z)
         cubit.cmd("group 'z_cpml' add hex "+txt)
         txt=' '.join(str(h) for h in cpml_xy)
         cubit.cmd("group 'xy_cpml' add hex "+txt)
         txt=' '.join(str(h) for h in cpml_xz)
         cubit.cmd("group 'xz_cpml' add hex "+txt)
         txt=' '.join(str(h) for h in cpml_yz)
         cubit.cmd("group 'yz_cpml' add hex "+txt)
         txt=' '.join(str(h) for h in cpml_xyz)
         cubit.cmd("group 'xyz_cpml' add hex "+txt)
         return cpml_x,cpml_y,cpml_z,cpml_xy,cpml_xz,cpml_yz,cpml_xyz