[MOAB-dev] [PATCH] scdtest.cpp: print what failed on error

Jason Kraftcheck kraftche at cae.wisc.edu
Mon Nov 30 09:22:11 CST 2009


Why do you want to change this from a function to a macro?

- jason



Jed Brown wrote:
> ---
>  parallel/scdtest.cpp |   15 ++++++++-------
>  1 files changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/parallel/scdtest.cpp b/parallel/scdtest.cpp
> index 64ca4d8..4158ff2 100644
> --- a/parallel/scdtest.cpp
> +++ b/parallel/scdtest.cpp
> @@ -42,6 +42,14 @@ void create_hexes_and_verts();
>  void resolve_and_exchange();
>  void error(MBErrorCode err);
>  
> +#define error(err) do {                         \
> +    if((err) != MB_SUCCESS) {                   \
> +      cerr << "Error: MOAB function failed\n";  \
> +      assert((err) == MB_SUCCESS);              \
> +    }                                           \
> +  } while (0)
> +
> +
>  int main(int argc, char *argv[])
>  {
>    MPI_Init(&argc, &argv);
> @@ -196,10 +204,3 @@ void resolve_and_exchange()
>    error(mbpc->exchange_ghost_cells(-1, 0, 1, true));
>  }
>  
> -void error(MBErrorCode err)
> -{
> -  if(err != MB_SUCCESS) {
> -    cerr << "Error: MOAB function failed\n";
> -    assert(0);
> -  }
> -}


-- 
"A foolish consistency is the hobgoblin of little minds" - Ralph Waldo Emerson



More information about the moab-dev mailing list