BioDynaMo  v1.05.120-25dc9790
debug.h
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------
2 //
3 // Copyright (C) 2021 CERN & University of Surrey for the benefit of the
4 // BioDynaMo collaboration. All Rights Reserved.
5 //
6 // Licensed under the Apache License, Version 2.0 (the "License");
7 // you may not use this file except in compliance with the License.
8 //
9 // See the LICENSE file distributed with this work for details.
10 // See the NOTICE file distributed with this work for additional information
11 // regarding copyright ownership.
12 //
13 // -----------------------------------------------------------------------------
14 
15 #ifndef CORE_UTIL_DEBUG_H_
16 #define CORE_UTIL_DEBUG_H_
17 
18 #include <algorithm>
19 #include <array>
20 #include <iomanip>
21 #include <iostream>
22 
24 
25 template <typename T>
26 inline void debug_print(const std::string& name, T t) {
27  std::cout << name << " = " << t << std::endl;
28 }
29 
30 // Convenience macro to quickly print out values of variables
31 // Usage: BDM_PRINT_DEBUG(foo)
32 // Output on terminal: $ foo = <value_of_foo>
33 // arg must be printable
34 #define BDM_PRINT_DEBUG(arg) debug_print(#arg, arg);
35 
36 inline void Print(const bdm::Real3& a, int precision = 10) {
37  std::cout << std::setprecision(precision) << a[0] << ", " << a[1] << ", "
38  << a[2] << std::endl;
39 }
40 
41 #endif // CORE_UTIL_DEBUG_H_
Print
void Print(const bdm::Real3 &a, int precision=10)
Definition: debug.h:36
debug_print
void debug_print(const std::string &name, T t)
Definition: debug.h:26
math_array.h
bdm::MathArray< real_t, 3 >