Skip to content

Commit

Permalink
PABLO: rename Octant::computeMorton to getMorton
Browse files Browse the repository at this point in the history
  • Loading branch information
andrea-iob committed Feb 26, 2021
1 parent 1a72c2b commit 51907df
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 60 deletions.
66 changes: 33 additions & 33 deletions src/PABLO/LocalTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ namespace bitpit {
* \return Morton index of the octant.
*/
uint64_t
LocalTree::computeMorton(int32_t idx) const {
return m_octants[idx].computeMorton();
LocalTree::getMorton(int32_t idx) const {
return m_octants[idx].getMorton();
};

/** Compute the persistent XYZ key of the specified node of an octant
Expand Down Expand Up @@ -163,7 +163,7 @@ namespace bitpit {
*/
uint64_t
LocalTree::computeGhostMorton(int32_t idx) const {
return m_ghosts[idx].computeMorton();
return m_ghosts[idx].getMorton();
};

/** Compute the persistent XYZ key of the specified node of a ghost octant
Expand Down Expand Up @@ -226,7 +226,7 @@ namespace bitpit {
LocalTree::setFirstDescMorton(){
if(m_sizeOctants){
octvector::const_iterator firstOctant = m_octants.begin();
m_firstDescMorton = firstOctant->computeMorton();
m_firstDescMorton = firstOctant->getMorton();
} else {
m_firstDescMorton = std::numeric_limits<uint64_t>::max();
}
Expand All @@ -244,7 +244,7 @@ namespace bitpit {
y = lastOctant->getLogicalY() + delta;
z = lastOctant->getLogicalZ() + (m_dim-2)*delta;
Octant lastDesc = Octant(m_dim, TreeConstants::MAX_LEVEL,x,y,z);
m_lastDescMorton = lastDesc.computeMorton();
m_lastDescMorton = lastDesc.getMorton();
} else {
m_lastDescMorton = 0;
}
Expand Down Expand Up @@ -559,7 +559,7 @@ namespace bitpit {
while(check){
check = idx1_gh < m_sizeGhosts;
if (check){
check = m_ghosts[idx1_gh].computeMorton() > m_firstDescMorton;
check = m_ghosts[idx1_gh].getMorton() > m_firstDescMorton;
}
if (check) idx1_gh--;
}
Expand All @@ -568,7 +568,7 @@ namespace bitpit {
while(check){
check = idx2_gh < m_sizeGhosts;
if (check){
check = m_ghosts[idx2_gh].computeMorton() < m_lastDescMorton;
check = m_ghosts[idx2_gh].getMorton() < m_lastDescMorton;
}
if (check) idx2_gh++;
}
Expand Down Expand Up @@ -897,7 +897,7 @@ namespace bitpit {
if (m_sizeOctants>0){

idx = 0;
if (m_octants[idx].computeMorton() < partLastDesc){
if (m_octants[idx].getMorton() < partLastDesc){

Octant father0 = m_octants[idx].buildFather();
Octant father = father0;
Expand Down Expand Up @@ -1013,7 +1013,7 @@ namespace bitpit {
sameSizeVirtualNeigh = Octant(m_dim, level, sameSizeVirtualNeighCoords[0], sameSizeVirtualNeighCoords[1], sameSizeVirtualNeighCoords[2]);
}

uint64_t sameSizeVirtualNeighMorton = sameSizeVirtualNeigh.computeMorton();
uint64_t sameSizeVirtualNeighMorton = sameSizeVirtualNeigh.getMorton();

//
// Search in the internal octants
Expand All @@ -1033,7 +1033,7 @@ namespace bitpit {
//
// This is the Morton number of the last discendent of the same-size
// virtual neighbour.
uint64_t lastCandidateMorton = sameSizeVirtualNeigh.buildLastDesc().computeMorton();
uint64_t lastCandidateMorton = sameSizeVirtualNeigh.buildLastDesc().getMorton();

// Compute coordinates
std::array<int64_t,3> coord;
Expand Down Expand Up @@ -1105,7 +1105,7 @@ namespace bitpit {
break;
}

candidateMorton = m_octants[candidateIdx].computeMorton();
candidateMorton = m_octants[candidateIdx].getMorton();
if (candidateMorton > lastCandidateMorton){
break;
}
Expand Down Expand Up @@ -1195,7 +1195,7 @@ namespace bitpit {
break;
}

candidateMorton = m_ghosts[candidateIdx].computeMorton();
candidateMorton = m_ghosts[candidateIdx].getMorton();
if (candidateMorton > lastCandidateMorton){
break;
}
Expand Down Expand Up @@ -1269,7 +1269,7 @@ namespace bitpit {
sameSizeVirtualNeigh = Octant(m_dim, level, sameSizeVirtualNeighCoords[0], sameSizeVirtualNeighCoords[1], sameSizeVirtualNeighCoords[2]);
}

uint64_t sameSizeVirtualNeighMorton = sameSizeVirtualNeigh.computeMorton();
uint64_t sameSizeVirtualNeighMorton = sameSizeVirtualNeigh.getMorton();

//
// Search in the internal octants
Expand All @@ -1289,7 +1289,7 @@ namespace bitpit {
//
// This is the Morton number of the last discendent of the same-size
// virtual neighbour.
uint64_t lastCandidateMorton = sameSizeVirtualNeigh.buildLastDesc().computeMorton();
uint64_t lastCandidateMorton = sameSizeVirtualNeigh.buildLastDesc().getMorton();

// Compute coordinates
std::array<int64_t,3> coord;
Expand Down Expand Up @@ -1362,7 +1362,7 @@ namespace bitpit {
break;
}

candidateMorton = m_octants[candidateIdx].computeMorton();
candidateMorton = m_octants[candidateIdx].getMorton();
if (candidateMorton > lastCandidateMorton){
break;
}
Expand Down Expand Up @@ -1443,7 +1443,7 @@ namespace bitpit {
break;
}

candidateMorton = m_ghosts[candidateIdx].computeMorton();
candidateMorton = m_ghosts[candidateIdx].getMorton();
if (candidateMorton > lastCandidateMorton){
break;
}
Expand Down Expand Up @@ -1514,7 +1514,7 @@ namespace bitpit {
sameSizeVirtualNeigh = Octant(m_dim, level, sameSizeVirtualNeighCoords[0], sameSizeVirtualNeighCoords[1], sameSizeVirtualNeighCoords[2]);
}

uint64_t sameSizeVirtualNeighMorton = sameSizeVirtualNeigh.computeMorton();
uint64_t sameSizeVirtualNeighMorton = sameSizeVirtualNeigh.getMorton();

//
// Search in the internal octants
Expand All @@ -1534,7 +1534,7 @@ namespace bitpit {
//
// This is the Morton number of the last discendent of the same-size
// virtual neighbour.
uint64_t lastCandidateMorton = sameSizeVirtualNeigh.buildLastDesc().computeMorton();
uint64_t lastCandidateMorton = sameSizeVirtualNeigh.buildLastDesc().getMorton();

// Compute coordinates
std::array<int64_t,3> coord;
Expand Down Expand Up @@ -1576,7 +1576,7 @@ namespace bitpit {
break;
}

candidateMorton = m_octants[candidateIdx].computeMorton();
candidateMorton = m_octants[candidateIdx].getMorton();
if (candidateMorton > lastCandidateMorton){
break;
}
Expand Down Expand Up @@ -1627,7 +1627,7 @@ namespace bitpit {
break;
}

candidateMorton = m_ghosts[candidateIdx].computeMorton();
candidateMorton = m_ghosts[candidateIdx].getMorton();
if (candidateMorton > lastCandidateMorton){
break;
}
Expand Down Expand Up @@ -1896,7 +1896,7 @@ namespace bitpit {
*searchBeginMorton = lowerBoundMorton;
} else {
*searchBeginIdx = lowerBoundIdx - 1;
*searchBeginMorton = octants[*searchBeginIdx].computeMorton();
*searchBeginMorton = octants[*searchBeginIdx].getMorton();
}

}
Expand Down Expand Up @@ -1937,13 +1937,13 @@ namespace bitpit {
bool checkend = true;
bool checkstart = true;
if (m_ghosts.size()){
while(m_ghosts[idx2_gh].computeMorton() <= m_lastDescMorton){
while(m_ghosts[idx2_gh].getMorton() <= m_lastDescMorton){
idx2_gh++;
if (idx2_gh > m_sizeGhosts-1) break;
}
if (idx2_gh > m_sizeGhosts-1) checkend = false;

while(m_ghosts[idx1_gh].computeMorton() <= m_octants[0].computeMorton()){
while(m_ghosts[idx1_gh].getMorton() <= m_octants[0].getMorton()){
idx1_gh++;
if (idx1_gh > m_sizeGhosts-1) break;
}
Expand Down Expand Up @@ -2043,12 +2043,12 @@ namespace bitpit {
if (internal){
father = m_octants[0].buildFather();
lastdesc = father.buildLastDesc();
mortonld = lastdesc.computeMorton();
mortonld = lastdesc.getMorton();
nbro = 0;
for (idx=0; idx<m_treeConstants->nChildren; idx++){
if (idx<nocts){
// Check if family is complete or to be checked in the internal loop (some brother refined)
if (m_octants[idx].computeMorton() <= mortonld){
if (m_octants[idx].getMorton() <= mortonld){
nbro++;
}
}
Expand Down Expand Up @@ -2120,13 +2120,13 @@ namespace bitpit {
bool checkend = true;
bool checkstart = true;
if (m_ghosts.size()){
while(m_ghosts[idx2_gh].computeMorton() <= m_lastDescMorton){
while(m_ghosts[idx2_gh].getMorton() <= m_lastDescMorton){
idx2_gh++;
if (idx2_gh > m_sizeGhosts-1) break;
}
if (idx2_gh > m_sizeGhosts-1) checkend = false;

while(m_ghosts[idx1_gh].computeMorton() <= m_octants[0].computeMorton()){
while(m_ghosts[idx1_gh].getMorton() <= m_octants[0].getMorton()){
idx1_gh++;
if (idx1_gh > m_sizeGhosts-1) break;
}
Expand Down Expand Up @@ -2227,12 +2227,12 @@ namespace bitpit {
// Check first internal octants
father = m_octants[0].buildFather();
lastdesc = father.buildLastDesc();
mortonld = lastdesc.computeMorton();
mortonld = lastdesc.getMorton();
nbro = 0;
for (idx=0; idx<m_treeConstants->nChildren; idx++){
// Check if family is complete or to be checked in the internal loop (some brother refined)
if (idx<nocts){
if (m_octants[idx].computeMorton() <= mortonld){
if (m_octants[idx].getMorton() <= mortonld){
nbro++;
}
}
Expand Down Expand Up @@ -3083,7 +3083,7 @@ namespace bitpit {
uint64_t midMorton = PABLO::INVALID_MORTON;
while (lowIndex < highIndex) {
midIndex = lowIndex + (highIndex - lowIndex) / 2;
midMorton = octants[midIndex].computeMorton();
midMorton = octants[midIndex].getMorton();
if (targetMorton < midMorton) {
highIndex = midIndex;
}
Expand All @@ -3103,7 +3103,7 @@ namespace bitpit {
*lowerBoundMorton = midMorton;
}
else if (*lowerBoundIdx < nOctants) {
*lowerBoundMorton = octants[*lowerBoundIdx].computeMorton();
*lowerBoundMorton = octants[*lowerBoundIdx].getMorton();
}
else {
*lowerBoundMorton = PABLO::INVALID_MORTON;
Expand Down Expand Up @@ -3138,7 +3138,7 @@ namespace bitpit {
uint64_t midMorton = PABLO::INVALID_MORTON;
while (lowIndex < highIndex) {
midIndex = lowIndex + (highIndex - lowIndex) / 2;
midMorton = octants[midIndex].computeMorton();
midMorton = octants[midIndex].getMorton();
if (targetMorton < midMorton) {
highIndex = midIndex;
}
Expand All @@ -3152,7 +3152,7 @@ namespace bitpit {
*upperBoundMorton = midMorton;
}
else if (*upperBoundIdx < nOctants) {
*upperBoundMorton = octants[*upperBoundIdx].computeMorton();
*upperBoundMorton = octants[*upperBoundIdx].getMorton();
}
else {
*upperBoundMorton = PABLO::INVALID_MORTON;
Expand Down
2 changes: 1 addition & 1 deletion src/PABLO/LocalTree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ class LocalTree{
int8_t getLocalMaxDepth() const;
int8_t getMarker(int32_t idx) const;
uint8_t getLevel(int32_t idx) const;
uint64_t computeMorton(int32_t idx) const;
uint64_t getMorton(int32_t idx) const;
uint64_t computeNodePersistentKey(int32_t idx, uint8_t inode) const;
uint8_t getGhostLevel(int32_t idx) const;
uint64_t computeGhostMorton(int32_t idx) const;
Expand Down
8 changes: 4 additions & 4 deletions src/PABLO/Octant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -591,10 +591,10 @@ void Octant::getNormal(uint8_t iface, i8array3 & normal, const int8_t (&normals
};


/** Compute the Morton index of the octant (without level).
/** Get the Morton index of the octant (without level).
* \return morton Morton index of the octant.
*/
uint64_t Octant::computeMorton() const{
uint64_t Octant::getMorton() const{
return m_morton;
};

Expand Down Expand Up @@ -1411,7 +1411,7 @@ void Octant::computeNodeMinSizeMorton(uint8_t inode, uint8_t maxdepth, const uin
uint8_t iface = nodeface[inode][i];
if (m_info[iface]) {
*hasMorton = false;
*morton = this->computeMorton();
*morton = this->getMorton();
return;
}
}
Expand Down Expand Up @@ -1528,7 +1528,7 @@ uint64_t Octant::computePeriodicMorton(uint8_t iface) const {
u32array3 coords = getLogicalCoordinates();

if (!m_info[iface]){
return this->computeMorton();
return this->getMorton();
}
else{
switch (iface) {
Expand Down
2 changes: 1 addition & 1 deletion src/PABLO/Octant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ class Octant{
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 getMorton() const;
uint64_t computeNodePersistentKey(uint8_t inode) const;
uint64_t computeNodePersistentKey(const u32array3 &node) const;

Expand Down
Loading

0 comments on commit 51907df

Please sign in to comment.