libatomprobe
Library for Atom Probe Tomography (APT) computation
|
Data storage and retrieval class for various range files. More...
#include <ranges.h>
Public Member Functions | |
RangeFile () | |
const RangeFile & | operator= (const RangeFile &other) |
bool | open (const char *rangeFile) |
Open a specified range file - returns true on success. More... | |
unsigned int | openFormat (const char *rangeFile, unsigned int format) |
Open a specified range file using a given file format. Returns nonzero on failure. More... | |
bool | isSelfConsistent () const |
Performs checks for self consistency. More... | |
bool | isSelfConsistent (std::vector< std::string > &consistencyMessages) const |
Performs checks for self consistency, whilst providing information on the inconsistent components. More... | |
bool | makeSelfConsistent () |
Modify range file to ensure self-consistency, by arbitrary heuristics. More... | |
std::string | getErrString () const |
Retrieve the translated error associated with the current range file state. More... | |
unsigned int | getErrState () const |
Obtain the error state last set for this rangefile. More... | |
unsigned int | getNumRanges () const |
Get the number of unique ranges. More... | |
unsigned int | getNumRanges (unsigned int ionID) const |
Get the number of ranges for a given ion ID. More... | |
unsigned int | getNumIons () const |
Get the number of unique ions. More... | |
std::pair< float, float > | getRange (unsigned int) const |
Retrieve the start and end of a given range as a pair(start,end) More... | |
std::pair< float, float > & | getRangeByRef (unsigned int) |
Retrieve the start and end of a given range as a pair(start,end) More... | |
bool | haveRangeVolumes () const |
Return true if we have range volume data, false otherwise. More... | |
float | getRangeVolume (unsigned int rangeId) const |
Obtain an ions volume, if we have it. Zero may indicate no ion volume specfied for that range. More... | |
void | setRangeVolume (unsigned int rangeId, float newVolume) |
Set the ion volume for a given range. If ion volumes are not tracked, these will be created. More... | |
RGBf | getColour (unsigned int) const |
Retrieve a given colour from the ion ID. More... | |
void | setColour (unsigned int, const RGBf &r) |
Set the colour using the ion ID. More... | |
unsigned int | getIonID (float mass) const |
Get the ion's ID from a specified mass. More... | |
unsigned int | getIonID (const IonHit &hit) const |
Get the ion's ID from a specified mass, using an IonHit. More... | |
unsigned int | getIonID (unsigned int range) const |
Get the ion ID from a given range ID. More... | |
unsigned int | getIonID (const char *name, bool useShortName=true) const |
Get the ion ID from its short or long name, returns -1 if name does not exist. Case must match. More... | |
unsigned int | getIonID (const std::string &name) const |
void | setIonID (unsigned int range, unsigned int newIonId) |
Set the ion ID for a given range. More... | |
std::map< std::string, size_t > | getIonFormula (unsigned int ionID) const |
Get ion formula by ion ID. More... | |
void | setIonFormula (const std::string &name, const std::map< std::string, size_t > &formula, bool useShortName=true) |
Set ion formula using ion short or long name (if it is already set) More... | |
void | setIonFormula (const unsigned int ionID, const std::map< std::string, size_t > &formula) |
Set ion formula using ion ID. More... | |
void | guessFormulas (bool overwrite=false) |
Use heuristics to guess missing formula data from the shortname. More... | |
void | clearFormulas () |
Erase any formula data. More... | |
bool | isRanged (float mass) const |
Returns true if a specified mass is ranged. More... | |
bool | isRanged (const IonHit &) const |
Returns true if an ion is ranged. More... | |
void | range (std::vector< IonHit > &ionHits) const |
Clips out ions that are not inside the rangefile's ranges. More... | |
void | rangeInvertable (std::vector< IonHit > &ionHits, bool invert) |
Clips out ions that are inside the rangefile's ranges, if invert is false. If true, then reverse the set. More... | |
bool | range (std::vector< IonHit > &ionHits, const std::string &shortIonName) |
Clips out ions that don't match the specified ion name. More... | |
bool | rangeByID (std::vector< IonHit > &ionHits, unsigned int range) |
Clips out ions that don't lie in the specified range number. More... | |
void | rangeByRangeID (std::vector< IonHit > &ionHits, unsigned int rangeID) |
Range the given ions, allowing only ions in the specified range. Input data will be modified to return result. More... | |
void | extractIons (const std::vector< IonHit > &ionHits, const std::vector< unsigned int > &ionIDs, std::vector< IonHit > &hits) const |
Extract ion hit events in the specified ion ID values, from the input ion ionhit sequence. More... | |
std::string | getName (unsigned int ionID, bool shortName=true) const |
Get the short name or long name of a specified ionID. More... | |
std::string | getName (const IonHit &ion, bool shortName=true) const |
Obtain the short name for a given IonHit. If not ranged, an empty string will be returned. More... | |
void | setIonShortName (unsigned int ionID, const std::string &newName) |
set the short name for a given ion More... | |
void | setIonLongName (unsigned int ionID, const std::string &newName) |
Set the long name for a given ion. More... | |
bool | isRanged (std::string shortName, bool caseSensitive=true) |
Check to see if an atom is ranged. More... | |
unsigned int | write (std::ostream &o, size_t format=RANGE_FORMAT_ORNL) const |
Write the rangefile to the specified output stream (default ORNL format) More... | |
unsigned int | write (const char *datafile, size_t format=RANGE_FORMAT_ORNL) const |
Write the rangefile to a file (ORNL format) More... | |
unsigned int | getRangeID (float mass) const |
Get a range ID from mass to charge. More... | |
void | swap (RangeFile &rng) |
Swap a range file with this one. More... | |
bool | moveRange (unsigned int range, bool limit, float newMass) |
Move a range's mass to a new location. More... | |
bool | moveBothRanges (unsigned int range, float newLow, float newHigh) |
Move both of a range's masses to a new location. More... | |
unsigned int | addRange (float start, float end, unsigned int ionID) |
Add a range to the rangefile. Returns ID number of added range. More... | |
unsigned int | addIon (const std::string &shortName, const std::string &longName, const RGBf &ionCol) |
Add the ion to the database returns ion ID if successful, -1 otherwise. More... | |
bool | setRangeStart (unsigned int rangeID, float v) |
Set the lower bound of the given range. More... | |
bool | setRangeEnd (unsigned int rangeID, float v) |
Set the upper bound of the given range. More... | |
void | eraseRange (unsigned int rangeId) |
Erase given range - this will reorder rangeIDs, so any ids you had previously will not longer be valid. More... | |
void | eraseIon (unsigned int ionId) |
erase given ions and associated ranges) More... | |
bool | decomposeIonById (unsigned int ionId, std::vector< std::pair< std::string, size_t > > &fragments) const |
Perform decomposeIonNames(...) for a given ionID. More... | |
bool | guessChargeState (unsigned int rangeId, const AtomProbe::AbundanceData &massTable, unsigned int &charge, float tolerance=0.5f) const |
Guess the charge state for the ion that corresponds to the given range's midpoint. More... | |
Static Public Member Functions | |
static bool | extensionIsRange (const char *ext) |
is the extension string the same as that for a range file? I don't advocate this method, but it is convenient in a pinch. More... | |
static void | getAllExts (std::vector< std::string > &exts) |
Grab a vector that contains all the extensions that are valid for range files. More... | |
static unsigned int | detectFileType (const char *file) |
Attempt to detect the file format of an unknown rangefile. More... | |
static std::string | rangeTypeString (unsigned int rangeType) |
Return the human readable name for the given RANGE_FORMAT value. More... | |
static void | setEnforceConsistent (bool shouldEnforce=true) |
Set whether the class will attempt to enfore consistency when running. More... | |
static bool | decomposeIonNames (const std::string &name, std::vector< std::pair< std::string, size_t > > &fragments) |
static void | decomposeIonNameToFormula (const std::string &name, std::map< std::string, size_t > &formula) |
Break a given string down into a chemical formula with a count of each element. More... | |
AtomProbe::RangeFile::RangeFile | ( | ) |
Definition at line 413 of file ranges.cpp.
References ARRAYSIZE, and AtomProbe::RANGE_FORMAT_END_OF_ENUM.
unsigned int AtomProbe::RangeFile::addIon | ( | const std::string & | shortName, |
const std::string & | longName, | ||
const RGBf & | ionCol | ||
) |
Add the ion to the database returns ion ID if successful, -1 otherwise.
Short and long names may not contain white space. !
Definition at line 3274 of file ranges.cpp.
References ASSERT, and isSelfConsistent().
Referenced by AtomProbe::checkMassRangingCorrectness(), clearFormulas(), AtomProbe::findOverlaps(), guessChargeState(), and main().
unsigned int AtomProbe::RangeFile::addRange | ( | float | start, |
float | end, | ||
unsigned int | ionID | ||
) |
Add a range to the rangefile. Returns ID number of added range.
if adding successful, (unsigned int)-1 otherwise. If enforceConsistency is true, this will disallow addition of ranges that collide with existing ranges
Definition at line 3235 of file ranges.cpp.
References ASSERT, isSelfConsistent(), and range().
Referenced by AtomProbe::checkMassRangingCorrectness(), clearFormulas(), AtomProbe::findOverlaps(), guessChargeState(), and main().
|
inline |
Erase any formula data.
Definition at line 315 of file ranges.h.
References addIon(), addRange(), decomposeIonById(), decomposeIonNames(), decomposeIonNameToFormula(), eraseIon(), eraseRange(), extractIons(), getName(), getRangeID(), guessChargeState(), isRanged(), moveBothRanges(), moveRange(), range(), AtomProbe::RANGE_FORMAT_ORNL, rangeByID(), rangeByRangeID(), rangeInvertable(), setIonLongName(), setIonShortName(), setRangeEnd(), setRangeStart(), swap(), and write().
bool AtomProbe::RangeFile::decomposeIonById | ( | unsigned int | ionId, |
std::vector< std::pair< std::string, size_t > > & | fragments | ||
) | const |
Perform decomposeIonNames(...) for a given ionID.
Definition at line 252 of file ranges.cpp.
References decomposeIonNames(), and getName().
Referenced by clearFormulas(), and AtomProbe::findOverlaps().
|
static |
Break a given string down into a series of substring-count pairs depicting basic ionic components returns false if the name cannot be broken down. E.g. H2O will be converted to [ {H,2}, {O,1}] Each string in the vector will be unique
Definition at line 121 of file ranges.cpp.
References AtomProbe::stream_cast(), and AtomProbe::vectorMultiErase().
Referenced by clearFormulas(), decomposeIonById(), decomposeIonNameToFormula(), AtomProbe::getRangeMolecule(), guessChargeState(), AtomProbe::matchComposedName(), and AtomProbe::MultiRange::MultiRange().
|
static |
Break a given string down into a chemical formula with a count of each element.
If the name cannot be decomposed then an empty map is placed in the formula argument. !
Definition at line 261 of file ranges.cpp.
References decomposeIonNames().
Referenced by clearFormulas(), and guessFormulas().
|
static |
Attempt to detect the file format of an unknown rangefile.
Returns one of RANGE_FORMAT_ enum value on success, or RANGE_FORMAT_END_OF_ENUM on failure
Definition at line 1116 of file ranges.cpp.
References AtomProbe::isNotDirectory(), AtomProbe::lowercase(), AtomProbe::RANGE_FORMAT_DBL_ORNL, AtomProbe::RANGE_FORMAT_END_OF_ENUM, AtomProbe::RANGE_FORMAT_ENV, AtomProbe::RANGE_FORMAT_ORNL, AtomProbe::RANGE_FORMAT_RRNG, AtomProbe::splitStrsRef(), AtomProbe::stream_cast(), AtomProbe::stripWhite(), and AtomProbe::stripZeroEntries().
Referenced by open().
void AtomProbe::RangeFile::eraseIon | ( | unsigned int | ionId | ) |
erase given ions and associated ranges)
Definition at line 3317 of file ranges.cpp.
References ASSERT, and AtomProbe::vectorMultiErase().
Referenced by clearFormulas().
void AtomProbe::RangeFile::eraseRange | ( | unsigned int | rangeId | ) |
Erase given range - this will reorder rangeIDs, so any ids you had previously will not longer be valid.
Definition at line 3301 of file ranges.cpp.
References ASSERT.
Referenced by clearFormulas().
|
static |
is the extension string the same as that for a range file? I don't advocate this method, but it is convenient in a pinch.
Definition at line 2419 of file ranges.cpp.
void AtomProbe::RangeFile::extractIons | ( | const std::vector< IonHit > & | ionHits, |
const std::vector< unsigned int > & | ionIDs, | ||
std::vector< IonHit > & | hits | ||
) | const |
Extract ion hit events in the specified ion ID values, from the input ion ionhit sequence.
Definition at line 3001 of file ranges.cpp.
References getIonID().
Referenced by clearFormulas().
|
static |
Grab a vector that contains all the extensions that are valid for range files.
Definition at line 2437 of file ranges.cpp.
RGBf AtomProbe::RangeFile::getColour | ( | unsigned int | ui | ) | const |
Retrieve a given colour from the ion ID.
Definition at line 2878 of file ranges.cpp.
References ASSERT.
Referenced by getErrState(), AtomProbe::MultiRange::MultiRange(), and write().
|
inline |
Obtain the error state last set for this rangefile.
Definition at line 237 of file ranges.h.
References getColour(), getIonID(), getNumIons(), getNumRanges(), getRange(), getRangeByRef(), getRangeVolume(), haveRangeVolumes(), range(), setColour(), and setRangeVolume().
std::string AtomProbe::RangeFile::getErrString | ( | ) | const |
Retrieve the translated error associated with the current range file state.
Definition at line 3355 of file ranges.cpp.
References ARRAYSIZE, and AtomProbe::RANGE_ERR_ENUM_END.
Referenced by main(), and setEnforceConsistent().
std::map< std::string, size_t > AtomProbe::RangeFile::getIonFormula | ( | unsigned int | ionID | ) | const |
Get ion formula by ion ID.
Returns the ion formula if there exists a range that contains this mass. If no range contains the ion hit then an empty map is returned: std::map<std::string, size_t>> The ion ID can be found using the getIonID method by mass, IonHit, name or range ID !
Definition at line 2950 of file ranges.cpp.
References ASSERT.
Referenced by getIonID(), and guessChargeState().
unsigned int AtomProbe::RangeFile::getIonID | ( | float | mass | ) | const |
Get the ion's ID from a specified mass.
Returns the ions ID if there exists a range that contains this mass. Otherwise (unsigned int)-1 is returned
Definition at line 2884 of file ranges.cpp.
Referenced by extractIons(), getErrState(), getIonID(), getName(), getNumRanges(), AtomProbe::getRangeMolecule(), guessChargeState(), main(), AtomProbe::MultiRange::MultiRange(), open(), and setIonFormula().
unsigned int AtomProbe::RangeFile::getIonID | ( | const IonHit & | hit | ) | const |
Get the ion's ID from a specified mass, using an IonHit.
Returns the ions ID if there exists a range that contains this mass. Otherwise (unsigned int)-1 is returned
Definition at line 2898 of file ranges.cpp.
References getIonID(), and AtomProbe::IonHit::getMassToCharge().
unsigned int AtomProbe::RangeFile::getIonID | ( | unsigned int | range | ) | const |
Get the ion ID from a given range ID.
No validation checks are performed outside debug mode. Ion range must exist
Definition at line 2918 of file ranges.cpp.
References ASSERT, and range().
unsigned int AtomProbe::RangeFile::getIonID | ( | const char * | name, |
bool | useShortName = true |
||
) | const |
Get the ion ID from its short or long name, returns -1 if name does not exist. Case must match.
Definition at line 2925 of file ranges.cpp.
|
inline |
Definition at line 284 of file ranges.h.
References getIonFormula(), getIonID(), guessFormulas(), setIonFormula(), and setIonID().
Referenced by getIonID().
std::string AtomProbe::RangeFile::getName | ( | unsigned int | ionID, |
bool | shortName = true |
||
) | const |
Get the short name or long name of a specified ionID.
Pass shortname=false to retrieve the long name ionID passed in must exist. No checking outside debug mode
Definition at line 2975 of file ranges.cpp.
References ASSERT.
Referenced by clearFormulas(), decomposeIonById(), dumpAutocorrelation(), AtomProbe::getRangeMolecule(), guessChargeState(), main(), and AtomProbe::MultiRange::MultiRange().
std::string AtomProbe::RangeFile::getName | ( | const IonHit & | ion, |
bool | shortName = true |
||
) | const |
Obtain the short name for a given IonHit. If not ranged, an empty string will be returned.
Definition at line 2984 of file ranges.cpp.
References getIonID(), AtomProbe::IonHit::getMassToCharge(), and isRanged().
unsigned int AtomProbe::RangeFile::getNumIons | ( | ) | const |
Get the number of unique ions.
Definition at line 2863 of file ranges.cpp.
Referenced by dumpAutocorrelation(), AtomProbe::findOverlaps(), getErrState(), main(), and AtomProbe::MultiRange::MultiRange().
unsigned int AtomProbe::RangeFile::getNumRanges | ( | ) | const |
Get the number of unique ranges.
Definition at line 2846 of file ranges.cpp.
Referenced by AtomProbe::checkMassRangingCorrectness(), getErrState(), guessChargeState(), AtomProbe::MultiRange::MultiRange(), and open().
unsigned int AtomProbe::RangeFile::getNumRanges | ( | unsigned int | ionID | ) | const |
Get the number of ranges for a given ion ID.
Definition at line 2851 of file ranges.cpp.
References getIonID().
pair< float, float > AtomProbe::RangeFile::getRange | ( | unsigned int | ui | ) | const |
Retrieve the start and end of a given range as a pair(start,end)
Definition at line 2868 of file ranges.cpp.
Referenced by AtomProbe::checkMassRangingCorrectness(), getErrState(), guessChargeState(), AtomProbe::MultiRange::MultiRange(), and open().
pair< float, float > & AtomProbe::RangeFile::getRangeByRef | ( | unsigned int | ui | ) |
Retrieve the start and end of a given range as a pair(start,end)
Definition at line 2873 of file ranges.cpp.
Referenced by getErrState().
unsigned int AtomProbe::RangeFile::getRangeID | ( | float | mass | ) | const |
Get a range ID from mass to charge.
Definition at line 2904 of file ranges.cpp.
Referenced by clearFormulas(), and guessChargeState().
float AtomProbe::RangeFile::getRangeVolume | ( | unsigned int | rangeId | ) | const |
Obtain an ions volume, if we have it. Zero may indicate no ion volume specfied for that range.
Definition at line 3423 of file ranges.cpp.
References ASSERT.
Referenced by getErrState().
bool AtomProbe::RangeFile::guessChargeState | ( | unsigned int | rangeId, |
const AtomProbe::AbundanceData & | massTable, | ||
unsigned int & | charge, | ||
float | tolerance = 0.5f |
||
) | const |
Guess the charge state for the ion that corresponds to the given range's midpoint.
Definition at line 3462 of file ranges.cpp.
References addIon(), addRange(), AtomProbe::RGBf::blue, decomposeIonNames(), AtomProbe::AbundanceData::generateIsotopeDist(), getIonFormula(), getIonID(), getName(), getNumRanges(), getRange(), getRangeID(), AtomProbe::RGBf::green, guessChargeState(), guessFormulas(), isSelfConsistent(), makeSelfConsistent(), AtomProbe::AbundanceData::open(), range(), AtomProbe::RANGE_FORMAT_DBL_ORNL, AtomProbe::RANGE_FORMAT_END_OF_ENUM, AtomProbe::RGBf::red, AtomProbe::AbundanceData::symbolIndex(), TEST, and write().
Referenced by clearFormulas(), guessChargeState(), and main().
void AtomProbe::RangeFile::guessFormulas | ( | bool | overwrite = false | ) |
Use heuristics to guess missing formula data from the shortname.
To overwrite existing formula data, set overwrite to true
Definition at line 3438 of file ranges.cpp.
References decomposeIonNameToFormula().
Referenced by getIonID(), and guessChargeState().
bool AtomProbe::RangeFile::haveRangeVolumes | ( | ) | const |
Return true if we have range volume data, false otherwise.
Definition at line 3433 of file ranges.cpp.
Referenced by getErrState().
bool AtomProbe::RangeFile::isRanged | ( | float | mass | ) | const |
Returns true if a specified mass is ranged.
Definition at line 2713 of file ranges.cpp.
Referenced by clearFormulas(), getName(), isRanged(), range(), and rangeInvertable().
bool AtomProbe::RangeFile::isRanged | ( | const IonHit & | ion | ) | const |
Returns true if an ion is ranged.
Definition at line 2727 of file ranges.cpp.
References AtomProbe::IonHit::getMassToCharge(), and isRanged().
bool AtomProbe::RangeFile::isRanged | ( | std::string | shortName, |
bool | caseSensitive = true |
||
) |
Check to see if an atom is ranged.
Returns true if rangefile holds at least one range with shortname corresponding input value. Case sensitivity search is default
Definition at line 3024 of file ranges.cpp.
bool AtomProbe::RangeFile::isSelfConsistent | ( | ) | const |
Performs checks for self consistency.
Definition at line 2450 of file ranges.cpp.
References ASSERT.
Referenced by addIon(), addRange(), guessChargeState(), main(), makeSelfConsistent(), open(), openFormat(), runTests(), setEnforceConsistent(), setRangeEnd(), and setRangeStart().
bool AtomProbe::RangeFile::isSelfConsistent | ( | std::vector< std::string > & | consistencyMessages | ) | const |
Performs checks for self consistency, whilst providing information on the inconsistent components.
Definition at line 2591 of file ranges.cpp.
References AtomProbe::rangeToStr(), and AtomProbe::strAppend().
bool AtomProbe::RangeFile::makeSelfConsistent | ( | ) |
Modify range file to ensure self-consistency, by arbitrary heuristics.
Returns true if self consistant after corrections. false otherwise
Definition at line 2535 of file ranges.cpp.
References isSelfConsistent(), and AtomProbe::vectorMultiErase().
Referenced by guessChargeState(), and setEnforceConsistent().
bool AtomProbe::RangeFile::moveBothRanges | ( | unsigned int | range, |
float | newLow, | ||
float | newHigh | ||
) |
Move both of a range's masses to a new location.
Definition at line 3197 of file ranges.cpp.
Referenced by AtomProbe::checkMassRangingCorrectness(), and clearFormulas().
bool AtomProbe::RangeFile::moveRange | ( | unsigned int | range, |
bool | limit, | ||
float | newMass | ||
) |
Move a range's mass to a new location.
Definition at line 3136 of file ranges.cpp.
Referenced by clearFormulas().
bool AtomProbe::RangeFile::open | ( | const char * | rangeFile | ) |
Open a specified range file - returns true on success.
Definition at line 678 of file ranges.cpp.
References ASSERT, AtomProbe::RGBf::blue, detectFileType(), getIonID(), getNumRanges(), getRange(), AtomProbe::RGBf::green, isSelfConsistent(), AtomProbe::matchComposedName(), AtomProbe::MAX_LINE_SIZE, openFormat(), AtomProbe::RANGE_ERR_DASHHEADER, AtomProbe::RANGE_ERR_DATA_NOMAPPED_IONNAME, AtomProbe::RANGE_ERR_FORMAT, AtomProbe::RANGE_ERR_FORMAT_EMPTY_RANGEROW, AtomProbe::RANGE_ERR_FORMAT_TABLESEPARATOR, AtomProbe::RANGE_ERR_NONUNIQUE_POLYATOMIC, AtomProbe::RANGE_FORMAT_END_OF_ENUM, AtomProbe::RGBf::red, and AtomProbe::stream_cast().
Referenced by main(), and runTests().
unsigned int AtomProbe::RangeFile::openFormat | ( | const char * | rangeFile, |
unsigned int | format | ||
) |
Open a specified range file using a given file format. Returns nonzero on failure.
Definition at line 609 of file ranges.cpp.
References ASSERT, AtomProbe::getFilesize(), isSelfConsistent(), AtomProbe::popLocale(), AtomProbe::pushLocale(), AtomProbe::RANGE_ERR_DATA_INCONSISTENT, AtomProbe::RANGE_ERR_FILESIZE, AtomProbe::RANGE_ERR_FORMAT, AtomProbe::RANGE_ERR_OPEN, AtomProbe::RANGE_FORMAT_DBL_ORNL, AtomProbe::RANGE_FORMAT_ENV, AtomProbe::RANGE_FORMAT_ORNL, and AtomProbe::RANGE_FORMAT_RRNG.
Referenced by open().
Definition at line 418 of file ranges.cpp.
void AtomProbe::RangeFile::range | ( | std::vector< IonHit > & | ionHits | ) | const |
Clips out ions that are not inside the rangefile's ranges.
Definition at line 2783 of file ranges.cpp.
References isRanged().
Referenced by addRange(), clearFormulas(), getErrState(), getIonID(), guessChargeState(), main(), rangeByID(), and setIonID().
bool AtomProbe::RangeFile::range | ( | std::vector< IonHit > & | ionHits, |
const std::string & | shortIonName | ||
) |
Clips out ions that don't match the specified ion name.
Returns false if the ion name given doesn't match any in the rangefile (case sensitive)
Definition at line 2732 of file ranges.cpp.
bool AtomProbe::RangeFile::rangeByID | ( | std::vector< IonHit > & | ionHits, |
unsigned int | range | ||
) |
Clips out ions that don't lie in the specified range number.
Returns false if the range does not exist any in the rangefile (case sensitive)
Definition at line 2995 of file ranges.cpp.
References range().
Referenced by clearFormulas().
void AtomProbe::RangeFile::rangeByRangeID | ( | std::vector< IonHit > & | ionHits, |
unsigned int | rangeID | ||
) |
Range the given ions, allowing only ions in the specified range. Input data will be modified to return result.
Definition at line 2822 of file ranges.cpp.
Referenced by clearFormulas().
void AtomProbe::RangeFile::rangeInvertable | ( | std::vector< IonHit > & | ionHits, |
bool | invert | ||
) |
Clips out ions that are inside the rangefile's ranges, if invert is false. If true, then reverse the set.
Definition at line 2803 of file ranges.cpp.
References isRanged(), and XOR.
Referenced by clearFormulas().
|
static |
Return the human readable name for the given RANGE_FORMAT value.
Definition at line 1340 of file ranges.cpp.
References ARRAYSIZE, ASSERT, AtomProbe::RGBf::blue, AtomProbe::fpeek(), AtomProbe::RGBf::green, AtomProbe::lowercase(), AtomProbe::MAX_LINE_SIZE, AtomProbe::nullifyMarker(), AtomProbe::parseColString(), AtomProbe::RANGE_ERR_BAD_LINE_RANGEBLOCK, AtomProbe::RANGE_ERR_BAD_MULTIPLICITY, AtomProbe::RANGE_ERR_BADCOLOUR, AtomProbe::RANGE_ERR_BADEND, AtomProbe::RANGE_ERR_BADSTART, AtomProbe::RANGE_ERR_DATA_FLIPPED, AtomProbe::RANGE_ERR_DATA_TOO_MANY_USELESS_RANGES, AtomProbe::RANGE_ERR_DUPLICATE_NUMRANGES, AtomProbe::RANGE_ERR_EMPTY, AtomProbe::RANGE_ERR_FORMAT, AtomProbe::RANGE_ERR_FORMAT_COLOUR, AtomProbe::RANGE_ERR_FORMAT_HEADER, AtomProbe::RANGE_ERR_FORMAT_LONGNAME, AtomProbe::RANGE_ERR_FORMAT_MASS_PAIR, AtomProbe::RANGE_ERR_FORMAT_RANGETABLE, AtomProbe::RANGE_ERR_FORMAT_SHORTNAME, AtomProbe::RANGE_ERR_FORMAT_TABLE_ENTRY, AtomProbe::RANGE_ERR_FORMAT_TABLEHEADER_NUMIONS, AtomProbe::RANGE_ERR_FORMAT_TABLESEPARATOR, AtomProbe::RANGE_ERR_ION_BLOCK_NOT_PRESENT, AtomProbe::RANGE_ERR_ION_NOT_MAPPED, AtomProbe::RANGE_ERR_IONBLOCK_CONTENT, AtomProbe::RANGE_ERR_MISMATCHED_NUMRANGES, AtomProbe::RANGE_ERR_MISSING_IONBLOCK, AtomProbe::RANGE_ERR_NO_BASIC_IONS, AtomProbe::RANGE_ERR_NO_RANGES, AtomProbe::RANGE_ERR_NUMIONS, AtomProbe::RANGE_ERR_NUMIONS_DUPLICATED, AtomProbe::RANGE_ERR_NUMRANGE_PARSE, AtomProbe::RANGE_ERR_RANGEBLOCK_FORMAT, AtomProbe::RANGE_ERR_RRNG_COLON_SEPARATOR, AtomProbe::RANGE_ERR_RRNG_IONS_TOOSHORT, AtomProbe::RANGE_ERR_TOO_MANYIONS, AtomProbe::RANGE_ERR_VOLUME_PARSE, AtomProbe::RANGE_FORMAT_END_OF_ENUM, AtomProbe::RGBf::red, AtomProbe::splitStrsRef(), AtomProbe::stream_cast(), AtomProbe::stripChars(), AtomProbe::stripWhite(), and AtomProbe::stripZeroEntries().
void AtomProbe::RangeFile::setColour | ( | unsigned int | id, |
const RGBf & | r | ||
) |
Set the colour using the ion ID.
Definition at line 3066 of file ranges.cpp.
References ASSERT.
Referenced by getErrState().
|
inlinestatic |
Set whether the class will attempt to enfore consistency when running.
Definition at line 215 of file ranges.h.
References getErrString(), isSelfConsistent(), and makeSelfConsistent().
void AtomProbe::RangeFile::setIonFormula | ( | const std::string & | name, |
const std::map< std::string, size_t > & | formula, | ||
bool | useShortName = true |
||
) |
Set ion formula using ion short or long name (if it is already set)
The ion to change will be looked up using its short name (useShortName=true) or long name otherwise. The ion formula is automatically set using the short name of an ion when it is added by the addIon method. This method can be used to redefine the ion formulae. !
Definition at line 2957 of file ranges.cpp.
References ASSERT, and getIonID().
Referenced by getIonID().
void AtomProbe::RangeFile::setIonFormula | ( | const unsigned int | ionID, |
const std::map< std::string, size_t > & | formula | ||
) |
Set ion formula using ion ID.
The ionID must be smaller than number of ions (e.g. from getNumIons() ) !
Definition at line 2966 of file ranges.cpp.
References ASSERT.
void AtomProbe::RangeFile::setIonID | ( | unsigned int | range, |
unsigned int | newIonId | ||
) |
Set the ion ID for a given range.
Definition at line 3295 of file ranges.cpp.
References ASSERT, and range().
Referenced by getIonID().
void AtomProbe::RangeFile::setIonLongName | ( | unsigned int | ionID, |
const std::string & | newName | ||
) |
Set the long name for a given ion.
Short and long names may not contain white space. !
Definition at line 3078 of file ranges.cpp.
Referenced by clearFormulas().
void AtomProbe::RangeFile::setIonShortName | ( | unsigned int | ionID, |
const std::string & | newName | ||
) |
set the short name for a given ion
Short and long names may not contain white space. !
Definition at line 3073 of file ranges.cpp.
Referenced by clearFormulas().
bool AtomProbe::RangeFile::setRangeEnd | ( | unsigned int | rangeID, |
float | v | ||
) |
Set the upper bound of the given range.
Definition at line 3103 of file ranges.cpp.
References ASSERT, and isSelfConsistent().
Referenced by clearFormulas().
bool AtomProbe::RangeFile::setRangeStart | ( | unsigned int | rangeID, |
float | v | ||
) |
Set the lower bound of the given range.
Definition at line 3083 of file ranges.cpp.
References ASSERT, and isSelfConsistent().
Referenced by clearFormulas().
void AtomProbe::RangeFile::setRangeVolume | ( | unsigned int | rangeId, |
float | newVolume | ||
) |
Set the ion volume for a given range. If ion volumes are not tracked, these will be created.
Definition at line 3412 of file ranges.cpp.
References ASSERT.
Referenced by getErrState().
void AtomProbe::RangeFile::swap | ( | RangeFile & | rng | ) |
Swap a range file with this one.
Definition at line 3123 of file ranges.cpp.
Referenced by clearFormulas().
unsigned int AtomProbe::RangeFile::write | ( | std::ostream & | o, |
size_t | format = RANGE_FORMAT_ORNL |
||
) | const |
Write the rangefile to the specified output stream (default ORNL format)
Definition at line 441 of file ranges.cpp.
References ASSERT, getColour(), AtomProbe::RANGE_FORMAT_ENV, AtomProbe::RANGE_FORMAT_ORNL, AtomProbe::RANGE_FORMAT_RRNG, and AtomProbe::RGBf::toHex().
Referenced by clearFormulas(), guessChargeState(), and write().
unsigned int AtomProbe::RangeFile::write | ( | const char * | datafile, |
size_t | format = RANGE_FORMAT_ORNL |
||
) | const |
Write the rangefile to a file (ORNL format)
Definition at line 587 of file ranges.cpp.
References write().