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.
point.h
1 
7 /***************************************************************************
8  * Copyright (C) 2005 by Hari sundar *
9  * hsundar@seas.upenn.edu *
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  * This program is distributed in the hope that it will be useful, *
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
19  * GNU General Public License for more details. *
20  * *
21  * You should have received a copy of the GNU General Public License *
22  * along with this program; if not, write to the *
23  * Free Software Foundation, Inc., *
24  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
25 ***************************************************************************/
26 #ifndef __POINT_H
27 #define __POINT_H
28 
29 #include <cmath>
30 #include "mpi.h"
31 
36 class Point{
37  public:
38 
41  Point();
42  // virtual ~Point();
43 
44  Point(double newx, double newy, double newz);
45  Point(int newx, int newy, int newz);
46  Point(unsigned int newx, unsigned int newy, unsigned int newz);
47  Point(const Point &newpoint);
49 
52  const double& x() const {return _x; };
53  const double& y() const {return _y; };
54  const double& z() const {return _z; };
55 
56  int xint() const {return static_cast<int>(_x); };
57  int yint() const {return static_cast<int>(_y); };
58  int zint() const {return static_cast<int>(_z); };
60 
63  Point operator-() const;
64 
65  void operator += (const Point &other);
66  void operator /= (const int divisor);
67  void operator /= (const double divisor);
68  void operator *= (const int factor);
69  void operator *= (const double factor);
70 
71  Point& operator=(const Point &other);
72  Point operator+(const Point &other);
73  Point operator-(const Point &other);
74  Point operator-(const Point &other) const;
75 
76  Point operator/(const double divisor);
77  Point operator*(const double factor);
78 
79  double magnitude();
80 
81  inline bool operator != (const Point &other) { return ( (xint() != other.xint() ) || (yint() != other.yint()) || (zint() != other.zint())); };
82 
83  inline bool operator == (const Point &other) { return ( ( xint() == other.xint() ) && ( yint() == other.yint()) && ( zint() == other.zint())); };
85 
86  inline double dot(Point Other) {
87  return (_x*Other._x+_y*Other._y+_z*Other._z);
88  };
89 
90  inline Point cross(Point Other){
91  return Point(_y*Other._z-Other._y*_z, _z*Other._x-_x*Other._z,
92  _x*Other._y-_y*Other._x);
93  };
94 
95  inline double abs(){
96  return sqrt(_x*_x+_y*_y+_z*_z);
97  };
98 
99  void normalize();
100 
101  static Point TransMatMultiply( double* transMat, Point inPoint);
102  protected:
103  double _x;
104  double _y;
105  double _z;
106 };
107 
108 
109 
110 namespace par {
111 
112  //Forward Declaration
113  template <typename T>
114  class Mpi_datatype;
115 
116  template <>
117  class Mpi_datatype<Point > {
118 
119 
120  static void Point_SUM(void *in, void *inout, int* len, MPI_Datatype * dptr) {
121  for(int i = 0; i < (*len); i++) {
122  Point p1 = (static_cast<Point*>(in))[i];
123  Point p2 = (static_cast<Point*>(inout))[i];
124  (static_cast<Point*>(inout))[i] +=p1;
125  }//end for
126  }//end function
127 
128 
129  public:
133  static MPI_Op _SUM() {
134  static bool first = true;
135  static MPI_Op sum;
136  if (first) {
137  first = false;
138  MPI_Op_create(Mpi_datatype<Point>::Point_SUM ,true ,&sum);
139  }
140  return sum;
141  }
142 
146  static MPI_Datatype value()
147  {
148  static bool first = true;
149  static MPI_Datatype datatype;
150 
151  if (first)
152  {
153  first = false;
154  MPI_Type_contiguous(sizeof(Point), MPI_BYTE, &datatype);
155  MPI_Type_commit(&datatype);
156  }
157 
158  return datatype;
159  }
160 
161  };
162 
163 }//end namespace par
164 
165 
166 #endif // POINT_H
static MPI_Datatype value()
Definition: point.h:146
A point class.
Definition: point.h:36
static MPI_Op _SUM()
define MPI_SUM operator on Points
Definition: point.h:133
An abstract class used for communicating messages using user-defined datatypes. The user must impleme...
Definition: zoltan_hilbert.h:76
Collection of Generic Parallel Functions: Sorting, Partitioning, Searching,...
Definition: zoltan_hilbert.h:72