/[escript]/branches/arrayview_from_1695_trunk/finley/src/Assemble_AverageElementData.c
ViewVC logotype

Diff of /branches/arrayview_from_1695_trunk/finley/src/Assemble_AverageElementData.c

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

trunk/finley/src/Assemble_CopyElementData.c revision 1062 by gross, Mon Mar 26 06:17:53 2007 UTC trunk/finley/src/Assemble_AverageElementData.c revision 1116 by gross, Mon Apr 23 03:36:34 2007 UTC
# Line 28  Line 28 
28  /******************************************************************************************************/  /******************************************************************************************************/
29    
30    
31  void Finley_Assemble_CopyElementData(Finley_ElementFile* elements,escriptDataC* out,escriptDataC* in) {  void Finley_Assemble_AverageElementData(Finley_ElementFile* elements,escriptDataC* out,escriptDataC* in) {
32      dim_t n,q, numElements, numQuad;      dim_t n,q, numElements, numQuad_in, numQuad_out, i;
33      double *in_array,*out_array;      double *in_array,*out_array, vol, volinv, *wq;
34        register double rtmp;
35      dim_t numComps=getDataPointSize(out);      dim_t numComps=getDataPointSize(out);
36    
37      Finley_resetError();      Finley_resetError();
# Line 41  void Finley_Assemble_CopyElementData(Fin Line 42  void Finley_Assemble_CopyElementData(Fin
42    
43      numElements=elements->numElements;      numElements=elements->numElements;
44      if (Finley_Assemble_reducedIntegrationOrder(in)) {      if (Finley_Assemble_reducedIntegrationOrder(in)) {
45         numQuad=elements->ReferenceElementReducedOrder->numQuadNodes;         numQuad_in=elements->ReferenceElementReducedOrder->numQuadNodes;
46           wq=elements->ReferenceElementReducedOrder->QuadWeights;
47      } else {      } else {
48         numQuad=elements->ReferenceElement->numQuadNodes;         numQuad_in=elements->ReferenceElement->numQuadNodes;
49           wq=elements->ReferenceElement->QuadWeights;
50        }
51        if (Finley_Assemble_reducedIntegrationOrder(out)) {
52           numQuad_out=elements->ReferenceElementReducedOrder->numQuadNodes;
53        } else {
54           numQuad_out=elements->ReferenceElement->numQuadNodes;
55      }      }
56    
57      /* check out and in */      /* check out and in */
58      if (numComps!=getDataPointSize(in)) {      if (numComps!=getDataPointSize(in)) {
59         Finley_setError(TYPE_ERROR,"Finley_Assemble_CopyElementData: number of components of input and output Data do not match.");         Finley_setError(TYPE_ERROR,"Finley_Assemble_AverageElementData: number of components of input and output Data do not match.");
60      } else if (!numSamplesEqual(in,numQuad,numElements)) {      } else if (!numSamplesEqual(in,numQuad_in,numElements)) {
61         Finley_setError(TYPE_ERROR,"Finley_Assemble_CopyElementData: illegal number of samples of input Data object");         Finley_setError(TYPE_ERROR,"Finley_Assemble_AverageElementData: illegal number of samples of input Data object");
62      } else if (!numSamplesEqual(out,numQuad,numElements)) {      } else if (!numSamplesEqual(out,numQuad_out,numElements)) {
63         Finley_setError(TYPE_ERROR,"Finley_Assemble_CopyElementData: illegal number of samples of output Data object");         Finley_setError(TYPE_ERROR,"Finley_Assemble_AverageElementData: illegal number of samples of output Data object");
64      } else if (!isExpanded(out)) {      } else if (!isExpanded(out)) {
65         Finley_setError(TYPE_ERROR,"Finley_Assemble_CopyElementData: expanded Data object is expected for output data.");         Finley_setError(TYPE_ERROR,"Finley_Assemble_AverageElementData: expanded Data object is expected for output data.");
66      }      }
67    
68      /* now we can start */      /* now we can start */
69    
70      if (Finley_noError()) {      if (Finley_noError()) {
71           if (isExpanded(in)) {           if (isExpanded(in)) {
72               # pragma omp parallel for private(n) schedule(static)               vol=0;
73               for (n=0;n<numElements;n++)               for (q=0; q< numQuad_in;++q) vol+=wq[q];
74                   Finley_copyDouble(numComps*numQuad,getSampleData(in,n),getSampleData(out,n));               volinv=1./vol;
75                 # pragma omp parallel for private(n, i, rtmp, q, in_array, out_array) schedule(static)
76                 for (n=0;n<numElements;n++) {
77                     in_array=getSampleData(in,n);
78                     out_array=getSampleData(out,n);
79                     for (i=0; i<numComps; ++i) {
80                         rtmp=0;
81                         for (q=0; q< numQuad_in;++q) rtmp+=in_array[INDEX2(i,q,numComps)]*wq[q];
82                         rtmp*=volinv;
83                         for (q=0; q< numQuad_out;++q) out_array[INDEX2(i,q,numComps)]=rtmp;
84                     }
85                 }
86           } else {           } else {
87               # pragma omp parallel for private(q,n,out_array,in_array) schedule(static)               # pragma omp parallel for private(q,n,out_array,in_array) schedule(static)
88               for (n=0;n<numElements;n++) {               for (n=0;n<numElements;n++) {
89                   in_array=getSampleData(in,n);                   in_array=getSampleData(in,n);
90                   out_array=getSampleData(out,n);                   out_array=getSampleData(out,n);
91                   for (q=0;q<numQuad;q++) Finley_copyDouble(numComps,in_array,out_array+q*numComps);                   for (q=0;q<numQuad_out;q++) Finley_copyDouble(numComps,in_array,out_array+q*numComps);
92               }               }
93           }           }
94      }      }
95      return;      return;
96  }  }
 /*  
  * $Log$  
  * Revision 1.4  2005/09/15 03:44:21  jgs  
  * Merge of development branch dev-02 back to main trunk on 2005-09-15  
  *  
  * Revision 1.3  2005/08/12 01:45:42  jgs  
  * erge of development branch dev-02 back to main trunk on 2005-08-12  
  *  
  * Revision 1.2.2.2  2005/09/07 06:26:17  gross  
  * the solver from finley are put into the standalone package paso now  
  *  
  * Revision 1.2.2.1  2005/08/02 05:29:11  gross  
  * bug in finley/src/Assemble_CopyElementData fixed  
  *  
  * Revision 1.2  2005/07/08 04:07:45  jgs  
  * Merge of development branch back to main trunk on 2005-07-08  
  *  
  * Revision 1.1.1.1.2.1  2005/06/29 02:34:46  gross  
  * some changes towards 64 integers in finley  
  *  
  * Revision 1.1.1.1  2004/10/26 06:53:56  jgs  
  * initial import of project esys2  
  *  
  * Revision 1.2  2004/07/21 05:00:54  gross  
  * name changes in DataC  
  *  
  * Revision 1.1  2004/07/02 04:21:13  gross  
  * Finley C code has been included  
  *  
  *  
  */  

Legend:
Removed from v.1062  
changed lines
  Added in v.1116

  ViewVC Help
Powered by ViewVC 1.1.26