Zoltan2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Zoltan2_Util.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Zoltan2: A package of combinatorial algorithms for scientific computing
4 //
5 // Copyright 2012 NTESS and the Zoltan2 contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
16 #ifndef ZOLTAN2_UTIL_HPP
17 #define ZOLTAN2_UTIL_HPP
18 
19 #include <Zoltan2_Standards.hpp>
20 #include <Teuchos_DefaultComm.hpp>
21 #include <stdexcept>
22 
23 namespace Zoltan2{
24 
25 long getProcessKilobytes();
26 
27 template <typename scalar_t>
28  inline bool outsideRegion(scalar_t val, scalar_t mark, double epsilon){
29  return ((val < mark-epsilon) || (val > mark+epsilon));
30 }
31 
32 static inline void
33 AssertCondition(bool condition, const std::string &message,
34  const char *file = __FILE__, int line = __LINE__) {
35  if (!condition) {
36  std::ostringstream eMsg;
37  eMsg << "Error: " << file << ", " << line << ": " << message
38  << std::endl;
39  throw std::runtime_error(eMsg.str());
40  }
41 }
42 
43 } // namespace Zoltan2
44 
45 #endif
static void AssertCondition(bool condition, const std::string &message, const char *file=__FILE__, int line=__LINE__)
long getProcessKilobytes()
#define epsilon
Definition: nd.cpp:47
Gathering definitions used in software development.
bool outsideRegion(scalar_t val, scalar_t mark, double epsilon)