Dendro  5.01
Dendro in Greek language means tree. The Dendro library is a large scale (262K cores on ORNL's Titan) distributed memory adaptive octree framework. The main goal of Dendro is to perform large scale multiphysics simulations efficeiently in mordern supercomputers. Dendro consists of efficient parallel data structures and algorithms to perform variational ( finite element) methods and finite difference mthods on 2:1 balanced arbitary adaptive octrees which enables the users to perform simulations raning from black holes (binary black hole mergers) to blood flow in human body, where applications ranging from relativity, astrophysics to biomedical engineering.
binUtils.h
Go to the documentation of this file.
1 
8 #ifndef __BIN_UTILS_H_
9 #define __BIN_UTILS_H_
10 #include <vector>
11 
17 namespace binOp{
18 
22  bool isPowerOfTwo(unsigned int n);
23 
27  unsigned int binLength(unsigned int num) ;
28 
32  unsigned int fastLog2(unsigned int num) ;
33 
41  int toBin(unsigned int dec, unsigned int binLen, std::vector<bool>& result);
42 
48  unsigned int binToDec(unsigned int* numBin, unsigned int binLen) ;
49 
53  int getNextHighestPowerOfTwo(unsigned int n);
54 
58  int getPrevHighestPowerOfTwo(unsigned int n);
59 
60 
62  template <typename T>
63  inline void setBit(T& val, unsigned int i)
64  {
65  val=(((T)1<<i)|val);
66  }
67 
69  template<typename T>
70  inline unsigned int getBit(T val, unsigned int i)
71  {
72  return (val >> i) & 1;
73  }
74 
75 
76 
77 }//end namespace
78 
79 #endif
int getNextHighestPowerOfTwo(unsigned int n)
Definition: binUtils.cpp:61
unsigned int fastLog2(unsigned int num)
Definition: binUtils.cpp:15
unsigned int binLength(unsigned int num)
Definition: binUtils.cpp:24
int getPrevHighestPowerOfTwo(unsigned int n)
Definition: binUtils.cpp:75
int toBin(unsigned int dec, unsigned int binLen, std::vector< bool > &result)
Converts a decimal number to binary.
Definition: binUtils.cpp:33
A set of functions for fast binary operations.
void setBit(T &val, unsigned int i)
sets the i^th bit on the value val
Definition: binUtils.h:63
bool isPowerOfTwo(unsigned int n)
Definition: binUtils.cpp:56
unsigned int getBit(T val, unsigned int i)
gets the i^th bit on the value val
Definition: binUtils.h:70
unsigned int binToDec(unsigned int *numBin, unsigned int binLen)
Definition: binUtils.cpp:47