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

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

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

temp_trunk_copy/finley/src/Assemble_interpolate.c revision 1384 by phornby, Fri Jan 11 02:29:38 2008 UTC trunk/finley/src/Assemble_interpolate.c revision 2271 by jfenwick, Mon Feb 16 05:08:29 2009 UTC
# Line 1  Line 1 
1    
 /* $Id$ */  
   
2  /*******************************************************  /*******************************************************
3   *  *
4   *           Copyright 2003-2007 by ACceSS MNRF  * Copyright (c) 2003-2008 by University of Queensland
5   *       Copyright 2007 by University of Queensland  * Earth Systems Science Computational Center (ESSCC)
6   *  * http://www.uq.edu.au/esscc
7   *                http://esscc.uq.edu.au  *
8   *        Primary Business: Queensland, Australia  * Primary Business: Queensland, Australia
9   *  Licensed under the Open Software License version 3.0  * Licensed under the Open Software License version 3.0
10   *     http://www.opensource.org/licenses/osl-3.0.php  * http://www.opensource.org/licenses/osl-3.0.php
11   *  *
12   *******************************************************/  *******************************************************/
13    
14    
15  /**************************************************************/  /**************************************************************/
16    
# Line 29  Line 28 
28    
29    
30  void Finley_Assemble_interpolate(Finley_NodeFile *nodes, Finley_ElementFile* elements,escriptDataC* data,escriptDataC* interpolated_data) {  void Finley_Assemble_interpolate(Finley_NodeFile *nodes, Finley_ElementFile* elements,escriptDataC* data,escriptDataC* interpolated_data) {
31    double* local_data=NULL,*S=NULL,*data_array;    __const double *data_array;
32    index_t dof_offset,*resort_nodesi, NN, NS;    double* local_data=NULL,*S=NULL;
33      index_t dof_offset, NN, NS;
34    bool_t reduced_integration=FALSE;    bool_t reduced_integration=FALSE;
35    dim_t q,i,NS_DOF,NN_DOF,numNodes,e, numQuad;    dim_t q,i,NS_DOF,NN_DOF,numNodes=0,e, numQuad;
36    Finley_RefElement* reference_element=NULL;    Finley_RefElement* reference_element=NULL;
37    dim_t numComps=getDataPointSize(data);    dim_t numComps=getDataPointSize(data);
38    index_t id[MAX_numNodes], *resort_nodes, *map;    index_t id[MAX_numNodes], *resort_nodes=0, *map=0;
39    type_t data_type=getFunctionSpaceType(data);    type_t data_type=getFunctionSpaceType(data);
40    type_t type;    type_t type;
41    size_t numComps_size;    size_t numComps_size;
# Line 129  void Finley_Assemble_interpolate(Finley_ Line 129  void Finley_Assemble_interpolate(Finley_
129    /* now we can start */    /* now we can start */
130    
131    if (Finley_noError()) {    if (Finley_noError()) {
132           void* buffer=allocSampleBuffer(data);
133           requireWrite(interpolated_data);
134         #pragma omp parallel private(local_data, numComps_size)         #pragma omp parallel private(local_data, numComps_size)
135         {         {
136    
137            local_data=NULL;            local_data=NULL;
138            /* allocation of work arrays */            /* allocation of work arrays */
139            local_data=THREAD_MEMALLOC(NS*numComps,double);            local_data=THREAD_MEMALLOC(NS*numComps,double);
# Line 143  void Finley_Assemble_interpolate(Finley_ Line 146  void Finley_Assemble_interpolate(Finley_
146          for(e=0;e<elements->numElements;e++) {          for(e=0;e<elements->numElements;e++) {
147                for (q=0;q<NS_DOF;q++) {                for (q=0;q<NS_DOF;q++) {
148                        i=elements->Nodes[INDEX2(resort_nodes[dof_offset+q],e,NN)];                        i=elements->Nodes[INDEX2(resort_nodes[dof_offset+q],e,NN)];
149                        data_array=getSampleData(data,map[i]);                        data_array=getSampleDataRO(data,map[i],buffer);
150                        memcpy(local_data+q*numComps, data_array, numComps_size);                        memcpy(local_data+q*numComps, data_array, numComps_size);
151                }                }
152            /*  calculate interpolated_data=local_data*S */            /*  calculate interpolated_data=local_data*S */
153    
154            Finley_Util_SmallMatMult(numComps,numQuad,getSampleData(interpolated_data,e),NS_DOF,local_data,S);            Finley_Util_SmallMatMult(numComps,numQuad,getSampleDataRW(interpolated_data,e),NS_DOF,local_data,S);
155    
156          } /* end of element loop */          } /* end of element loop */
157    
158            }            }
159        THREAD_MEMFREE(local_data);        THREAD_MEMFREE(local_data);
160       } /* end of parallel region */       } /* end of parallel region */
161         freeSampleBuffer(buffer);
162    }    }
163    #undef NODES    #undef NODES
164    #undef REDUCED_NODES    #undef REDUCED_NODES

Legend:
Removed from v.1384  
changed lines
  Added in v.2271

  ViewVC Help
Powered by ViewVC 1.1.26