/[escript]/temp/finley/src/Assemble_jacobeans.c
ViewVC logotype

Diff of /temp/finley/src/Assemble_jacobeans.c

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

trunk/finley/src/finleyC/Assemble_PDE.c revision 155 by jgs, Wed Nov 9 02:02:19 2005 UTC trunk/finley/src/Assemble_PDE.c revision 616 by elspeth, Wed Mar 22 02:46:56 2006 UTC
# Line 1  Line 1 
1  /*  /*
2   ******************************************************************************   ************************************************************
3   *                                                                            *   *          Copyright 2006 by ACcESS MNRF                   *
4   *       COPYRIGHT  ACcESS 2003,2004,2005 -  All Rights Reserved              *   *                                                          *
5   *                                                                            *   *              http://www.access.edu.au                    *
6   * This software is the property of ACcESS. No part of this code              *   *       Primary Business: Queensland, Australia            *
7   * may be copied in any form or by any means without the expressed written    *   *  Licensed under the Open Software License version 3.0    *
8   * consent of ACcESS.  Copying, use or modification of this software          *   *     http://www.opensource.org/licenses/osl-3.0.php       *
9   * by any unauthorised person is illegal unless that person has a software    *   *                                                          *
10   * license agreement with ACcESS.                                             *   ************************************************************
  *                                                                            *  
  ******************************************************************************  
11  */  */
12    
13    
# Line 75  void Finley_Assemble_PDE(Finley_NodeFile Line 73  void Finley_Assemble_PDE(Finley_NodeFile
73    
74    /*  this function assumes NS=NN */    /*  this function assumes NS=NN */
75    if (p.NN!=p.NS) {    if (p.NN!=p.NS) {
76      Finley_setError(SYSTEM_ERROR,"__FILE__: for Finley_Assemble_PDE numNodes and numShapes have to be identical.");      Finley_setError(SYSTEM_ERROR,"Finley_Assemble_PDE: for Finley_Assemble_PDE numNodes and numShapes have to be identical.");
77      return;      return;
78    }    }
79    if (p.numDim!=p.numElementDim) {    if (p.numDim!=p.numElementDim) {
80      Finley_setError(SYSTEM_ERROR,"__FILE__: Finley_Assemble_PDE accepts volume elements only.");      Finley_setError(SYSTEM_ERROR,"Finley_Assemble_PDE: Finley_Assemble_PDE accepts volume elements only.");
81      return;      return;
82    }    }
83    /*  get a functionspace */    /*  get a functionspace */
# Line 95  void Finley_Assemble_PDE(Finley_NodeFile Line 93  void Finley_Assemble_PDE(Finley_NodeFile
93    /* check if all function spaces are the same */    /* check if all function spaces are the same */
94    
95    if (! functionSpaceTypeEqual(funcspace,A) ) {    if (! functionSpaceTypeEqual(funcspace,A) ) {
96          Finley_setError(TYPE_ERROR,"__FILE__: unexpected function space type for coefficient A");          Finley_setError(TYPE_ERROR,"Finley_Assemble_PDE: unexpected function space type for coefficient A");
97    }    }
98    if (! functionSpaceTypeEqual(funcspace,B) ) {    if (! functionSpaceTypeEqual(funcspace,B) ) {
99          Finley_setError(TYPE_ERROR,"__FILE__: unexpected function space type for coefficient B");          Finley_setError(TYPE_ERROR,"Finley_Assemble_PDE: unexpected function space type for coefficient B");
100    }    }
101    if (! functionSpaceTypeEqual(funcspace,C) ) {    if (! functionSpaceTypeEqual(funcspace,C) ) {
102          Finley_setError(TYPE_ERROR,"__FILE__: unexpected function space type for coefficient C");          Finley_setError(TYPE_ERROR,"Finley_Assemble_PDE: unexpected function space type for coefficient C");
103    }    }
104    if (! functionSpaceTypeEqual(funcspace,D) ) {    if (! functionSpaceTypeEqual(funcspace,D) ) {
105          Finley_setError(TYPE_ERROR,"__FILE__: unexpected function space type for coefficient D");          Finley_setError(TYPE_ERROR,"Finley_Assemble_PDE: unexpected function space type for coefficient D");
106    }    }
107    if (! functionSpaceTypeEqual(funcspace,X) ) {    if (! functionSpaceTypeEqual(funcspace,X) ) {
108          Finley_setError(TYPE_ERROR,"__FILE__: unexpected function space type for coefficient X");          Finley_setError(TYPE_ERROR,"Finley_Assemble_PDE: unexpected function space type for coefficient X");
109    }    }
110    if (! functionSpaceTypeEqual(funcspace,Y) ) {    if (! functionSpaceTypeEqual(funcspace,Y) ) {
111          Finley_setError(TYPE_ERROR,"__FILE__: unexpected function space type for coefficient Y");          Finley_setError(TYPE_ERROR,"Finley_Assemble_PDE: unexpected function space type for coefficient Y");
112    }    }
113    
114    /* check if all function spaces are the same */    /* check if all function spaces are the same */
115    
116    if (! numSamplesEqual(A,p.numQuad,elements->numElements) ) {    if (! numSamplesEqual(A,p.numQuad,elements->numElements) ) {
117          sprintf(error_msg,"__FILE__: sample points of coefficient A don't match (%d,%d)",p.numQuad,elements->numElements);          sprintf(error_msg,"Finley_Assemble_PDE: sample points of coefficient A don't match (%d,%d)",p.numQuad,elements->numElements);
118          Finley_setError(TYPE_ERROR,error_msg);          Finley_setError(TYPE_ERROR,error_msg);
119    }    }
120    
121    if (! numSamplesEqual(B,p.numQuad,elements->numElements) ) {    if (! numSamplesEqual(B,p.numQuad,elements->numElements) ) {
122          sprintf(error_msg,"__FILE__: sample points of coefficient B don't match (%d,%d)",p.numQuad,elements->numElements);          sprintf(error_msg,"Finley_Assemble_PDE: sample points of coefficient B don't match (%d,%d)",p.numQuad,elements->numElements);
123          Finley_setError(TYPE_ERROR,error_msg);          Finley_setError(TYPE_ERROR,error_msg);
124    }    }
125    
126    if (! numSamplesEqual(C,p.numQuad,elements->numElements) ) {    if (! numSamplesEqual(C,p.numQuad,elements->numElements) ) {
127          sprintf(error_msg,"__FILE__: sample points of coefficient C don't match (%d,%d)",p.numQuad,elements->numElements);          sprintf(error_msg,"Finley_Assemble_PDE: sample points of coefficient C don't match (%d,%d)",p.numQuad,elements->numElements);
128          Finley_setError(TYPE_ERROR,error_msg);          Finley_setError(TYPE_ERROR,error_msg);
129    }    }
130    
131    if (! numSamplesEqual(D,p.numQuad,elements->numElements) ) {    if (! numSamplesEqual(D,p.numQuad,elements->numElements) ) {
132          sprintf(error_msg,"__FILE__: sample points of coefficient D don't match (%d,%d)",p.numQuad,elements->numElements);          sprintf(error_msg,"Finley_Assemble_PDE: sample points of coefficient D don't match (%d,%d)",p.numQuad,elements->numElements);
133          Finley_setError(TYPE_ERROR,error_msg);          Finley_setError(TYPE_ERROR,error_msg);
134    }    }
135    
136    if (! numSamplesEqual(X,p.numQuad,elements->numElements) ) {    if (! numSamplesEqual(X,p.numQuad,elements->numElements) ) {
137          sprintf(error_msg,"__FILE__: sample points of coefficient X don't match (%d,%d)",p.numQuad,elements->numElements);          sprintf(error_msg,"Finley_Assemble_PDE: sample points of coefficient X don't match (%d,%d)",p.numQuad,elements->numElements);
138          Finley_setError(TYPE_ERROR,error_msg);          Finley_setError(TYPE_ERROR,error_msg);
139    }    }
140    
141    if (! numSamplesEqual(Y,p.numQuad,elements->numElements) ) {    if (! numSamplesEqual(Y,p.numQuad,elements->numElements) ) {
142          sprintf(error_msg,"__FILE__: sample points of coefficient Y don't match (%d,%d)",p.numQuad,elements->numElements);          sprintf(error_msg,"Finley_Assemble_PDE: sample points of coefficient Y don't match (%d,%d)",p.numQuad,elements->numElements);
143          Finley_setError(TYPE_ERROR,error_msg);          Finley_setError(TYPE_ERROR,error_msg);
144    }    }
145    
# Line 152  void Finley_Assemble_PDE(Finley_NodeFile Line 150  void Finley_Assemble_PDE(Finley_NodeFile
150        dimensions[0]=p.numDim;        dimensions[0]=p.numDim;
151        dimensions[1]=p.numDim;        dimensions[1]=p.numDim;
152        if (!isDataPointShapeEqual(A,2,dimensions)) {        if (!isDataPointShapeEqual(A,2,dimensions)) {
153            sprintf(error_msg,"__FILE__: coefficient A: illegal shape, expected shape (%d,%d)",dimensions[0],dimensions[1]);            sprintf(error_msg,"Finley_Assemble_PDE: coefficient A: illegal shape, expected shape (%d,%d)",dimensions[0],dimensions[1]);
154            Finley_setError(TYPE_ERROR,error_msg);            Finley_setError(TYPE_ERROR,error_msg);
155        }        }
156      }      }
157      if (!isEmpty(B)) {      if (!isEmpty(B)) {
158         dimensions[0]=p.numDim;         dimensions[0]=p.numDim;
159         if (!isDataPointShapeEqual(B,1,dimensions)) {         if (!isDataPointShapeEqual(B,1,dimensions)) {
160            sprintf(error_msg,"__FILE__: coefficient B: illegal shape (%d,)",dimensions[0]);            sprintf(error_msg,"Finley_Assemble_PDE: coefficient B: illegal shape (%d,)",dimensions[0]);
161            Finley_setError(TYPE_ERROR,error_msg);            Finley_setError(TYPE_ERROR,error_msg);
162         }         }
163      }      }
164      if (!isEmpty(C)) {      if (!isEmpty(C)) {
165         dimensions[0]=p.numDim;         dimensions[0]=p.numDim;
166         if (!isDataPointShapeEqual(C,1,dimensions)) {         if (!isDataPointShapeEqual(C,1,dimensions)) {
167            sprintf(error_msg,"__FILE__: coefficient C, expected shape (%d,)",dimensions[0]);            sprintf(error_msg,"Finley_Assemble_PDE: coefficient C, expected shape (%d,)",dimensions[0]);
168            Finley_setError(TYPE_ERROR,error_msg);            Finley_setError(TYPE_ERROR,error_msg);
169         }         }
170      }      }
171      if (!isEmpty(D)) {      if (!isEmpty(D)) {
172         if (!isDataPointShapeEqual(D,0,dimensions)) {         if (!isDataPointShapeEqual(D,0,dimensions)) {
173            Finley_setError(TYPE_ERROR,"__FILE__: coefficient D, rank 0 expected.");            Finley_setError(TYPE_ERROR,"Finley_Assemble_PDE: coefficient D, rank 0 expected.");
174         }         }
175      }      }
176      if (!isEmpty(X)) {      if (!isEmpty(X)) {
177         dimensions[0]=p.numDim;         dimensions[0]=p.numDim;
178         if (!isDataPointShapeEqual(X,1,dimensions)) {         if (!isDataPointShapeEqual(X,1,dimensions)) {
179            sprintf(error_msg,"__FILE__: coefficient X, expected shape (%d,",dimensions[0]);            sprintf(error_msg,"Finley_Assemble_PDE: coefficient X, expected shape (%d,",dimensions[0]);
180            Finley_setError(TYPE_ERROR,error_msg);            Finley_setError(TYPE_ERROR,error_msg);
181         }         }
182      }      }
183      if (!isEmpty(Y)) {      if (!isEmpty(Y)) {
184         if (!isDataPointShapeEqual(Y,0,dimensions)) {         if (!isDataPointShapeEqual(Y,0,dimensions)) {
185            Finley_setError(TYPE_ERROR,"__FILE__: coefficient Y, rank 0 expected.");            Finley_setError(TYPE_ERROR,"Finley_Assemble_PDE: coefficient Y, rank 0 expected.");
186         }         }
187      }      }
188    } else {    } else {
# Line 194  void Finley_Assemble_PDE(Finley_NodeFile Line 192  void Finley_Assemble_PDE(Finley_NodeFile
192        dimensions[2]=p.numComp;        dimensions[2]=p.numComp;
193        dimensions[3]=p.numDim;        dimensions[3]=p.numDim;
194        if (!isDataPointShapeEqual(A,4,dimensions)) {        if (!isDataPointShapeEqual(A,4,dimensions)) {
195            sprintf(error_msg,"__FILE__: coefficient A, expected shape (%d,%d,%d,%d)",dimensions[0],dimensions[1],dimensions[2],dimensions[3]);            sprintf(error_msg,"Finley_Assemble_PDE: coefficient A, expected shape (%d,%d,%d,%d)",dimensions[0],dimensions[1],dimensions[2],dimensions[3]);
196            Finley_setError(TYPE_ERROR,error_msg);            Finley_setError(TYPE_ERROR,error_msg);
197        }        }
198      }      }
# Line 203  void Finley_Assemble_PDE(Finley_NodeFile Line 201  void Finley_Assemble_PDE(Finley_NodeFile
201        dimensions[1]=p.numDim;        dimensions[1]=p.numDim;
202        dimensions[2]=p.numComp;        dimensions[2]=p.numComp;
203        if (!isDataPointShapeEqual(B,3,dimensions)) {        if (!isDataPointShapeEqual(B,3,dimensions)) {
204            sprintf(error_msg,"__FILE__: coefficient B, expected shape (%d,%d,%d)",dimensions[0],dimensions[1],dimensions[2]);            sprintf(error_msg,"Finley_Assemble_PDE: coefficient B, expected shape (%d,%d,%d)",dimensions[0],dimensions[1],dimensions[2]);
205            Finley_setError(TYPE_ERROR,error_msg);            Finley_setError(TYPE_ERROR,error_msg);
206        }        }
207      }      }
# Line 212  void Finley_Assemble_PDE(Finley_NodeFile Line 210  void Finley_Assemble_PDE(Finley_NodeFile
210        dimensions[1]=p.numComp;        dimensions[1]=p.numComp;
211        dimensions[2]=p.numDim;        dimensions[2]=p.numDim;
212        if (!isDataPointShapeEqual(C,3,dimensions)) {        if (!isDataPointShapeEqual(C,3,dimensions)) {
213            sprintf(error_msg,"__FILE__: coefficient C, expected shape (%d,%d,%d)",dimensions[0],dimensions[1],dimensions[2]);            sprintf(error_msg,"Finley_Assemble_PDE: coefficient C, expected shape (%d,%d,%d)",dimensions[0],dimensions[1],dimensions[2]);
214            Finley_setError(TYPE_ERROR,error_msg);            Finley_setError(TYPE_ERROR,error_msg);
215        }        }
216      }      }
# Line 220  void Finley_Assemble_PDE(Finley_NodeFile Line 218  void Finley_Assemble_PDE(Finley_NodeFile
218        dimensions[0]=p.numEqu;        dimensions[0]=p.numEqu;
219        dimensions[1]=p.numComp;        dimensions[1]=p.numComp;
220        if (!isDataPointShapeEqual(D,2,dimensions)) {        if (!isDataPointShapeEqual(D,2,dimensions)) {
221            sprintf(error_msg,"__FILE__: coefficient D, expected shape (%d,%d)",dimensions[0],dimensions[1]);            sprintf(error_msg,"Finley_Assemble_PDE: coefficient D, expected shape (%d,%d)",dimensions[0],dimensions[1]);
222            Finley_setError(TYPE_ERROR,error_msg);            Finley_setError(TYPE_ERROR,error_msg);
223        }        }
224      }      }
# Line 228  void Finley_Assemble_PDE(Finley_NodeFile Line 226  void Finley_Assemble_PDE(Finley_NodeFile
226        dimensions[0]=p.numEqu;        dimensions[0]=p.numEqu;
227        dimensions[1]=p.numDim;        dimensions[1]=p.numDim;
228        if (!isDataPointShapeEqual(X,2,dimensions)) {        if (!isDataPointShapeEqual(X,2,dimensions)) {
229            sprintf(error_msg,"__FILE__: coefficient X, expected shape (%d,%d)",dimensions[0],dimensions[1]);            sprintf(error_msg,"Finley_Assemble_PDE: coefficient X, expected shape (%d,%d)",dimensions[0],dimensions[1]);
230            Finley_setError(TYPE_ERROR,error_msg);            Finley_setError(TYPE_ERROR,error_msg);
231        }        }
232      }      }
233      if (!isEmpty(Y)) {      if (!isEmpty(Y)) {
234        dimensions[0]=p.numEqu;        dimensions[0]=p.numEqu;
235        if (!isDataPointShapeEqual(Y,1,dimensions)) {        if (!isDataPointShapeEqual(Y,1,dimensions)) {
236            sprintf(error_msg,"__FILE__: coefficient Y, expected shape (%d,)",dimensions[0]);            sprintf(error_msg,"Finley_Assemble_PDE: coefficient Y, expected shape (%d,)",dimensions[0]);
237            Finley_setError(TYPE_ERROR,error_msg);            Finley_setError(TYPE_ERROR,error_msg);
238        }        }
239      }      }
# Line 270  void Finley_Assemble_PDE(Finley_NodeFile Line 268  void Finley_Assemble_PDE(Finley_NodeFile
268                #pragma omp for private(e) schedule(static)                #pragma omp for private(e) schedule(static)
269                for(e=0;e<elements->numElements;e++){                for(e=0;e<elements->numElements;e++){
270                  if (elements->Color[e]==color) {                  if (elements->Color[e]==color) {
271    //============================
272                    for (q=0;q<p.NN_row;q++) index_row[q]=p.label_row[elements->Nodes[INDEX2(p.row_node[q],e,p.NN)]];                    for (q=0;q<p.NN_row;q++) index_row[q]=p.label_row[elements->Nodes[INDEX2(p.row_node[q],e,p.NN)]];
273                    /* gather V-coordinates of nodes into V: */                    /* gather V-coordinates of nodes into V: */
274            Finley_Util_Gather_double(p.NN,&(elements->Nodes[INDEX2(0,e,p.NN)]),p.numDim,nodes->Coordinates,V);            Finley_Util_Gather_double(p.NN,&(elements->Nodes[INDEX2(0,e,p.NN)]),p.numDim,nodes->Coordinates,V);
# Line 281  void Finley_Assemble_PDE(Finley_NodeFile Line 280  void Finley_Assemble_PDE(Finley_NodeFile
280            Finley_Util_SmallMatSetMult(p.numQuad,p.NS_row,p.numDim,dSdV,p.numDim,p.referenceElement_row->dSdv,dvdV);            Finley_Util_SmallMatSetMult(p.numQuad,p.NS_row,p.numDim,dSdV,p.numDim,p.referenceElement_row->dSdv,dvdV);
281                    /*  scale volume: */                    /*  scale volume: */
282            for (q=0;q<p.numQuad;q++) Vol[q]=ABS(Vol[q]*p.referenceElement->QuadWeights[q]);            for (q=0;q<p.numQuad;q++) Vol[q]=ABS(Vol[q]*p.referenceElement->QuadWeights[q]);
283    //============================
284            
285                     /*   integration for the stiffness matrix: */                     /*   integration for the stiffness matrix: */
286                     /*   in order to optimze the number of operations the case of constants coefficience needs a bit more work */                     /*   in order to optimze the number of operations the case of constants coefficience needs a bit more work */

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

  ViewVC Help
Powered by ViewVC 1.1.26