Simpatico  v1.10
List of all members | Public Member Functions | Friends
Tools::Species Class Reference

Detailed Description

A set of identical molecules.

Definition at line 27 of file tools/chemistry/Species.h.

#include <Species.h>

Public Member Functions

 Species ()
 Constructor. More...
 
 ~Species ()
 Destructor. More...
 
void setId (int id)
 Set the index for this species. More...
 
void initialize (int nAtom, int capacity)
 Initialize memory for this species and set sizes. More...
 
void addAtom (Atom &atom)
 Add an atom to the species. More...
 
void clear ()
 Clear all molecules, reset to empty. More...
 
void begin (Iterator &iterator)
 Initialize an iterator over molecules. More...
 
Moleculemolecule (int i)
 Return a specific molecule by reference. More...
 
int id () const
 Return integer id for this species. More...
 
int nAtom () const
 Return number of atoms per molecule. More...
 
int size () const
 Return number of molecules in this species (=maximum id + 1) More...
 
int capacity () const
 Return maximum number of molecules in this species. More...
 
bool isValid () const
 Return true if valid, or throw Exception. More...
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 Serialize to/from an archive. More...
 

Friends

std::istream & operator>> (std::istream &in, Species &species)
 istream extractor (>>) for a Species. More...
 
std::ostream & operator<< (std::ostream &out, const Species &species)
 ostream inserter (<<) for a Species. More...
 

Constructor & Destructor Documentation

Tools::Species::Species ( )

Constructor.

Tools::Species::~Species ( )

Destructor.

Member Function Documentation

void Tools::Species::setId ( int  id)

Set the index for this species.

Parameters
idspecies index
void Tools::Species::initialize ( int  nAtom,
int  capacity 
)

Initialize memory for this species and set sizes.

Parameters
nAtomnumber of atoms per molecule (exact)
capacitymaximum number of molecules in species

Definition at line 36 of file tools/chemistry/Species.cpp.

References Simp::Species::capacity(), Simp::Species::nAtom(), Simp::Species::nAtom_, and UTIL_THROW.

void Tools::Species::addAtom ( Atom atom)

Add an atom to the species.

Parameters
atomAtom object to be added, must have AtomContext info.

Definition at line 105 of file tools/chemistry/Species.cpp.

References Tools::Atom::atomId, Simp::Species::id_, Tools::Atom::moleculeId, Simp::Species::nAtom_, Tools::Atom::speciesId, and UTIL_THROW.

void Tools::Species::clear ( )

Clear all molecules, reset to empty.

Definition at line 91 of file tools/chemistry/Species.cpp.

void Tools::Species::begin ( Iterator iterator)
Molecule & Tools::Species::molecule ( int  i)
inline

Return a specific molecule by reference.

Parameters
imolecule index

Definition at line 185 of file tools/chemistry/Species.h.

References Simp::Species::id(), Simp::Species::id_, Simp::Species::nAtom(), and Simp::Species::nAtom_.

int Tools::Species::id ( ) const

Return integer id for this species.

int Tools::Species::nAtom ( ) const

Return number of atoms per molecule.

int Tools::Species::size ( ) const
inline

Return number of molecules in this species (=maximum id + 1)

Definition at line 203 of file tools/chemistry/Species.h.

References Simp::Species::capacity(), Simp::Species::nAtom_, and Util::ParamComponent::serialize().

int Tools::Species::capacity ( ) const

Return maximum number of molecules in this species.

bool Tools::Species::isValid ( ) const

Return true if valid, or throw Exception.

template<class Archive >
void Tools::Species::serialize ( Archive &  ar,
const unsigned int  version 
)

Serialize to/from an archive.

Friends And Related Function Documentation

std::istream& operator>> ( std::istream &  in,
Species species 
)
friend

istream extractor (>>) for a Species.

Parameters
ininput stream
speciesSpecies to be read from stream
Returns
modified input stream

Definition at line 206 of file tools/chemistry/Species.cpp.

std::ostream& operator<< ( std::ostream &  out,
const Species species 
)
friend

ostream inserter (<<) for a Species.

Format on one line with no line break:

Parameters
outoutput stream
speciesSpecies to be written to stream
Returns
modified output stream

Definition at line 217 of file tools/chemistry/Species.cpp.


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