Geant4-11
Public Types | Public Member Functions | Private Attributes
G4INCL::ClusteringModelIntercomparison::SortedNucleonConfiguration Class Reference

Class for storing and comparing sorted nucleon configurations. More...

Public Types

typedef G4int NucleonItem
 

Public Member Functions

void fill (NucleonItem *config, size_t n)
 Fill configuration with array of NucleonItem. More...
 
G4bool operator< (const SortedNucleonConfiguration &rhs) const
 Order operator for SortedNucleonConfiguration. More...
 
SortedNucleonConfigurationoperator= (const SortedNucleonConfiguration &rhs)
 Assignment operator. More...
 
 SortedNucleonConfiguration ()
 Constructor. More...
 
 SortedNucleonConfiguration (const SortedNucleonConfiguration &rhs)
 Copy constructor. More...
 
void swap (SortedNucleonConfiguration &rhs)
 Helper method for the assignment operator. More...
 
 ~SortedNucleonConfiguration ()
 Destructor. More...
 

Private Attributes

NucleonItemnucleons
 The real array. More...
 
size_t theSize
 Size of the array. More...
 

Detailed Description

Class for storing and comparing sorted nucleon configurations.

This class is actually just a wrapper around an array of Particle* pointers. It provides a lexicographical comparison operator (SortedNucleonConfiguration::operator<) for inclusion in std::set containers.

Definition at line 243 of file G4INCLClusteringModelIntercomparison.hh.

Member Typedef Documentation

◆ NucleonItem

Definition at line 246 of file G4INCLClusteringModelIntercomparison.hh.

Constructor & Destructor Documentation

◆ SortedNucleonConfiguration() [1/2]

G4INCL::ClusteringModelIntercomparison::SortedNucleonConfiguration::SortedNucleonConfiguration ( )
inline

◆ SortedNucleonConfiguration() [2/2]

G4INCL::ClusteringModelIntercomparison::SortedNucleonConfiguration::SortedNucleonConfiguration ( const SortedNucleonConfiguration rhs)
inline

Copy constructor.

Definition at line 252 of file G4INCLClusteringModelIntercomparison.hh.

252 :
253 theSize(rhs.theSize),
255 {
256 std::copy(rhs.nucleons, rhs.nucleons+theSize, nucleons);
257 }
void copy(G4double dst[], const G4double src[], size_t size=G4FieldTrack::ncompSVEC)
Definition: G4FieldUtils.cc:98

References field_utils::copy(), nucleons, and theSize.

◆ ~SortedNucleonConfiguration()

G4INCL::ClusteringModelIntercomparison::SortedNucleonConfiguration::~SortedNucleonConfiguration ( )
inline

Destructor.

Definition at line 260 of file G4INCLClusteringModelIntercomparison.hh.

260 {
261 delete [] nucleons;
262 }

References nucleons.

Member Function Documentation

◆ fill()

void G4INCL::ClusteringModelIntercomparison::SortedNucleonConfiguration::fill ( NucleonItem config,
size_t  n 
)
inline

Fill configuration with array of NucleonItem.

Definition at line 288 of file G4INCLClusteringModelIntercomparison.hh.

References field_utils::copy(), CLHEP::detail::n, nucleons, and theSize.

Referenced by G4INCL::ClusteringModelIntercomparison::findClusterStartingFrom().

◆ operator<()

G4bool G4INCL::ClusteringModelIntercomparison::SortedNucleonConfiguration::operator< ( const SortedNucleonConfiguration rhs) const
inline

Order operator for SortedNucleonConfiguration.

The comparison is done lexicographically (i.e. from the first element to the last).

Definition at line 282 of file G4INCLClusteringModelIntercomparison.hh.

282 {
283// assert(theSize==rhs.theSize);
284 return std::lexicographical_compare(nucleons, nucleons+theSize, rhs.nucleons, rhs.nucleons+theSize);
285 }

References nucleons, and theSize.

◆ operator=()

SortedNucleonConfiguration & G4INCL::ClusteringModelIntercomparison::SortedNucleonConfiguration::operator= ( const SortedNucleonConfiguration rhs)
inline

Assignment operator.

Definition at line 271 of file G4INCLClusteringModelIntercomparison.hh.

271 {
272 SortedNucleonConfiguration tempConfig(rhs);
273 swap(tempConfig);
274 return *this;
275 }
void swap(SortedNucleonConfiguration &rhs)
Helper method for the assignment operator.

References swap().

◆ swap()

void G4INCL::ClusteringModelIntercomparison::SortedNucleonConfiguration::swap ( SortedNucleonConfiguration rhs)
inline

Helper method for the assignment operator.

Definition at line 265 of file G4INCLClusteringModelIntercomparison.hh.

265 {
266 std::swap(theSize, rhs.theSize);
267 std::swap(nucleons, rhs.nucleons);
268 }

References nucleons, and theSize.

Referenced by operator=().

Field Documentation

◆ nucleons

NucleonItem* G4INCL::ClusteringModelIntercomparison::SortedNucleonConfiguration::nucleons
private

◆ theSize

size_t G4INCL::ClusteringModelIntercomparison::SortedNucleonConfiguration::theSize
private

Size of the array.

Definition at line 297 of file G4INCLClusteringModelIntercomparison.hh.

Referenced by fill(), operator<(), SortedNucleonConfiguration(), and swap().


The documentation for this class was generated from the following file: