/[escript]/trunk/esys2/finley/src/finleyC/Assemble_RobinCondition.c
ViewVC logotype

Diff of /trunk/esys2/finley/src/finleyC/Assemble_RobinCondition.c

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

revision 149 by jgs, Thu Sep 1 03:31:39 2005 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 21  Line 33 
33    
34  /**************************************************************/  /**************************************************************/
35    
 /*   Copyrights by ACcESS Australia, 2003,2004 */  
36  /*   author: gross@access.edu.au */  /*   author: gross@access.edu.au */
37  /*   Version: $Id$ */  /*   Version: $Id$ */
38    
39  /**************************************************************/  /**************************************************************/
40    
 #include "escript/Data/DataC.h"  
41  #include "Assemble.h"  #include "Assemble.h"
 #include "NodeFile.h"  
 #include "ElementFile.h"  
 #include "Finley.h"  
42  #include "Util.h"  #include "Util.h"
43  #ifdef _OPENMP  #ifdef _OPENMP
44  #include <omp.h>  #include <omp.h>
# Line 39  Line 46 
46    
47  /**************************************************************/  /**************************************************************/
48    
49  void Finley_Assemble_RobinCondition(Finley_NodeFile* nodes,Finley_ElementFile* elements,Finley_SystemMatrix* S, escriptDataC* F, escriptDataC* d, escriptDataC* y, Finley_Assemble_handelShapeMissMatch handelShapeMissMatchForEM) {  void Finley_Assemble_RobinCondition(Finley_NodeFile* nodes,Finley_ElementFile* elements,Paso_SystemMatrix* S, escriptDataC* F, escriptDataC* d, escriptDataC* y, Finley_Assemble_handelShapeMissMatch handelShapeMissMatchForEM) {
50      char error_msg[LenErrorMsg_MAX];
51    double *EM_S=NULL,*EM_F=NULL,*V=NULL,*dVdv=NULL,*dSdV=NULL,*Area=NULL;    double *EM_S=NULL,*EM_F=NULL,*V=NULL,*dVdv=NULL,*dSdV=NULL,*Area=NULL;
52    double time0;    double time0;
53    Assemble_Parameters p;    Assemble_Parameters p;
54    index_t *index_row=NULL,*index_col=NULL,color;    index_t *index_row=NULL,*index_col=NULL,color;
55    dim_t dimensions[ESCRIPT_MAX_DATA_RANK],e,q;    dim_t dimensions[ESCRIPT_MAX_DATA_RANK],e,q;
56      Finley_resetError();
57    
58    if (nodes==NULL || elements==NULL) return;    if (nodes==NULL || elements==NULL) return;
59    if (S==NULL && isEmpty(F)) return;    if (S==NULL && isEmpty(F)) return;
60    
61    /* set all parameters in p*/    /* set all parameters in p*/
62    Assemble_getAssembleParameters(nodes,elements,S,F,&p);    Assemble_getAssembleParameters(nodes,elements,S,F,&p);
63    if (Finley_ErrorCode!=NO_ERROR) return;    if (! Finley_noError()) return;
64    
65    /*  get a functionspace */    /*  get a functionspace */
66    type_t funcspace=UNKNOWN;    type_t funcspace=UNKNOWN;
# Line 62  void Finley_Assemble_RobinCondition(Finl Line 71  void Finley_Assemble_RobinCondition(Finl
71    /* check if all function spaces are the same */    /* check if all function spaces are the same */
72    
73    if (! functionSpaceTypeEqual(funcspace,d) ) {    if (! functionSpaceTypeEqual(funcspace,d) ) {
74          Finley_ErrorCode=TYPE_ERROR;          Finley_setError(TYPE_ERROR,"__FILE__: unexpected function space type for coefficient d");
         sprintf(Finley_ErrorMsg,"unexpected function space type for coefficient d");  
75    }    }
76    if (! functionSpaceTypeEqual(funcspace,y) ) {    if (! functionSpaceTypeEqual(funcspace,y) ) {
77          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");  
78    }    }
79    
80    /* check if all function spaces are the same */    /* check if all function spaces are the same */
81    
82    if (! numSamplesEqual(d,p.numQuad,elements->numElements) ) {    if (! numSamplesEqual(d,p.numQuad,elements->numElements) ) {
83          Finley_ErrorCode=TYPE_ERROR;          sprintf(error_msg,"__FILE__: sample points of coefficient d don't match (%d,%d)",p.numQuad,elements->numElements);
84          sprintf(Finley_ErrorMsg,"sample points of coefficient d don't match (%d,%d)",p.numQuad,elements->numElements);          Finley_setError(TYPE_ERROR,error_msg);
85    }    }
86    
87    if (! numSamplesEqual(y,p.numQuad,elements->numElements) ) {    if (! numSamplesEqual(y,p.numQuad,elements->numElements) ) {
88          Finley_ErrorCode=TYPE_ERROR;          sprintf(error_msg,"__FILE__: sample points of coefficient y don't match (%d,%d)",p.numQuad,elements->numElements);
89          sprintf(Finley_ErrorMsg,"sample points of coefficient y don't match (%d,%d)",p.numQuad,elements->numElements);          Finley_setError(TYPE_ERROR,error_msg);
90    }    }
91    
92        
# Line 88  void Finley_Assemble_RobinCondition(Finl Line 95  void Finley_Assemble_RobinCondition(Finl
95    if (p.numEqu==1 && p.numComp==1) {    if (p.numEqu==1 && p.numComp==1) {
96      if (!isEmpty(d)) {      if (!isEmpty(d)) {
97        if (! isDataPointShapeEqual(d,0,dimensions)) {        if (! isDataPointShapeEqual(d,0,dimensions)) {
98            Finley_ErrorCode=TYPE_ERROR;            Finley_setError(TYPE_ERROR,"__FILE__: coefficient d, rank 0 expected.");
           sprintf(Finley_ErrorMsg,"coefficient d, rank 0 expected.");  
99        }        }
100      }      }
101      if (!isEmpty(y)) {      if (!isEmpty(y)) {
102        if (! isDataPointShapeEqual(y,0,dimensions)) {        if (! isDataPointShapeEqual(y,0,dimensions)) {
103            Finley_ErrorCode=TYPE_ERROR;            Finley_setError(TYPE_ERROR,"__FILE__: coefficient y, rank 0 expected.");
           sprintf(Finley_ErrorMsg,"coefficient y, rank 0 expected.");  
104        }        }
105      }      }
106    } else {    } else {
# Line 103  void Finley_Assemble_RobinCondition(Finl Line 108  void Finley_Assemble_RobinCondition(Finl
108        dimensions[0]=p.numEqu;        dimensions[0]=p.numEqu;
109        dimensions[1]=p.numComp;        dimensions[1]=p.numComp;
110        if (! isDataPointShapeEqual(d,2,dimensions)) {        if (! isDataPointShapeEqual(d,2,dimensions)) {
111            Finley_ErrorCode=TYPE_ERROR;            sprintf(error_msg,"__FILE__: coefficient d, expected shape (%d,%d)",dimensions[0],dimensions[1]);
112            sprintf(Finley_ErrorMsg,"coefficient d, expected shape (%d,%d)",dimensions[0],dimensions[1]);            Finley_setError(TYPE_ERROR,error_msg);
113        }        }
114      }      }
115      if (!isEmpty(y)) {      if (!isEmpty(y)) {
116        dimensions[0]=p.numEqu;        dimensions[0]=p.numEqu;
117        if (! isDataPointShapeEqual(y,1,dimensions)) {        if (! isDataPointShapeEqual(y,1,dimensions)) {
118            Finley_ErrorCode=TYPE_ERROR;            sprintf(error_msg,"__FILE__: coefficient y, expected shape (%d,)",dimensions[0]);
119            sprintf(Finley_ErrorMsg,"coefficient y, expected shape (%d,)",dimensions[0]);            Finley_setError(TYPE_ERROR,error_msg);
120        }        }
121      }      }
122    }    }
123        
124    if (Finley_ErrorCode==NO_ERROR) {    if (Finley_noError()) {
125       time0=Finley_timer();       time0=Finley_timer();
126       #pragma omp parallel private(index_row,index_col,EM_S,EM_F,V,dVdv,dSdV,Area,color)       #pragma omp parallel private(index_row,index_col,EM_S,EM_F,V,dVdv,dSdV,Area,color)
127       {       {
# Line 179  void Finley_Assemble_RobinCondition(Finl Line 184  void Finley_Assemble_RobinCondition(Finl
184                       */                       */
185                         /* add  */                         /* add  */
186                         for (q=0;q<p.NN_col;q++) index_col[q]=p.label_col[elements->Nodes[INDEX2(p.col_node[q],e,p.NN)]];                         for (q=0;q<p.NN_col;q++) index_col[q]=p.label_col[elements->Nodes[INDEX2(p.col_node[q],e,p.NN)]];
187                         Finley_SystemMatrix_add(S,p.NN_row,index_row,p.numEqu,p.NN_col,index_col,p.numComp,EM_S);                         Finley_Assemble_addToSystemMatrix(S,p.NN_row,index_row,p.numEqu,p.NN_col,index_col,p.numComp,EM_S);
188                     }                     }
189                     if (!isEmpty(F)) {                     if (!isEmpty(F)) {
190                       for (q=0;q<p.NN_row*p.numEqu;q++) EM_F[q]=0;                       for (q=0;q<p.NN_row*p.numEqu;q++) EM_F[q]=0;
# Line 225  void Finley_Assemble_RobinCondition(Finl Line 230  void Finley_Assemble_RobinCondition(Finl
230  }  }
231  /*  /*
232   * $Log$   * $Log$
233     * Revision 1.8  2005/09/15 03:44:21  jgs
234     * Merge of development branch dev-02 back to main trunk on 2005-09-15
235     *
236   * Revision 1.7  2005/09/01 03:31:35  jgs   * Revision 1.7  2005/09/01 03:31:35  jgs
237   * 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
238   *   *
239   * Revision 1.6  2005/08/12 01:45:43  jgs   * Revision 1.6  2005/08/12 01:45:43  jgs
240   * 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
241   *   *
242     * Revision 1.5.2.4  2005/09/07 06:26:17  gross
243     * the solver from finley are put into the standalone package paso now
244     *
245   * Revision 1.5.2.3  2005/08/24 02:02:18  gross   * Revision 1.5.2.3  2005/08/24 02:02:18  gross
246   * 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.
247   *   *

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

  ViewVC Help
Powered by ViewVC 1.1.26