The axom::utilities
namespace contains basic commonly-used functions. Often these started out in another Axom component and were "promoted" to Axom Core when they were useful in other Axom libraries. In some cases, axom::utilities
brings functionality from recent C++ standards to platforms restricted to older compilers.
Axom can print a self-explanatory message and provide a version string.
../../examples/core_utilities.cpp
Here a function showing the usage of string and filesystem facilities available in Axom Core.
../../examples/core_utilities.cpp
Axom Core also includes a Timer
class. Here, we time the preceding filesystem example snippet.
../../examples/core_utilities.cpp
There are several other utility functions. Some are numerical functions such as variations on clamp
(ensure a variable is restricted to a given range) and swap
(exchange the values of two variables). There are also functions for testing values with tolerances, such as isNearlyEqual
and isNearlyEqualRelative
. These are provided since they work in device (GPU) kernel code, wheras C++ standard library routines do not. There is also processAbort
, to gracefully exit an application. For details, please see the Axom Core API Documentation.