Message: Re: BooleanProcessor - Too many edges problem Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: BooleanProcessor - Too many edges problem 

Forum: Visualization
Re: None BooleanProcessor - Too many edges problem (Edward Mitchell)
Re: None Re: BooleanProcessor - Too many edges problem (John Allison)
Date: 28 Nov, 2011
From: Edward Mitchell <Edward Mitchell>

Dear John,

Thank you very much for the reply.

Sorry it was a bit of a false alarm; I was enlarging each subtracted volume by a small (constant) amount so that they overlap when adjacent. This prevents shared surfaces at the join, but I realised that some subtractions will share surfaces on the overlapping region.

To get around it I had to enlarge each by a different amount, so it's not a very nice solution. Presumably an alternative is to join all the subtraction volumes together first, then do one single subtraction (haven't tried this).

Plus I also found that it does display eventually, so there is no problem really but thanks anyway.


The code was:

//-----------Titanium carrier-------

  G4double sm = 2.0*micrometer; //extra bit

  //overall dimensions
  G4double TiC_lx = 13.2*mm;
  G4double TiC_ly = 8.0*mm;
  G4double TiC_lz = 4.7*mm;

  // (TiC centre -> TiC ref):
  G4ThreeVector TiC_c2ref(0.5*TiC_lx,-0.5*TiC_ly,0.5*TiC_lz);

  //cube region sizes to cut away:
  G4double TiC_c1[] = {11.2*mm,8.0*mm,2.2*mm};
  G4double TiC_c2[] = {7.25*mm,8.0*mm,0.7*mm};
  G4double TiC_c3[] = {2.75*mm,2.25*mm,0.3*mm};
  G4double TiC_c4[] = {3.75*mm,0.75*mm,0.3*mm};
  G4double TiC_c5[] = {6.5*mm,2.5*mm,1.8*mm};
  G4double TiC_c6[] = {11.2*mm,1.5*mm,4.7*mm};
  G4double TiC_c7[] = {13.2*mm,1.2*mm,1.25*mm};
  G4double TiC_c8[] = {4.0*mm,2.0*mm,0.5*mm};
  G4double TiC_c9[] = {3.3*mm,8.0*mm,1.25*mm};

  G4double TiC_c10[] = {0.25*mm,0.5*mm}; //radius, length

  // locations (TiC ref -> vol ref) : each box location is specified by its (+x,-y,+z) corner
  G4ThreeVector TiC_c1vec(-1.0*mm,0.0*mm,0.0*mm);
  G4ThreeVector TiC_c2vec(-3.1*mm,0.0*mm,-2.2*mm);
  G4ThreeVector TiC_c3vec(-3.1*mm,2.5*mm,-2.9*mm);
  G4ThreeVector TiC_c4vec(-5.85*mm,2.5*mm,-2.9*mm);
  G4ThreeVector TiC_c5vec(-3.1*mm,0.0*mm,-2.9*mm);
  G4ThreeVector TiC_c6vec(-1.0*mm,6.5*mm,0.0*mm);
  G4ThreeVector TiC_c7vec(0.0*mm,5.3*mm,-3.45*mm);
  G4ThreeVector TiC_c8vec(-4.9*mm,3.3*mm,-4.2*mm);
  G4ThreeVector TiC_c9vec(-8.9*mm,0.0*mm,-3.45*mm);

  //to the centre of the cylinder:
  G4ThreeVector TiC_c10vec(-4.9*mm,3.3*mm,-4.45*mm);

  //create the volumes: make each slightly bigger than required
