/[escript]/branches/domexper/dudley/src/Util.c
ViewVC logotype

Diff of /branches/domexper/dudley/src/Util.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/esys2/finley/src/finleyC/Util.c revision 123 by jgs, Fri Jul 8 04:08:13 2005 UTC trunk/finley/src/Util.c revision 471 by jgs, Fri Jan 27 01:33:02 2006 UTC
# Line 1  Line 1 
1  /* $Id$ */  /*
2     ******************************************************************************
3     *                                                                            *
4     *       COPYRIGHT  ACcESS 2003,2004,2005 -  All Rights Reserved              *
5     *                                                                            *
6     * This software is the property of ACcESS. No part of this code              *
7     * may be copied in any form or by any means without the expressed written    *
8     * consent of ACcESS.  Copying, use or modification of this software          *
9     * by any unauthorised person is illegal unless that person has a software    *
10     * license agreement with ACcESS.                                             *
11     *                                                                            *
12     ******************************************************************************
13    */
14    
15  /**************************************************************/  /**************************************************************/
16    
# Line 6  Line 18 
18    
19  /**************************************************************/  /**************************************************************/
20    
 /*   Copyrights by ACcESS Australia, 2003 */  
21  /*   author: gross@access.edu.au */  /*   author: gross@access.edu.au */
22  /*   Version: $Id$ */  /*   Version: $Id$ */
23    
24  /**************************************************************/  /**************************************************************/
25    
 #include "Common.h"  
26  #include "Finley.h"  #include "Finley.h"
27  #include "Util.h"  #include "Util.h"
28  #ifdef _OPENMP  #ifdef _OPENMP
# Line 21  Line 31 
31    
32  /**************************************************************/  /**************************************************************/
33    
34    /*   returns true if any of the values in the short array values is not equalt to Zero */
35    
36    bool_t Finley_Util_anyNonZeroDouble(dim_t N, double* values) {
37       dim_t q;
38       for (q=0;q<N;++q) if (ABS(values[q])>0) return TRUE;
39       return FALSE;
40    }
41    /**************************************************************/
42    
43  /*   gathers double values out from in by index: */  /*   gathers double values out from in by index: */
44    
45  /*        out(1:numData,1:len)=in(1:numData,index(1:len)) */  /*        out(1:numData,1:len)=in(1:numData,index(1:len)) */
# Line 115  void Finley_Util_InvertSmallMat(dim_t le Line 134  void Finley_Util_InvertSmallMat(dim_t le
134                 D=1./D;                 D=1./D;
135                 invA[q]=D;                 invA[q]=D;
136              } else {              } else {
137                 Finley_ErrorCode=ZERO_DIVISION_ERROR;                 Finley_setError(ZERO_DIVISION_ERROR,"__FILE__: Non-regular matrix");
                sprintf(Finley_ErrorMsg,"Non-regular matrix");  
138                 return;                 return;
139              }              }
140           }           }
# Line 138  void Finley_Util_InvertSmallMat(dim_t le Line 156  void Finley_Util_InvertSmallMat(dim_t le
156                 invA[INDEX3(0,1,q,2,2)]=-A12*D;                 invA[INDEX3(0,1,q,2,2)]=-A12*D;
157                 invA[INDEX3(1,1,q,2,2)]= A11*D;                 invA[INDEX3(1,1,q,2,2)]= A11*D;
158              } else {              } else {
159                 Finley_ErrorCode=ZERO_DIVISION_ERROR;                 Finley_setError(ZERO_DIVISION_ERROR,"__FILE__: Non-regular matrix");
                sprintf(Finley_ErrorMsg,"Non-regular matrix");  
160                 return;                 return;
161              }              }
162           }           }
# Line 171  void Finley_Util_InvertSmallMat(dim_t le Line 188  void Finley_Util_InvertSmallMat(dim_t le
188                 invA[INDEX3(1,2,q,3,3)]=(A13*A21-A11*A23)*D;                 invA[INDEX3(1,2,q,3,3)]=(A13*A21-A11*A23)*D;
189                 invA[INDEX3(2,2,q,3,3)]=(A11*A22-A12*A21)*D;                 invA[INDEX3(2,2,q,3,3)]=(A11*A22-A12*A21)*D;
190              } else {              } else {
191                 Finley_ErrorCode=ZERO_DIVISION_ERROR;                 Finley_setError(ZERO_DIVISION_ERROR,"__FILE__: Non-regular matrix");
                sprintf(Finley_ErrorMsg,"Non-regular matrix");  
192                 return;                 return;
193              }              }
194           }           }
# Line 242  void  Finley_NormalVector(dim_t len, dim Line 258  void  Finley_NormalVector(dim_t len, dim
258              A21=A[INDEX3(1,0,q,2,dim1)];              A21=A[INDEX3(1,0,q,2,dim1)];
259              length = sqrt(A11*A11+A21*A21);              length = sqrt(A11*A11+A21*A21);
260              if (! length>0) {              if (! length>0) {
261                 Finley_ErrorCode=ZERO_DIVISION_ERROR;                 Finley_setError(ZERO_DIVISION_ERROR,"__FILE__: area equals zero.");
                sprintf(Finley_ErrorMsg,"area equals zero.");  
262                 return;                 return;
263              } else {              } else {
264                 invlength=1./length;                 invlength=1./length;
# Line 265  void  Finley_NormalVector(dim_t len, dim Line 280  void  Finley_NormalVector(dim_t len, dim
280              CO_A33=A11*A22-A21*A12;              CO_A33=A11*A22-A21*A12;
281              length=sqrt(CO_A13*CO_A13+CO_A23*CO_A23+CO_A33*CO_A33);              length=sqrt(CO_A13*CO_A13+CO_A23*CO_A23+CO_A33*CO_A33);
282              if (! length>0) {              if (! length>0) {
283                 Finley_ErrorCode=ZERO_DIVISION_ERROR;                 Finley_setError(ZERO_DIVISION_ERROR,"__FILE__: area equals zero.");
                sprintf(Finley_ErrorMsg,"area equals zero.");  
284                 return;                 return;
285              } else {              } else {
286                 invlength=1./length;                 invlength=1./length;
# Line 464  void Finley_copyDouble(dim_t n,double* s Line 478  void Finley_copyDouble(dim_t n,double* s
478  }  }
479    
480  /*  /*
481   * $Log$   * Revision 1.8  2005/08/12 01:45:43  jgs
482     * erge of development branch dev-02 back to main trunk on 2005-08-12
483     *
484     * Revision 1.7.2.2  2005/09/07 06:26:22  gross
485     * the solver from finley are put into the standalone package paso now
486     *
487     * Revision 1.7.2.1  2005/08/04 22:41:11  gross
488     * some extra routines for finley that might speed-up RHS assembling in some cases (not actived right now)
489     *
490   * Revision 1.7  2005/07/08 04:07:59  jgs   * Revision 1.7  2005/07/08 04:07:59  jgs
491   * Merge of development branch back to main trunk on 2005-07-08   * Merge of development branch back to main trunk on 2005-07-08
492   *   *

Legend:
Removed from v.123  
changed lines
  Added in v.471

  ViewVC Help
Powered by ViewVC 1.1.26