Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PABLO: simplify 2:1 balance #335

Merged
merged 15 commits into from
Oct 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,679 changes: 778 additions & 901 deletions src/PABLO/LocalTree.cpp

Large diffs are not rendered by default.

36 changes: 27 additions & 9 deletions src/PABLO/LocalTree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include "tree_constants.hpp"
#include "Octant.hpp"
#include "Intersection.hpp"
#include "morton.hpp"

namespace bitpit {

Expand Down Expand Up @@ -121,8 +120,6 @@ class LocalTree{
u64vector m_globalIdxGhosts; /**< Global index of the ghost octants (size = size_ghosts) */
uint64_t m_firstDescMorton; /**< Morton number of first (Morton order) most refined octant possible in local partition */
uint64_t m_lastDescMorton; /**< Morton number of last (Morton order) most refined octant possible in local partition */
uint32_t m_sizeGhosts; /**< Size of vector of ghost octants */
uint32_t m_sizeOctants; /**< Size of vector of local octants */
int8_t m_localMaxDepth; /**< Reached max depth in local tree */
uint8_t m_balanceCodim; /**<Maximum codimension of the entity for 2:1 balancing (1 = 2:1 balance through faces (default);
2 = 2:1 balance through edges and faces;
Expand Down Expand Up @@ -150,6 +147,27 @@ class LocalTree{
// METHODS
// =================================================================================== //

protected:
std::array<int64_t, 3> computeFirstVirtualNeighOffset(uint8_t level, uint8_t iface, uint8_t neighLevel) const;
std::array<int64_t, 3> computeLastVirtualNeighOffset(uint8_t level, uint8_t iface, uint8_t neighLevel) const;
void computeVirtualNeighOffsets(uint8_t level, uint8_t iface, uint8_t neighLevel, std::vector<std::array<int64_t, 3>> *neighOffsets) const;

std::array<int64_t, 3> computeFirstVirtualNodeNeighOffset(uint8_t level, uint8_t inode, uint8_t neighLevel) const;
std::array<int64_t, 3> computeLastVirtualNodeNeighOffset(uint8_t level, uint8_t inode, uint8_t neighLevel) const;
void computeVirtualNodeNeighOffsets(uint8_t level, uint8_t inode, uint8_t neighLevel, std::vector<std::array<int64_t, 3>> *neighOffsets) const;

std::array<int64_t, 3> computeFirstVirtualEdgeNeighOffset(uint8_t level, uint8_t iedge, uint8_t neighLevel) const;
std::array<int64_t, 3> computeLastVirtualEdgeNeighOffset(uint8_t level, uint8_t iedge, uint8_t neighLevel) const;
void computeVirtualEdgeNeighOffsets(uint8_t level, uint8_t iedge, uint8_t neighLevel, std::vector<std::array<int64_t, 3>> *neighOffsets) const;

std::array<int64_t, 3> getPeriodicOffset(const Octant &octant, uint8_t iface) const;
std::array<int64_t, 3> getNodePeriodicOffset(const Octant &octant, uint8_t inode) const;
std::array<int64_t, 3> getEdgePeriodicOffset(const Octant &octant, uint8_t iedge) const;

uint8_t getMaxNeighLevel(const Octant &octant) const;
uint8_t getMaxNodeNeighLevel(const Octant &octant) const;
uint8_t getMaxEdgeNeighLevel(const Octant &octant) const;

// =================================================================================== //
// BASIC GET/SET METHODS
// =================================================================================== //
Expand Down Expand Up @@ -203,15 +221,15 @@ class LocalTree{
void checkCoarse(uint64_t partLastDesc, u32vector & mapidx);
void updateLocalMaxDepth();

void findNeighbours(const Octant* oct, uint8_t iface, u32vector & neighbours, bvector & isghost, bool onlyinternal) const;
void findEdgeNeighbours(const Octant* oct, uint8_t iedge, u32vector & neighbours, bvector & isghost, bool onlyinternal) const;
void findNodeNeighbours(const Octant* oct, uint8_t inode, u32vector & neighbours, bvector & isghost, bool onlyinternal) const;
void findNeighbours(const Octant* oct, uint8_t iface, u32vector & neighbours, bvector & isghost, bool onlyinternal, bool append) const;
void findEdgeNeighbours(const Octant* oct, uint8_t iedge, u32vector & neighbours, bvector & isghost, bool onlyinternal, bool append) const;
void findNodeNeighbours(const Octant* oct, uint8_t inode, u32vector & neighbours, bvector & isghost, bool onlyinternal, bool append) const;

void computeNeighSearchBegin(uint64_t sameSizeVirtualNeighMorton, const octvector &octants, uint32_t *searchBeginIdx, uint64_t *searchBeginMorton) const;

void preBalance21(bool internal);
void preBalance21(u32vector& newmodified);
bool localBalance(bool doNew, bool doInterior);
bool localBalance(bool doNew, bool doInterior, bool doGhost);

bool fixBrokenFamiliesMarkers(std::vector<Octant *> *updatedOctants = nullptr, std::vector<bool> *updatedGhostFlags = nullptr);

void computeIntersections();

Expand Down
1 change: 0 additions & 1 deletion src/PABLO/Map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// INCLUDES //
// =================================================================================== //
#include "tree_constants.hpp"
#include "Operators.hpp"
#include "Map.hpp"
#include <cmath>

Expand Down
Loading