added_resample_mesh#536
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
lang-m
left a comment
There was a problem hiding this comment.
@fangohr @samjrholt, @swapneelap This MR introduces mesh.resample. We don't strictly need it as it is just calling mesh.__init__ with the new n. It might still be nice to have for consistency. What is your opinion?
| ``pmin`` and ``pmax`` stay unchanged. The values of the new cells are taken from | ||
| the nearest old cell, no interpolation is performed. |
There was a problem hiding this comment.
| ``pmin`` and ``pmax`` stay unchanged. The values of the new cells are taken from | |
| the nearest old cell, no interpolation is performed. | |
| ``pmin`` and ``pmax`` stay unchanged. |
The mesh does not have any values. Therefore this sentence does not apply.
| n = np.array(n, dtype=int) | ||
| new_n = self.n.copy() | ||
| for i in range(len(n)): | ||
| new_n[i] = n[i] | ||
|
|
||
| return self.__class__( | ||
| region=self.region, | ||
| n=new_n, |
There was a problem hiding this comment.
| n = np.array(n, dtype=int) | |
| new_n = self.n.copy() | |
| for i in range(len(n)): | |
| new_n[i] = n[i] | |
| return self.__class__( | |
| region=self.region, | |
| n=new_n, | |
| return self.__class__( | |
| region=self.region, | |
| n=n, |
None of this should be required.
PR Type
Enhancement
Description
Added a new
resamplemethod to theMeshclass.Enables resampling of mesh with specified number of cells.
Includes detailed documentation and examples for usage.
Ensures boundaries remain unchanged during resampling.
Changes walkthrough 📝
mesh.py
Add `resample` method to `Mesh` classdiscretisedfield/mesh.py
resamplemethod to theMeshclass.boundaries fixed.
regionandbc.