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.
matRecord.h
1 //
2 // Created by milinda on 12/20/18.
3 //
4 
12 #ifdef BUILD_WITH_PETSC
13  #include "petsc.h"
14 #endif
15 
16 #include <iostream>
17 #include <ostream>
18 #include "dendro.h"
19 
20 #ifndef DENDRO_5_0_MATRECORD_H
21 #define DENDRO_5_0_MATRECORD_H
22 
23 namespace ot
24 {
25 
26  class MatRecord {
27 
28  private:
30  unsigned int m_uiRowID;
32  unsigned int m_uiColID;
34  unsigned int m_uiRowDim;
36  unsigned int m_uiColDim;
37 
38 #ifdef BUILD_WITH_PETSC
39 
40  PetscScalar m_uiVal;
41 #else
42 
43  DendroScalar m_uiVal;
44 #endif
45 
46  public:
47 
52  m_uiRowID = m_uiColID = m_uiRowDim = m_uiColDim = static_cast<unsigned int>(-1);
53  m_uiVal = 0;
54  }
55 
57  inline unsigned int getRowID() const {return m_uiRowID;}
59  inline unsigned int getColID() const {return m_uiColID;}
61  inline unsigned int getRowDim() const {return m_uiRowDim;}
63  inline unsigned int getColDim() const {return m_uiColDim;}
64 
66  inline void setRowID(unsigned int rowID) {m_uiRowID=rowID;}
67 
69  inline void setColID(unsigned int colID) {m_uiColID=colID;}
70 
72  inline void setRowDim(unsigned int rowDim) {m_uiRowDim=rowDim;}
73 
75  inline void setColDim(unsigned int colDim) {m_uiColDim=colDim;}
76 
77 
78 #ifdef BUILD_WITH_PETSC
79 
88  MatRecord(unsigned int rowID, unsigned int colID, unsigned int rowDim, unsigned int colDim, PetscScalar value)
89  {
90  m_uiRowID=rowID;
91  m_uiColID=colID;
92 
93  m_uiRowDim=rowDim;
94  m_uiColDim=colDim;
95 
96  m_uiVal=value;
97 
98  }
99 
100 
101 
103  inline PetscScalar getMatVal() const {return m_uiVal;}
104 
106  inline void setMatValue(PetscScalar value) {m_uiVal=value;}
107 
108 #else
109 
118  MatRecord(unsigned int rowID, unsigned int colID, unsigned int rowDim, unsigned int colDim, DendroScalar value)
119  {
120  m_uiRowID=rowID;
121  m_uiColID=colID;
122 
123  m_uiRowDim=rowDim;
124  m_uiColDim=colDim;
125 
126  m_uiVal=value;
127 
128  }
129 
130 
131 
133  inline DendroScalar getMatVal() const {return m_uiVal;}
134 
136  inline void setMatValue(DendroScalar value) {m_uiVal=value;}
137 
138 #endif
139 
141  MatRecord(const MatRecord & other) {
142  m_uiRowID = other.getRowID();
143  m_uiColID = other.getColID();
144  m_uiRowDim = other.getRowDim();
145  m_uiColDim = other.getColDim();
146  m_uiVal = other.getMatVal();
147  }
148 
149 
151  MatRecord & operator = (MatRecord const & other) {
152  if(this == (&other)) {return *this;}
153  m_uiRowID = other.getRowID();
154  m_uiColID = other.getColID();
155  m_uiRowDim = other.getRowDim();
156  m_uiColDim = other.getColDim();
157  m_uiVal = other.getMatVal();
158  return *this;
159  }
160 
162  bool operator == ( MatRecord const &other) const {
163  return ( (m_uiRowID == other.getRowID()) && (m_uiColID == other.getColID())
164  && (m_uiVal == other.getMatVal()) && (m_uiRowDim == other.getRowDim()) && (m_uiColDim == other.getColDim()) );
165  }
166 
168  bool operator != (MatRecord const &other) const {
169  return (!((*this) == other));
170  }
171 
173  bool operator < (MatRecord const &other) const {
174  if(m_uiRowID < other.getRowID()) {
175  return true;
176  }else if(m_uiRowID == other.getRowID()) {
177  if(m_uiRowDim < other.getRowDim()) {
178  return true;
179  }else if(m_uiRowDim == other.getRowDim()) {
180  if(m_uiColID < other.getColID()) {
181  return true;
182  }else if (m_uiColID == other.getColID()) {
183  if(m_uiColDim < other.getColDim()) {
184  return true;
185  }else if(m_uiColDim == other.getColDim()) {
186  return (m_uiVal < other.getMatVal());
187  }else {
188  return false;
189  }
190  }else {
191  return false;
192  }
193  }else {
194  return false;
195  }
196  }else {
197  return false;
198  }
199  }
200 
202  bool operator > (MatRecord const &other) const {
203  return ( (!((*this) < other)) && ((*this) != other) );
204  }
205 
207  bool operator <= (MatRecord const &other) const {
208  return ( ((*this) < other) || ((*this) == other) );
209  }
210 
212  bool operator >= (MatRecord const &other) const {
213  return (!((*this) < other)) ;
214  }
215 
216  friend std::ostream & operator<< (std::ostream & os, MatRecord const & re)
217  {
218  return (os << " row : "<<re.getRowID() << " col: "<<re.getColID()<<" rdim: "<<re.getRowDim()<<" cdim: "<<re.getColDim() );
219  }
220 
221 
222 
223  };
224 
225 
226 }
227 
228 
229 
230 
231 
232 #endif //DENDRO_5_0_MATRECORD_H
void setRowDim(unsigned int rowDim)
sets the rowDim value
Definition: matRecord.h:72
MatRecord(unsigned int rowID, unsigned int colID, unsigned int rowDim, unsigned int colDim, DendroScalar value)
Definition: matRecord.h:118
DendroScalar getMatVal() const
returns the entry value
Definition: matRecord.h:133
bool operator>(MatRecord const &other) const
Overloaded > Operator.
Definition: matRecord.h:202
Simple class to manage async data transfer in the ODA class.
Definition: asyncExchangeContex.h:16
bool operator<=(MatRecord const &other) const
Overloaded <= Operator.
Definition: matRecord.h:207
MatRecord & operator=(MatRecord const &other)
The assignment operator.
Definition: matRecord.h:151
MatRecord()
The default constructor.
Definition: matRecord.h:51
unsigned int getColDim() const
return the col dof
Definition: matRecord.h:63
unsigned int getRowDim() const
return the row dof
Definition: matRecord.h:61
void setColDim(unsigned int colDim)
sets the colDim value
Definition: matRecord.h:75
void setMatValue(DendroScalar value)
sets matrix value
Definition: matRecord.h:136
Definition: matRecord.h:26
bool operator!=(MatRecord const &other) const
Overloaded != Operator.
Definition: matRecord.h:168
MatRecord(const MatRecord &other)
The copy constructor.
Definition: matRecord.h:141
bool operator>=(MatRecord const &other) const
Overloaded >= Operator.
Definition: matRecord.h:212
void setRowID(unsigned int rowID)
sets the rowID value
Definition: matRecord.h:66
bool operator<(MatRecord const &other) const
Overloaded < Operator.
Definition: matRecord.h:173
bool operator==(MatRecord const &other) const
Overloaded == Operator.
Definition: matRecord.h:162
unsigned int getRowID() const
returns the row ID
Definition: matRecord.h:57
void setColID(unsigned int colID)
sets the rowID value
Definition: matRecord.h:69
unsigned int getColID() const
returns the col ID
Definition: matRecord.h:59