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

[ContactStructuralMechanicsApplication] Refactor ContactUtilities to cpp #7616

Merged
merged 8 commits into from
Oct 20, 2020

Conversation

loumalouomega
Copy link
Member

@loumalouomega loumalouomega commented Oct 19, 2020

Description
Moving ContactUtilities to cpp

Changelog

  • ContactUtilities to cpp

@loumalouomega loumalouomega added Applications FastPR This Pr is simple and / or has been already tested and the revision should be fast labels Oct 19, 2020
@loumalouomega loumalouomega requested a review from a team October 19, 2020 07:23
@loumalouomega loumalouomega added the Refactor When code is moved or rewrote keeping the same behavior label Oct 19, 2020
Comment on lines 39 to 42
///@}
///@name Namespaces
///@{

Copy link
Member

Choose a reason for hiding this comment

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

I think this is legacy from the previous implementation

Comment on lines +51 to +66
const int num_threads = OpenMPUtils::GetNumThreads();
std::vector<double> max_vector(num_threads, 0.0);
double nodal_h;
#pragma omp parallel for private(nodal_h)
for(int i = 0; i < static_cast<int>(r_nodes_array.size()); ++i) {
auto it_node = it_node_begin + i;
KRATOS_DEBUG_ERROR_IF_NOT(it_node->SolutionStepsDataHas(NODAL_H)) << "ERROR:: NODAL_H not added" << std::endl;
nodal_h = it_node->FastGetSolutionStepValue(NODAL_H);

const int id = OpenMPUtils::ThisThread();

if (nodal_h > max_vector[id])
max_vector[id] = nodal_h;
}

return *std::max_element(max_vector.begin(), max_vector.end());
Copy link
Member

Choose a reason for hiding this comment

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

just to say that this could be done simpler with the ParallelUtilities

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 have it in my TODO list

#include "contact_structural_mechanics_application_variables.h"
#include "includes/model_part.h"
Copy link
Member

Choose a reason for hiding this comment

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

this is used in this file, I wouldn't remove

Copy link
Member Author

Choose a reason for hiding this comment

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

Done, reapproval?

rubenzorrilla
rubenzorrilla previously approved these changes Oct 20, 2020
Copy link
Member

@rubenzorrilla rubenzorrilla left a comment

Choose a reason for hiding this comment

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

As this is only refactor I'd leave changes for a future PR. @loumalouomega and @philbucher up to you 😉

@loumalouomega loumalouomega merged commit 38e7dd6 into master Oct 20, 2020
@loumalouomega loumalouomega deleted the contact/refactor-ContactUtilities branch October 20, 2020 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Applications FastPR This Pr is simple and / or has been already tested and the revision should be fast Refactor When code is moved or rewrote keeping the same behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants