/[escript]/trunk/paso/src/Paso.c
ViewVC logotype

Annotation of /trunk/paso/src/Paso.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 155 - (hide annotations)
Wed Nov 9 02:02:19 2005 UTC (14 years, 4 months ago) by jgs
File MIME type: text/plain
File size: 2176 byte(s)
move all directories from trunk/esys2 into trunk and remove esys2

1 jgs 150 /* $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 jgs 154 /* return (err==NO_ERROR || err==WARNING);*/
43     return (err==NO_ERROR);
44 jgs 150 }
45     /* This function checks if the pointer ptr has a target. If not an
46     error is raised and TRUE is returned. */
47    
48     bool_t Paso_checkPtr(void* ptr) {
49     if (ptr==NULL) {
50     Paso_setError(MEMORY_ERROR,"Out of memory.");
51     return TRUE;
52     } else {
53     return FALSE;
54     }
55     }
56    
57     /* This function returns a timer */
58     double Paso_timer(void) {
59     double out;
60     #ifdef _OPENMP
61     out=omp_get_wtime();
62     #else
63     out=((double) clock())/CLOCKS_PER_SEC;
64     #endif
65     return out;
66     }
67    
68     /* return the error code */
69     Paso_ErrorCodeType Paso_getErrorType(void) {
70     return Paso_ErrorCode_;
71     }
72    
73     /* return the error message */
74     char* Paso_getErrorMessage(void) {
75     return Paso_ErrorMsg_;
76     }
77    
78     /**************************************************************/

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26