-
Notifications
You must be signed in to change notification settings - Fork 1
Mesh for anisotropic particles #52
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
base: refactor-aniso
Are you sure you want to change the base?
Conversation
include/flyft/mesh.h
Outdated
@@ -19,22 +19,22 @@ class Mesh | |||
BoundaryType lower_bc, | |||
BoundaryType upper_bc); | |||
|
|||
std::shared_ptr<Mesh> slice(int start, int end) const; | |||
std::shared_ptr<Mesh> slice(std::vector<int> start, std::vector<int> end) 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.
Make sure to pass all these vectors by const reference to avoid copies
std::shared_ptr<Mesh> slice(std::vector<int> start, std::vector<int> end) const; | |
std::shared_ptr<Mesh> slice(const std::vector<int>& start, const std::vector<int>& end) const; |
include/flyft/mesh.h
Outdated
|
||
//! Get position on the mesh, defined as center of bin | ||
double center(int i) const; | ||
std::vector<double> center(std::vector<int> i) 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.
std::vector<double> center(std::vector<int> i) const; | |
std::vector<double> center(const std::vector<int>& i) const; |
include/flyft/mesh.h
Outdated
|
||
//! Get lower bound of bin | ||
double lower_bound(int i) const; | ||
std::vector<double> lower_bound(std::vector<int> i) 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.
std::vector<double> lower_bound(std::vector<int> i) const; | |
std::vector<double> lower_bound(const std::vector<int>& i) const; |
include/flyft/mesh.h
Outdated
|
||
//! Get upper bound of bin | ||
double upper_bound(int i) const; | ||
std::vector<double> upper_bound(std::vector<int> i) 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.
std::vector<double> upper_bound(std::vector<int> i) const; | |
std::vector<double> upper_bound(const std::vector<int>& i) const; |
include/flyft/mesh.h
Outdated
|
||
//! Boundary condition on lower bound of mesh | ||
BoundaryType lower_boundary_condition() const; | ||
|
||
//! Boundary condition on upper bound of mesh | ||
BoundaryType upper_boundary_condition() const; | ||
|
||
int asShape(double dx) const; | ||
std::vector<int> asShape(std::vector<double> dx) 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.
std::vector<int> asShape(std::vector<double> dx) const; | |
std::vector<int> asShape(const std::vector<double>& dx) const; |
include/flyft/mesh.h
Outdated
double integrateSurface(std::vector<int> idx, double j_lo, double j_hi) const; | ||
double integrateSurface(std::vector<int> idx, const DataView<double>& j) const; | ||
double integrateSurface(std::vector<int> idx, const DataView<const double>& j) 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.
We need to be careful here. Isn't j
now going to need to be a vector? Or 1 vector per face of the mesh site?
include/flyft/mesh.h
Outdated
double integrateVolume(std::vector<int> idx, double f) const; | ||
double integrateVolume(std::vector<int> idx, const DataView<double>& f) const; | ||
double integrateVolume(std::vector<int> idx, const DataView<const double>& f) 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.
double integrateVolume(std::vector<int> idx, double f) const; | |
double integrateVolume(std::vector<int> idx, const DataView<double>& f) const; | |
double integrateVolume(std::vector<int> idx, const DataView<const double>& f) const; | |
double integrateVolume(const std::vector<int>& idx, double f) const; | |
double integrateVolume(const std::vector<int>& idx, const DataView<double>& f) const; | |
double integrateVolume(const std::vector<int>& idx, const DataView<const double>& f) const; |
include/flyft/mesh.h
Outdated
virtual double gradient(std::vector<int> idx, double f_lo, double f_hi) const = 0; | ||
double gradient(std::vector<int> idx, const DataView<const double>& f) const; | ||
double gradient(std::vector<int> idx, const DataView<double>& f) 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.
Similarly here, won't the gradient now return a vector?
|
||
void validateBoundaryCondition() const; | ||
|
||
virtual std::shared_ptr<Mesh> clone() const = 0; | ||
}; | ||
|
||
template<typename T> | ||
typename std::remove_const<T>::type Mesh::interpolate(double x, const DataView<T>& f) const | ||
typename std::remove_const<T>::type Mesh::interpolate(std::vector<double> x, |
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.
Is this implementation right? Don't we need to do multidimensional interpolation?
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.
Based on our discussion, this interpolation method probably needs to be updated so that it is operating only on one coordinate, with the rest fixed to a specific bin.
src/mesh.cc
Outdated
BoundaryType lower_bc, | ||
BoundaryType upper_bc) | ||
: lower_(lower_bound), shape_(shape), lower_bc_(lower_bc), upper_bc_(upper_bc), start_(0) | ||
{ | ||
step_ = (upper_bound - lower_bound) / shape_; | ||
std::vector<double> step_; |
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.
Step is already a member variable
std::vector<double> step_; |
/*! | ||
* \param i Multidimensional bin index | ||
* \return Upper bound of the multidimensional bin | ||
*/ | ||
virtual double area(int i) const = 0; |
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 this method, what area is this going to return? Should it return the areas of all lower faces in some defined order? Or, should it take both an index to a bin and an index to a dimension and return the area of that lower face?
Or perhaps, it needs three arguments: bin, face, and +/- direction?
* \param x Coordinate position of the bin | ||
* \return Bin index | ||
*/ | ||
std::vector<int> bin(double x) 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.
This is going to need to take a vector, right?
/*! | ||
* \param i Multidimensional bin index | ||
* \return Volume of the bin | ||
*/ | ||
virtual double volume(int i) const = 0; |
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.
This needs to be a vector
|
||
void validateBoundaryCondition() const; | ||
|
||
virtual std::shared_ptr<Mesh> clone() const = 0; | ||
}; | ||
|
||
template<typename T> | ||
typename std::remove_const<T>::type Mesh::interpolate(double x, const DataView<T>& f) const | ||
typename std::remove_const<T>::type Mesh::interpolate(std::vector<double> x, |
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.
Based on our discussion, this interpolation method probably needs to be updated so that it is operating only on one coordinate, with the rest fixed to a specific bin.
//! Get the integral of the surface over the mesh | ||
/*! | ||
* \param shape Shape of the mesh | ||
* \return Length of the mesh | ||
*/ | ||
double integrateSurface(const std::vector<int>& idx, double j_lo, double j_hi) const; | ||
double integrateSurface(const std::vector<int>& idx, const DataView<double>& j) const; | ||
double integrateSurface(const std::vector<int>& idx, const DataView<const double>& j) 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.
Did you think about how these are going to work in the new code? Is it going to integrate over a specific face, or all of them? And what will it integrate?
No description provided.