-
Notifications
You must be signed in to change notification settings - Fork 96
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
Many improvements to Grid and Dimension. #484
Conversation
- make grid.compute* methods private - add methods grid.p_centers_with_ghost and grid.p_edges_with_ghost - simplify grid._compute_p_centers and grid._compute_p_edges - fix typos in docstrings - simplify grid._compute_c_centers_with_ghost - remove dimension.num_ghost - make _centers and _edges exist separately for each Dimension - make cached centers and edges exist separately for each Grid - pass num_ghost as argument to dimension.*_with_ghost() - don't cache dimension or grid coordinate arrays with ghosts - print function for Grid with useful information - mapc2p does not take Patch as an argument (now only takes 1 argument, the list of coordinate arrays) - add grid.c_center and grid.p_center methods to give coordinates of a single cell center - add grid.plot() method for 2D grids - expand grid docstring
Also make better use of mapping function in annulus advection example.
I support all of these changes. I especially like the grid plots. |
This makes it so that the expected inputs to mapc2p are the sequence of coordinate arrays x,y,z. Resolves clawpack#73 (more than 3 years later!)
8daad48
to
60f130d
Compare
I failed to note it originally, but the change to how mapc2p is called is technically backward-incompatible. OTOH, it's likely that people weren't using that interface before (our examples did not), so I'm in favor of merging it and sending a note to claw-users in case anyone happened to rely on it. |
Is it worthwhile or possible to raise an exception JIC? |
@mandli I added code to print a warning if the first argument to mapc2p is named |
…s return a tuple
Fix bug inadvertently introduced in #484: mapc2p should always return a tuple
Some of the things in this PR are demonstrated in http://nbviewer.ipython.org/gist/ketch/1a7888d1fcc37209b260,
which is work in progress.
This PR implements the following changes:
Grid
grid.num_ghost
since ghost cell information belongs to solvermapc2p
does not take Patch as an argument. Now it takes a number of arguments equal tonum_dim
, which are the coordinate arrays. Note that this is backward-incompatible, but only affects problems with mapped grids. Resolves Make the mapc2p function interfaces for running and for plotting identical #73._check_validity()
methodCoordinate functions
grid.p_centers_with_ghost
andgrid.p_edges_with_ghost
to get physical edge locations.grid.p_center
andgrid.c_center
to retrieve coordinates of a single cell centergrid.compute_*
methods private (by adding an initial underscore) since they should only be called internally.grid._compute*
(don't need to explicitly pass self)grid._compute_p_centers
andgrid._compute_p_edges
(1D does not need to be a special case).grid._compute_c_centers_with_ghost
Docstrings
grid.c_centers_with_ghost
#385)Dimension
dimension.num_ghost
_centers
and_edges
exist separately for each Dimensiondimension.*_with_ghost()
_check_validity()
method