ug4
|
further general utilities More...
Modules | |
String Utilities | |
Common IO | |
Common Types | |
Typedefs | |
typedef void * | ug::DynLibHandle |
Defines a reference to a dynamically loaded library. More... | |
typedef SmartPtr< MessageHub > | ug::SPMessageHub |
Enumerations | |
enum | ug::PathTypes { ug::BIN_PATH = 0 , ug::SCRIPT_PATH , ug::ROOT_PATH , ug::PLUGIN_PATH , ug::APPS_PATH , ug::MAX_PATH_CONSTANT } |
Constants used by PathProvider. More... | |
Functions | |
bool | boolstrcmp (const char *a, const char *b) |
bool | boolstrcmpReversed (const char *a, const char *b) |
bool | ug::CloseLibrary (DynLibHandle h) |
Frees a library. More... | |
template<typename TCompareValues > | |
CompareIndicesByClass< TCompareValues, false > | CompareIndicesBy (const TCompareValues &values) |
template<typename TCompareValues , typename TCompare > | |
CompareIndicesByClass2< TCompareValues, TCompare > | CompareIndicesBy (const TCompareValues &values, TCompare comp) |
template<typename TCompareValues > | |
CompareIndicesByClass< TCompareValues, true > | CompareIndicesReversedBy (const TCompareValues &values) |
uint32 | ug::crc32 (const char *str) |
Calculates the crc32 for a null-terminated string. More... | |
bool | ug::FindParam (const char *param, int argc, const char *const *argv) |
template<typename TTarget , typename TSrc > | |
TTarget | function_cast (TSrc src) |
Casts a function of one type to a function of another type. More... | |
const char * | ug::GetDynamicLibraryPrefix () |
returns the standard prefix of static and dynamic libraries on this os More... | |
const char * | ug::GetDynamicLibrarySuffix () |
returns the standard suffix of dynamic libraries on this os More... | |
void * | ug::GetLibraryProcedure (DynLibHandle h, const char *procName) |
Returns the address of the specified procedure in the given library. More... | |
UG_API std::vector< std::string > | ug::GetLoadedPlugins () |
int | ug::GetParamIndex (const char *param, int argc, const char *const *argv) |
const char * | ug::GetPathSeparator () |
returns a string containing the path-separator for the current os More... | |
template<typename TCompareValues > | |
std::vector< size_t > | GetSortedIndices (const TCompareValues &values) |
template<typename TCompareValues , typename TCompare > | |
std::vector< size_t > | GetSortedIndices (const TCompareValues &values, TCompare comp) |
template<typename TCompareValues > | |
void | GetSortedIndices (std::vector< size_t > &indices, const TCompareValues &values, bool bReverse=false) |
template<typename TCompareValues , typename TCompare > | |
void | GetSortedIndices (std::vector< size_t > &indices, const TCompareValues &values, TCompare comp) |
template<class TType > | |
size_t | ug::GetUniqueTypeID () |
This method associated a unique unsigned integer value with each type. More... | |
bool | ug::IsBigEndian () |
bool | ug::IsLittleEndian () |
UG_API bool | ug::LoadPlugins (const char *pluginPath, std::string parentGroup, bridge::Registry ®, bool bPrefixGroup=false) |
Loads all plugins in the given path. More... | |
DynLibHandle | ug::OpenLibrary (const char *fileName) |
Loads a library and returns a handle. More... | |
double | ug::ParamToDouble (const char *param, int argc, const char *const *argv, double dDefault) |
bool | ug::ParamToDouble (double &dOut, const char *param, int argc, const char *const *argv) |
int | ug::ParamToInt (const char *param, int argc, const char *const *argv, int iDefault) |
bool | ug::ParamToInt (int &iOut, const char *param, int argc, const char *const *argv) |
bool | ug::ParamToString (const char **strOut, const char *param, int argc, const char *const *argv) |
UG_API bool | ug::PluginLoaded (const std::string &name) |
void | ug::split_parameters (std::vector< std::string > ¶msOut, char *strParams, const char *delims=" ") |
fills paramsOut with the parameters that are seperated by the characters given in delim. More... | |
UG_API bool | ug::UnloadPlugins () |
Variables | |
const NullSmartPtr | SPNULL |
The equivalent to NULL for smart pointers. More... | |
template<typename TKey > | |
size_t | ug::hash_key (const TKey &key) |
The hashing method can be specialized for different types. More... | |
template<class T > | |
T * | ug::GetDataPtr (std::vector< T > &v) |
Returns a pointer to the array which is managed by the std::vector. More... | |
template<class T > | |
const T * | ug::GetDataPtr (const std::vector< T > &v) |
Returns a pointer to the array which is managed by the std::vector. More... | |
further general utilities
An associative container for key-value pairs, which provides fast access using hash-keys.
typedef void* ug::DynLibHandle |
Defines a reference to a dynamically loaded library.
typedef SmartPtr<MessageHub> ug::SPMessageHub |
enum ug::PathTypes |
Constants used by PathProvider.
Enumerator | |
---|---|
BIN_PATH | path in which the binary lies |
SCRIPT_PATH | |
ROOT_PATH | |
PLUGIN_PATH | |
APPS_PATH | path in which the application-scripts lie |
MAX_PATH_CONSTANT |
|
inline |
|
inline |
bool ug::CloseLibrary | ( | DynLibHandle | h | ) |
Frees a library.
The method returns true if the operation was successful, false if not.
Referenced by ug::LoadPlugins(), ug::UnloadPlugins(), and ug::bridge::LUACompiler::~LUACompiler().
|
inline |
Allows sorting of indices by their values in another array. example: int v[] = {1, 3, 2}; int pivot[] = {5, 2, 3, 1}; sort(v, v+3, CompareIndicesBy(pivot)); for(size_t i=0; i<3; i++) cout << v[i] << " = " << pivot[v[i]] << endl;
Referenced by ug::ParallelNodes::sort_by_global_id().
|
inline |
Allows sorting of indices by their values in another array with a comp function
|
inline |
uint32 ug::crc32 | ( | const char * | str | ) |
Calculates the crc32 for a null-terminated string.
Referenced by ug::DebugIDManager::debug_id_registered(), ug::DebugID::DebugID(), ug::DebugIDManager::get_debug_id(), ug::DebugIDManager::get_debug_level(), ug::DebugIDManager::get_or_create_debug_id(), ug::bridge::GetLogAssistantTag(), ug::DebugIDManager::register_debug_id(), and ug::DebugIDManager::set_debug_level().
UG_API bool ug::FindParam | ( | const char * | param, |
int | argc, | ||
const char *const * | argv | ||
) |
searches argv for the given parameter and returns true if it is found.
References ug::GetParamIndex().
Referenced by ugshell_main().
TTarget function_cast | ( | TSrc | src | ) |
Casts a function of one type to a function of another type.
ATTENTION: Use with care! This method should only be used on functions which have similar parameters, and where different parameters in TTarget and TSrc are pointers or references to types which are connected through inheritance.
The main purpose of this method is to make code readable and to allow more secure compiler dependent implementations.
const T* ug::GetDataPtr | ( | const std::vector< T > & | v | ) |
Returns a pointer to the array which is managed by the std::vector.
Note that this pointer may be invalidated once new elements are added to the vector or old ones are removed.
The method returns NULL if the vector is empty.
T* ug::GetDataPtr | ( | std::vector< T > & | v | ) |
Returns a pointer to the array which is managed by the std::vector.
Note that this pointer may be invalidated once new elements are added to the vector or old ones are removed.
The method returns NULL if the vector is empty.
Referenced by pcl::ProcessCommunicator::allgatherv(), ug::BinaryBuffer::buffer(), ug::BinaryStreamBuffer::buffer(), pcl::CommunicateInvolvedProcesses(), pcl::ProcessCommunicator::distribute_data(), ug::DistributeGrid(), pcl::ProcessCommunicator::gatherv(), and ug::ExpectedErrorMarkingStrategy< TDomain >::mark().
UG_API const char * ug::GetDynamicLibraryPrefix | ( | ) |
returns the standard prefix of static and dynamic libraries on this os
Referenced by ug::LoadPlugins().
UG_API const char * ug::GetDynamicLibrarySuffix | ( | ) |
returns the standard suffix of dynamic libraries on this os
Referenced by ug::LoadPlugins().
void * ug::GetLibraryProcedure | ( | DynLibHandle | h, |
const char * | procName | ||
) |
Returns the address of the specified procedure in the given library.
If no procedure with the given name was found, NULL is returned.
Referenced by ug::bridge::LUACompiler::createC(), ug::LoadPlugins(), and ug::UnloadPlugins().
vector< string > ug::GetLoadedPlugins | ( | ) |
Referenced by ug::bridge::RegisterInfoCommands().
UG_API int ug::GetParamIndex | ( | const char * | param, |
int | argc, | ||
const char *const * | argv | ||
) |
searches argv for the given parameter and returns its position in argv. If the parameter is not contained in argv, -1 is returned.
Referenced by ug::FindParam(), ug::ParamToDouble(), ug::ParamToInt(), ug::ParamToString(), ugshell_get_call_command(), and ugshell_main().
UG_API const char * ug::GetPathSeparator | ( | ) |
returns a string containing the path-separator for the current os
Referenced by ug::baseName(), ug::PathProvider::get_dirname_relative_to_current_path(), ug::PathProvider::get_dirname_relative_to_path(), ug::PathProvider::get_filename_relative_to_current_path(), ug::PathProvider::get_filename_relative_to_path(), ug::InitPaths(), and ug::SetRootPath().
std::vector<size_t> GetSortedIndices | ( | const TCompareValues & | values | ) |
References GetSortedIndices().
std::vector<size_t> GetSortedIndices | ( | const TCompareValues & | values, |
TCompare | comp | ||
) |
References GetSortedIndices().
void GetSortedIndices | ( | std::vector< size_t > & | indices, |
const TCompareValues & | values, | ||
bool | bReverse = false |
||
) |
example: std::vector<size_t> v; // = { 45, 3, 6, 4, 9}; ind = GetSortedIndices(ind, v); then v[ ind[0] ] <= v[ ind[1] ] <= ... <= v [ ind[v.size() -1] ]; , and here ind = 1, 3, 2, 4, 0, because e.g. v[ind[0]] = v[1] = 3.
values | array where indices should be sorted after |
Referenced by GetSortedIndices().
void GetSortedIndices | ( | std::vector< size_t > & | indices, |
const TCompareValues & | values, | ||
TCompare | comp | ||
) |
example: std::vector<const char*> v; // some strings GetSortedIndices(ind, v, boolstrcmp); then v[ ind[0] ] <= v[ ind[1] ] <= ... <= v [ ind[v.size() -1] ]; ,
indices | array with indices |
values | array where indices should be sorted after |
comp | compare function |
size_t ug::GetUniqueTypeID | ( | ) |
This method associated a unique unsigned integer value with each type.
References ug::UniqueTypeIDProvider::inst(), and ug::UniqueTypeIDProvider::new_id().
Referenced by ug::bridge::ExportedClassBaseImpl::get_json_constructor().
size_t ug::hash_key | ( | const TKey & | key | ) |
The hashing method can be specialized for different types.
A default implementation exists, which casts each key to a unsigned long.
Referenced by ug::Grid::find_face_in_associated_faces(), ug::Grid::find_volume_in_associated_volumes(), ug::Hash< TKey, TValue >::hash_index(), and ug::VolumeContains().
|
inline |
Returns false if the system endianess is little endian, i.e. the least significant byte is stored first. If returned true the system endianess is big endian, i.e. most significant byte first. Please note, that this is a runtime check.
References ug::IsLittleEndian().
|
inline |
Returns true if the system endianess is little endian, i.e. the least significant byte is stored first. If returned false the system endianess is big endian, i.e. most significant byte first. Please note, that this is a runtime check.
Referenced by ug::IsBigEndian(), ug::VTKOutput< TDim >::print(), ug::VTKOutput< TDim >::print_subset(), and ug::VTKOutput< TDim >::print_subsets().
UG_API bool ug::LoadPlugins | ( | const char * | pluginPath, |
std::string | parentGroup, | ||
bridge::Registry & | reg, | ||
bool | bPrefixGroup = false |
||
) |
Loads all plugins in the given path.
DynLibHandle ug::OpenLibrary | ( | const char * | fileName | ) |
Loads a library and returns a handle.
The function throws an std::string as error if the library could not be found or if the library could not be opened (e.g. dependent shared libraries not found)
Referenced by ug::bridge::LUACompiler::createC(), and ug::LoadPlugins().
UG_API double ug::ParamToDouble | ( | const char * | param, |
int | argc, | ||
const char *const * | argv, | ||
double | dDefault | ||
) |
References ug::ParamToDouble().
UG_API bool ug::ParamToDouble | ( | double & | dOut, |
const char * | param, | ||
int | argc, | ||
const char *const * | argv | ||
) |
searches argv for the given parameter, and converts the associated value to a double value. Returns true if the parameter was found, false if not.
References ug::GetParamIndex().
Referenced by ug::ParamToDouble().
UG_API int ug::ParamToInt | ( | const char * | param, |
int | argc, | ||
const char *const * | argv, | ||
int | iDefault | ||
) |
References ug::ParamToInt().
UG_API bool ug::ParamToInt | ( | int & | iOut, |
const char * | param, | ||
int | argc, | ||
const char *const * | argv | ||
) |
searches argv for the given parameter, and converts the associated value to an integer. Returns true if the parameter was found, false if not.
References ug::GetParamIndex().
Referenced by ug::ParamToInt(), and ugshell_main().
UG_API bool ug::ParamToString | ( | const char ** | strOut, |
const char * | param, | ||
int | argc, | ||
const char *const * | argv | ||
) |
searches argv for the given parameter, and returns the associated string (the argv directly following param). associated Returns true if the parameter was found, false if not.
Please note that spaces may not be contained in the associated string.
References ug::GetParamIndex().
Referenced by ugshell_main().
UG_API bool ug::PluginLoaded | ( | const std::string & | name | ) |
Referenced by ug::bridge::RegisterInfoCommands().
void ug::split_parameters | ( | std::vector< std::string > & | paramsOut, |
char * | strParams, | ||
const char * | delims = " " |
||
) |
fills paramsOut with the parameters that are seperated by the characters given in delim.
if you pass " ,.-" to delims, then paramsOut will contain all parameters that are separated by ' ', ',', '.' or '-'.
Please note that strParams is not const!
bool ug::UnloadPlugins | ( | ) |
References ug::CloseLibrary(), and ug::GetLibraryProcedure().
const NullSmartPtr SPNULL |
The equivalent to NULL for smart pointers.
Referenced by ug::LocalSchurComplement< TAlgebra >::apply(), ug::PowerMethod< TAlgebra >::B_norm(), ug::IDomain< TGrid, TSubsetHandler >::broadcast_refinement_projector(), ug::PowerMethod< TAlgebra >::calculate_max_eigenvalue(), ug::PowerMethod< TAlgebra >::calculate_min_eigenvalue(), ug::ILinearOperatorInverse< X, Y >::clone(), ug::IExternalSolver< TAlgebra >::clone(), ug::OperatorInverseIterator< TAlgebra >::clone(), ug::UzawaBase< TDomain, TAlgebra >::clone(), ug::NewtonSolver< TAlgebra >::disable_line_search(), ug::LocalFiniteElementProvider::get_dof_ptr(), ug::LocalFiniteElementProvider::getptr(), ug::GridFunction< TDomain, TAlgebra >::grid_changed_callback(), ug::GridFunction< TDomain, TAlgebra >::grid_distribution_callback(), ug::GridFunction< TDomain, TAlgebra >::init(), ug::FETISolver< TAlgebra >::init(), ug::AssembledMultiGridCycle< TDomain, TAlgebra >::init_level_memory(), ug::AssembledMultiGridCycle< TDomain, TAlgebra >::init_rap_operator(), ug::ICplUserData< dim >::needed_data(), ug::PINVIT< TAlgebra >::PINVIT(), ug::SchurPrecond< TAlgebra >::postprocess(), ug::PowerMethod< TAlgebra >::PowerMethod(), ug::SchurPrecond< TAlgebra >::SchurPrecond(), ug::UserDataInfo::set_obj_name(), ug::ILU< TAlgebra >::set_sort(), ug::ILUTPreconditioner< TAlgebra >::set_sort(), ug::AssembledTransformingSmoother< TDomain, TAlgebra >::untransform_correction(), and ug::FETISolver< TAlgebra >::write_debug().