SpeciesList Class Reference
A type used as a collection of species. More...
#include <SpeciesList.hpp>
Public Types | |
| using | value_type = Species |
| The type of the value stored in a SpeciesList (for STL compatibility reasons). | |
Public Member Functions | |
| SpeciesList () | |
| Construct a default SpeciesList object. | |
| SpeciesList (std::initializer_list< Species > species) | |
| Construct an SpeciesList object with given species. | |
| SpeciesList (const Vec< Species > &species) | |
| Construct an SpeciesList object with given species. | |
| SpeciesList (const StringList &formulas) | |
| Construct an SpeciesList object with given species formulas. | |
| auto | append (const Species &species) -> void |
| Append a new species to the list of species. | |
| auto | data () const -> const Vec< Species > & |
| Return the internal collection of Species objects. | |
| auto | empty () const -> bool |
| Return true if there are no species in the collection. | |
| auto | size () const -> Index |
| Return the number of species in the collection. | |
| auto | elements () const -> ElementList |
| Return the elements that compose the species in the collection sorted in ascending order of molar mass. | |
| auto | operator[] (Index i) const -> const Species & |
| Return the Species object with given index. | |
| auto | operator[] (Index i) -> Species & |
| Return the Species object with given index. | |
| auto | find (const String &name) const -> Index |
| Return the index of the first species with given unique name or the number of species if not found. | |
| auto | findWithName (const String &name) const -> Index |
| Return the index of the first species with given unique name or the number of species if not found. | |
| auto | findWithFormula (const ChemicalFormula &formula) const -> Index |
| Return the index of the first species with equivalent formula or the number of species if not found. | |
| auto | findWithSubstance (const String &substance) const -> Index |
| Return the index of the first species with given substance name or the number of species if not found. | |
| auto | index (const String &name) const -> Index |
| Return the index of the first species with given unique name or throw a runtime error if not found. | |
| auto | indexWithName (const String &name) const -> Index |
| Return the index of the species with given unique name or throw a runtime error if not found. | |
| auto | indexWithFormula (const ChemicalFormula &formula) const -> Index |
| Return the index of the first species with equivalent formula or throw a runtime error if not found. | |
| auto | indexWithSubstance (const String &substance) const -> Index |
| Return the index of the first species with given substance name or throw a runtime error if not found. | |
| auto | front () const -> Species const & |
| Return the species at the front of the collection. | |
| auto | back () const -> Species const & |
| Return the species at the back of the collection. | |
| auto | get (const String &name) const -> const Species & |
| Return the species with a given name. | |
| auto | getWithName (const String &name) const -> const Species & |
| Return the species with a given name. | |
| auto | getWithFormula (const ChemicalFormula &formula) const -> const Species & |
| Return the species with a given formula. | |
| auto | getWithSubstance (const String substance) const -> const Species & |
| Return the species with a given substance name. | |
| auto | withNames (const StringList &names) const -> SpeciesList |
| Return all species with given names. | |
| auto | withFormulas (const StringList &formulas) const -> SpeciesList |
| Return all species with given substance formulas. | |
| auto | withSubstances (const StringList &substances) const -> SpeciesList |
| Return all species with given substance names. | |
| auto | withAggregateState (AggregateState state) const -> SpeciesList |
| Return all species with a given aggregate state. | |
| auto | withCharge (real value) const -> SpeciesList |
| Return all species with a given charge. | |
| auto | withTag (String tag) const -> SpeciesList |
| Return all species with a given tag. | |
| auto | withoutTag (String tag) const -> SpeciesList |
| Return all species without a given tag. | |
| auto | withTags (const StringList &tags) const -> SpeciesList |
| Return all species with given tags. | |
| auto | withoutTags (const StringList &tags) const -> SpeciesList |
| Return all species without given tags. | |
| auto | withElements (const StringList &symbols) const -> SpeciesList |
| Return all species with a certain elemental composition. More... | |
| auto | withElementsOf (const StringList &formulas) const -> SpeciesList |
| Return all species with a certain elemental composition. More... | |
| operator Vec< Species > & () | |
| Convert this SpeciesList object into its Data. | |
| operator Vec< Species >const & () const | |
| Convert this SpeciesList object into its Data. | |
| template<typename InputIterator > | |
| SpeciesList (InputIterator begin, InputIterator end) | |
| Construct an SpeciesList object with given begin and end iterators. | |
| auto | begin () const |
| Return begin const iterator of this SpeciesList instance (for STL compatibility reasons). | |
| auto | begin () |
| Return begin iterator of this SpeciesList instance (for STL compatibility reasons). | |
| auto | end () const |
| Return end const iterator of this SpeciesList instance (for STL compatibility reasons). | |
| auto | end () |
| Return end iterator of this SpeciesList instance (for STL compatibility reasons). | |
| auto | push_back (const Species &species) -> void |
| Append a new Species at the back of the container (for STL compatibility reasons). | |
| template<typename Iterator , typename InputIterator > | |
| auto | insert (Iterator pos, InputIterator begin, InputIterator end) -> void |
| Insert a container of Species objects into this SpeciesList instance (for STL compatibility reasons). | |
Detailed Description
A type used as a collection of species.
Member Function Documentation
◆ withElements()
| auto withElements | ( | const StringList & | symbols | ) | const -> SpeciesList |
Return all species with a certain elemental composition.
This method filters the species composed of one or more given elements, as shown below.
using namespace Reaktoro;
SpeciesList specieslist("H2O H+ OH- H2 O2 Na+ Cl- NaCl CO2 HCO3- CO3-2 CH4");
SpeciesList list5 = specieslist.withElements("H O Na Cl C"); // H2O H+ OH- H2 O2 Na+ Cl- NaCl CO2 HCO3- CO3-2 CH4
The namespace containing all components of the Reaktoro library.
Definition: Algorithms.hpp:29
- Parameters
-
symbols The element symbols of interest.
- See also
- SpeciesList::withElementsOf
◆ withElementsOf()
| auto withElementsOf | ( | const StringList & | formulas | ) | const -> SpeciesList |
Return all species with a certain elemental composition.
This method extracts the elements from a given set of chemical formulas and then filters the species composed of one or more such elements, as shown below.
using namespace Reaktoro;
SpeciesList specieslist("H2O H+ OH- H2 O2 Na+ Cl- NaCl CO2 HCO3- CO3-2 CH4");
- Parameters
-
formulas The formulas of the species from which elements are extracted.
- See also
- SpeciesList::withElements
The documentation for this class was generated from the following file:
- Reaktoro/Core/SpeciesList.hpp