/[escript]/trunk/finley/src/Quadrature.c
ViewVC logotype

Diff of /trunk/finley/src/Quadrature.c

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

revision 149 by jgs, Tue Oct 26 06:53:54 2004 UTC revision 150 by jgs, Thu Sep 15 03:44:45 2005 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"  
 #include "Finley.h"  
26  #include "Quadrature.h"  #include "Quadrature.h"
27    
28  #define QUADNODES(_K_,_I_) quadNodes[INDEX2(_K_,_I_,DIM)]  #define QUADNODES(_K_,_I_) quadNodes[INDEX2(_K_,_I_,DIM)]
# Line 40  void Finley_Quad_getNodesTri(int numQuad Line 49  void Finley_Quad_getNodesTri(int numQuad
49      /*  get scheme on [0.1]^2 */      /*  get scheme on [0.1]^2 */
50            
51      Finley_Quad_getNodesRec(numQuadNodes,quadNodes,quadWeights);      Finley_Quad_getNodesRec(numQuadNodes,quadNodes,quadWeights);
52      if (Finley_ErrorCode!=NO_ERROR) return;      if (! Finley_noError()) return;
53            
54      /*  squeeze it: */      /*  squeeze it: */
55            
# Line 77  void Finley_Quad_getNodesTet(int numQuad Line 86  void Finley_Quad_getNodesTet(int numQuad
86      /*  get scheme on [0.1]^3 */      /*  get scheme on [0.1]^3 */
87            
88      Finley_Quad_getNodesHex(numQuadNodes,quadNodes,quadWeights);      Finley_Quad_getNodesHex(numQuadNodes,quadNodes,quadWeights);
89      if (Finley_ErrorCode!=NO_ERROR) return;      if (! Finley_noError()) return;
90            
91      /*  squeeze it: */      /*  squeeze it: */
92            
# Line 111  void Finley_Quad_getNodesTet(int numQuad Line 120  void Finley_Quad_getNodesTet(int numQuad
120  /*   as a X-product of a 1D scheme. */  /*   as a X-product of a 1D scheme. */
121    
122  void Finley_Quad_getNodesRec(int numQuadNodes,double* quadNodes,double* quadWeights) {  void Finley_Quad_getNodesRec(int numQuadNodes,double* quadNodes,double* quadWeights) {
123      char error_msg[LenErrorMsg_MAX];
124    int numQuadNodes1d,i,j,l;    int numQuadNodes1d,i,j,l;
125    double quadNodes1d[numQuadNodes],quadWeights1d[numQuadNodes];    double quadNodes1d[numQuadNodes],quadWeights1d[numQuadNodes];
126    #define DIM 2    #define DIM 2
# Line 126  void Finley_Quad_getNodesRec(int numQuad Line 136  void Finley_Quad_getNodesRec(int numQuad
136                
137        /*  make 2D scheme: */        /*  make 2D scheme: */
138                
139        if (Finley_ErrorCode==NO_ERROR) {        if (Finley_noError()) {
140          l=0;          l=0;
141          for (i=0;i<numQuadNodes1d;i++) {          for (i=0;i<numQuadNodes1d;i++) {
142            for (j=0;j<numQuadNodes1d;j++) {            for (j=0;j<numQuadNodes1d;j++) {
# Line 140  void Finley_Quad_getNodesRec(int numQuad Line 150  void Finley_Quad_getNodesRec(int numQuad
150        return;        return;
151      }      }
152    }    }
153    Finley_ErrorCode=VALUE_ERROR;    sprintf(error_msg,"__FILE__: Illegal number of quadrature nodes %d on hexahedron.",numQuadNodes);
154    sprintf(Finley_ErrorMsg,"Illegal number of quadrature nodes %d on hexahedron.",numQuadNodes);    Finley_setError(VALUE_ERROR,error_msg);
155    #undef DIM    #undef DIM
156  }  }
157    
# Line 151  void Finley_Quad_getNodesRec(int numQuad Line 161  void Finley_Quad_getNodesRec(int numQuad
161  /*   as a X-product of a 1D scheme. */  /*   as a X-product of a 1D scheme. */
162    
163  void Finley_Quad_getNodesHex(int numQuadNodes,double* quadNodes,double* quadWeights) {  void Finley_Quad_getNodesHex(int numQuadNodes,double* quadNodes,double* quadWeights) {
164      char error_msg[LenErrorMsg_MAX];
165    int numQuadNodes1d,i,j,k,l;    int numQuadNodes1d,i,j,k,l;
166    double quadNodes1d[numQuadNodes],quadWeights1d[numQuadNodes];    double quadNodes1d[numQuadNodes],quadWeights1d[numQuadNodes];
167    #define DIM 3    #define DIM 3
# Line 166  void Finley_Quad_getNodesHex(int numQuad Line 177  void Finley_Quad_getNodesHex(int numQuad
177                
178        /*  make 3D scheme: */        /*  make 3D scheme: */
179                
180        if (Finley_ErrorCode==NO_ERROR) {        if (Finley_noError()) {
181          l=0;          l=0;
182          for (i=0;i<numQuadNodes1d;i++) {          for (i=0;i<numQuadNodes1d;i++) {
183            for (j=0;j<numQuadNodes1d;j++) {            for (j=0;j<numQuadNodes1d;j++) {
# Line 184  void Finley_Quad_getNodesHex(int numQuad Line 195  void Finley_Quad_getNodesHex(int numQuad
195        return;        return;
196      }      }
197    }    }
198    Finley_ErrorCode=VALUE_ERROR;    sprintf(error_msg,"__FILE__: Illegal number of quadrature nodes %d on hexahedron.",numQuadNodes);
199    sprintf(Finley_ErrorMsg,"Illegal number of quadrature nodes %d on hexahedron.",numQuadNodes);    Finley_setError(VALUE_ERROR,error_msg);
200    #undef DIM    #undef DIM
201  }  }
202    
# Line 197  void Finley_Quad_getNodesHex(int numQuad Line 208  void Finley_Quad_getNodesHex(int numQuad
208    
209  void Finley_Quad_getNodesPoint(int numQuadNodes,double* quadNodes,double* quadWeights) {  void Finley_Quad_getNodesPoint(int numQuadNodes,double* quadNodes,double* quadWeights) {
210    if (numQuadNodes!=0) {    if (numQuadNodes!=0) {
211         Finley_ErrorCode=VALUE_ERROR;         Finley_setError(VALUE_ERROR,"__FILE__: There is no quadrature scheme on points.");
        sprintf(Finley_ErrorMsg,"There is no quadrature scheme on points.");  
212    }    }
213  }  }
214    
# Line 350  void Finley_Quad_getNodesLine(int numQua Line 360  void Finley_Quad_getNodesLine(int numQua
360          break;          break;
361    
362        default:        default:
363          Finley_ErrorCode=VALUE_ERROR;          Finley_setError(VALUE_ERROR,"__FILE__: Negative intergration order.");
         sprintf(Finley_ErrorMsg,"Negative intergration order.");  
364          break;          break;
365    }    }
366  }  }
# Line 382  void Finley_Quad_makeNodesOnFace(int dim Line 391  void Finley_Quad_makeNodesOnFace(int dim
391    
392      #define DIM dim      #define DIM dim
393      getFaceNodes(numQuadNodes,quadNodesOnFace,quadWeights);      getFaceNodes(numQuadNodes,quadNodesOnFace,quadWeights);
394      if (Finley_ErrorCode!=NO_ERROR) return;      if (! Finley_noError()) return;
395            
396      for (q=0;q<numQuadNodes;q++) {      for (q=0;q<numQuadNodes;q++) {
397         for (i=0;i<dim-1;i++) QUADNODES(i,q)=quadNodesOnFace[INDEX2(i,q,dim-1)];         for (i=0;i<dim-1;i++) QUADNODES(i,q)=quadNodesOnFace[INDEX2(i,q,dim-1)];
# Line 400  void Finley_Quad_makeNodesOnFace(int dim Line 409  void Finley_Quad_makeNodesOnFace(int dim
409    
410  int Finley_Quad_getNumNodesPoint(int order) {  int Finley_Quad_getNumNodesPoint(int order) {
411    if (order <0 ) {    if (order <0 ) {
412      Finley_ErrorCode=VALUE_ERROR;      Finley_setError(VALUE_ERROR,"__FILE__: Negative intergration order.");
     sprintf(Finley_ErrorMsg,"Negative intergration order.");  
413      return -1;      return -1;
414    } else {    } else {
415      return 0;      return 0;
# Line 409  int Finley_Quad_getNumNodesPoint(int ord Line 417  int Finley_Quad_getNumNodesPoint(int ord
417  }  }
418    
419  int Finley_Quad_getNumNodesLine(int order) {  int Finley_Quad_getNumNodesLine(int order) {
420      char error_msg[LenErrorMsg_MAX];
421    if (order <0 ) {    if (order <0 ) {
422      Finley_ErrorCode=VALUE_ERROR;      Finley_setError(VALUE_ERROR,"__FILE__: Negative intergration order.");
     sprintf(Finley_ErrorMsg,"Negative intergration order.");  
423      return -1;      return -1;
424    } else {    } else {
425      if (order > 2*MAX_numQuadNodesLine-1) {      if (order > 2*MAX_numQuadNodesLine-1) {
426        Finley_ErrorCode=VALUE_ERROR;        sprintf(error_msg,"__FILE__: requested integration order %d on line is too large (>%d).",
       sprintf(Finley_ErrorMsg,"requested integration order %d on line is too large (>%d).",  
427                                                             order,2*MAX_numQuadNodesLine-1);                                                             order,2*MAX_numQuadNodesLine-1);
428          Finley_setError(VALUE_ERROR,error_msg);
429        return -1;        return -1;
430      } else {      } else {
431         Finley_ErrorCode=NO_ERROR;         Finley_resetError();
432         return order/2+1;         return order/2+1;
433      }      }
434    }    }
# Line 432  int Finley_Quad_getNumNodesTri(int order Line 440  int Finley_Quad_getNumNodesTri(int order
440        return 1;        return 1;
441    } else {    } else {
442        numQuadNodesLine=Finley_Quad_getNumNodesLine(order+1);        numQuadNodesLine=Finley_Quad_getNumNodesLine(order+1);
443        if (Finley_ErrorCode==NO_ERROR) {        if (Finley_noError()) {
444           return numQuadNodesLine*numQuadNodesLine;           return numQuadNodesLine*numQuadNodesLine;
445        } else {        } else {
446           return -1;           return -1;
# Line 443  int Finley_Quad_getNumNodesTri(int order Line 451  int Finley_Quad_getNumNodesTri(int order
451  int Finley_Quad_getNumNodesRec(int order) {  int Finley_Quad_getNumNodesRec(int order) {
452    int numQuadNodesLine;    int numQuadNodesLine;
453    numQuadNodesLine=Finley_Quad_getNumNodesLine(order);    numQuadNodesLine=Finley_Quad_getNumNodesLine(order);
454    if (Finley_ErrorCode==NO_ERROR) {    if (Finley_noError()) {
455        return numQuadNodesLine*numQuadNodesLine;        return numQuadNodesLine*numQuadNodesLine;
456    } else {    } else {
457        return -1;        return -1;
# Line 453  int Finley_Quad_getNumNodesRec(int order Line 461  int Finley_Quad_getNumNodesRec(int order
461  int Finley_Quad_getNumNodesTet(int order) {  int Finley_Quad_getNumNodesTet(int order) {
462    int numQuadNodesLine;    int numQuadNodesLine;
463    numQuadNodesLine=Finley_Quad_getNumNodesLine(order+2);    numQuadNodesLine=Finley_Quad_getNumNodesLine(order+2);
464    if (Finley_ErrorCode==NO_ERROR) {    if (Finley_noError()) {
465        return numQuadNodesLine*numQuadNodesLine*numQuadNodesLine;        return numQuadNodesLine*numQuadNodesLine*numQuadNodesLine;
466    } else {    } else {
467        return -1;        return -1;
# Line 463  int Finley_Quad_getNumNodesTet(int order Line 471  int Finley_Quad_getNumNodesTet(int order
471  int Finley_Quad_getNumNodesHex(int order) {  int Finley_Quad_getNumNodesHex(int order) {
472    int numQuadNodesLine;    int numQuadNodesLine;
473    numQuadNodesLine=Finley_Quad_getNumNodesLine(order);    numQuadNodesLine=Finley_Quad_getNumNodesLine(order);
474    if (Finley_ErrorCode==NO_ERROR) {    if (Finley_noError()) {
475        return numQuadNodesLine*numQuadNodesLine*numQuadNodesLine;        return numQuadNodesLine*numQuadNodesLine*numQuadNodesLine;
476    } else {    } else {
477        return -1;        return -1;
# Line 471  int Finley_Quad_getNumNodesHex(int order Line 479  int Finley_Quad_getNumNodesHex(int order
479  }  }
480  /*  /*
481  * $Log$  * $Log$
482  * Revision 1.1  2004/10/26 06:53:57  jgs  * Revision 1.2  2005/09/15 03:44:23  jgs
483  * Initial revision  * Merge of development branch dev-02 back to main trunk on 2005-09-15
484    *
485    * Revision 1.1.1.1.6.1  2005/09/07 06:26:20  gross
486    * the solver from finley are put into the standalone package paso now
487    *
488    * Revision 1.1.1.1  2004/10/26 06:53:57  jgs
489    * initial import of project esys2
490  *  *
491  * Revision 1.2  2004/08/03 04:49:06  gross  * Revision 1.2  2004/08/03 04:49:06  gross
492  * bug in Quadrature.c fixed  * bug in Quadrature.c fixed

Legend:
Removed from v.149  
changed lines
  Added in v.150

  ViewVC Help
Powered by ViewVC 1.1.26