/* OLD code:
  G4Box* TiC_block = new G4Box("TiC_block", 0.5*TiC_lx,0.5*TiC_ly,0.5*TiC_lz);
  G4Box* TiC_v1 = new G4Box("TiC_v1", 0.5*TiC_c1[0]+sm, 0.5*TiC_c1[1]+sm, 0.5*TiC_c1[2]+sm);
  G4Box* TiC_v2 = new G4Box("TiC_v2", 0.5*TiC_c2[0]+sm, 0.5*TiC_c2[1]+sm, 0.5*TiC_c2[2]+sm);
  G4Box* TiC_v3 = new G4Box("TiC_v3", 0.5*TiC_c3[0]+sm, 0.5*TiC_c3[1]+sm, 0.5*TiC_c3[2]+sm);
  G4Box* TiC_v4 = new G4Box("TiC_v4", 0.5*TiC_c4[0]+sm, 0.5*TiC_c4[1]+sm, 0.5*TiC_c4[2]+sm);
  G4Box* TiC_v5 = new G4Box("TiC_v5", 0.5*TiC_c5[0]+sm, 0.5*TiC_c5[1]+sm, 0.5*TiC_c5[2]+sm);
  G4Box* TiC_v6 = new G4Box("TiC_v6", 0.5*TiC_c6[0]+sm, 0.5*TiC_c6[1]+sm, 0.5*TiC_c6[2]+sm);
  G4Box* TiC_v7 = new G4Box("TiC_v7", 0.5*TiC_c7[0]+sm, 0.5*TiC_c7[1]+sm, 0.5*TiC_c7[2]+sm);
  G4Box* TiC_v8 = new G4Box("TiC_v8", 0.5*TiC_c8[0]+sm, 0.5*TiC_c8[1]+sm, 0.5*TiC_c8[2]+sm);
  G4Box* TiC_v9 = new G4Box("TiC_v9", 0.5*TiC_c9[0]+sm, 0.5*TiC_c9[1]+sm, 0.5*TiC_c9[2]+sm);
  G4Tubs* TiC_v10 = new G4Tubs("TiC_v10", 0.0, TiC_c10[0]+sm, 0.5*TiC_c10[1]+sm, 0.0, 2*pi);

  // NOW:
  G4Box* TiC_block = new G4Box("TiC_block", 0.5*TiC_lx,0.5*TiC_ly,0.5*TiC_lz);
  G4Box* TiC_v1 = new G4Box("TiC_v1", 0.5*TiC_c1[0]+sm, 0.5*TiC_c1[1]+sm, 0.5*TiC_c1[2]+sm);
  G4Box* TiC_v2 = new G4Box("TiC_v2", 0.5*TiC_c2[0]+2.0*sm, 0.5*TiC_c2[1]+2.0*sm, 0.5*TiC_c2[2]+2.0*sm);
  G4Box* TiC_v3 = new G4Box("TiC_v3", 0.5*TiC_c3[0]+3.0*sm, 0.5*TiC_c3[1]+3.0*sm, 0.5*TiC_c3[2]+3.0*sm);
  G4Box* TiC_v4 = new G4Box("TiC_v4", 0.5*TiC_c4[0]+4.0*sm, 0.5*TiC_c4[1]+4.0*sm, 0.5*TiC_c4[2]+4.0*sm);
  G4Box* TiC_v5 = new G4Box("TiC_v5", 0.5*TiC_c5[0]+5.0*sm, 0.5*TiC_c5[1]+5.0*sm, 0.5*TiC_c5[2]+5.0*sm);
  G4Box* TiC_v6 = new G4Box("TiC_v6", 0.5*TiC_c6[0]+6.0*sm, 0.5*TiC_c6[1]+6.0*sm, 0.5*TiC_c6[2]+6.0*sm);
  G4Box* TiC_v7 = new G4Box("TiC_v7", 0.5*TiC_c7[0]+7.0*sm, 0.5*TiC_c7[1]+7.0*sm, 0.5*TiC_c7[2]+7.0*sm);
  G4Box* TiC_v8 = new G4Box("TiC_v8", 0.5*TiC_c8[0]+8.0*sm, 0.5*TiC_c8[1]+8.0*sm, 0.5*TiC_c8[2]+8.0*sm);
  G4Box* TiC_v9 = new G4Box("TiC_v9", 0.5*TiC_c9[0]+9.0*sm, 0.5*TiC_c9[1]+9.0*sm, 0.5*TiC_c9[2]+9.0*sm);
  G4Tubs* TiC_v10 = new G4Tubs("TiC_v10", 0.0, TiC_c10[0]+sm, 0.5*TiC_c10[1]+sm, 0.0, 2*pi);

  // positions relative to TiC centre:
  // (TiC centre -> TiC ref) + (TiC ref -> vol ref) + (vol ref -> vol centre)
  TiC_c1vec = TiC_c2ref + TiC_c1vec + G4ThreeVector(-0.5*TiC_c1[0],0.5*TiC_c1[1],-0.5*TiC_c1[2]);
  TiC_c2vec = TiC_c2ref + TiC_c2vec + G4ThreeVector(-0.5*TiC_c2[0],0.5*TiC_c2[1],-0.5*TiC_c2[2]);
  TiC_c3vec = TiC_c2ref + TiC_c3vec + G4ThreeVector(-0.5*TiC_c3[0],0.5*TiC_c3[1],-0.5*TiC_c3[2]);
  TiC_c4vec = TiC_c2ref + TiC_c4vec + G4ThreeVector(-0.5*TiC_c4[0],0.5*TiC_c4[1],-0.5*TiC_c4[2]);
  TiC_c5vec = TiC_c2ref + TiC_c5vec + G4ThreeVector(-0.5*TiC_c5[0],0.5*TiC_c5[1],-0.5*TiC_c5[2]);
  TiC_c6vec = TiC_c2ref + TiC_c6vec + G4ThreeVector(-0.5*TiC_c6[0],0.5*TiC_c6[1],-0.5*TiC_c6[2]);
  TiC_c7vec = TiC_c2ref + TiC_c7vec + G4ThreeVector(-0.5*TiC_c7[0],0.5*TiC_c7[1],-0.5*TiC_c7[2]);
  TiC_c8vec = TiC_c2ref + TiC_c8vec + G4ThreeVector(-0.5*TiC_c8[0],0.5*TiC_c8[1],-0.5*TiC_c8[2]);
  TiC_c9vec = TiC_c2ref + TiC_c9vec + G4ThreeVector(-0.5*TiC_c9[0],0.5*TiC_c9[1],-0.5*TiC_c9[2]);
  TiC_c10vec = TiC_c2ref + TiC_c10vec;

  //do the subtractions:
  G4SubtractionSolid* TiC_s1 = new G4SubtractionSolid("TiC_s1", TiC_block, TiC_v1, 0, TiC_c1vec);
  TiC_s1 = new G4SubtractionSolid("TiC_s1", TiC_s1, TiC_v2,0, TiC_c2vec);
  TiC_s1 = new G4SubtractionSolid("TiC_s1", TiC_s1, TiC_v3,0, TiC_c3vec);
  TiC_s1 = new G4SubtractionSolid("TiC_s1", TiC_s1, TiC_v4,0, TiC_c4vec);
  TiC_s1 = new G4SubtractionSolid("TiC_s1", TiC_s1, TiC_v5,0, TiC_c5vec);
  TiC_s1 = new G4SubtractionSolid("TiC_s1", TiC_s1, TiC_v6,0, TiC_c6vec);
  TiC_s1 = new G4SubtractionSolid("TiC_s1", TiC_s1, TiC_v7,0, TiC_c7vec);
  TiC_s1 = new G4SubtractionSolid("TiC_s1", TiC_s1, TiC_v8,0, TiC_c8vec);
  TiC_s1 = new G4SubtractionSolid("TiC_s1", TiC_s1, TiC_v9,0, TiC_c9vec);
  TiC_s1 = new G4SubtractionSolid("TiC_s1", TiC_s1, TiC_v10,0, TiC_c10vec);

  G4LogicalVolume* TiC_l = new G4LogicalVolume(TiC_s1, titanium, "TiC_l");
  G4VPhysicalVolume* TiC_p = new G4PVPlacement(0, G4ThreeVector(0.0,0.0,0.0), "TiC_p", TiC_l, world_p, false, 0);

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 None: Re: BooleanProcessor - Too many edges problem   (Joseph Perl - 30 Nov, 2011)
 Add Message Add Message
to: "Re: BooleanProcessor - Too many edges problem"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews

[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]