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

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

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

trunk/esys2/finley/src/finleyC/Assemble_PDE_RHS.c revision 149 by jgs, Thu Sep 1 03:31:39 2005 UTC trunk/finley/src/finleyC/Assemble_PDE_RHS.c revision 155 by jgs, Wed Nov 9 02:02:19 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 19  Line 31 
31    
32  /**************************************************************/  /**************************************************************/
33    
34  /*   Copyrights by ACcESS Australia, 2003,2004,2005 */  /*  Author: gross@access.edu.au */
35  /*   author: gross@access.edu.au */  /*  Version: $Id$ */
 /*   Version: $Id$ */  
36    
37  /**************************************************************/  /**************************************************************/
38    
 #include "escript/Data/DataC.h"  
 #include "Finley.h"  
39  #include "Assemble.h"  #include "Assemble.h"
 #include "NodeFile.h"  
 #include "ElementFile.h"  
40  #include "Util.h"  #include "Util.h"
41  #ifdef _OPENMP  #ifdef _OPENMP
42  #include <omp.h>  #include <omp.h>
# Line 40  Line 47 
47    
48  void Finley_Assemble_PDE_RHS(Finley_NodeFile* nodes,Finley_ElementFile* elements,escriptDataC* F,escriptDataC* X, escriptDataC* Y ) {  void Finley_Assemble_PDE_RHS(Finley_NodeFile* nodes,Finley_ElementFile* elements,escriptDataC* F,escriptDataC* X, escriptDataC* Y ) {
49    
50      char error_msg[LenErrorMsg_MAX];
51    double *EM_F=NULL,*V=NULL,*dVdv=NULL,*dSdV=NULL,*Vol=NULL,*dvdV=NULL;    double *EM_F=NULL,*V=NULL,*dVdv=NULL,*dSdV=NULL,*Vol=NULL,*dvdV=NULL;
52    double time0;    double time0;
53    dim_t dimensions[ESCRIPT_MAX_DATA_RANK],e,q;    dim_t dimensions[ESCRIPT_MAX_DATA_RANK],e,q;
54    Assemble_Parameters p;    Assemble_Parameters p;
55    index_t *index_row=NULL,color;    index_t *index_row=NULL,color;
56    bool_t assemble;    bool_t assemble;
57      Finley_resetError();
58    
59    if (nodes==NULL || elements==NULL) return;    if (nodes==NULL || elements==NULL) return;
60    if (isEmpty(F) || (isEmpty(Y) && isEmpty(X)) ) return;    if (isEmpty(F) || (isEmpty(Y) && isEmpty(X)) ) return;
61    
62    /* set all parameters in p*/    /* set all parameters in p*/
63    Assemble_getAssembleParameters(nodes,elements,NULL,F,&p);    Assemble_getAssembleParameters(nodes,elements,NULL,F,&p);
64    if (Finley_ErrorCode!=NO_ERROR) return;    if (! Finley_noError()) return;
65    
66    /*  this function assumes NS=NN */    /*  this function assumes NS=NN */
67    if (p.NN!=p.NS) {    if (p.NN!=p.NS) {
68      Finley_ErrorCode=SYSTEM_ERROR;      Finley_setError(SYSTEM_ERROR,"__FILE__: for Finley_Assemble_PDE numNodes and numShapes have to be identical.");
     sprintf(Finley_ErrorMsg,"for Finley_Assemble_PDE numNodes and numShapes have to be identical.");  
69      return;      return;
70    }    }
71    if (p.numDim!=p.numElementDim) {    if (p.numDim!=p.numElementDim) {
72      Finley_ErrorCode=SYSTEM_ERROR;      Finley_setError(SYSTEM_ERROR,"__FILE__: Finley_Assemble_PDE accepts volume elements only.");
     sprintf(Finley_ErrorMsg,"Finley_Assemble_PDE accepts volume elements only.");  
73      return;      return;
74    }    }
75    /*  get a functionspace */    /*  get a functionspace */
# Line 74  void Finley_Assemble_PDE_RHS(Finley_Node Line 81  void Finley_Assemble_PDE_RHS(Finley_Node
81    /* check if all function spaces are the same */    /* check if all function spaces are the same */
82    
83    if (! functionSpaceTypeEqual(funcspace,X) ) {    if (! functionSpaceTypeEqual(funcspace,X) ) {
84          Finley_ErrorCode=TYPE_ERROR;          Finley_setError(TYPE_ERROR,"__FILE__: unexpected function space type for coefficient X");
         sprintf(Finley_ErrorMsg,"unexpected function space type for coefficient X");  
85    }    }
86    if (! functionSpaceTypeEqual(funcspace,Y) ) {    if (! functionSpaceTypeEqual(funcspace,Y) ) {
87          Finley_ErrorCode=TYPE_ERROR;          Finley_setError(TYPE_ERROR,"__FILE__: unexpected function space type for coefficient Y");
         sprintf(Finley_ErrorMsg,"unexpected function space type for coefficient Y");  
88    }    }
89    
90    /* check if all function spaces are the same */    /* check if all function spaces are the same */
91    
92    if (! numSamplesEqual(X,p.numQuad,elements->numElements) ) {    if (! numSamplesEqual(X,p.numQuad,elements->numElements) ) {
93          Finley_ErrorCode=TYPE_ERROR;          sprintf(error_msg,"__FILE__: sample points of coefficient X don't match (%d,%d)",p.numQuad,elements->numElements);
94          sprintf(Finley_ErrorMsg,"sample points of coefficient X don't match (%d,%d)",p.numQuad,elements->numElements);          Finley_setError(TYPE_ERROR,error_msg);
95    }    }
96    
97    if (! numSamplesEqual(Y,p.numQuad,elements->numElements) ) {    if (! numSamplesEqual(Y,p.numQuad,elements->numElements) ) {
98          Finley_ErrorCode=TYPE_ERROR;          sprintf(error_msg,"__FILE__: sample points of coefficient Y don't match (%d,%d)",p.numQuad,elements->numElements);
99          sprintf(Finley_ErrorMsg,"sample points of coefficient Y don't match (%d,%d)",p.numQuad,elements->numElements);          Finley_setError(TYPE_ERROR,error_msg);
100    }    }
101    
102    /*  check the dimensions: */    /*  check the dimensions: */
# Line 100  void Finley_Assemble_PDE_RHS(Finley_Node Line 105  void Finley_Assemble_PDE_RHS(Finley_Node
105      if (!isEmpty(X)) {      if (!isEmpty(X)) {
106         dimensions[0]=p.numDim;         dimensions[0]=p.numDim;
107         if (!isDataPointShapeEqual(X,1,dimensions)) {         if (!isDataPointShapeEqual(X,1,dimensions)) {
108            Finley_ErrorCode=TYPE_ERROR;            sprintf(error_msg,"__FILE__: coefficient X, expected shape (%d,",dimensions[0]);
109            sprintf(Finley_ErrorMsg,"coefficient X, expected shape (%d,",dimensions[0]);            Finley_setError(TYPE_ERROR,error_msg);
110         }         }
111      }      }
112      if (!isEmpty(Y)) {      if (!isEmpty(Y)) {
113         if (!isDataPointShapeEqual(Y,0,dimensions)) {         if (!isDataPointShapeEqual(Y,0,dimensions)) {
114            Finley_ErrorCode=TYPE_ERROR;            Finley_setError(TYPE_ERROR,"__FILE__: coefficient Y, rank 0 expected.");
           sprintf(Finley_ErrorMsg,"coefficient Y, rank 0 expected.");  
115         }         }
116      }      }
117    } else {    } else {
# Line 115  void Finley_Assemble_PDE_RHS(Finley_Node Line 119  void Finley_Assemble_PDE_RHS(Finley_Node
119        dimensions[0]=p.numEqu;        dimensions[0]=p.numEqu;
120        dimensions[1]=p.numDim;        dimensions[1]=p.numDim;
121        if (!isDataPointShapeEqual(X,2,dimensions)) {        if (!isDataPointShapeEqual(X,2,dimensions)) {
122             Finley_ErrorCode=TYPE_ERROR;            sprintf(error_msg,"__FILE__: coefficient X, expected shape (%d,%d)",dimensions[0],dimensions[1]);
123            sprintf(Finley_ErrorMsg,"coefficient X, expected shape (%d,%d)",dimensions[0],dimensions[1]);            Finley_setError(TYPE_ERROR,error_msg);
124        }        }
125      }      }
126      if (!isEmpty(Y)) {      if (!isEmpty(Y)) {
127        dimensions[0]=p.numEqu;        dimensions[0]=p.numEqu;
128        if (!isDataPointShapeEqual(Y,1,dimensions)) {        if (!isDataPointShapeEqual(Y,1,dimensions)) {
129             Finley_ErrorCode=TYPE_ERROR;            sprintf(error_msg,"__FILE__: coefficient Y, expected shape (%d,)",dimensions[0]);
130            sprintf(Finley_ErrorMsg,"coefficient Y, expected shape (%d,)",dimensions[0]);            Finley_setError(TYPE_ERROR,error_msg);
131        }        }
132      }      }
133    }    }
134    
135    if (Finley_ErrorCode==NO_ERROR) {    if (Finley_noError()) {
136       time0=Finley_timer();       time0=Finley_timer();
137       #pragma omp parallel private(index_row,EM_F,V,dVdv,dSdV,Vol,dvdV,color,q,assemble)       #pragma omp parallel private(index_row,EM_F,V,dVdv,dSdV,Vol,dvdV,color,q,assemble)
138       {       {
# Line 218  void Finley_Assemble_PDE_RHS(Finley_Node Line 222  void Finley_Assemble_PDE_RHS(Finley_Node
222  }  }
223  /*  /*
224   * $Log$   * $Log$
225     * Revision 1.4  2005/09/15 03:44:21  jgs
226     * Merge of development branch dev-02 back to main trunk on 2005-09-15
227     *
228   * Revision 1.3  2005/09/01 03:31:35  jgs   * Revision 1.3  2005/09/01 03:31:35  jgs
229   * Merge of development branch dev-02 back to main trunk on 2005-09-01   * Merge of development branch dev-02 back to main trunk on 2005-09-01
230   *   *
231   * Revision 1.2  2005/08/12 01:45:42  jgs   * Revision 1.2  2005/08/12 01:45:42  jgs
232   * erge of development branch dev-02 back to main trunk on 2005-08-12   * erge of development branch dev-02 back to main trunk on 2005-08-12
233   *   *
234     * Revision 1.1.2.3  2005/09/07 06:26:17  gross
235     * the solver from finley are put into the standalone package paso now
236     *
237   * Revision 1.1.2.2  2005/08/24 02:02:18  gross   * Revision 1.1.2.2  2005/08/24 02:02:18  gross
238   * timing output switched off. solver output can be swiched through getSolution(verbose=True) now.   * timing output switched off. solver output can be swiched through getSolution(verbose=True) now.
239   *   *

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

  ViewVC Help
Powered by ViewVC 1.1.26