3Depict
|
#include "mathfuncs.h"
#include "common/assertion.h"
#include <vector>
#include <sstream>
#include <list>
#include <fstream>
#include <algorithm>
Classes | |
class | UniqueIDHandler |
A class to manage "tear-off" ID values, to allow for indexing without knowing position. More... | |
class | ComparePairFirst |
class | ComparePairSecond |
class | ComparePairFirstReverse |
class | BoundCube |
A helper class to define a bounding cube. More... | |
struct | RGBf |
Data holder for colour as float. More... | |
class | ColourRGBA |
class | ColourRGBAf |
Macros | |
#define | THREEDEP_ARRAYSIZE(f) (sizeof (f) / sizeof(*f)) |
Basic objects header file. More... | |
#define | ATOMIC_BOOL bool |
Typedefs | |
typedef struct RGBf | RGBf |
Data holder for colour as float. More... | |
Enumerations | |
enum | { ERR_FILE_OPEN =1, ERR_FILE_FORMAT, ERR_FILE_NUM_FIELDS, ERR_FILE_ENUM_END } |
Text file loader errors. More... | |
Functions | |
void | pushLocale (const char *newLocale, int type) |
void | popLocale () |
int | fpeek (FILE *stream) |
template<class T > | |
bool | rangesOverlap (const T &minA, const T &maxA, const T &minB, const T &maxB) |
template<class T > | |
bool | xorFunc (const T a, const T b) |
template<class T > | |
void | rotate3 (T &a, T &b, T &c) |
template<class T > | |
T | maxValue (const T *t, size_t n) |
template<class T > | |
T | minValue (const T *t, size_t n) |
template<class T1 , class T2 > | |
bool | hasFirstInPairVec (const std::vector< std::pair< T1, T2 > > &v, const std::pair< T1, T2 > &r) |
void | tickSpacingsFromInterspace (float start, float end, float interSpacing, std::vector< float > &spacings) |
Convert a normal string to a latex one, using character replacement. More... | |
void | tickSpacingsFromFixedNum (float start, float end, unsigned int nTicks, std::vector< float > &spacings) |
std::string | veryFuzzyTimeSince (time_t origTime, time_t newTime) |
Get a "human-like" version of the time elapsed between new and original time period. More... | |
unsigned int | loadTextData (const char *cpFilename, std::vector< std::vector< float > > &dataVec, std::vector< std::string > &header, const char *delim) |
A routine for loading numeric data from a text file. Returns 0 on success. More... | |
unsigned int | loadTextStringData (const char *cpFilename, std::vector< std::vector< std::string > > &dataVec, const char *delim) |
Load non-numeric data from a text file into ragged array, using specified delimiters. More... | |
template<class T > | |
bool | writeTextFile (const char *cpFilename, const std::vector< std::pair< T, T > > &dataVec, const char delim='\t') |
void | setDefaultFontFile (const std::string &font) |
Return the default font file to use. Must precede (first) call to getDefaultFontFile. More... | |
std::string | getDefaultFontFile () |
Return the default font file to use. More... | |
template<class T1 , class T2 > | |
bool | stream_cast (T1 &result, const T2 &obj) |
Template function to cast and object to another by the stringstream. More... | |
void | nullifyMarker (char *buffer, char marker) |
Replace first instance of marker with null terminator. More... | |
unsigned int | getBitNum (unsigned int u) |
bool | getFilesize (const char *fname, size_t &size) |
Get total filesize in bytes. More... | |
int | getTotalRAM () |
get total ram in MB More... | |
size_t | getAvailRAM () |
Get available ram in MB. More... | |
bool | isNotDirectory (const char *filename) |
Determine if a given path is a not a directory,. More... | |
bool | rmFile (const std::string &filename) |
template<class T > | |
size_t | randomSelect (std::vector< T > &result, const std::vector< T > &source, RandNumGen &rng, size_t num, unsigned int &progress, ATOMIC_BOOL &wantAbort, bool strongRandom=false) |
template<class T > | |
size_t | randomDigitSelection (std::vector< T > &result, const size_t max, RandNumGen &rng, size_t num, unsigned int &progress, bool strongRandom=false) |
template<class T > | |
void | vectorMultiErase (std::vector< T > &vec, const std::vector< bool > &wantKill) |
#define ATOMIC_BOOL bool |
Referenced by ExportPosDialog::initialiseData(), LimitLoadPosFile(), loadTapsimBinFile(), FilterTree::size(), and testFilterTree().
#define THREEDEP_ARRAYSIZE | ( | f | ) | (sizeof (f) / sizeof(*f)) |
Basic objects header file.
Referenced by AnnotateFilter::AnnotateFilter(), DataLoadFilter::DataLoadFilter(), Effect::Effect(), Filter::Filter(), RangeFile::getAllExts(), RangeFile::getErrString(), IonClipFilter::getSpecificErrString(), ExternalProgramFilter::getSpecificErrString(), TransformFilter::getSpecificErrString(), SpectrumPlotFilter::getSpecificErrString(), IonDownsampleFilter::getSpecificErrString(), RangeFileFilter::getSpecificErrString(), IonInfoFilter::getSpecificErrString(), ProfileFilter::getSpecificErrString(), VoxeliseFilter::getSpecificErrString(), ClusterAnalysisFilter::getSpecificErrString(), SpatialAnalysisFilter::getSpecificErrString(), IonClipFilter::IonClipFilter(), locateDataFile(), MainWindowFrame::MainWindowFrame(), MathGLPane::MathGLPane(), plotID(), ProfileFilter::ProfileFilter(), RangeFile::RangeFile(), readOps(), SpatialAnalysisFilter::setUserString(), SpatialAnalysisFilter::SpatialAnalysisFilter(), TransformFilter::TransformFilter(), veryFuzzyTimeSince(), and VoxeliseFilter::VoxeliseFilter().
anonymous enum |
|
inline |
size_t getAvailRAM | ( | ) |
Get available ram in MB.
Referenced by FilterTree::refreshFilterTree(), and UniqueIDHandler::size().
unsigned int getBitNum | ( | unsigned int | u | ) |
References ASSERT.
Referenced by FilterTree::contains(), stream_cast(), and Filter::updateOutputInfo().
std::string getDefaultFontFile | ( | ) |
Return the default font file to use.
References defaultFontFile.
Referenced by DrawColourBarOverlay::DrawColourBarOverlay(), DrawPointLegendOverlay::DrawPointLegendOverlay(), BoundingBoxFilter::numBytesForCache(), AnnotateFilter::refresh(), and writeTextFile().
bool getFilesize | ( | const char * | fname, |
size_t & | size | ||
) |
Get total filesize in bytes.
Referenced by LimitLoadPosFile(), DataLoadFilter::monitorNeedsRefresh(), DataLoadFilter::numBytesForCache(), MainWindowFrame::OnFileExportPackage(), RangeFile::open(), RangeFile::openGuessFormat(), readOps(), DataLoadFilter::refresh(), and UniqueIDHandler::size().
int getTotalRAM | ( | ) |
get total ram in MB
Referenced by UniqueIDHandler::size().
bool hasFirstInPairVec | ( | const std::vector< std::pair< T1, T2 > > & | v, |
const std::pair< T1, T2 > & | r | ||
) |
References loadTextData(), loadTextStringData(), tickSpacingsFromFixedNum(), tickSpacingsFromInterspace(), and veryFuzzyTimeSince().
Referenced by AnalysisState::merge().
bool isNotDirectory | ( | const char * | filename | ) |
Determine if a given path is a not a directory,.
Referenced by RangeFile::detectFileType(), loadTextData(), loadTextStringData(), DataLoadFilter::setProperty(), and UniqueIDHandler::size().
unsigned int loadTextData | ( | const char * | cpFilename, |
std::vector< std::vector< float > > & | dataVec, | ||
std::vector< std::string > & | header, | ||
const char * | delim | ||
) |
A routine for loading numeric data from a text file. Returns 0 on success.
References ERR_FILE_FORMAT, ERR_FILE_NUM_FIELDS, ERR_FILE_OPEN, isNotDirectory(), splitStrsRef(), stream_cast(), strhas(), and stripZeroEntries().
Referenced by hasFirstInPairVec(), limitLoadTextFile(), ExternalProgramFilter::refresh(), and DataLoadFilter::refresh().
unsigned int loadTextStringData | ( | const char * | cpFilename, |
std::vector< std::vector< std::string > > & | dataVec, | ||
const char * | delim | ||
) |
Load non-numeric data from a text file into ragged array, using specified delimiters.
References ERR_FILE_FORMAT, ERR_FILE_OPEN, isNotDirectory(), splitStrsRef(), and stripZeroEntries().
Referenced by StringKeyFrameDialog::getStrings(), and hasFirstInPairVec().
T maxValue | ( | const T * | t, |
size_t | n | ||
) |
References ASSERT.
Referenced by VoxeliseFilter::getRefreshUseMask().
T minValue | ( | const T * | t, |
size_t | n | ||
) |
References ASSERT.
Referenced by VoxeliseFilter::getRefreshUseMask().
void nullifyMarker | ( | char * | buffer, |
char | marker | ||
) |
Replace first instance of marker with null terminator.
Referenced by RangeFile::detectFileType(), and stream_cast().
void popLocale | ( | ) |
Referenced by RangeFile::open(), and MathGLPane::saveSVG().
void pushLocale | ( | const char * | newLocale, |
int | type | ||
) |
References ASSERT.
Referenced by RangeFile::open(), and MathGLPane::saveSVG().
size_t randomDigitSelection | ( | std::vector< T > & | result, |
const size_t | max, | ||
RandNumGen & | rng, | ||
size_t | num, | ||
unsigned int & | progress, | ||
bool | strongRandom = false |
||
) |
References ASSERT, LinearFeedbackShiftReg::clock(), RandNumGen::genUniformDev(), LinearFeedbackShiftReg::setMaskPeriod(), and LinearFeedbackShiftReg::setState().
Referenced by LimitLoadPosFile(), limitLoadTextFile(), LoadATOFile(), and CropHelper::runFilter().
size_t randomSelect | ( | std::vector< T > & | result, |
const std::vector< T > & | source, | ||
RandNumGen & | rng, | ||
size_t | num, | ||
unsigned int & | progress, | ||
ATOMIC_BOOL & | wantAbort, | ||
bool | strongRandom = false |
||
) |
References ASSERT, LinearFeedbackShiftReg::clock(), RandNumGen::genUniformDev(), LinearFeedbackShiftReg::setMaskPeriod(), and LinearFeedbackShiftReg::setState().
Referenced by IonDownsampleFilter::refresh().
bool rangesOverlap | ( | const T & | minA, |
const T & | maxA, | ||
const T & | minB, | ||
const T & | maxB | ||
) |
References ASSERT.
Referenced by PropertyAnimator::checkSelfConsistent(), and RegionGroup::getOverlaps().
bool rmFile | ( | const std::string & | filename | ) |
References ColourRGBA::b(), EQ_TOL, BoundCube::getPlaneIntersectVertices(), rmFile(), TEST, and WARN.
Referenced by loadTapsimBinFile(), TreeState::resetModifyLevel(), rmFile(), and UniqueIDHandler::size().
void rotate3 | ( | T & | a, |
T & | b, | ||
T & | c | ||
) |
void setDefaultFontFile | ( | const std::string & | font | ) |
Return the default font file to use. Must precede (first) call to getDefaultFontFile.
References defaultFontFile.
Referenced by threeDepictApp::OnInit(), and writeTextFile().
bool stream_cast | ( | T1 & | result, |
const T2 & | obj | ||
) |
Template function to cast and object to another by the stringstream.
References getBitNum(), and nullifyMarker().
Referenced by ExportRngDialog::addRangeData(), Filter::applyPropertyNow(), MainWindowFrame::checkReloadAutosave(), choiceString(), choiceStringToVector(), RangeFile::decomposeIonNames(), RangeFile::detectFileType(), digitString(), DrawColourBarOverlay::draw(), filterIsSampling(), filterTreeTests(), getActiveChoice(), Filter::getBaseErrString(), MathGLPane::getErrString(), ExportAnimationDialog::getFilename(), InterpData::getInterpolatedData(), IonClipFilter::getProperties(), IonColourFilter::getProperties(), TransformFilter::getProperties(), BoundingBoxFilter::getProperties(), SpectrumPlotFilter::getProperties(), IonDownsampleFilter::getProperties(), AnnotateFilter::getProperties(), IonInfoFilter::getProperties(), RangeFileFilter::getProperties(), ProfileFilter::getProperties(), VoxeliseFilter::getProperties(), DataLoadFilter::getProperties(), ClusterAnalysisFilter::getProperties(), SpatialAnalysisFilter::getProperties(), CameraLookAt::getProperties(), getPropValueFromEvent(), getRealKeyFrame(), IonDownsampleFilter::getRefreshUseMask(), VoxeliseFilter::getRefreshUseMask(), StringKeyFrameDialog::getStartFrame(), limitLoadTextFile(), loadTapsimBinFile(), loadTextData(), MainWindowFrame::MainWindowFrame(), IonInfoFilter::needsUnrangedData(), MainWindowFrame::OnAutosaveTimer(), ExportPosDialog::OnBtnAddData(), ExportAnimationDialog::OnBtnResolution(), MainWindowFrame::OnClose(), MainWindowFrame::OnFileExportFilterVideo(), MainWindowFrame::OnFileExportVideo(), PrefDialog::OnFilterCellChange(), ExportAnimationDialog::OnFilterGridCellSelected(), ExportAnimationDialog::OnFrameViewSlider(), MainWindowFrame::OnGridCameraPropertyChange(), MainWindowFrame::OnGridFilterPropertyChange(), RangeEditorDialog::OnGridRangesCellChange(), ExportRngDialog::OnListRangeItemActivate(), ResolutionDialog::OnMouseWheelHeight(), ResolutionDialog::OnMouseWheelWidth(), MainWindowFrame::OnStatusBarTimer(), ExportAnimationDialog::OnTextFrame(), ResolutionDialog::OnTextHeight(), ResolutionDialog::OnTextWidth(), ExportPosDialog::OnTreeFiltersSelChanged(), StashDialog::OnTreeSelChange(), MainWindowFrame::OnUpdateTimer(), RangeFile::openGuessFormat(), Point3D::parse(), parseVersion(), parseXMLColour(), ExportAnimationDialog::prepare(), ConfigFile::read(), readOps(), readScalarsXML(), IonColourFilter::readState(), BoundingBoxFilter::readState(), SpectrumPlotFilter::readState(), RangeFileFilter::readState(), ProfileFilter::readState(), VoxeliseFilter::readState(), DataLoadFilter::readState(), CameraLookAt::readState(), readVectorsXML(), AnnotateFilter::refresh(), IonInfoFilter::refresh(), VoxeliseFilter::refresh(), DataLoadFilter::refresh(), ClusterAnalysisFilter::refresh(), MainWindowFrame::restoreConfigDefaults(), AnalysisState::save(), BasicGLPane::saveImageSequence(), FilterTree::saveXML(), FilterTree::serialiseToStringPaths(), ExportAnimationDialog::setDefImSize(), RangeEditorDialog::setPlotWrapper(), IonColourFilter::setProperty(), TransformFilter::setProperty(), SpectrumPlotFilter::setProperty(), BoundingBoxFilter::setProperty(), IonDownsampleFilter::setProperty(), AnnotateFilter::setProperty(), IonInfoFilter::setProperty(), RangeFileFilter::setProperty(), ProfileFilter::setProperty(), VoxeliseFilter::setProperty(), DataLoadFilter::setProperty(), ClusterAnalysisFilter::setProperty(), SpatialAnalysisFilter::setProperty(), CameraLookAt::setProperty(), IonClipFilter::setPropFromBinding(), TransformFilter::setPropFromBinding(), AnnotateFilter::setPropFromBinding(), ProfileFilter::setPropFromBinding(), SpatialAnalysisFilter::setPropFromBinding(), ResolutionDialog::setRes(), StringKeyFrameDialog::StringKeyFrameDialog(), updateCameraPropertyGrid(), updateFilterPropertyGrid(), VisController::updateRawGrid(), validateTextAsStream(), wxErrMsg(), XMLGetAttrib(), XMLGetNextElemAttrib(), XMLHelpGetProp(), and Scene::~Scene().
void tickSpacingsFromFixedNum | ( | float | start, |
float | end, | ||
unsigned int | nTicks, | ||
std::vector< float > & | spacings | ||
) |
References ASSERT.
Referenced by hasFirstInPairVec(), and AnnotateFilter::refresh().
void tickSpacingsFromInterspace | ( | float | start, |
float | end, | ||
float | interSpacing, | ||
std::vector< float > & | spacings | ||
) |
Convert a normal string to a latex one, using character replacement.
References ASSERT.
Referenced by hasFirstInPairVec(), and AnnotateFilter::refresh().
void vectorMultiErase | ( | std::vector< T > & | vec, |
const std::vector< bool > & | wantKill | ||
) |
References ASSERT.
Referenced by countBinnedIons(), RangeFile::decomposeIonNames(), RangeFile::eraseIon(), AbundanceData::generateIsotopeDist(), BoundCube::getPlaneIntersectVertices(), FilterTree::safeDeleteFilterList(), and PropertyAnimator::updateMappings().
std::string veryFuzzyTimeSince | ( | time_t | origTime, |
time_t | newTime | ||
) |
Get a "human-like" version of the time elapsed between new and original time period.
References ASSERT, COMPILE_ASSERT, NTRANS, THREEDEP_ARRAYSIZE, and TRANS.
Referenced by MainWindowFrame::checkReloadAutosave(), and hasFirstInPairVec().
bool writeTextFile | ( | const char * | cpFilename, |
const std::vector< std::pair< T, T > > & | dataVec, | ||
const char | delim = '\t' |
||
) |
References getDefaultFontFile(), and setDefaultFontFile().
Referenced by ExternalProgramFilter::refresh().
bool xorFunc | ( | const T | a, |
const T | b | ||
) |
Referenced by Plot2DStreamData::getNumBasicObjects(), and SpatialAnalysisFilter::setPropFromBinding().