/[escript]/trunk/dudley/src/Assemble_CopyElementData.cpp
ViewVC logotype

Diff of /trunk/dudley/src/Assemble_CopyElementData.cpp

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

revision 1028 by gross, Wed Mar 14 00:15:24 2007 UTC revision 1811 by ksteube, Thu Sep 25 23:11:13 2008 UTC
# Line 1  Line 1 
 /*  
  ************************************************************  
  *          Copyright 2006 by ACcESS MNRF                   *  
  *                                                          *  
  *              http://www.access.edu.au                    *  
  *       Primary Business: Queensland, Australia            *  
  *  Licensed under the Open Software License version 3.0    *  
  *     http://www.opensource.org/licenses/osl-3.0.php       *  
  *                                                          *  
  ************************************************************  
 */  
 /**************************************************************/  
1    
2  /*    assemblage routines: copies data between elements       */  /*******************************************************
3    *
4    * Copyright (c) 2003-2008 by University of Queensland
5    * Earth Systems Science Computational Center (ESSCC)
6    * http://www.uq.edu.au/esscc
7    *
8    * Primary Business: Queensland, Australia
9    * Licensed under the Open Software License version 3.0
10    * http://www.opensource.org/licenses/osl-3.0.php
11    *
12    *******************************************************/
13    
14    
15  /**************************************************************/  /**************************************************************/
16    
17  /*   author: gross@access.edu.au */  /*    assemblage routines: copies data between elements       */
 /*   Version: $Id$ */  
18    
19  /**************************************************************/  /**************************************************************/
20    
# Line 30  Line 28 
28    
29  void Finley_Assemble_CopyElementData(Finley_ElementFile* elements,escriptDataC* out,escriptDataC* in) {  void Finley_Assemble_CopyElementData(Finley_ElementFile* elements,escriptDataC* out,escriptDataC* in) {
30      dim_t n,q, numElements, numQuad;      dim_t n,q, numElements, numQuad;
     dim_t numComps=getDataPointSize(out);  
31      double *in_array,*out_array;      double *in_array,*out_array;
32        dim_t numComps=getDataPointSize(out);
33        size_t len_size;
34    
35      Finley_resetError();      Finley_resetError();
36        if( elements == NULL )
37        {
38           return;
39        }
40    
     if (elements==NULL) return;  
41      numElements=elements->numElements;      numElements=elements->numElements;
42      numQuad=elements->ReferenceElement->numQuadNodes;      if (Finley_Assemble_reducedIntegrationOrder(in)) {
43           numQuad=elements->ReferenceElementReducedOrder->numQuadNodes;
44        } else {
45           numQuad=elements->ReferenceElement->numQuadNodes;
46        }
47    
48      /* check out and in */      /* check out and in */
49      if (numComps!=getDataPointSize(in)) {      if (numComps!=getDataPointSize(in)) {
50         Finley_setError(TYPE_ERROR,"__FILE__: number of components of input and output Data do not match.");         Finley_setError(TYPE_ERROR,"Finley_Assemble_CopyElementData: number of components of input and output Data do not match.");
51      } else if (!numSamplesEqual(in,numQuad,numElements)) {      } else if (!numSamplesEqual(in,numQuad,numElements)) {
52         Finley_setError(TYPE_ERROR,"__FILE__: illegal number of samples of input Data object");         Finley_setError(TYPE_ERROR,"Finley_Assemble_CopyElementData: illegal number of samples of input Data object");
53      } else if (!numSamplesEqual(out,numQuad,numElements)) {      } else if (!numSamplesEqual(out,numQuad,numElements)) {
54         Finley_setError(TYPE_ERROR,"__FILE__: illegal number of samples of output Data object");         Finley_setError(TYPE_ERROR,"Finley_Assemble_CopyElementData: illegal number of samples of output Data object");
55      } else if (!isExpanded(out)) {      } else if (!isExpanded(out)) {
56         Finley_setError(TYPE_ERROR,"__FILE__: expanded Data object is expected for output data.");         Finley_setError(TYPE_ERROR,"Finley_Assemble_CopyElementData: expanded Data object is expected for output data.");
57      }      }
58    
59      /* now we can start */      /* now we can start */
60    
61      if (Finley_noError()) {      if (Finley_noError()) {
62           if (isExpanded(in)) {           if (isExpanded(in)) {
63                 len_size=numComps*numQuad*sizeof(double);
64               # pragma omp parallel for private(n) schedule(static)               # pragma omp parallel for private(n) schedule(static)
65               for (n=0;n<numElements;n++)               for (n=0;n<numElements;n++)
66                   Finley_copyDouble(numComps*numQuad,getSampleData(in,n),getSampleData(out,n));                   memcpy(getSampleData(out,n),getSampleData(in,n), len_size);
67           } else {           } else {
68                 len_size=numComps*sizeof(double);
69               # 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)
70               for (n=0;n<numElements;n++) {               for (n=0;n<numElements;n++) {
71                   in_array=getSampleData(in,n);                   in_array=getSampleData(in,n);
72                   out_array=getSampleData(out,n);                   out_array=getSampleData(out,n);
73                   for (q=0;q<numQuad;q++) Finley_copyDouble(numComps,in_array,out_array+q*numComps);                   for (q=0;q<numQuad;q++) memcpy(out_array+q*numComps,in_array,len_size);
74               }               }
75           }           }
76      }      }
77      return;      return;
78  }  }
 /*  
  * $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.1028  
changed lines
  Added in v.1811

  ViewVC Help
Powered by ViewVC 1.1.26