criptic v1
Cosmic Ray Interstellar Propagation Tool using Itô Calculus
Loading...
Searching...
No Matches
GasTree.H
Go to the documentation of this file.
1
11 #ifndef _GASTREE_H_
12 #define _GASTREE_H_
13
14 #include <iostream>
15 #include <vector>
16 #include "../Definitions.H"
17 #include "../Core/FieldQty.H"
18 #include "../MPI/MPIUtil.H"
19 #include "../Utils/Constants.H"
20 #include "../Utils/Units.H"
21 #include "../Core/CRTree.H"
22 #include "../Losses/Losses.H"
23 #include "../Prob/Prob.H"
24 #include "../Propagation/Propagation.H"
25 #include "../Utils/Types.H"
26 #include "hdf5.h"
27
28 namespace criptic {
33 class GasNode{
34 public:
35
47 GasNode(IdxType first_, IdxType numPart_, int splitDim_, Real splitVal_,
48 RealBox bbox_, RealBox searchBox_,Real hMax_) :
49 first(first_), numPart(numPart_), splitDim(splitDim_), splitVal(splitVal_),
50 bbox(bbox_), searchBox(searchBox_), hMax(hMax_) {};
51
52 // Internal Data
63 };
64
75 class GasTree{
76 public:
84 GasTree(std::vector<RealVec> positions, std::vector<Real> smoothingLengths,
85 Real hLimit = 0, int leafSize_ = 16);
86
90 void buildTree();
91
96 static RealBox constructBox(std::vector<RealVec> positions);
97
103 static inline bool inBox(const RealVec& pos_, const RealBox& bx) {
104 return (pos_[0] > bx.lo[0] && pos_[0] < bx.hi[0] &&
105 pos_[1] > bx.lo[1] && pos_[1] < bx.hi[1] &&
106 pos_[2] > bx.lo[2] && pos_[2] < bx.hi[2]);
107 }
108
117 void partitionNode(GasNode& nd);
118
119
128 std::vector<IdxType> getIdxs(const RealVec& targetPos,
129 const Real smoothingScale = 1) const;
130
131 // Internal Data
132 private:
133 std::vector<RealVec> posArray;
134 std::vector<IdxType> idxs;
135 std::vector<Real> hs;
138 std::vector<GasNode> nodes;
140 };
141}
142
143 // _GASTREE_H_
144 #endif
A class to store information of nodes in a GasTree.
Definition GasTree.H:33
RealBox bbox
Definition GasTree.H:58
RealBox searchBox
Definition GasTree.H:59
IdxType first
Definition GasTree.H:53
Real hMax
Definition GasTree.H:62
GasNode(IdxType first_, IdxType numPart_, int splitDim_, Real splitVal_, RealBox bbox_, RealBox searchBox_, Real hMax_)
Construct a GasNode.
Definition GasTree.H:47
int splitDim
Definition GasTree.H:55
Real splitVal
Definition GasTree.H:57
IdxType numPart
Definition GasTree.H:54
A class to manage Gas packets for Lagrangian gas descriptions.
Definition GasTree.H:75
void partitionNode(GasNode &nd)
Partition a GasNode at the median point.
Definition GasTree.cpp:123
std::vector< IdxType > idxs
Definition GasTree.H:134
void buildTree()
Build a GasTree given that it has a well defined root node.
Definition GasTree.cpp:59
std::vector< GasNode > nodes
Definition GasTree.H:138
static RealBox constructBox(std::vector< RealVec > positions)
Construct a bounding box from a list of positions.
Definition GasTree.cpp:172
Real hLim
Definition GasTree.H:136
std::vector< RealVec > posArray
Definition GasTree.H:133
std::vector< IdxType > getIdxs(const RealVec &targetPos, const Real smoothingScale=1) const
Searches a GasTree to find indices of points close to the target.
Definition GasTree.cpp:190
int leafSize
Definition GasTree.H:139
static bool inBox(const RealVec &pos_, const RealBox &bx)
Determine if a position is inside a bounding box.
Definition GasTree.H:103
std::vector< Real > hs
Definition GasTree.H:135
Class that represents a 3D rectangular prism.
Definition RealBox.H:30
RealVec hi
Definition RealBox.H:166
RealVec lo
Definition RealBox.H:165
The primary namespace for criptic objects.
Definition AdvancePacket.H:25
std::vector< Real >::size_type IdxType
Definition Types.H:45
double Real
Definition Types.H:38