Mesh for anisotropic particles#52
Conversation
include/flyft/mesh.h
Outdated
| 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.
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.
| 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.
| 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.
| 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
| 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.
| 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.
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.
| 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.
Similarly here, won't the gradient now return a vector?
include/flyft/mesh.h
Outdated
|
|
||
| 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.
Is this implementation right? Don't we need to do multidimensional interpolation?
There was a problem hiding this comment.
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
| : 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.
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.
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?
include/flyft/mesh.h
Outdated
| * \param x Coordinate position of the bin | ||
| * \return Bin index | ||
| */ | ||
| std::vector<int> bin(double x) const; |
There was a problem hiding this comment.
This is going to need to take a vector, right?
include/flyft/mesh.h
Outdated
| * \param i Multidimensional bin index | ||
| * \return Volume of the bin | ||
| */ | ||
| virtual double volume(int i) const = 0; |
There was a problem hiding this comment.
This needs to be a vector
include/flyft/mesh.h
Outdated
|
|
||
| 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.
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.
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?
|
@mayukh33 can this be merged into |
|
Hi! I think it can be merged into |
|
Please revert that change, and I'll have a look at it locally |
No description provided.