/[escript]/trunk/esysUtils/src/error.c
ViewVC logotype

Contents of /trunk/esysUtils/src/error.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 150 - (show annotations)
Thu Sep 15 03:44:45 2005 UTC (14 years, 2 months ago) by jgs
Original Path: trunk/esys2/paso/src/Paso.c
File MIME type: text/plain
File size: 3402 byte(s)
Merge of development branch dev-02 back to main trunk on 2005-09-15

1 /* $Id$ */
2
3 /**************************************************************/
4
5 /* Paso finite element solver */
6
7 /**************************************************************/
8
9 /* Copyrights by ACcESS Australia, 2003 */
10 /* Version: $Id$ */
11
12 /**************************************************************/
13
14 #include "Paso.h"
15 #ifdef _OPENMP
16 #include <omp.h>
17 #else
18 #include <time.h>
19 #endif
20
21 Paso_ErrorCodeType Paso_ErrorCode_=NO_ERROR;
22 char Paso_ErrorMsg_[LenErrorMsg_MAX]={'\0'};
23
24 /* reset the error to NO_ERROR */
25 void Paso_resetError(void) {
26 Paso_ErrorCode_=NO_ERROR;
27 }
28
29 /* sets an error */
30 void Paso_setError(Paso_ErrorCodeType err,char* msg) {
31 size_t lenMsg=strlen(msg);
32 if (Paso_noError()) {
33 Paso_ErrorCode_=err;
34 strncpy(Paso_ErrorMsg_,msg,MIN(LenErrorMsg_MAX,lenMsg));
35 Paso_ErrorMsg_[MIN(LenErrorMsg_MAX,lenMsg)]='\0';
36 }
37 }
38
39 /* checks if there is no error */
40 bool_t Paso_noError(void) {
41 Paso_ErrorCodeType err=Paso_getErrorType();
42 return (err==NO_ERROR || err==WARNING);
43 }
44 /* This function checks if the pointer ptr has a target. If not an
45 error is raised and TRUE is returned. */
46
47 bool_t Paso_checkPtr(void* ptr) {
48 if (ptr==NULL) {
49 Paso_setError(MEMORY_ERROR,"Out of memory.");
50 return TRUE;
51 } else {
52 return FALSE;
53 }
54 }
55
56 /* This function returns a timer */
57 double Paso_timer(void) {
58 double out;
59 #ifdef _OPENMP
60 out=omp_get_wtime();
61 #else
62 out=((double) clock())/CLOCKS_PER_SEC;
63 #endif
64 return out;
65 }
66
67 /* return the error code */
68 Paso_ErrorCodeType Paso_getErrorType(void) {
69 return Paso_ErrorCode_;
70 }
71
72 /* return the error message */
73 char* Paso_getErrorMessage(void) {
74 return Paso_ErrorMsg_;
75 }
76
77
78
79 /**************************************************************/
80
81
82 /*
83 * $Log$
84 * Revision 1.2 2005/09/15 03:44:38 jgs
85 * Merge of development branch dev-02 back to main trunk on 2005-09-15
86 *
87 * Revision 1.1.2.3 2005/09/08 08:28:39 gross
88 * some cleanup in savevtk
89 *
90 * Revision 1.1.2.2 2005/09/07 00:59:08 gross
91 * some inconsistent renaming fixed to make the linking work.
92 *
93 * Revision 1.1.2.1 2005/09/05 06:29:47 gross
94 * These files have been extracted from finley to define a stand alone libray for iterative
95 * linear solvers on the ALTIX. main entry through Paso_solve. this version compiles but
96 * has not been tested yet.
97 *
98 * Revision 1.2 2005/07/08 04:07:50 jgs
99 * Merge of development branch back to main trunk on 2005-07-08
100 *
101 * Revision 1.1.1.1.2.1 2005/06/29 02:34:50 gross
102 * some changes towards 64 integers in finley
103 *
104 * Revision 1.1.1.1 2004/10/26 06:53:57 jgs
105 * initial import of project esys2
106 *
107 * Revision 1.2 2004/07/02 04:21:13 gross
108 * Paso C code has been included
109 *
110 * Revision 1.1.1.1 2004/06/24 04:00:40 johng
111 * Initial version of eys using boost-python.
112 *
113 *
114 */

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26