Skip to content

Commit

Permalink
PABLO: fix indentation of Octant.hpp
Browse files Browse the repository at this point in the history
  • Loading branch information
edoardolombardi authored and andrea-iob committed Mar 25, 2020
1 parent 9934f09 commit d0869b8
Showing 1 changed file with 148 additions and 146 deletions.
294 changes: 148 additions & 146 deletions src/PABLO/Octant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
#include "bitpit_containers.hpp"

namespace bitpit {
class Octant;

class Octant;

}

bitpit::IBinaryStream& operator>>(bitpit::IBinaryStream &buffer, bitpit::Octant& octant);
Expand All @@ -47,57 +49,57 @@ namespace bitpit {
// =================================================================================== //
// TYPEDEFS
// =================================================================================== //
typedef std::vector<uint8_t> u8vector;
typedef std::vector<uint32_t> u32vector;
typedef std::vector<uint64_t> u64vector;
typedef std::vector<double> dvector;
typedef std::array<double, 3> darray3;
typedef std::array<int8_t, 3> i8array3;
typedef std::array<uint32_t, 3> u32array3;
typedef std::vector<std::vector<uint32_t> > u32vector2D;
typedef std::vector<std::vector<uint64_t> > u64vector2D;
typedef std::vector<u32array3> u32arr3vector;
typedef std::vector<uint8_t> u8vector;
typedef std::vector<uint32_t> u32vector;
typedef std::vector<uint64_t> u64vector;
typedef std::vector<double> dvector;
typedef std::array<double, 3> darray3;
typedef std::array<int8_t, 3> i8array3;
typedef std::array<uint32_t, 3> u32array3;
typedef std::vector<std::vector<uint32_t>> u32vector2D;
typedef std::vector<std::vector<uint64_t>> u64vector2D;
typedef std::vector<u32array3> u32arr3vector;

// =================================================================================== //
// CLASS DEFINITION //
// =================================================================================== //
/*!
* \ingroup PABLO
* \date 10/dec/2015
* \authors Edoardo Lombardi
* \authors Marco Cisternino
* \copyright Copyright (C) 2015-2019 OPTIMAD engineering srl. All rights reserved.
* \ingroup PABLO
* \date 10/dec/2015
* \authors Edoardo Lombardi
* \authors Marco Cisternino
* \copyright Copyright (C) 2015-2019 OPTIMAD engineering srl. All rights reserved.
*
* \brief Octant class definition
* \brief Octant class definition
*
* Octants are the grid elements of PABLO. In the logical domain octants are
* squares or cubes, depending on dimension, with size function of their level.
* Each octant has nodes and faces ordered with Z-order.
* \image html PabloOctant.png
* \image html PabloOctant3D.png
* The main feature of each octant are:
* - x,y,z : coordinates of the node 0 of the octant;
* - Morton index : classical Morton index defined anly by the coordinates
* (info about level used additionally for equality operator);
* - marker : refinement marker can assume negative, positive or zero values, wich mean
* a coarsening, refinement and none adaptation respectively;
* - level : octant level in the octree, zero for the first upper level.
* - balance : flag to fix if the octant has to 2:1 balanced with respect
* to its face neighbours.
* Octants are the grid elements of PABLO. In the logical domain octants are
* squares or cubes, depending on dimension, with size function of their level.
* Each octant has nodes and faces ordered with Z-order.
* \image html PabloOctant.png
* \image html PabloOctant3D.png
* The main feature of each octant are:
* - x,y,z : coordinates of the node 0 of the octant;
* - Morton index : classical Morton index defined anly by the coordinates
* (info about level used additionally for equality operator);
* - marker : refinement marker can assume negative, positive or zero values, wich mean
* a coarsening, refinement and none adaptation respectively;
* - level : octant level in the octree, zero for the first upper level.
* - balance : flag to fix if the octant has to 2:1 balanced with respect
* to its face neighbours.
*
*/
class Octant{

// =================================================================================== //
// FRIENDSHIPS
// =================================================================================== //
// =================================================================================== //
// FRIENDSHIPS
// =================================================================================== //

friend class LocalTree;
friend class ParaTree;
friend class LocalTree;
friend class ParaTree;
friend class Global;

friend bitpit::OBinaryStream& (::operator<<) (bitpit::OBinaryStream& buf, const Octant& octant);
friend bitpit::IBinaryStream& (::operator>>) (bitpit::IBinaryStream& buf, Octant& octant);
friend bitpit::OBinaryStream& (::operator<<) (bitpit::OBinaryStream& buf, const Octant& octant);
friend bitpit::IBinaryStream& (::operator>>) (bitpit::IBinaryStream& buf, Octant& octant);


// =================================================================================== //
Expand All @@ -106,9 +108,9 @@ class Octant{

static const TreeConstants::Instances sm_treeConstants; /**< Static member for internal use. */

// =================================================================================== //
// MEMBERS
// =================================================================================== //
// =================================================================================== //
// MEMBERS
// =================================================================================== //
enum OctantInfo {
INFO_BOUNDFACE0 = 0, /**< Identifier to access face bound information in bitset info for face 0 */
INFO_BOUNDFACE1 = 1, /**< Identifier to access face bound information in bitset info for face 1 */
Expand All @@ -131,127 +133,127 @@ class Octant{
};

private:
uint32_t m_x; /**< Coordinate x */
uint32_t m_y; /**< Coordinate y */
uint32_t m_z; /**< Coordinate z (2D case = 0)*/
uint8_t m_level; /**< Refinement level (0=root) */
int8_t m_marker; /**< Set for Refinement(m>0) or Coarsening(m<0) |m|-times */
std::bitset<INFO_ITEM_COUNT> m_info; /**< -Info[0..5]: true if 0..5 face is a boundary face [bound] \n
-Info[6..11]: true if 0..6 face is a process boundary face [pbound] \n
-Info[12/13]: true if octant is new after refinement/coarsening \n
-Info[14] : true if balancing is required for this octant \n
-Info[15] : Aux */
uint8_t m_dim; /**< Dimension of octant (2D/3D) */
int m_ghost; /**< Ghost specifier:\n
-1 : internal, \n
0 : ghost in the 0-th layer of the halo, \n
1 : ghost in the 1-st layer of the halo, \n
... \n
n : ghost in the n-th layer of the halo. */
uint32_t m_x; /**< Coordinate x */
uint32_t m_y; /**< Coordinate y */
uint32_t m_z; /**< Coordinate z (2D case = 0)*/
uint8_t m_level; /**< Refinement level (0=root) */
int8_t m_marker; /**< Set for Refinement(m>0) or Coarsening(m<0) |m|-times */
std::bitset<INFO_ITEM_COUNT> m_info; /**< -Info[0..5]: true if 0..5 face is a boundary face [bound] \n
-Info[6..11]: true if 0..6 face is a process boundary face [pbound] \n
-Info[12/13]: true if octant is new after refinement/coarsening \n
-Info[14] : true if balancing is required for this octant \n
-Info[15] : Aux */
uint8_t m_dim; /**< Dimension of octant (2D/3D) */
int m_ghost; /**< Ghost specifier:\n
-1 : internal, \n
0 : ghost in the 0-th layer of the halo, \n
1 : ghost in the 1-st layer of the halo, \n
... \n
n : ghost in the n-th layer of the halo. */

//TODO add bitset for edge & node
//TODO add bitset for edge & node

// =================================================================================== //
// CONSTRUCTORS AND OPERATORS
// =================================================================================== //
// =================================================================================== //
// CONSTRUCTORS AND OPERATORS
// =================================================================================== //
public:
Octant();
Octant();
private:
Octant(uint8_t dim);
Octant(uint8_t dim, uint8_t level, int32_t x, int32_t y, int32_t z = 0);
Octant(bool bound, uint8_t dim, uint8_t level, int32_t x, int32_t y, int32_t z = 0);
bool operator ==(const Octant & oct2);
Octant(uint8_t dim);
Octant(uint8_t dim, uint8_t level, int32_t x, int32_t y, int32_t z = 0);
Octant(bool bound, uint8_t dim, uint8_t level, int32_t x, int32_t y, int32_t z = 0);
bool operator ==(const Octant & oct2);

// =================================================================================== //
// STATIC METHODS
// =================================================================================== //
// =================================================================================== //
// STATIC METHODS
// =================================================================================== //
public:
static unsigned int getBinarySize();
static unsigned int getBinarySize();

private:
// =================================================================================== //
// PRIVATE METHODS
// =================================================================================== //
void initialize();
void initialize(uint8_t dim, uint8_t level, bool bound);
// =================================================================================== //
// PRIVATE METHODS
// =================================================================================== //
void initialize();
void initialize(uint8_t dim, uint8_t level, bool bound);

public:
// =================================================================================== //
// PUBLIC METHODS
// =================================================================================== //
uint64_t computeFatherMorton() const;
u32array3 computeFatherCoordinates() const;
// =================================================================================== //
// PUBLIC METHODS
// =================================================================================== //
uint64_t computeFatherMorton() const;
u32array3 computeFatherCoordinates() const;

// =================================================================================== //
// BASIC GET/SET METHODS
// =================================================================================== //
uint32_t getDim() const;
u32array3 getLogicalCoordinates() const;
uint32_t getLogicalX() const;
uint32_t getLogicalY() const;
uint32_t getLogicalZ() const;
u32array3 getLogicalCoord() const;
uint8_t getLevel() const;
int8_t getMarker() const;
bool getBound(uint8_t face) const;
bool getBound() const;
bool getPbound(uint8_t face) const;
bool getPbound() const;
bool getIsNewR() const;
bool getIsNewC() const;
bool getIsGhost() const;
int getGhostLayer() const;
bool getBalance() const;
// =================================================================================== //
// BASIC GET/SET METHODS
// =================================================================================== //
uint32_t getDim() const;
u32array3 getLogicalCoordinates() const;
uint32_t getLogicalX() const;
uint32_t getLogicalY() const;
uint32_t getLogicalZ() const;
u32array3 getLogicalCoord() const;
uint8_t getLevel() const;
int8_t getMarker() const;
bool getBound(uint8_t face) const;
bool getBound() const;
bool getPbound(uint8_t face) const;
bool getPbound() const;
bool getIsNewR() const;
bool getIsNewC() const;
bool getIsGhost() const;
int getGhostLayer() const;
bool getBalance() const;
protected:
void setBound(uint8_t face);
void setMarker(int8_t marker);
void setBalance(bool balance);
void setLevel(uint8_t level);
void setPbound(uint8_t face, bool flag);
void setGhostLayer(int ghostLayer);
void setBound(uint8_t face);
void setMarker(int8_t marker);
void setBalance(bool balance);
void setLevel(uint8_t level);
void setPbound(uint8_t face, bool flag);
void setGhostLayer(int ghostLayer);

// =================================================================================== //
// OTHER GET/SET METHODS
// =================================================================================== //
// =================================================================================== //
// OTHER GET/SET METHODS
// =================================================================================== //
public:
uint32_t getLogicalSize() const;
uint64_t getLogicalArea() const;
uint64_t getLogicalVolume() const;
darray3 getLogicalCenter() const;
darray3 getLogicalFaceCenter(uint8_t iface) const;
darray3 getLogicalEdgeCenter(uint8_t iedge) const;
void getLogicalNodes(u32arr3vector & nodes) const;
u32arr3vector getLogicalNodes() const;
void getLogicalNode(u32array3 & node, uint8_t inode) const;
u32array3 getLogicalNode(uint8_t inode) const;
void getNormal(uint8_t iface, i8array3 & normal, const int8_t (&normals)[6][3]) const;
uint64_t computeMorton() const;
uint64_t computeNodeMorton(uint8_t inode) const;
uint64_t computeNodeMorton(const u32array3 &node) const;
uint32_t getLogicalSize() const;
uint64_t getLogicalArea() const;
uint64_t getLogicalVolume() const;
darray3 getLogicalCenter() const;
darray3 getLogicalFaceCenter(uint8_t iface) const;
darray3 getLogicalEdgeCenter(uint8_t iedge) const;
void getLogicalNodes(u32arr3vector & nodes) const;
u32arr3vector getLogicalNodes() const;
void getLogicalNode(u32array3 & node, uint8_t inode) const;
u32array3 getLogicalNode(uint8_t inode) const;
void getNormal(uint8_t iface, i8array3 & normal, const int8_t (&normals)[6][3]) const;
uint64_t computeMorton() const;
uint64_t computeNodeMorton(uint8_t inode) const;
uint64_t computeNodeMorton(const u32array3 &node) const;

// =================================================================================== //
// OTHER METHODS //
// =================================================================================== //
Octant buildLastDesc() const;
Octant buildFather() const;
std::vector< Octant > buildChildren() const;
// =================================================================================== //
// OTHER METHODS //
// =================================================================================== //
Octant buildLastDesc() const;
Octant buildFather() const;
std::vector<Octant> buildChildren() const;
protected:
void computeHalfSizeMortons(uint8_t iface, uint32_t *nMortons, std::vector<uint64_t> *mortons) const;
void computeMinSizeMortons(uint8_t iface, uint8_t maxdepth, uint32_t *nMortons, std::vector<uint64_t> *mortons) const;
void computeFaceVirtualMortons(uint8_t iface, uint8_t maxdepth, uint32_t *nMortons, std::vector<uint64_t> *mortons) const;
void computeEdgeHalfSizeMortons(uint8_t iedge, const uint8_t (&edgeface)[12][2], uint32_t *nMortons, std::vector<uint64_t> *mortons) const;
void computeEdgeMinSizeMortons(uint8_t iedge, uint8_t maxdepth, const uint8_t (&edgeface)[12][2], uint32_t *nMortons, std::vector<uint64_t> *mortons) const;
void computeEdgeVirtualMortons(uint8_t iedge, uint8_t maxdepth, uint8_t balance_codim, const uint8_t (&edgeface)[12][2], uint32_t *nMortons, std::vector<uint64_t> *mortons) const;
void computeNodeMinSizeMorton(uint8_t inode, uint8_t maxdepth, const uint8_t (&nodeface)[8][3], bool *hasMorton, uint64_t *morton) const;
void computeNodeVirtualMorton(uint8_t inode, uint8_t maxdepth, const uint8_t (&nodeface)[8][3], bool *hasMorton, uint64_t *morton) const;
uint64_t computePeriodicMorton(uint8_t iface) const;
Octant computePeriodicOctant(uint8_t iface) const;
Octant computeNodePeriodicOctant(uint8_t inode) const;
Octant computeEdgePeriodicOctant(uint8_t iedge) const;
std::array<int64_t,3> getPeriodicCoord(uint8_t iface) const;
std::array<int64_t,3> getNodePeriodicCoord(uint8_t inode) const;
std::array<int64_t,3> getEdgePeriodicCoord(uint8_t iedge) const;
uint8_t getFamilySplittingNode() const;
void computeHalfSizeMortons(uint8_t iface, uint32_t *nMortons, std::vector<uint64_t> *mortons) const;
void computeMinSizeMortons(uint8_t iface, uint8_t maxdepth, uint32_t *nMortons, std::vector<uint64_t> *mortons) const;
void computeFaceVirtualMortons(uint8_t iface, uint8_t maxdepth, uint32_t *nMortons, std::vector<uint64_t> *mortons) const;
void computeEdgeHalfSizeMortons(uint8_t iedge, const uint8_t (&edgeface)[12][2], uint32_t *nMortons, std::vector<uint64_t> *mortons) const;
void computeEdgeMinSizeMortons(uint8_t iedge, uint8_t maxdepth, const uint8_t (&edgeface)[12][2], uint32_t *nMortons, std::vector<uint64_t> *mortons) const;
void computeEdgeVirtualMortons(uint8_t iedge, uint8_t maxdepth, uint8_t balance_codim, const uint8_t (&edgeface)[12][2], uint32_t *nMortons, std::vector<uint64_t> *mortons) const;
void computeNodeMinSizeMorton(uint8_t inode, uint8_t maxdepth, const uint8_t (&nodeface)[8][3], bool *hasMorton, uint64_t *morton) const;
void computeNodeVirtualMorton(uint8_t inode, uint8_t maxdepth, const uint8_t (&nodeface)[8][3], bool *hasMorton, uint64_t *morton) const;
uint64_t computePeriodicMorton(uint8_t iface) const;
Octant computePeriodicOctant(uint8_t iface) const;
Octant computeNodePeriodicOctant(uint8_t inode) const;
Octant computeEdgePeriodicOctant(uint8_t iedge) const;
std::array<int64_t,3> getPeriodicCoord(uint8_t iface) const;
std::array<int64_t,3> getNodePeriodicCoord(uint8_t inode) const;
std::array<int64_t,3> getEdgePeriodicCoord(uint8_t iedge) const;
uint8_t getFamilySplittingNode() const;
};

}
Expand Down

0 comments on commit d0869b8

Please sign in to comment.