Comments (8)
Since it is ATS and not Amanzi, more details would be helpful. For example, this exception could be handled inside ATS's main().
from amanzi.
It's not an ATS thing though since any physics can call get_set_*() calls. I thought it was handled in the geometric model, but apparently not. I can deal with it, but any opposition to putting it there?
from amanzi.
valid_set_name() does the job you need. Of coarse, we can check name validity every time we call get_set_*() and replace one exception with another. But this will be the fourth level of control in Amanzi on the top of (1) Akuna that creates an input file using existing regions, (2) converter that performs many checks and (3) InputAnalysis that verifies mesh sets.
from amanzi.
No, this is clearly an ask forgiveness not permission. "try" has no overhead on almost all compilers, only costs more if exceptions are thrown, at which point the code is dying anyway so who cares about a bit of overhead.
from amanzi.
Where should we draw a line? Check validity regions of input parameters (like RCP pointers) in all subroutines and throw an exception when checks fail? I vote for using valid_set_name() and improving error messages in this subroutine. But this is Rao's code and I'll follow his advice.
from amanzi.
If you use valid_set_name, then you will get a more meaningful error message. It is obviously a non-zero expense so perhaps one can enclose it within a #ifdef DEBUG statement or call AMANZI_ASSERT on its result?
from amanzi.
Alternately we can try, catch the exception, then call valid_set_name().
Cost is free when the set is valid, and we still get the more useful error
message.
In terms of where to draw the line, I believe that error messages should be
handled in the library/component which has the error. Validating the input
spec is great, but not robust, and not self-contained.
For instance, if the mesh class gets pulled out as a library, calling it
maybe Jolly or something, then the input spec parser is worthless and the
error message is again useless. Components should be as self contained as
possible.
Furthermore, your example isn't a good one -- a bad Ptr/RCP is a developer
bug. A bad set name is a user bug. We should be much more careful about
error messages with regards to the latter.
Ethan
On Fri, Oct 21, 2016 at 1:43 PM Rao Garimella [email protected]
wrote:
If you use valid_set_name, then you will get a more meaningful error
message. It is obviously a non-zero expense so perhaps one can enclose it
within a #ifdef DEBUG statement or call AMANZI_ASSERT on its result?—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
#47 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AE43-2w0GABCLURKYYVv-NiRUjoHX08Rks5q2RXSgaJpZM4Kcf0_
.
from amanzi.
from amanzi.
Related Issues (20)
- fix speed tests from mesh refactor
- Compiling with GCC 13 breaks TPLs and Amanzi HOT 1
- Prepare Amanzi for in-memory coupling with other codes
- NERSC Shifter requires removal of RPATH and updates to ld.so.conf HOT 3
- RPATH on Amanzi 1.2 release is incomplete for some tests
- TPL Updates for version 0.98.8 HOT 10
- Initialize volumetric liquid/gas fluxes in Multiphase_PK::Initialize() based on initial pressure profiles.
- Change boundary condition implementation in Multiphase_PK.
- Potential code handing in coupled flow simulations
- A test for initialize-from-file scenario is needed
- return error codes and deal with missing variable names HOT 3
- Support of edge to cells connectivity in Simple mesh framework
- Add Alquimia extra properties to pass to chem engines HOT 5
- Fix poor naming conventions in PK_DomainFunction HOT 6
- Logical region is neither open nor closed HOT 9
- NERSC Transition from Shifter to podman-hpc
- ic in all vis files? HOT 2
- A few operator tests were commented out
- TPL updates for version 0.98.9 HOT 3
- TimeStepManager and transport HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amanzi.