28 extern void updateQtGui(
bool full,
int frame,
float time,
const std::string& curPlugin);
31 inline void updateQtGui(
bool full,
int frame,
float time,
const std::string& curPlugin) {}
43 class Error :
public std::exception
46 Error(
const std::string& s) : mS(s) {
49 std::cerr <<
"Aborting: "<< s <<
" \n";
51 *(
volatile int*)(0) = 1;
54 virtual ~
Error()
throw() {}
55 virtual const char* what()
const throw() {
return mS.c_str(); }
61 #define unusedParameter(x) ((void)x) 64 extern int gDebugLevel;
66 #define MSGSTREAM std::ostringstream msg; msg.precision(7); msg.width(9); 67 #define debMsg(mStr, level) if (_chklevel(level)) { MSGSTREAM; msg << mStr; std::cout << msg.str() << std::endl; } 68 inline bool _chklevel(
int level=0) {
return gDebugLevel >= level; }
72 # define DEBUG_ONLY(a) a 74 # define DEBUG_ONLY(a) 76 #define throwError(msg) { std::ostringstream __s; __s << msg << std::endl << "Error raised in " << __FILE__ << ":" << __LINE__; throw Manta::Error(__s.str()); } 77 #define errMsg(msg) throwError(msg); 78 #define assertMsg(cond,msg) if(!(cond)) throwError(msg) 79 #define assertDeb(cond,msg) DEBUG_ONLY( assertMsg(cond,msg) ) 89 typedef long long IndexInt;
113 MuTime operator/(
unsigned long a) {
MuTime b; b.time = time / a;
return b; };
114 MuTime& operator+=(
const MuTime& a) { time += a.time;
return *
this; }
115 MuTime& operator-=(
const MuTime& a) { time -= a.time;
return *
this; }
116 MuTime& operator/=(
unsigned long a) { time /= a;
return *
this; }
117 std::string toString();
119 void clear() { time = 0; }
125 std::ostream& operator<< (std::ostream& os,
const MuTime& t);
131 template<
class T>
inline T square(T a) {
134 template<
class T>
inline T cubed(T a) {
138 template<
class T>
inline T clamp(
const T& val,
const T& vmin,
const T& vmax) {
139 if (val < vmin)
return vmin;
140 if (val > vmax)
return vmax;
144 template<
class T>
inline T nmod(
const T& a,
const T& b);
145 template<>
inline int nmod(
const int& a,
const int& b) {
int c=a%b;
return (c<0) ? (c+b) : c; }
146 template<>
inline float nmod(
const float& a,
const float& b) {
float c=std::fmod(a,b);
return (c<0) ? (c+b) : c; }
147 template<>
inline double nmod(
const double& a,
const double& b) {
double c=std::fmod(a,b);
return (c<0) ? (c+b) : c; }
149 template<
class T>
inline T safeDivide(
const T& a,
const T& b);
150 template<>
inline int safeDivide<int>(
const int &a,
const int& b) {
return (b) ? (a/b) : a; }
151 template<>
inline float safeDivide<float>(
const float &a,
const float& b) {
return (b) ? (a/b) : a; }
152 template<>
inline double safeDivide<double>(
const double &a,
const double& b) {
return (b) ? (a/b) : a; }
154 inline bool c_isnan(
float c) {
Definition: commonkernels.h:22
std::string buildInfoString()
print info about this mantaflow build, used eg by printBuildInfo in fluidsolver.cpp ...
Definition: general.cpp:102
Timing class for preformance measuring.
Definition: general.h:109