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

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

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

revision 149 by jgs, Fri Jul 8 04:08:13 2005 UTC revision 150 by jgs, Thu Sep 15 03:44:45 2005 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 */  /*   Copyrights by ACcESS Australia, 2003,2004,2005 */
22  /*   author: gross@access.edu.au */  /*   author: gross@access.edu.au */
23  /*   Version: $Id$ */  /*   version: $Id$ */
24    
25  /**************************************************************/  /**************************************************************/
26    
 #include "escript/Data/DataC.h"  
 #include "Common.h"  
 #include "Finley.h"  
27  #include "Assemble.h"  #include "Assemble.h"
 #include "NodeFile.h"  
 #include "ElementFile.h"  
28  #include "Util.h"  #include "Util.h"
29  #ifdef _OPENMP  #ifdef _OPENMP
30  #include <omp.h>  #include <omp.h>
# Line 45  void Finley_Assemble_gradient(Finley_Nod Line 52  void Finley_Assemble_gradient(Finley_Nod
52    dim_t numComps=getDataPointSize(data);    dim_t numComps=getDataPointSize(data);
53    dim_t numQuad=elements->ReferenceElement->numQuadNodes;    dim_t numQuad=elements->ReferenceElement->numQuadNodes;
54    for (i=0;i<NN;i++) id[i]=i;    for (i=0;i<NN;i++) id[i]=i;
55      Finley_resetError();
56    
57      /* set some parameter */      /* set some parameter */
58    
# Line 70  void Finley_Assemble_gradient(Finley_Nod Line 78  void Finley_Assemble_gradient(Finley_Nod
78         gradS=elements->LinearReferenceElement->dSdv;         gradS=elements->LinearReferenceElement->dSdv;
79         numNodes=nodes->reducedNumDegreesOfFreedom;         numNodes=nodes->reducedNumDegreesOfFreedom;
80     } else {     } else {
81         Finley_ErrorCode=TYPE_ERROR;         Finley_setError(TYPE_ERROR,"__FILE__: Cannot calculate gradient of data");
        sprintf(Finley_ErrorMsg,"Cannot calculate gradient of data");  
82    }    }
83    if (getFunctionSpaceType(grad_data)==FINLEY_CONTACT_ELEMENTS_2) {    if (getFunctionSpaceType(grad_data)==FINLEY_CONTACT_ELEMENTS_2) {
84         node_offset=NN-NS;         node_offset=NN-NS;
# Line 84  void Finley_Assemble_gradient(Finley_Nod Line 91  void Finley_Assemble_gradient(Finley_Nod
91    /* check the dimensions of interpolated_data and data */    /* check the dimensions of interpolated_data and data */
92    
93    if (numDim!=elements->ReferenceElement->Type->numDim) {    if (numDim!=elements->ReferenceElement->Type->numDim) {
94       Finley_ErrorCode=TYPE_ERROR;       Finley_setError(TYPE_ERROR,"__FILE__: Spatial and element dimension must match.");
      sprintf(Finley_ErrorMsg,"Gradient: Spatial and element dimension must match.");  
95    } else if (! numSamplesEqual(grad_data,numQuad,elements->numElements)) {    } else if (! numSamplesEqual(grad_data,numQuad,elements->numElements)) {
96         Finley_ErrorCode=TYPE_ERROR;         Finley_setError(TYPE_ERROR,"__FILE__: illegal number of samples in gradient Data object");
        sprintf(Finley_ErrorMsg,"illegal number of samples in gradient Data object");  
97    } else if (! numSamplesEqual(data,1,numNodes)) {    } else if (! numSamplesEqual(data,1,numNodes)) {
98         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");  
99    } else if (numDim*numComps!=getDataPointSize(grad_data)) {    } else if (numDim*numComps!=getDataPointSize(grad_data)) {
100         Finley_ErrorCode=TYPE_ERROR;         Finley_setError(TYPE_ERROR,"__FILE__: illegal number of components in gradient data object.");
        sprintf(Finley_ErrorMsg,"illegal number of components in gradient data object.");  
101    }  else if (!isExpanded(grad_data)) {    }  else if (!isExpanded(grad_data)) {
102         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.");  
103    }    }
104        
105    /* now we can start */    /* now we can start */
106    
107    if (Finley_ErrorCode==NO_ERROR) {    if (Finley_noError()) {
108            #pragma omp parallel private(local_X,local_data,dvdV,dVdv,Vol,d_datadv)            #pragma omp parallel private(local_X,local_data,dvdV,dVdv,Vol,d_datadv)
109            {            {
110                 local_X=local_data=dVdv=dvdV=Vol=d_datadv=NULL;                 local_X=local_data=dVdv=dvdV=Vol=d_datadv=NULL;
# Line 168  void Finley_Assemble_gradient(Finley_Nod Line 170  void Finley_Assemble_gradient(Finley_Nod
170  #undef REDUCED_DOF  #undef REDUCED_DOF
171  /*  /*
172   * $Log$   * $Log$
173     * Revision 1.6  2005/09/15 03:44:21  jgs
174     * Merge of development branch dev-02 back to main trunk on 2005-09-15
175     *
176     * Revision 1.5.2.1  2005/09/07 06:26:17  gross
177     * the solver from finley are put into the standalone package paso now
178     *
179   * Revision 1.5  2005/07/08 04:07:47  jgs   * Revision 1.5  2005/07/08 04:07:47  jgs
180   * Merge of development branch back to main trunk on 2005-07-08   * Merge of development branch back to main trunk on 2005-07-08
181   *   *

Legend:
Removed from v.149  
changed lines
  Added in v.150

  ViewVC Help
Powered by ViewVC 1.1.26