/[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

trunk/esys2/finley/src/finleyC/Assemble_interpolate.c revision 97 by jgs, Tue Dec 14 05:39:33 2004 UTC trunk/finley/src/Assemble_interpolate.c revision 471 by jgs, Fri Jan 27 01:33:02 2006 UTC
# Line 1  Line 1 
1  /* $Id$ */  /*
2     ******************************************************************************
3     *                                                                            *
4     *       COPYRIGHT  ACcESS 2003,2004,2005 -  All Rights Reserved              *
5     *                                                                            *
6     * This software is the property of ACcESS. No part of this code              *
7     * may be copied in any form or by any means without the expressed written    *
8     * consent of ACcESS.  Copying, use or modification of this software          *
9     * by any unauthorised person is illegal unless that person has a software    *
10     * license agreement with ACcESS.                                             *
11     *                                                                            *
12     ******************************************************************************
13    */
14    
15  /**************************************************************/  /**************************************************************/
16    
# Line 6  Line 18 
18    
19  /**************************************************************/  /**************************************************************/
20    
21  /*   Copyrights by ACcESS Australia, 2003,2004 */  /*  Author: gross@access.edu.au */
22  /*   author: gross@access.edu.au */  /*  Version: $Id$ */
 /*   Version: $Id$ */  
23    
24  /**************************************************************/  /**************************************************************/
25    
 #include "Common.h"  
 #include "escript/Data/DataC.h"  
 #include "Finley.h"  
26  #include "Assemble.h"  #include "Assemble.h"
 #include "NodeFile.h"  
 #include "ElementFile.h"  
27  #include "Util.h"  #include "Util.h"
28  #ifdef _OPENMP  #ifdef _OPENMP
29  #include <omp.h>  #include <omp.h>
# Line 28  Line 34 
34    
35  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) {
36    double* local_data=NULL,*S=NULL,*data_array;    double* local_data=NULL,*S=NULL,*data_array;
37    int dof_offset,q,*resort_nodes,type,i,NS_DOF,NN_DOF,numNodes,e;    index_t dof_offset,*resort_nodes;
38      dim_t q,i,NS_DOF,NN_DOF,numNodes,e;
39      type_t type;
40    #define NODES 0    #define NODES 0
41    #define DOF 1    #define DOF 1
42    #define REDUCED_DOF 2    #define REDUCED_DOF 2
43    if (nodes==NULL || elements==NULL) return;    if (nodes==NULL || elements==NULL) return;
44    int NN=elements->ReferenceElement->Type->numNodes;    dim_t NN=elements->ReferenceElement->Type->numNodes;
45    int NS=elements->ReferenceElement->Type->numShapes;    dim_t NS=elements->ReferenceElement->Type->numShapes;
46    int numComps=getDataPointSize(data);    dim_t numComps=getDataPointSize(data);
47    int data_type=getFunctionSpaceType(data);    type_t data_type=getFunctionSpaceType(data);
48    int numQuad=elements->ReferenceElement->numQuadNodes;    dim_t numQuad=elements->ReferenceElement->numQuadNodes;
49    int id[NN];    index_t id[NN];
50    for (i=0;i<NN;i++) id[i]=i;    for (i=0;i<NN;i++) id[i]=i;
51      Finley_resetError();
52    
53    /* set some parameter */    /* set some parameter */
54    
# Line 65  void Finley_Assemble_interpolate(Finley_ Line 74  void Finley_Assemble_interpolate(Finley_
74         S=elements->LinearReferenceElement->S;         S=elements->LinearReferenceElement->S;
75         numNodes=nodes->reducedNumDegreesOfFreedom;         numNodes=nodes->reducedNumDegreesOfFreedom;
76     } else {     } else {
77         Finley_ErrorCode=TYPE_ERROR;         Finley_setError(TYPE_ERROR,"__FILE__: Cannot interpolate data");
        sprintf(Finley_ErrorMsg,"Cannot interpolate data");  
78    }    }
79    
80    if (getFunctionSpaceType(interpolated_data)==FINLEY_CONTACT_ELEMENTS_2) {    if (getFunctionSpaceType(interpolated_data)==FINLEY_CONTACT_ELEMENTS_2) {
# Line 78  void Finley_Assemble_interpolate(Finley_ Line 86  void Finley_Assemble_interpolate(Finley_
86    /* check the dimensions of interpolated_data and data */    /* check the dimensions of interpolated_data and data */
87    
88    if (! numSamplesEqual(interpolated_data,numQuad,elements->numElements)) {    if (! numSamplesEqual(interpolated_data,numQuad,elements->numElements)) {
89         Finley_ErrorCode=TYPE_ERROR;         Finley_setError(TYPE_ERROR,"__FILE__: illegal number of samples of output Data object");
        sprintf(Finley_ErrorMsg,"illegal number of samples of output Data object");  
90    } else if (! numSamplesEqual(data,1,numNodes)) {    } else if (! numSamplesEqual(data,1,numNodes)) {
91         Finley_ErrorCode=TYPE_ERROR;         Finley_setError(TYPE_ERROR,"__FILE__: illegal number of samples of input Data object");
        sprintf(Finley_ErrorMsg,"illegal number of samples of input Data object");  
92    } else if (numComps!=getDataPointSize(interpolated_data)) {    } else if (numComps!=getDataPointSize(interpolated_data)) {
93         Finley_ErrorCode=TYPE_ERROR;         Finley_setError(TYPE_ERROR,"__FILE__: number of components of input and interpolated Data do not match.");
        sprintf(Finley_ErrorMsg,"number of components of input and interpolated Data do not match.");  
94    }  else if (!isExpanded(interpolated_data)) {    }  else if (!isExpanded(interpolated_data)) {
95         Finley_ErrorCode=TYPE_ERROR;         Finley_setError(TYPE_ERROR,"__FILE__: expanded Data object is expected for output data.");
        sprintf(Finley_ErrorMsg,"expanded Data object is expected for output data.");  
96    }    }
97    
98    /* now we can start */    /* now we can start */
99    
100    if (Finley_ErrorCode==NO_ERROR) {    if (Finley_noError()) {
101         #pragma omp parallel private(local_data)         #pragma omp parallel private(local_data)
102         {         {
103            local_data=NULL;            local_data=NULL;
# Line 146  void Finley_Assemble_interpolate(Finley_ Line 150  void Finley_Assemble_interpolate(Finley_
150  }  }
151  /*  /*
152   * $Log$   * $Log$
153   * Revision 1.2  2004/12/14 05:39:30  jgs   * Revision 1.6  2005/09/15 03:44:21  jgs
154   * *** empty log message ***   * Merge of development branch dev-02 back to main trunk on 2005-09-15
155   *   *
156   * Revision 1.1.1.1.2.2  2004/11/24 01:37:12  gross   * Revision 1.5.2.1  2005/09/07 06:26:18  gross
157   * some changes dealing with the integer overflow in memory allocation. Finley solves 4M unknowns now   * the solver from finley are put into the standalone package paso now
158   *   *
159   * Revision 1.1.1.1.2.1  2004/10/27 23:39:21  gross   * Revision 1.5  2005/07/08 04:07:48  jgs
160   * bug in finley interpolation fixed. GradTest is running now   * Merge of development branch back to main trunk on 2005-07-08
161   *   *
162   * Revision 1.1.1.1  2004/10/26 06:53:57  jgs   * Revision 1.4  2004/12/15 07:08:32  jgs
163   * initial import of project esys2   * *** empty log message ***
164     * Revision 1.1.1.1.2.3  2005/06/29 02:34:48  gross
165     * some changes towards 64 integers in finley
166   *   *
167   * Revision 1.2  2004/07/21 05:00:54  gross   * Revision 1.1.1.1.2.2  2004/11/24 01:37:12  gross
168   * name changes in DataC   * some changes dealing with the integer overflow in memory allocation. Finley solves 4M unknowns now
169   *   *
  * Revision 1.1  2004/07/02 04:21:13  gross  
  * Finley C code has been included  
170   *   *
171   *   *
172   */   */

Legend:
Removed from v.97  
changed lines
  Added in v.471

  ViewVC Help
Powered by ViewVC 1.1.26