preCICE v3.1.2
|
contains precice-related utilities. More...
Namespaces | |
namespace | eigenio |
namespace | networking |
namespace | petsc |
PETSc related utilities. | |
namespace | statistics |
Classes | |
struct | ComponentWiseLess |
struct | conjunction |
struct | conjunction< B1 > |
struct | conjunction< B1, Bn... > |
class | DoubleAggregator |
An accurate aggregator for doubles with usability in mind. More... | |
struct | IndexMaps |
Provides mappings of indices for dimensions 2 and 3. More... | |
struct | IndexMaps< 2 > |
struct | IndexMaps< 3 > |
class | IntraComm |
Utility class for managing intra-participant communication operations. More... | |
class | LockNotFoundException |
class | ManageUniqueIDs |
Manages a set of unique IDs. More... | |
struct | MPIResult |
class | MultiLock |
Class handling multiple locks allowing global lock and unlock operations. More... | |
class | MultiLockException |
class | Parallel |
Utility class for managing MPI operations. More... | |
class | Petsc |
Utility class for managing PETSc operations. More... | |
struct | RangePreview |
The RangePreview object used as a lazy proxy struct for proviewing the content of a Range. More... | |
class | StringMaker |
Utility class to build a string from C functions with output pointers and static maximum length. More... | |
struct | StringMatch |
struct | transform |
struct | type_transform |
Functions | |
template<class InputIt1 , class InputIt2 , class OutputIt > | |
void | set_intersection_indices (InputIt1 ref1, InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, OutputIt d_first) |
This function is by and large the same as std::set_intersection(). The only difference is that we don't return the intersection set itself, but we return the indices of elements in InputIt1 , which appear in both sets ( InputIt1 and InputIt2 ) The implementation was taken from https://en.cppreference.com/w/cpp/algorithm/set_intersection#Version_1 with the only difference that we compute and store std::distance() (i.e. the indices) in the output iterator. Similar to the std function, this function operates on sorted ranges. | |
template<typename... Elements> | |
auto | make_array (Elements &&... elements) -> std::array< typename std::common_type< Elements... >::type, sizeof...(Elements)> |
Function that generates an array from given elements. | |
template<typename Container , typename BinaryPredicate = std::equal_to<typename Container::value_type>> | |
bool | unique_elements (const Container &c, BinaryPredicate p={}) |
template<class InputIter , class ElementType > | |
void | intersperse (InputIter first, InputIter last, const ElementType &elem, std::ostream &out) |
template<class InputIt1 , class InputIt2 > | |
std::pair< InputIt1, InputIt2 > | mismatch (InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2) |
template<typename Iter > | |
std::ostream & | operator<< (std::ostream &out, const RangePreview< Iter > &rp) |
Allows streaming of RangePreview objects. | |
template<typename Range , typename Iter = typename Range::const_iterator, typename Size = typename std::iterator_traits<Iter>::difference_type> | |
const RangePreview< Iter > | previewRange (Size n, const Range &range) |
template<typename T , typename Index , size_t n> | |
auto | reorder_array (const std::array< Index, n > &order, const std::array< T, n > &elements) -> std::array< T, n > |
Reorders an array given an array of unique indices. | |
template<class InputIt , class Size , class InOutIt > | |
void | add_n (InputIt first, Size count, InOutIt result) |
template<class InputIt , class Unary > | |
void | for_each_unique (InputIt first, InputIt last, Unary func) |
Calls each value in the range of [first, last[ exactly once. | |
template<class InputIt , class Predicate > | |
std::pair< InputIt, InputIt > | find_first_range (InputIt first, InputIt last, Predicate p) |
Finds the first range in [first, last[ that fulfills a predicate. | |
const Eigen::VectorXd & | delinearize (int toDelinearize, int dimensions) |
template<typename VECTOR_T > | |
int | linearize (const VECTOR_T &toLinearize) |
DoubleAggregator | operator+ (double lhs, DoubleAggregator rhs) |
DoubleAggregator | operator+ (DoubleAggregator lhs, double rhs) |
DoubleAggregator | operator- (DoubleAggregator lhs, double rhs) |
void | shiftSetFirst (Eigen::MatrixXd &A, const Eigen::VectorXd &v) |
void | appendFront (Eigen::MatrixXd &A, Eigen::VectorXd &v) |
void | removeColumnFromMatrix (Eigen::MatrixXd &A, int col) |
void | append (Eigen::VectorXd &v, double value) |
template<typename Derived1 > | |
void | append (Eigen::MatrixXd &A, const Eigen::PlainObjectBase< Derived1 > &B) |
template<typename Derived1 > | |
void | append (Eigen::VectorXd &v, const Eigen::PlainObjectBase< Derived1 > &app) |
template<typename Derived > | |
auto | firstN (const Eigen::PlainObjectBase< Derived > &val, unsigned n) -> const Eigen::Map< const Eigen::Matrix< typename Derived::Scalar, 1, Eigen::Dynamic > > |
template<typename Derived , typename Iter = const typename Derived::Scalar *, typename Size = typename std::iterator_traits<Iter>::difference_type> | |
const RangePreview< Iter > | previewRange (Size n, const Eigen::PlainObjectBase< Derived > &eigen) |
template<typename DerivedLHS , typename DerivedRHS > | |
bool | componentWiseLess (const Eigen::PlainObjectBase< DerivedLHS > &lhs, const Eigen::PlainObjectBase< DerivedRHS > &rhs) |
std::string | format_or_error (std::string_view str) |
template<class... A> | |
std::string | format_or_error (std::string_view fmt, A &&... args) |
bool | isMachineBigEndian () |
Returns true if machine is big-endian needed for parallel vtk output. | |
template<class Out , class In > | |
bool | isTruncated (In in) |
Returns true, if numerical truncation happens in case of type conversion. | |
bool | isValidPort (int port) |
Returns true if the argument represents a valid port. | |
bool | xOR (bool lhs, bool rhs) |
Exclusive "or" logical operation. Returns true, if either lhs or rhs are true. | |
template<typename ELEMENT_T > | |
bool | contained (const ELEMENT_T &element, const std::vector< ELEMENT_T > &vec) |
Returns true, if given element is in vector, otherwise false. | |
template<typename KEY_T , typename ELEMENT_T > | |
bool | contained (const KEY_T &key, const std::map< KEY_T, ELEMENT_T > &map) |
template<typename KEY_T > | |
bool | contained (const KEY_T &key, const std::set< KEY_T > &set) |
template<class... Arguments> | |
void | ignore (Arguments &&...) |
std::ostream & | operator<< (std::ostream &out, const Parallel::CommState &value) |
pretty printer for CommState | |
std::string | wrapText (const std::string &text, int linewidth, int indentation) |
std::string & | checkAppendExtension (std::string &filename, const std::string &extension) |
Checks if filename has the given extension, if not appends it. | |
bool | convertStringToBool (std::string const &value) |
Evaluates a string to find out if it represents a bool. | |
std::string | truncate_wstring_to_string (std::wstring wstr, char fill) |
std::size_t | editDistance (std::string_view s1, std::string_view s2) |
template<class Container > | |
std::vector< StringMatch > | computeMatches (std::string_view given, const Container &expected) |
std::string | getTypeName (const double &var) |
std::string | getTypeName (const std::string &var) |
std::string | getTypeName (const bool &var) |
std::string | getTypeName (const int &var) |
std::string | getTypeName (Eigen::VectorXd const &var) |
Variables | |
static constexpr std::string_view | ASSERT_FMT |
const Eigen::VectorXd | DELINEARIZE_2D [8] |
const Eigen::VectorXd | DELINEARIZE_3D [8] |
contains precice-related utilities.
void precice::utils::add_n | ( | InputIt | first, |
Size | count, | ||
InOutIt | result ) |
void precice::utils::append | ( | Eigen::MatrixXd & | A, |
const Eigen::PlainObjectBase< Derived1 > & | B ) |
Definition at line 21 of file EigenHelperFunctions.hpp.
void precice::utils::append | ( | Eigen::VectorXd & | v, |
const Eigen::PlainObjectBase< Derived1 > & | app ) |
Definition at line 37 of file EigenHelperFunctions.hpp.
void precice::utils::append | ( | Eigen::VectorXd & | v, |
double | value ) |
Definition at line 48 of file EigenHelperFunctions.cpp.
void precice::utils::appendFront | ( | Eigen::MatrixXd & | A, |
Eigen::VectorXd & | v ) |
Definition at line 22 of file EigenHelperFunctions.cpp.
std::string & precice::utils::checkAppendExtension | ( | std::string & | filename, |
const std::string & | extension ) |
Checks if filename has the given extension, if not appends it.
Definition at line 44 of file String.cpp.
bool precice::utils::componentWiseLess | ( | const Eigen::PlainObjectBase< DerivedLHS > & | lhs, |
const Eigen::PlainObjectBase< DerivedRHS > & | rhs ) |
Definition at line 73 of file EigenHelperFunctions.hpp.
std::vector< StringMatch > precice::utils::computeMatches | ( | std::string_view | given, |
const Container & | expected ) |
bool precice::utils::contained | ( | const ELEMENT_T & | element, |
const std::vector< ELEMENT_T > & | vec ) |
Returns true, if given element is in vector, otherwise false.
Requirements:
Definition at line 39 of file Helpers.hpp.
bool precice::utils::contained | ( | const KEY_T & | key, |
const std::map< KEY_T, ELEMENT_T > & | map ) |
bool precice::utils::contained | ( | const KEY_T & | key, |
const std::set< KEY_T > & | set ) |
bool precice::utils::convertStringToBool | ( | std::string const & | value | ) |
Evaluates a string to find out if it represents a bool.
Returns True if string is yes, true, 1 or on. Otherwise False. This function is case-insensitive.
Definition at line 55 of file String.cpp.
const Eigen::VectorXd & precice::utils::delinearize | ( | int | toDelinearize, |
int | dimensions ) |
Definition at line 24 of file Dimensions.cpp.
std::size_t precice::utils::editDistance | ( | std::string_view | s1, |
std::string_view | s2 ) |
std::pair< InputIt, InputIt > precice::utils::find_first_range | ( | InputIt | first, |
InputIt | last, | ||
Predicate | p ) |
Finds the first range in [first, last[ that fulfills a predicate.
Definition at line 212 of file algorithm.hpp.
auto precice::utils::firstN | ( | const Eigen::PlainObjectBase< Derived > & | val, |
unsigned | n ) -> const Eigen::Map<const Eigen::Matrix<typename Derived::Scalar, 1, Eigen::Dynamic>> |
Maps the first at most n values of an Eigen object to a row vector
[in] | val | the Eigen object to map from |
Definition at line 58 of file EigenHelperFunctions.hpp.
void precice::utils::for_each_unique | ( | InputIt | first, |
InputIt | last, | ||
Unary | func ) |
Calls each value in the range of [first, last[ exactly once.
Definition at line 198 of file algorithm.hpp.
std::string precice::utils::format_or_error | ( | std::string_view | fmt, |
A &&... | args ) |
|
inline |
|
inline |
Definition at line 25 of file TypeNames.hpp.
|
inline |
Definition at line 15 of file TypeNames.hpp.
|
inline |
Definition at line 30 of file TypeNames.hpp.
|
inline |
Definition at line 20 of file TypeNames.hpp.
|
inline |
Definition at line 35 of file TypeNames.hpp.
void precice::utils::ignore | ( | Arguments && | ... | ) |
Ignores all inputs to prevent warnings about unused variables
Don't worry compiers will optimize this and unneeded arguments away even at -O1.
Definition at line 10 of file ignore.hpp.
void precice::utils::intersperse | ( | InputIter | first, |
InputIter | last, | ||
const ElementType & | elem, | ||
std::ostream & | out ) |
intersperse a the range [first, last[ with a given element.
This results in a range [first, elem, first+1, elem, ... , elem, last[
InputIter | the type of the input iterators |
ElementType | the type of the element to intersperse |
Definition at line 93 of file algorithm.hpp.
bool precice::utils::isMachineBigEndian | ( | ) |
Returns true if machine is big-endian needed for parallel vtk output.
Definition at line 5 of file Helpers.cpp.
|
inline |
Returns true, if numerical truncation happens in case of type conversion.
Definition at line 14 of file Helpers.hpp.
|
inline |
Returns true if the argument represents a valid port.
Definition at line 21 of file Helpers.hpp.
int precice::utils::linearize | ( | const VECTOR_T & | toLinearize | ) |
auto precice::utils::make_array | ( | Elements &&... | elements | ) | -> std::array<typename std::common_type<Elements...>::type, sizeof...(Elements)> |
Function that generates an array from given elements.
Definition at line 51 of file algorithm.hpp.
std::pair< InputIt1, InputIt2 > precice::utils::mismatch | ( | InputIt1 | first1, |
InputIt1 | last1, | ||
InputIt2 | first2, | ||
InputIt2 | last2 ) |
|
inline |
|
inline |
|
inline |
std::ostream & precice::utils::operator<< | ( | std::ostream & | out, |
const Parallel::CommState & | value ) |
pretty printer for CommState
Definition at line 310 of file Parallel.cpp.
std::ostream & precice::utils::operator<< | ( | std::ostream & | out, |
const RangePreview< Iter > & | rp ) |
Allows streaming of RangePreview objects.
Definition at line 162 of file algorithm.hpp.
const RangePreview< Iter > precice::utils::previewRange | ( | Size | n, |
const Eigen::PlainObjectBase< Derived > & | eigen ) |
const RangePreview< Iter > precice::utils::previewRange | ( | Size | n, |
const Range & | range ) |
returns a display object which previews a range
The preview contains the first and last n elements and the minmax-elements.
Definition at line 173 of file algorithm.hpp.
void precice::utils::removeColumnFromMatrix | ( | Eigen::MatrixXd & | A, |
int | col ) |
Definition at line 38 of file EigenHelperFunctions.cpp.
auto precice::utils::reorder_array | ( | const std::array< Index, n > & | order, |
const std::array< T, n > & | elements ) -> std::array<T, n> |
Reorders an array given an array of unique indices.
Definition at line 180 of file algorithm.hpp.
void precice::utils::set_intersection_indices | ( | InputIt1 | ref1, |
InputIt1 | first1, | ||
InputIt1 | last1, | ||
InputIt2 | first2, | ||
InputIt2 | last2, | ||
OutputIt | d_first ) |
This function is by and large the same as std::set_intersection(). The only difference is that we don't return the intersection set itself, but we return the indices of elements in InputIt1
, which appear in both sets ( InputIt1
and InputIt2
) The implementation was taken from https://en.cppreference.com/w/cpp/algorithm/set_intersection#Version_1 with the only difference that we compute and store std::distance() (i.e. the indices) in the output iterator. Similar to the std function, this function operates on sorted ranges.
ref1 | The reference iterator, to which we compute the distance/indices. |
first1 | The begin of the first range we want to compute the intersection with |
last1 | The end of the first range we want to compute the intersection with |
first1 | The begin of the second range we want to compute the intersection with |
last1 | The end of the second range we want to compute the intersection with |
d_first | Beginning of the output range |
Definition at line 34 of file algorithm.hpp.
void precice::utils::shiftSetFirst | ( | Eigen::MatrixXd & | A, |
const Eigen::VectorXd & | v ) |
Definition at line 12 of file EigenHelperFunctions.cpp.
std::string precice::utils::truncate_wstring_to_string | ( | std::wstring | wstr, |
char | fill = '#' ) |
Converts a wstring to a string by truncating non-extended ascii characters.
[in] | wstr | the wide string to convert |
[in] | fill | the fill char to replace multibyte characters with |
Definition at line 65 of file String.cpp.
bool precice::utils::unique_elements | ( | const Container & | c, |
BinaryPredicate | p = {} ) |
Checks weather the given elements contains no duplicates.
Container | type of the passed container. |
BinaryPredicate | the predicate used to compare two elements for equality. |
c | the container to check for unique elements. |
Definition at line 64 of file algorithm.hpp.
std::string precice::utils::wrapText | ( | const std::string & | text, |
int | linewidth, | ||
int | indentation ) |
|
inline |
Exclusive "or" logical operation. Returns true, if either lhs or rhs are true.
Definition at line 27 of file Helpers.hpp.
|
staticconstexpr |
Definition at line 38 of file assertion.hpp.
const Eigen::VectorXd precice::utils::DELINEARIZE_2D[8] |
Definition at line 6 of file Dimensions.cpp.
const Eigen::VectorXd precice::utils::DELINEARIZE_3D[8] |
Definition at line 13 of file Dimensions.cpp.