MFEM  v3.2
Finite element discretization library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
error.cpp
Go to the documentation of this file.
1 // Copyright (c) 2010, Lawrence Livermore National Security, LLC. Produced at
2 // the Lawrence Livermore National Laboratory. LLNL-CODE-443211. All Rights
3 // reserved. See file COPYRIGHT for details.
4 //
5 // This file is part of the MFEM library. For more information and source code
6 // availability see http://mfem.org.
7 //
8 // MFEM is free software; you can redistribute it and/or modify it under the
9 // terms of the GNU Lesser General Public License (as published by the Free
10 // Software Foundation) version 2.1 dated February 1999.
11 
12 #include "error.hpp"
13 #include <cstdlib>
14 #include <iostream>
15 
16 #ifdef MFEM_USE_MPI
17 #include <mpi.h>
18 #endif
19 
20 namespace mfem
21 {
22 
23 void mfem_error(const char *msg)
24 {
25  if (msg)
26  {
27  // NOTE: This endl also flushes the I/O stream, which can be a very bad
28  // thing if all your processors try to do it at the same time.
29  std::cerr << "\n\n" << msg << std::endl;
30  }
31 #ifdef MFEM_USE_MPI
32  MPI_Abort(MPI_COMM_WORLD, 1);
33 #else
34  std::abort(); // force crash by calling abort
35 #endif
36 }
37 
38 void mfem_warning(const char *msg)
39 {
40  if (msg)
41  {
42  std::cout << "\n\n" << msg << std::endl;
43  }
44 }
45 
46 }
void mfem_warning(const char *msg)
Definition: error.cpp:38
void mfem_error(const char *msg)
Definition: error.cpp:23