SpatialOps
Nebo.h
1 /*
2  * Copyright (c) 2014-2017 The University of Utah
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a copy
5  * of this software and associated documentation files (the "Software"), to
6  * deal in the Software without restriction, including without limitation the
7  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8  * sell copies of the Software, and to permit persons to whom the Software is
9  * furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20  * IN THE SOFTWARE.
21  */
22 
23 #ifndef NEBO_H
24 #define NEBO_H
25 
26 #include <spatialops/SpatialOpsConfigure.h>
27 
28 #include <spatialops/NeboBasic.h>
29 #include <spatialops/NeboRhs.h>
30 #include <spatialops/NeboMask.h>
31 #include <spatialops/NeboOperators.h>
32 #include <spatialops/NeboCond.h>
33 #include <spatialops/NeboStencils.h>
34 #include <spatialops/NeboLhs.h>
35 #include <spatialops/NeboStencilBuilder.h>
36 #include <spatialops/NeboAssignment.h>
37 #include <spatialops/NeboReductions.h>
38 #include <spatialops/NeboTypeInference.h>
39 #include <spatialops/NeboApplyPointwise.h>
40 
41 
42 /* NEBO_ERROR_TRAP can be used to find where Nebo errors originate.
43  * NEBO_ERROR_TRAP takes a string and a block of code to run.
44  * NEBO_ERROR_TRAP does nothing in Release mode.
45  * In Debug mode, NEBO_ERROR_TRAP does the following:
46  * If there is no error in the given code, NEBO_ERROR_TRAP does nothing.
47  * If there is an error in the given code, NEBO_ERROR_TRAP adds the current file and line number.
48  *
49  * For example:
50  * NEBO_ERROR_TRAP("TEST LOCATION", throw(std::runtime_error("ERROR MESSAGE"));)
51  * will throw this error:
52  * terminate called after throwing an instance of 'std::runtime_error'
53  * what(): Error in NEBO ERROR TRAP (ERROR LOCATION)
54  ERROR MESSAGE
55  * At: /uufs/chpc.utah.edu/common/home/u0623470/aurora-cwearl/code/SpatialOps/test/Nebo.h : 48
56  * Aborted
57  */
58 #ifndef NDEBUG
59 #define NEBO_ERROR_TRAP(STRING, CODE) \
60  try { CODE } \
61  catch(std::runtime_error& e){ \
62  std::ostringstream msg; \
63  msg << "Error in NEBO ERROR TRAP ("; \
64  msg << STRING; \
65  msg << ")\n\t" << e.what(); \
66  msg << "\n\tAt: "; \
67  msg << __FILE__ << " : " << __LINE__; \
68  throw(std::runtime_error(msg.str())); \
69  };
70 #else
71 #define NEBO_ERROR_TRAP(STRING, CODE) CODE
72 #endif
73 
74 #endif
75