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: add node and edge periodic neighbours #58

Merged
merged 6 commits into from
Mar 26, 2020

Conversation

edoardolombardi
Copy link
Member

It enables finding node and edge neighbours with periodic boundaries (#55).

@@ -62,7 +62,8 @@ if(BUILD_EXAMPLES)
list(APPEND EXAMPLE_LIST "PABLO_example_00007")
list(APPEND EXAMPLE_LIST "PABLO_example_00008")
list(APPEND EXAMPLE_LIST "PABLO_example_00009")
list(APPEND EXAMPLE_LIST "PABLO_example_00010")
list(APPEND EXAMPLE_LIST "PABLO_example_00010")
list(APPEND EXAMPLE_LIST "PABLO_example_00011")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Example 00011 is not introduced by this commit, its introduced in a2f6106. This commit only modifies the example.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that something went wrong with my edit/squash/fixup...

@@ -1544,7 +1544,7 @@ Octant Octant::computePeriodicOctant(uint8_t iface) const {
uint32_t dh = this->getLogicalSize();

if (!m_info[iface]){
return this->computeMorton();
return *this;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems a fix that should be on a stand alone commit.

void findGhostNeighbours(uint32_t idx, uint8_t iface, u32vector & neighbours, bvector & isghost) const;
void findGhostEdgeNeighbours(uint32_t idx, uint8_t iedge, u32vector & neighbours, bvector & isghost) const;
void findGhostNodeNeighbours(uint32_t idx, uint8_t inode, u32vector & neighbours, bvector & isghost) const;
BITPIT_DEPRECATED(void findGhostPeriodicNeighbours(const Octant* oct, uint8_t iface, u32vector & neighbours) const);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commit title is "PABLO: added node and edge periodic neighbors", but you are also removing two functions. Better remove this two functions in a separate commit.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above...

if (!m_info[iface1] && !m_info[iface2] && !m_info[iface3]){
return *this;
}
else{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can 'getNodePeriodicCoord' be used to evaluate the coordinates instead of duplicating the code?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, they deal with periodic octant in different way.

for (int idim=0; idim<m_dim; idim++){
cxyz[idim] = sm_treeConstants[m_dim].edgeCoeffs[iedge][idim];
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can 'getEdgePeriodicCoord' be used to evaluate the coordinates instead of duplicating the code?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, they deal with periodic octant in different way.

u32array3 coordtry = m_ghosts[idxtry].getLogicalCoord();
u32array3 coord1 = { {1,1,1} };
array<int64_t,3> coord1 = { {1,1,1} };
u32array3 coordtry1 = { {1,1,1} };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated, please remove it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's correct.

if (m_periodic[iface]){
isperiodic = true;
// findPeriodicNeighbours(oct, iface, neighbours, isghost);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes belong to the previous commit.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, right.

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;
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that indentation is not coherent with the surrounding code.

*
* bitpit
*
* Copyright (C) 2015-2019 OPTIMAD engineering Srl
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

switch (iface1) {
case 0 :
{
if (m_info[0]){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are constants to access the m_info entries (OctantInfo enum in Octant.hpp).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I'll use this enum.

*/
Octant Octant::computeNodePeriodicOctant(uint8_t inode) const {
Octant degOct(this->m_dim, this->m_level, this->m_x, this->m_y, this->m_z);
uint32_t maxLength = uint32_t(1)<<TreeConstants::MAX_LEVEL;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a constant for the max length: MAX_LENGTH in TreeConstants (should be accessible through sm_treeConstants).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, I think I used some lines above....

@andrea-iob
Copy link
Member

All Octant coordinates are uint32_t, whereas get*PeriodicCoord() functions return int64_t. Is this intentional?

@andrea-iob
Copy link
Member

All Octant coordinates are uint32_t, whereas get*PeriodicCoord() functions return int64_t. Is this intentional?

Maybe I get it, is to allow negative numbers?

@edoardolombardi
Copy link
Member Author

Yes, this is the reason (I quickly commented in the inline comment). Maybe there is some inconsistent compares in the code, I check form them.

/*! Get the coordinates of the octant shifted through edge iedge and
* near the opposite periodic boundary (i.e. the coordinates considering this octant
* as a ghost periodic octant).
* The face through the octant is periodic has to be passed as boolean flags.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this comments it seems there should be an additional argument that tells which are the periodic faces. (same applies for the other getPeriodicCoord() and computePeriodicOctant functions).

@andrea-iob
Copy link
Member

andrea-iob commented Mar 17, 2020

I tried to check if the calculations in get*PeriodicCoord and compute*PeriodicOctant are correct, but I can't fully understand what these function do. If you want me to really check the calculations, I need some details on what is the purpose of the functions. However, if the functions pass the tests and I'm fine with them.

@edoardolombardi
Copy link
Member Author

Sure:

  • compute periodic octant functions give an octant (used as virtual) of the same size of the current one placed over the periodic entity (face, edge or node) on the opposite side of the domain; e.g. over periodic boundaries 0/1 if the current octant is at the maximum x-coordinate of the domain, the returned periodic octant over the face (1) is placed at zero x-coordinate.
  • get periodic coordinates functions give the coordinates of the current octant considered as periodic ghost placed on the same relative size of the opposite periodic entity; i.e. considering the same current octant of the example above, the returned coordinates are the coordinate of the octant placed at x-coordinate equal to -h (where h is the size of the octant), on the same size of the periodic face on the opposite domain boundary (boundary 0). This octant is placed outside the logical domain, for this reason negative coordinates are needed.

@edoardolombardi edoardolombardi force-pushed the PABLO.add.node.and.edge.periodic.neighbours branch from 5138494 to e28da13 Compare March 17, 2020 17:52
@edoardolombardi
Copy link
Member Author

edoardolombardi commented Mar 18, 2020

PR updated.

@edoardolombardi edoardolombardi force-pushed the PABLO.add.node.and.edge.periodic.neighbours branch 3 times, most recently from 98fe864 to 2a8bf2c Compare March 23, 2020 11:53
@andrea-iob andrea-iob force-pushed the PABLO.add.node.and.edge.periodic.neighbours branch from 2a8bf2c to d0869b8 Compare March 25, 2020 13:06
@andrea-iob
Copy link
Member

I fixed the indentation in a couple of places and remove some "unused variables" warnings. I will do the marge later this afternoon.

@andrea-iob andrea-iob self-requested a review March 25, 2020 13:08
@andrea-iob andrea-iob merged commit d0869b8 into master Mar 26, 2020
@andrea-iob andrea-iob deleted the PABLO.add.node.and.edge.periodic.neighbours branch March 26, 2020 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants