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

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

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

trunk/esys2/finley/src/finleyC/Assemble_getSize.c revision 102 by jgs, Wed Dec 15 07:08:39 2004 UTC trunk/finley/src/finleyC/Assemble_getSize.c revision 155 by jgs, Wed Nov 9 02:02:19 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 10  Line 22 
22    
23  /**************************************************************/  /**************************************************************/
24    
25  /*   Copyrights by ACcESS Australia, 2003,2004 */  /*   Copyrights by ACcESS Australia, 2003,2004,2005 */
26  /*   author: gross@access.edu.au */  /*   author: gross@access.edu.au */
27  /*   Version: $Id$ */  /*   version: $Id$ */
28    
29  /**************************************************************/  /**************************************************************/
30    
 #include "escript/Data/DataC.h"  
 #include "Finley.h"  
31  #include "Assemble.h"  #include "Assemble.h"
 #include "NodeFile.h"  
 #include "ElementFile.h"  
32  #include "Util.h"  #include "Util.h"
33  #ifdef _OPENMP  #ifdef _OPENMP
34  #include <omp.h>  #include <omp.h>
# Line 30  Line 38 
38  void Finley_Assemble_getSize(Finley_NodeFile* nodes, Finley_ElementFile* elements, escriptDataC* element_size) {  void Finley_Assemble_getSize(Finley_NodeFile* nodes, Finley_ElementFile* elements, escriptDataC* element_size) {
39    
40    double *local_X=NULL,*element_size_array;    double *local_X=NULL,*element_size_array;
41    int e,n0,n1,q,i,node_offset;    dim_t e,n0,n1,q,i;
42      index_t node_offset;
43    double d,diff,min_diff;    double d,diff,min_diff;
44      Finley_resetError();
45    
46    if (nodes==NULL || elements==NULL) return;    if (nodes==NULL || elements==NULL) return;
47    int NVertices=elements->ReferenceElement->Type->numVertices;    dim_t NVertices=elements->ReferenceElement->Type->numVertices;
48    int NN=elements->ReferenceElement->Type->numNodes;    dim_t NN=elements->ReferenceElement->Type->numNodes;
49    int NS=elements->ReferenceElement->Type->numShapes;    dim_t NS=elements->ReferenceElement->Type->numShapes;
50    int numQuad=elements->ReferenceElement->numQuadNodes;    dim_t numQuad=elements->ReferenceElement->numQuadNodes;
51    int numDim=nodes->numDim;    dim_t numDim=nodes->numDim;
52    
53    /* set a few more parameters */    /* set a few more parameters */
54    
# Line 51  void Finley_Assemble_getSize(Finley_Node Line 61  void Finley_Assemble_getSize(Finley_Node
61    /* check the dimensions of element_size */    /* check the dimensions of element_size */
62    
63    if (numDim!=elements->ReferenceElement->Type->numDim) {    if (numDim!=elements->ReferenceElement->Type->numDim) {
64       Finley_ErrorCode=TYPE_ERROR;       Finley_setError(TYPE_ERROR,"__FILE__: Gradient: Spatial and element dimension must match.");
      sprintf(Finley_ErrorMsg,"Gradient: Spatial and element dimension must match.");  
65    } else if (! numSamplesEqual(element_size,numQuad,elements->numElements)) {    } else if (! numSamplesEqual(element_size,numQuad,elements->numElements)) {
66         Finley_ErrorCode=TYPE_ERROR;         Finley_setError(TYPE_ERROR,"__FILE__: illegal number of samples of element size Data object");
        sprintf(Finley_ErrorMsg,"illegal number of samples of element size Data object");  
67    } else if (! isDataPointShapeEqual(element_size,0,&(numDim))) {    } else if (! isDataPointShapeEqual(element_size,0,&(numDim))) {
68         Finley_ErrorCode=TYPE_ERROR;         Finley_setError(TYPE_ERROR,"__FILE__: illegal data point shape of element size Data object");
        sprintf(Finley_ErrorMsg,"illegal data point shape of element size Data object");  
69    }  else if (!isExpanded(element_size)) {    }  else if (!isExpanded(element_size)) {
70         Finley_ErrorCode=TYPE_ERROR;         Finley_setError(TYPE_ERROR,"__FILE__: expanded Data object is expected for element size.");
        sprintf(Finley_ErrorMsg,"expanded Data object is expected for element size.");  
71    }    }
72    /* now we can start: */    /* now we can start: */
73    
74    if (Finley_ErrorCode==NO_ERROR) {    if (Finley_noError()) {
75          #pragma omp parallel private(local_X)          #pragma omp parallel private(local_X)
76          {          {
77         /* allocation of work arrays */         /* allocation of work arrays */
78         local_X=THREAD_MEMALLOC(NN*numDim,double);         local_X=THREAD_MEMALLOC(NN*numDim,double);
79         if (! Finley_checkPtr(local_X) ) {         if (! Finley_checkPtr(local_X) ) {
80           /* open the element loop */           /* open the element loop */
81               #pragma omp for private(e,min_diff,diff,n0,n1,d,q,i,element_size_array)               #pragma omp for private(e,min_diff,diff,n0,n1,d,q,i,element_size_array) schedule(static)
82           for(e=0;e<elements->numElements;e++) {           for(e=0;e<elements->numElements;e++) {
83             /* gather local coordinates of nodes into local_X(numDim,NN): */             /* gather local coordinates of nodes into local_X(numDim,NN): */
84             Finley_Util_Gather_double(NS,&(elements->Nodes[INDEX2(node_offset,e,NN)]),numDim,nodes->Coordinates,local_X);             Finley_Util_Gather_double(NS,&(elements->Nodes[INDEX2(node_offset,e,NN)]),numDim,nodes->Coordinates,local_X);
# Line 105  void Finley_Assemble_getSize(Finley_Node Line 111  void Finley_Assemble_getSize(Finley_Node
111  }  }
112  /*  /*
113   * $Log$   * $Log$
114   * Revision 1.4  2004/12/15 07:08:32  jgs   * Revision 1.7  2005/09/15 03:44:21  jgs
115   * *** empty log message ***   * Merge of development branch dev-02 back to main trunk on 2005-09-15
116     *
117     * Revision 1.6.2.1  2005/09/07 06:26:17  gross
118     * the solver from finley are put into the standalone package paso now
119     *
120     * Revision 1.6  2005/07/08 04:07:47  jgs
121     * Merge of development branch back to main trunk on 2005-07-08
122     *
123     * Revision 1.1.1.1.2.3  2005/06/29 02:34:48  gross
124     * some changes towards 64 integers in finley
125     *
126     * Revision 1.1.1.1.2.2  2005/03/02 23:35:05  gross
127     * reimplementation of the ILU in Finley. block size>1 still needs some testing
128     *
129     * Revision 1.1.1.1.2.1  2004/11/24 01:37:12  gross
130     * some changes dealing with the integer overflow in memory allocation. Finley solves 4M unknowns now
131     *
132     * Revision 1.1.1.1  2004/10/26 06:53:57  jgs
133     * initial import of project esys2
134     *
135     * Revision 1.3  2004/07/30 04:37:06  gross
136     * escript and finley are linking now and RecMeshTest.py has been passed
137     *
138     * Revision 1.2  2004/07/21 05:00:54  gross
139     * name changes in DataC
140   *   *
141     * Revision 1.1  2004/07/02 04:21:13  gross
142     * Finley C code has been included
143   *   *
144   *   *
145   */   */

Legend:
Removed from v.102  
changed lines
  Added in v.155

  ViewVC Help
Powered by ViewVC 1.1.26