/[escript]/branches/domexper/dudley/src/Assemble_interpolate.c
ViewVC logotype

Diff of /branches/domexper/dudley/src/Assemble_interpolate.c

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

revision 1311 by gross, Mon Mar 26 06:17:53 2007 UTC revision 1312 by ksteube, Mon Sep 24 06:18:44 2007 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  /**************************************************************/  /* $Id$ */
3    
4  /*    assemblage routines: interpolates nodal data in a data array onto elements (=integration points) */  /*******************************************************
5     *
6     *           Copyright 2003-2007 by ACceSS MNRF
7     *       Copyright 2007 by University of Queensland
8     *
9     *                http://esscc.uq.edu.au
10     *        Primary Business: Queensland, Australia
11     *  Licensed under the Open Software License version 3.0
12     *     http://www.opensource.org/licenses/osl-3.0.php
13     *
14     *******************************************************/
15    
16  /**************************************************************/  /**************************************************************/
17    
18  /*  Author: gross@access.edu.au */  /*    assemblage routines: interpolates nodal data in a data array onto elements (=integration points) */
 /*  Version: $Id$ */  
19    
20  /**************************************************************/  /**************************************************************/
21    
# Line 37  void Finley_Assemble_interpolate(Finley_ Line 35  void Finley_Assemble_interpolate(Finley_
35    dim_t q,i,NS_DOF,NN_DOF,numNodes,e, numQuad;    dim_t q,i,NS_DOF,NN_DOF,numNodes,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;    index_t id[MAX_numNodes], *resort_nodes, *map;
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;
42    Finley_resetError();    Finley_resetError();
43    #define NODES 0    #define NODES 0
44    #define REDUCED_NODES 3    #define REDUCED_NODES 3
45    #define DOF 1    #define DOF 1
46    #define REDUCED_DOF 2    #define REDUCED_DOF 2
47    if (nodes==NULL || elements==NULL) return;    if (nodes==NULL || elements==NULL) return;
48    NN=elements->ReferenceElement->Type->numNodes;    
49      NN=elements->numNodes;
50    NS=elements->ReferenceElement->Type->numShapes;    NS=elements->ReferenceElement->Type->numShapes;
51    reduced_integration = Finley_Assemble_reducedIntegrationOrder(interpolated_data);    reduced_integration = Finley_Assemble_reducedIntegrationOrder(interpolated_data);
52    for (i=0;i<NN;i++) id[i]=i;    for (i=0;i<NN;i++) id[i]=i;
# Line 61  void Finley_Assemble_interpolate(Finley_ Line 61  void Finley_Assemble_interpolate(Finley_
61         } else {         } else {
62            reference_element=elements->ReferenceElement;            reference_element=elements->ReferenceElement;
63         }         }
64         numNodes=nodes->numNodes;         numNodes=Finley_NodeFile_getNumNodes(nodes);
65           map=Finley_NodeFile_borrowTargetNodes(nodes);
66    } else if (data_type==FINLEY_REDUCED_NODES) {    } else if (data_type==FINLEY_REDUCED_NODES) {
67         type=REDUCED_NODES;         type=REDUCED_NODES;
68           resort_nodes=elements->ReferenceElement->Type->linearNodes;
69         if (reduced_integration) {         if (reduced_integration) {
70             reference_element=elements->LinearReferenceElementReducedOrder;             reference_element=elements->LinearReferenceElementReducedOrder;
71         } else {         } else {
72             reference_element=elements->LinearReferenceElement;             reference_element=elements->LinearReferenceElement;
73         }         }
74         /* TODO */         numNodes=Finley_NodeFile_getNumReducedNodes(nodes);
75         Finley_setError(TYPE_ERROR,"Finley_Assemble_interpolate: input from reduced nodes is not supported yet.");         map=Finley_NodeFile_borrowTargetReducedNodes(nodes);
76    } else if (data_type==FINLEY_DEGREES_OF_FREEDOM) {    } else if (data_type==FINLEY_DEGREES_OF_FREEDOM) {
77           if (elements->MPIInfo->size>1) {
78              Finley_setError(TYPE_ERROR,"Finley_Assemble_interpolate: for more than one processor DEGREES_OF_FREEDOM data are not accepted as input.");
79              return;
80           }
81         type=DOF;         type=DOF;
82         resort_nodes=id;         resort_nodes=id;
83         if (reduced_integration) {         if (reduced_integration) {
# Line 79  void Finley_Assemble_interpolate(Finley_ Line 85  void Finley_Assemble_interpolate(Finley_
85         } else {         } else {
86             reference_element=elements->ReferenceElement;             reference_element=elements->ReferenceElement;
87         }         }
88         numNodes=nodes->numDegreesOfFreedom;         numNodes=Finley_NodeFile_getNumDegreesOfFreedom(nodes);
89           map=Finley_NodeFile_borrowTargetDegreesOfFreedom(nodes);
90    } else if (data_type==FINLEY_REDUCED_DEGREES_OF_FREEDOM) {    } else if (data_type==FINLEY_REDUCED_DEGREES_OF_FREEDOM) {
91           if (elements->MPIInfo->size>1) {
92              Finley_setError(TYPE_ERROR,"Finley_Assemble_interpolate: for more than one processor REDUCED_DEGREES_OF_FREEDOM data are not accepted as input.");
93              return;
94           }
95         type=REDUCED_DOF;         type=REDUCED_DOF;
96         resort_nodes=elements->ReferenceElement->Type->linearNodes;         resort_nodes=elements->ReferenceElement->Type->linearNodes;
97         if (reduced_integration) {         if (reduced_integration) {
# Line 88  void Finley_Assemble_interpolate(Finley_ Line 99  void Finley_Assemble_interpolate(Finley_
99         } else {         } else {
100             reference_element=elements->LinearReferenceElement;             reference_element=elements->LinearReferenceElement;
101         }         }
102         numNodes=nodes->reducedNumDegreesOfFreedom;         numNodes=Finley_NodeFile_getNumReducedDegreesOfFreedom(nodes);
103           map=Finley_NodeFile_borrowTargetReducedDegreesOfFreedom(nodes);
104     } else {     } else {
105         Finley_setError(TYPE_ERROR,"Finley_Assemble_interpolate: Cannot interpolate data");         Finley_setError(TYPE_ERROR,"Finley_Assemble_interpolate: Cannot interpolate data");
106    }    }
# Line 117  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         #pragma omp parallel private(local_data)         #pragma omp parallel private(local_data, numComps_size)
133         {         {
134            local_data=NULL;            local_data=NULL;
135            /* allocation of work arrays */            /* allocation of work arrays */
136            local_data=THREAD_MEMALLOC(NS*numComps,double);            local_data=THREAD_MEMALLOC(NS*numComps,double);
137            if (! Finley_checkPtr(local_data)) {            if (! Finley_checkPtr(local_data)) {
138    
139                numComps_size=(size_t)numComps*sizeof(double);
140          /* open the element loop */          /* open the element loop */
141    
142              #pragma omp for private(e,q,i,data_array) schedule(static)              #pragma omp for private(e,q,i,data_array) schedule(static)
143          for(e=0;e<elements->numElements;e++) {          for(e=0;e<elements->numElements;e++) {
144            /* gather local data into local_data(numComps,NS_DOF): */                for (q=0;q<NS_DOF;q++) {
145                switch (type) {                        i=elements->Nodes[INDEX2(resort_nodes[dof_offset+q],e,NN)];
146                   case NODES:                        data_array=getSampleData(data,map[i]);
147                          for (q=0;q<NS_DOF;q++) {                        memcpy(local_data+q*numComps, data_array, numComps_size);
                            i=elements->Nodes[INDEX2(resort_nodes[dof_offset+q],e,NN)];  
                            data_array=getSampleData(data,i);  
                            Finley_copyDouble(numComps,data_array,local_data+q*numComps);  
                         }  
                         break;  
                  case REDUCED_NODES:  
                         for (q=0;q<NS_DOF;q++) {  
                            i=elements->Nodes[INDEX2(resort_nodes[dof_offset+q],e,NN)];  
                            data_array=getSampleData(data,i); /* TODO */  
                            Finley_copyDouble(numComps,data_array,local_data+q*numComps);  
                         }  
                         break;  
                  case DOF:  
                         for (q=0;q<NS_DOF;q++) {  
                            i=elements->Nodes[INDEX2(resort_nodes[dof_offset+q],e,NN)];  
                            data_array=getSampleData(data,nodes->degreeOfFreedom[i]);  
                            Finley_copyDouble(numComps,data_array,local_data+q*numComps);  
                         }  
                         break;  
                  case REDUCED_DOF:  
                         for (q=0;q<NS_DOF;q++) {  
                            i=elements->Nodes[INDEX2(resort_nodes[dof_offset+q],e,NN)];  
                            data_array=getSampleData(data,nodes->reducedDegreeOfFreedom[i]);  
                            Finley_copyDouble(numComps,data_array,local_data+q*numComps);  
                         }  
                         break;  
148                }                }
   
149            /*  calculate interpolated_data=local_data*S */            /*  calculate interpolated_data=local_data*S */
150    
151            Finley_Util_SmallMatMult(numComps,numQuad,getSampleData(interpolated_data,e),NS_DOF,local_data,S);            Finley_Util_SmallMatMult(numComps,numQuad,getSampleData(interpolated_data,e),NS_DOF,local_data,S);
# Line 175  void Finley_Assemble_interpolate(Finley_ Line 161  void Finley_Assemble_interpolate(Finley_
161    #undef DOF    #undef DOF
162    #undef REDUCED_DOF    #undef REDUCED_DOF
163  }  }
 /*  
  * $Log$  
  * Revision 1.6  2005/09/15 03:44:21  jgs  
  * Merge of development branch dev-02 back to main trunk on 2005-09-15  
  *  
  * Revision 1.5.2.1  2005/09/07 06:26:18  gross  
  * the solver from finley are put into the standalone package paso now  
  *  
  * Revision 1.5  2005/07/08 04:07:48  jgs  
  * Merge of development branch back to main trunk on 2005-07-08  
  *  
  * Revision 1.4  2004/12/15 07:08:32  jgs  
  * *** empty log message ***  
  * Revision 1.1.1.1.2.3  2005/06/29 02:34:48  gross  
  * some changes towards 64 integers in finley  
  *  
  * Revision 1.1.1.1.2.2  2004/11/24 01:37:12  gross  
  * some changes dealing with the integer overflow in memory allocation. Finley solves 4M unknowns now  
  *  
  *  
  *  
  */  

Legend:
Removed from v.1311  
changed lines
  Added in v.1312

  ViewVC Help
Powered by ViewVC 1.1.26