Loading...
Searching...
No Matches
PabloUniform.hpp
1/*---------------------------------------------------------------------------*\
2 *
3 * bitpit
4 *
5 * Copyright (C) 2015-2021 OPTIMAD engineering Srl
6 *
7 * -------------------------------------------------------------------------
8 * License
9 * This file is part of bitpit.
10 *
11 * bitpit is free software: you can redistribute it and/or modify it
12 * under the terms of the GNU Lesser General Public License v3 (LGPL)
13 * as published by the Free Software Foundation.
14 *
15 * bitpit is distributed in the hope that it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
18 * License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with bitpit. If not, see <http://www.gnu.org/licenses/>.
22 *
23 \*---------------------------------------------------------------------------*/
24
25#ifndef __BITPIT_PABLO_UNIFORM_HPP__
26#define __BITPIT_PABLO_UNIFORM_HPP__
27
28// =================================================================================== //
29// INCLUDES //
30// =================================================================================== //
31#include "ParaTree.hpp"
32
33namespace bitpit {
34
35 // =================================================================================== //
36 // TYPEDEFS //
37 // =================================================================================== //
38 typedef std::vector<bool> bvector;
39 typedef std::bitset<72> octantID;
40 typedef std::vector<Octant*> ptroctvector;
41 typedef ptroctvector::iterator octantIterator;
42 typedef std::vector<darray3> darray3vector;
43
44
45 // =================================================================================== //
46 // CLASS DEFINITION //
47 // =================================================================================== //
61 class PabloUniform : public ParaTree
62 {
63 // =================================================================================== //
64 // MEMBERS //
65 // =================================================================================== //
66 private:
67 darray3 m_origin;
68 double m_L;
69 double m_area;
70 double m_volume;
72 // =================================================================================== //
73 // CONSTRUCTORS AND OPERATORS
74 // =================================================================================== //
75
76 // =================================================================================== //
77 // METHODS
78 // =================================================================================== //
79 void __reset();
80 public:
81#if BITPIT_ENABLE_MPI==1
82 PabloUniform(const std::string &logfile = DEFAULT_LOG_FILE, MPI_Comm comm = MPI_COMM_WORLD);
83 PabloUniform(uint8_t dim, const std::string &logfile = DEFAULT_LOG_FILE, MPI_Comm comm = MPI_COMM_WORLD);
84 PabloUniform(double X, double Y, double Z, double L, uint8_t dim = 2, const std::string &logfile = DEFAULT_LOG_FILE, MPI_Comm comm = MPI_COMM_WORLD);
85#else
86 PabloUniform(const std::string &logfile = DEFAULT_LOG_FILE);
87 PabloUniform(uint8_t dim, const std::string &logfile = DEFAULT_LOG_FILE);
88 PabloUniform(double X, double Y, double Z, double L, uint8_t dim = 2, const std::string &logfile = DEFAULT_LOG_FILE);
89#endif
90
91 // =================================================================================== //
92 // METHODS
93 // =================================================================================== //
94 void reset() override;
95
96 int getDumpVersion() const override;
97 void dump(std::ostream &stream, bool full = true) override;
98 void restore(std::istream &stream) override;
99
100 // =================================================================================== //
101 // BASIC GET/SET METHODS //
102 // =================================================================================== //
103 darray3 getOrigin() const;
104 double getX0() const;
105 double getY0() const;
106 double getZ0() const;
107 double getL() const;
108 void setL(double L);
109 void setOrigin(const darray3 &origin);
110 double levelToSize( uint8_t level) const;
111
112 // =================================================================================== //
113 // INDEX BASED METHODS //
114 // =================================================================================== //
115 darray3 getCoordinates(uint32_t idx) const;
116 double getX(uint32_t idx) const;
117 double getY(uint32_t idx) const;
118 double getZ(uint32_t idx) const;
119 double getSize(uint32_t idx) const;
120 double getArea(uint32_t idx) const;
121 double getVolume(uint32_t idx) const;
122 void getCenter(uint32_t idx, darray3& center) const;
123 darray3 getCenter(uint32_t idx) const;
124 darray3 getFaceCenter(uint32_t idx, uint8_t iface) const;
125 void getFaceCenter(uint32_t idx, uint8_t iface, darray3& center) const;
126 darray3 getNode(uint32_t idx, uint8_t inode) const;
127 void getNode(uint32_t idx, uint8_t inode, darray3& node) const;
128 void getNodes(uint32_t idx, darr3vector & nodes) const;
129 darr3vector getNodes(uint32_t idx) const;
130 void getNormal(uint32_t idx, uint8_t iface, darray3 & normal) const;
131 darray3 getNormal(uint32_t idx, uint8_t iface) const;
132
133 // =================================================================================== //
134 // POINTER BASED METHODS //
135 // =================================================================================== //
136 darray3 getCoordinates(const Octant* oct) const;
137 double getX(const Octant* oct) const;
138 double getY(const Octant* oct) const;
139 double getZ(const Octant* oct) const;
140 double getSize(const Octant* oct) const;
141 double getArea(const Octant* oct) const;
142 double getVolume(const Octant* oct) const;
143 void getCenter(const Octant* oct, darray3& center) const;
144 darray3 getCenter(const Octant* oct) const;
145 darray3 getFaceCenter(const Octant* oct, uint8_t iface) const;
146 void getFaceCenter(const Octant* oct, uint8_t iface, darray3& center) const;
147 darray3 getNode(const Octant* oct, uint8_t inode) const;
148 void getNode(const Octant* oct, uint8_t inode, darray3& node) const;
149 void getNodes(const Octant* oct, darr3vector & nodes) const;
150 darr3vector getNodes(const Octant* oct) const;
151 void getNormal(const Octant* oct, uint8_t iface, darray3 & normal) const;
152 darray3 getNormal(const Octant* oct, uint8_t iface) const;
153
154 // =================================================================================== //
155 // LOCAL TREE GET/SET METHODS //
156 // =================================================================================== //
157 double getLocalMaxSize() const;
158 double getLocalMinSize() const;
159 void getBoundingBox(darray3 & P0, darray3 & P1) const;
160
161 // =================================================================================== //
162 // INTERSECTION GET/SET METHODS //
163 // =================================================================================== //
164 double getSize(const Intersection* inter) const;
165 double getArea(const Intersection* inter) const;
166 darray3 getCenter(const Intersection* inter) const;
167 darr3vector getNodes(const Intersection* inter) const;
168 darray3 getNormal(const Intersection* inter) const;
169
170 // =================================================================================== //
171 // OTHER OCTANT BASED METHODS //
172 // =================================================================================== //
173 Octant* getPointOwner(darray3 point);
174 uint32_t getPointOwnerIdx(darray3 point) const;
175 Octant* getPointOwner(darray3 point, bool & isghost);
176 uint32_t getPointOwnerIdx(darray3 point, bool & isghost) const;
177 int getPointOwnerRank(darray3 point);
178
179 // =================================================================================== //
180 // OTHER PARATREE BASED METHODS //
181 // =================================================================================== //
182 darray3 getNodeCoordinates(uint32_t inode) const;
183
184 // =================================================================================== //
185 // TESTING OUTPUT METHODS //
186 // =================================================================================== //
187 void write(const std::string &filename);
188 void writeTest(const std::string &filename, dvector data);
189 };
190
191}
192
193#endif /* __BITPIT_PABLO_UNIFORM_HPP__ */
Intersection class definition.
Octant class definition.
Definition Octant.hpp:89
PABLO Uniform is an example of user class derived from ParaTree to map ParaTree in a uniform (square/...
double getLocalMinSize() const
void setOrigin(const darray3 &origin)
void restore(std::istream &stream) override
void getNormal(uint32_t idx, uint8_t iface, darray3 &normal) const
double getSize(uint32_t idx) const
int getPointOwnerRank(darray3 point)
double getArea(uint32_t idx) const
void write(const std::string &filename)
void dump(std::ostream &stream, bool full=true) override
double getZ(uint32_t idx) const
int getDumpVersion() const override
void writeTest(const std::string &filename, dvector data)
Octant * getPointOwner(darray3 point)
darray3 getOrigin() const
darray3 getNode(uint32_t idx, uint8_t inode) const
darray3 getFaceCenter(uint32_t idx, uint8_t iface) const
double getVolume(uint32_t idx) const
uint32_t getPointOwnerIdx(darray3 point) const
void getBoundingBox(darray3 &P0, darray3 &P1) const
void getCenter(uint32_t idx, darray3 &center) const
double getY(uint32_t idx) const
void reset() override
double levelToSize(uint8_t level) const
double getLocalMaxSize() const
darray3 getCoordinates(uint32_t idx) const
darray3 getNodeCoordinates(uint32_t inode) const
PabloUniform(const std::string &logfile=DEFAULT_LOG_FILE, MPI_Comm comm=MPI_COMM_WORLD)
double getX(uint32_t idx) const
Para Tree is the user interface class.
Definition ParaTree.hpp:113
const u32arr3vector & getNodes() const
static BITPIT_PUBLIC_API const std::string DEFAULT_LOG_FILE
Definition ParaTree.hpp:119
--- layout: doxygen_footer ---