-
Notifications
You must be signed in to change notification settings - Fork 245
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
[Core][MeshingApplication] Extend gradient process to other geometries. Reduce the number of template arguments to reduce compilation time #3702
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wasn't it you that introduced the template-args?
kratos/tests/cpp_tests/processes/test_compute_nodal_gradient_process.cpp
Show resolved
Hide resolved
applications/MeshingApplication/tests/mmg_lagrangian_test/beam3D_test_result.sol
Show resolved
Hide resolved
applications/MeshingApplication/tests/mmg_lagrangian_test/beam2D_test_result.sol
Outdated
Show resolved
Hide resolved
applications/MeshingApplication/custom_processes/metrics_hessian_process.cpp
Outdated
Show resolved
Hide resolved
applications/MeshingApplication/custom_processes/metrics_hessian_process.cpp
Outdated
Show resolved
Hide resolved
it_node->SetValue(ANISOTROPIC_RATIO, ratio); | ||
const auto& it_element_begin = mThisModelPart.ElementsBegin(); | ||
const auto& r_first_element_geometry = it_element_begin->GetGeometry(); | ||
const std::size_t dimension = r_first_element_geometry.WorkingSpaceDimension(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say the processinfo is safer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For what?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
determining the dimension of the problem
applications/MeshingApplication/custom_processes/metrics_hessian_process.cpp
Outdated
Show resolved
Hide resolved
applications/MeshingApplication/custom_processes/metrics_hessian_process.cpp
Show resolved
Hide resolved
Co-Authored-By: loumalouomega <vicente.mataix@polytechnique.edu>
why do you make your algorithm to only consider the first element to determine the number of node, dimension? This can be easily broken! |
Yes, you are right. This branch was created at the same time and I had not
though about the repeated pieces of code. I will change that.
El jue., 20 dic. 2018 16:58, Philipp Bucher <notifications@github.com>
escribió:
… why do you make your algorithm to only consider the first element to
determine the number of node, dimension?
I had the same comment in another PR of you some days ago
This can be easily broken!
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#3702 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ATEMgJ4o89qP-B0hDAZ8RqoTqD17U2UMks5u67O7gaJpZM4Za4VM>
.
|
Done @philbucher |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Take a look at codacy (minor)
If you use DOMAIN_SIZE to determine the dimension the you could add a check if the value is reasonable
/***********************************************************************************/ | ||
/***********************************************************************************/ | ||
|
||
Parameters ComputeHessianSolMetricProcess::GetDefaultParameters() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ping
applications/MeshingApplication/custom_processes/metrics_hessian_process.cpp
Outdated
Show resolved
Hide resolved
@philbucher Comments adressed |
Ping @philbucher |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some comments are not addressed
plus some more minor comments
it_node->SetValue(ANISOTROPIC_RATIO, ratio); | ||
const auto& it_element_begin = mThisModelPart.ElementsBegin(); | ||
const auto& r_first_element_geometry = it_element_begin->GetGeometry(); | ||
const std::size_t dimension = r_first_element_geometry.WorkingSpaceDimension(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
determining the dimension of the problem
VariableUtils().CheckVariableExists(mrOriginVariableDoubleList[0], nodes_array); | ||
} else { | ||
VariableUtils().CheckVariableExists(mrOriginVariableComponentsList[0], nodes_array); | ||
} | ||
for (auto& i_node : nodes_array) | ||
KRATOS_ERROR_IF_NOT(i_node.Has(NODAL_H)) << "NODAL_H must be computed" << std::endl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ping
mrOriginVariableComponentsList.push_back(&rVariable); | ||
|
||
// We check the parameters | ||
Parameters default_parameters = GetDefaultParameters(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const
|
||
// We check the parameters | ||
Parameters default_parameters = GetDefaultParameters(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RecursivelyValidateAndAssignDefaults can not work with const Parameters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed, I checked, even though I think it should be
=> maybe after #58
if (dimension == 2) { | ||
CalculateMetric<2>(); | ||
} else { | ||
CalculateMetric<3>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
else if dim == 3
else: Error
/***********************************************************************************/ | ||
/***********************************************************************************/ | ||
|
||
Parameters ComputeHessianSolMetricProcess::GetDefaultParameters() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ping
/***********************************************************************************/ | ||
/***********************************************************************************/ | ||
|
||
Parameters ComputeHessianSolMetricProcess::GetDefaultParameters() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parameters ComputeHessianSolMetricProcess::GetDefaultParameters() | |
Parameters ComputeHessianSolMetricProcess::GetDefaultParameters() const |
void ComputeHessianSolMetricProcess::InitializeVariables(Parameters ThisParameters) | ||
{ | ||
// Get default variables | ||
Parameters default_parameters = GetDefaultParameters(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot be const, (the function can be), but not the parameters. Maybe adding a new method to the Parameters (the one is still in the oldest open PR)
// Set variables | ||
mMinSize = ThisParameters["minimal_size"].GetDouble(); | ||
mMaxSize = ThisParameters["maximal_size"].GetDouble(); | ||
mEnforceCurrent = ThisParameters["enforce_current"].GetBool(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all const
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Member variables, cannot be const
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me now 👍
This allows to use the gradient an Hessian with geometries different than triangles and tetras. Additionally it reduces significantly the number of template arguments required
@riccardotosi I will add the corrections you suggested on the Hessian in a future PR