-
Notifications
You must be signed in to change notification settings - Fork 21
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
Refactor the Permittivity function #465
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #465 +/- ##
==========================================
- Coverage 69.25% 69.23% -0.03%
==========================================
Files 179 180 +1
Lines 14975 14980 +5
==========================================
Hits 10371 10371
- Misses 4604 4609 +5 ☔ View full report in Codecov by Sentry. |
c38b7ab
to
43a38af
Compare
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.
Before I get into actually reviewing, I believe what you've implemented is a step function
ah, yes that is the name. I'll rename it properly |
ecfaadd
to
a91b466
Compare
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.
Potentially we can have many step functions in a calculation. The way it's written now, each will make their own copy of the Cavity
function, which can possibly become a memory bottleneck. Maybe instead of storing a Cavity
the classes should store a std::shared_ptr<Cavity>
?
This is a good idea, but the |
This was really a fix waiting to happen (cavity was passed as a |
b87b895
to
3c98000
Compare
for ease of future implementation work.
Co-authored-by: Roberto Di Remigio Eikås <[email protected]>
Co-authored-by: Roberto Di Remigio Eikås <[email protected]>
Co-authored-by: Roberto Di Remigio Eikås <[email protected]>
Co-authored-by: Roberto Di Remigio Eikås <[email protected]>
Co-authored-by: Roberto Di Remigio Eikås <[email protected]>
Co-authored-by: Roberto Di Remigio Eikås <[email protected]>
e10e8b0
to
ded952f
Compare
@@ -118,13 +119,11 @@ mrcpp::ComplexFunction SCRF::solvePoissonEquation(const mrcpp::ComplexFunction & | |||
mrcpp::ComplexFunction Vr_np1; | |||
Vr_np1.alloc(NUMBER::Real); | |||
|
|||
this->epsilon.flipFunction(true); | |||
|
|||
auto eps_inv_func = mrcpp::AnalyticFunction<3>([this](const mrcpp::Coord<3> &r) { return 1.0 / this->epsilon.evalf(r); }); |
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.
very good 👍🏻
src/environment/StepFunction.h
Outdated
std::shared_ptr<Cavity> getCavity() const { return this->cavity; } | ||
|
||
void printParameters() const; | ||
virtual void printHeader() 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.
there is some duplication between base and derived class.
We can add a free function (outside the class) to generate headers:
void print_header(const std::string &header, const std::string &formulation, double in_value, double out_value) {
mrcpp::print::header(0, header);
print_utils::text(0, "Formulation", formulation, true);
print_utils::scalar(0, "Value inside Cavity", in_value, "(in)", 6);
print_utils::scalar(0, "Value outside Cavity", out_value, "(out)", 6);
}
then in this class:
virtual void printHeader() const { print_header("Step function of Cavity values", "Standard", getValueIn(), getValueOut()); }
while in Permittivity
:
void printHeader() const override { print_header("Solvation Cavity", this->formulation, getValueIn(), getValueOut()); }
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.
Slightly harder than expected, ended up adding it to the detail
namespace
Co-authored-by: Roberto Di Remigio Eikås <[email protected]>
Co-authored-by: Roberto Di Remigio Eikås <[email protected]>
Co-authored-by: Roberto Di Remigio Eikås <[email protected]>
* Refactor the Permittivity function for ease of future implementation work. * Add ShiftFunction to CMakeLists * Add virtual and override where necessary * Remove evalf definition from shiftFunction * Rename ShiftFunction to StepFunction * Update src/environment/Permittivity.cpp Co-authored-by: Roberto Di Remigio Eikås <[email protected]> * Update src/environment/StepFunction.cpp Co-authored-by: Roberto Di Remigio Eikås <[email protected]> * Update src/environment/StepFunction.cpp Co-authored-by: Roberto Di Remigio Eikås <[email protected]> * Update src/environment/StepFunction.cpp Co-authored-by: Roberto Di Remigio Eikås <[email protected]> * Update src/environment/StepFunction.h Co-authored-by: Roberto Di Remigio Eikås <[email protected]> * Update src/environment/StepFunction.h Co-authored-by: Roberto Di Remigio Eikås <[email protected]> * Pass cavity as a shared_ptr to save memory. * Fix rebase error * Remove use for `flipFunction` in Permittivity * Update src/environment/Permittivity.h Co-authored-by: Roberto Di Remigio Eikås <[email protected]> * Update src/environment/StepFunction.cpp Co-authored-by: Roberto Di Remigio Eikås <[email protected]> * Add print_header to detail namespace * Update src/environment/StepFunction.h Co-authored-by: Roberto Di Remigio Eikås <[email protected]> --------- Co-authored-by: Roberto Di Remigio Eikås <[email protected]>
Create a Class "StepFunction" which sets up the base structure of any Permittivity-like function. This is in preparation to the pb-solvation and other work, so we can avoid repeating code