G4PolyhedronArbitrary.cc

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration and of QinetiQ Ltd,   *
00020 // * subject to DEFCON 705 IPR conditions.                            *
00021 // * By using,  copying,  modifying or  distributing the software (or *
00022 // * any work based  on the software)  you  agree  to acknowledge its *
00023 // * use  in  resulting  scientific  publications,  and indicate your *
00024 // * acceptance of all terms of the Geant4 Software license.          *
00025 // ********************************************************************
00026 //
00027 //
00028 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00029 //
00030 // MODULE:              G4PolyhedronArbitrary.cc
00031 //
00032 // Date:                15/06/2005
00033 // Author:              P R Truscott
00034 // Organisation:        QinetiQ Ltd, UK
00035 // Customer:            UK Ministry of Defence : RAO CRP TD Electronic Systems
00036 // Contract:            C/MAT/N03517
00037 //
00038 // This software is the intellectual property of QinetiQ Ltd, subject
00039 // DEFCON 705 IPR conditions.
00040 //
00041 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00042 //
00043 // CHANGE HISTORY
00044 // --------------
00045 //
00046 // 31 October 2004, P R Truscott, QinetiQ Ltd, UK
00047 // Created.
00048 //
00049 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00050 //
00051 // DESCRIPTION
00052 // -----------
00053 //
00054 //
00055 //
00057 //
00058 //
00059 #include "G4PolyhedronArbitrary.hh"
00061 //
00062 G4PolyhedronArbitrary::G4PolyhedronArbitrary (const G4int nVertices,
00063   const G4int nFacets)
00064 {
00065   AllocateMemory(nVertices, nFacets);
00066   nVertexCount = 0;
00067   nFacetCount  = 0;
00068 }
00070 //
00071 G4PolyhedronArbitrary::~G4PolyhedronArbitrary ()
00072 {;}
00074 //
00075 void G4PolyhedronArbitrary::AddVertex (const G4ThreeVector v)
00076 {
00077   if (nVertexCount == nvert + 1)
00078   {
00079     G4cerr <<G4endl;
00080     G4cerr <<"ERROR IN G4PolyhedronArbitrary::AddVertex" <<G4endl;
00081     G4cerr <<"ATTEMPT TO EXCEED MAXIMUM NUMBER OF VERTICES : " << nVertexCount
00082            <<G4endl;
00083     G4cerr <<G4endl;
00084   }
00085   else
00086   {
00087     nVertexCount++;
00088     pV[nVertexCount] = v;
00089   }
00090 }
00092 //
00093 void G4PolyhedronArbitrary::AddFacet (const G4int iv1, const G4int iv2,
00094   const G4int iv3, const G4int iv4)
00095 {
00096   if (nFacetCount == nface)
00097   {
00098     G4cerr <<G4endl;
00099     G4cerr <<"ERROR IN G4PolyhedronArbitrary::AddFacet" <<G4endl;
00100     G4cerr <<"ATTEMPT TO EXCEED MAXIMUM NUMBER OF FACETS : " << nFacetCount
00101            <<G4endl;
00102     G4cerr <<G4endl;
00103   }
00104   else if (iv1 < 1 || iv1 > nvert || iv2 < 1 || iv2 > nvert ||
00105             iv3 < 1 || iv3 > nvert || iv4 > nvert)
00106   {
00107     G4cerr <<G4endl;
00108     G4cerr <<"ERROR IN G4PolyhedronArbitrary::AddFacet" <<G4endl;
00109     G4cerr <<"ATTEMPT TO INDEX VERTEX NUMBER WHICH IS OUT-OF-RANGE : " <<G4endl;
00110     G4cerr <<G4endl;
00111   }
00112   else if (iv1 > nVertexCount || iv2 > nVertexCount || iv3 > nVertexCount ||
00113     iv4 > nVertexCount)
00114   {
00115     G4cerr <<G4endl;
00116     G4cerr <<"ERROR IN G4PolyhedronArbitrary::AddFacet" <<G4endl;
00117     G4cerr <<"VERTEX NEEDS TO BE DEFINED FIRST : " <<G4endl;
00118     G4cerr <<G4endl;
00119   }
00120   else
00121   {
00122     nFacetCount++;
00123     pF[nFacetCount] = G4Facet(iv1, 0, iv2, 0, iv3, 0, iv4, 0);
00124   }
00125 }
00127 //

Generated on Mon May 27 17:49:24 2013 for Geant4 by  doxygen 1.4.7