G4SmartVoxelNode.hh

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.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id$
00028 //
00029 // class G4SmartVoxelNode
00030 //
00031 // Class description:
00032 //
00033 // A node in the smart voxel hierarchy - a `slice' of space along a given
00034 // axis between given minima and maxima. Note that the node is not aware
00035 // of its position - this information being available/derivable by the
00036 // node's owner(s) (voxelheaders).
00037 //
00038 // Member Data:
00039 //
00040 // G4int fminEquivalent
00041 // G4int fmaxEquivalent
00042 //   - Min and maximum nodes with same contents. Set by constructor
00043 //     and set methods.
00044 // std::vector<G4int> fcontents
00045 //   - Vector of no.s of volumes inside the node.
00046 
00047 // History:
00048 // 18.04.01 G.Cosmo Migrated to STL vector
00049 // 12.07.95 P.Kent  Initial version
00050 // --------------------------------------------------------------------
00051 #ifndef G4SMARTVOXELNODE_HH
00052 #define G4SMARTVOXELNODE_HH
00053 
00054 #include "G4Types.hh"
00055 #include <vector>
00056 
00057 typedef std::vector<G4int> G4SliceVector;
00058 
00059 class G4SmartVoxelNode
00060 {
00061   public:  // with description
00062 
00063     G4SmartVoxelNode(G4int pSlice=0) : fminEquivalent(pSlice),
00064                                        fmaxEquivalent(pSlice) {}
00065       // Constructor. Create an empty node with slice number pSlice.
00066       // This number is not stored, but used to provide defaults for the
00067       // minimum and maximum equivalent node numbers.
00068 
00069     ~G4SmartVoxelNode();
00070       // Destructor. No actions.
00071 
00072     inline G4int GetVolume(G4int pVolumeNo) const;
00073       // Return contained volume number pVolumeNo.
00074       // Note: starts from 0 and no bounds checking performed.
00075 
00076     inline void Insert(G4int pVolumeNo);
00077       // Add the specified volume number to the contents.
00078 
00079     inline G4int GetNoContained() const;
00080       // Return the number of volumes inside the node.
00081 
00082     inline G4int GetCapacity() const;
00083       // Return the maximum capacity of the buffer.
00084 
00085     inline void Reserve(G4int noSlices);
00086       // Reserve memory in the vector of slices according to the specified
00087       // quantity, relative to the maximum number of slices.
00088 
00089     inline void Shrink();
00090       // Shrink buffer capacity to actual size to reduce wasted memory.
00091 
00092     inline G4int GetMaxEquivalentSliceNo() const;
00093       // Return the maximum slice (node/header) number with the same contents,
00094       // and with all intermediate slice also having the same contents.
00095     inline void SetMaxEquivalentSliceNo(G4int pMax);
00096       // Set the maximum slice number (as above).
00097     inline G4int GetMinEquivalentSliceNo() const;
00098       // Return the minimum slice (node/header) number with the same contents,
00099       // and with all intermediate nodes also having the same contents.
00100     inline void SetMinEquivalentSliceNo(G4int pMin);
00101       // Set the minimum slice number (as above).
00102 
00103     G4bool operator == (const G4SmartVoxelNode& v) const;
00104       // Equality operator.
00105 
00106   private:
00107 
00108     G4int fminEquivalent;
00109     G4int fmaxEquivalent;
00110     G4SliceVector fcontents;
00111 };
00112 
00113 #include "G4SmartVoxelNode.icc"
00114 
00115 #endif

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