~vcs-imports/escript-finley/trunk

« back to all changes in this revision

Viewing changes to dudley/src/CPPAdapter/DudleyError.cpp

  • Committer: jfenwick
  • Date: 2010-10-11 01:48:14 UTC
  • Revision ID: svn-v4:77569008-7704-0410-b7a0-a92fef0b09fd:trunk:3259
Merging dudley and scons updates from branches

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
/*******************************************************
 
3
*
 
4
* Copyright (c) 2003-2010 by University of Queensland
 
5
* Earth Systems Science Computational Center (ESSCC)
 
6
* http://www.uq.edu.au/esscc
 
7
*
 
8
* Primary Business: Queensland, Australia
 
9
* Licensed under the Open Software License version 3.0
 
10
* http://www.opensource.org/licenses/osl-3.0.php
 
11
*
 
12
*******************************************************/
 
13
 
 
14
 
 
15
#ifdef ESYS_MPI
 
16
#include <mpi.h>
 
17
#endif
 
18
#include "DudleyError.h"
 
19
#include <iostream>
 
20
 
 
21
namespace dudley {
 
22
 
 
23
  void setDudleyError(Dudley_ErrorCodeType errorCode, 
 
24
                      const std::string& errMess) 
 
25
  {
 
26
    Dudley_setError(errorCode,(__const char*)(errMess.c_str()));
 
27
  }
 
28
 
 
29
  void checkDudleyError() 
 
30
  {
 
31
    if (Dudley_noError()) {
 
32
      return;
 
33
    } else {
 
34
      //
 
35
      // reset the error code to no error otherwise the next call to
 
36
      // this function may resurrect a previous error
 
37
      Dudley_resetError();
 
38
      throw DudleyAdapterException(Dudley_getErrorMessage());
 
39
    }
 
40
  }
 
41
  void checkPasoError() 
 
42
  {
 
43
    if (Esys_noError()) {
 
44
      return;
 
45
    } else {
 
46
      //
 
47
      // reset the error code to no error otherwise the next call to
 
48
      // this function may resurrect a previous error
 
49
      Esys_resetError();
 
50
      throw DudleyAdapterException(Esys_getErrorMessage());
 
51
    }
 
52
  }
 
53
 
 
54
}  // end of namespace