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

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

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

trunk/esys2/finley/src/finleyC/Mesh_resolveNodeIds.c revision 82 by jgs, Tue Oct 26 06:53:54 2004 UTC trunk/finley/src/finleyC/Mesh_resolveNodeIds.c revision 155 by jgs, Wed Nov 9 02:02:19 2005 UTC
# Line 1  Line 1 
1    /*
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    
17  /*   Finley: Mesh */  /*   Finley: Mesh */
# Line 8  Line 22 
22    
23  /**************************************************************/  /**************************************************************/
24    
 /*   Copyrights by ACcESS Australia 2003 */  
25  /*   Author: gross@access.edu.au */  /*   Author: gross@access.edu.au */
26  /*   Version: $Id$ */  /*   Version: $Id$ */
27    
28  /**************************************************************/  /**************************************************************/
29    
 #include "Finley.h"  
30  #include "Mesh.h"  #include "Mesh.h"
31    #include "Util.h"
32    
33  /**************************************************************/  /**************************************************************/
34    
35  void  Finley_Mesh_resolveNodeIds(Finley_Mesh* in) {  void  Finley_Mesh_resolveNodeIds(Finley_Mesh* in) {
36    maybelong k,min_id,max_id,min_id2,max_id2,len,numDim,newNumNodes,n;    char error_msg[LenErrorMsg_MAX];
37    maybelong *maskNodes=NULL,*maskElements=NULL,*index=NULL;    dim_t k,len,numDim,newNumNodes,n;
38      index_t min_id,max_id,min_id2,max_id2,*maskNodes=NULL,*maskElements=NULL,*index=NULL;
39    Finley_NodeFile *newNodeFile=NULL;    Finley_NodeFile *newNodeFile=NULL;
40    Finley_ErrorCode=NO_ERROR;    Finley_resetError();
41    numDim=Finley_Mesh_getDim(in);    numDim=Finley_Mesh_getDim(in);
42        
43    /*   find the minimum and maximum id used: */    /*   find the minimum and maximum id used: */
44        
45    min_id=MAYBELONG_MAX;    min_id=INDEX_T_MAX;
46    max_id=-MAYBELONG_MAX;    max_id=-INDEX_T_MAX;
47    Finley_NodeFile_setIdRange(&min_id2,&max_id2,in->Nodes);    Finley_NodeFile_setIdRange(&min_id2,&max_id2,in->Nodes);
48    if (min_id2==MAYBELONG_MAX || max_id2==-MAYBELONG_MAX) {    if (min_id2==INDEX_T_MAX || max_id2==-INDEX_T_MAX) {
49      Finley_ErrorCode=VALUE_ERROR;      Finley_setError(VALUE_ERROR,"__FILE__: Mesh has not been defined completely.");
     sprintf(Finley_ErrorMsg,"Mesh has not been defined completely.");  
50      goto clean;      goto clean;
51    }    }
52    
# Line 59  void  Finley_Mesh_resolveNodeIds(Finley_ Line 72  void  Finley_Mesh_resolveNodeIds(Finley_
72        
73    len=max_id-min_id+1;    len=max_id-min_id+1;
74    newNodeFile=Finley_NodeFile_alloc(numDim);    newNodeFile=Finley_NodeFile_alloc(numDim);
75    if (Finley_ErrorCode!=NO_ERROR) goto clean;    if (! Finley_noError()) goto clean;
76    
77    maskNodes=(maybelong*)TMPMEMALLOC(len*sizeof(maybelong));    maskNodes=TMPMEMALLOC(len,index_t);
78    if (Finley_checkPtr(maskNodes)) goto clean;    if (Finley_checkPtr(maskNodes)) goto clean;
79    
80    maskElements=(maybelong*)TMPMEMALLOC(len*sizeof(maybelong));    maskElements=TMPMEMALLOC(len,index_t);
81    if (Finley_checkPtr(maskElements)) goto clean;    if (Finley_checkPtr(maskElements)) goto clean;
82    
83    index=(maybelong*)TMPMEMALLOC(in->Nodes->numNodes*sizeof(maybelong));    index=TMPMEMALLOC(in->Nodes->numNodes,index_t);
84    if (Finley_checkPtr(maskElements)) goto clean;    if (Finley_checkPtr(maskElements)) goto clean;
85    
86    Finley_NodeFile_allocTable(newNodeFile,len);    Finley_NodeFile_allocTable(newNodeFile,len);
87    if (Finley_ErrorCode!=NO_ERROR) goto clean;    if (! Finley_noError()) goto clean;
88    
89    #pragma omp parallel for private(n) schedule(static)    #pragma omp parallel for private(n) schedule(static)
90    for (n=0;n<in->Nodes->numNodes;n++) index[n]=-1;    for (n=0;n<in->Nodes->numNodes;n++) index[n]=-1;
# Line 95  void  Finley_Mesh_resolveNodeIds(Finley_ Line 108  void  Finley_Mesh_resolveNodeIds(Finley_
108    for (k=0;k<len;k++) {    for (k=0;k<len;k++) {
109       /* if a node is refered by an element is there a node defined ?*/       /* if a node is refered by an element is there a node defined ?*/
110       if (maskElements[k]>=0 && maskNodes[k]<0) {       if (maskElements[k]>=0 && maskNodes[k]<0) {
111         Finley_ErrorCode=VALUE_ERROR;         sprintf(error_msg,"__FILE__:Node id %d is referenced by element but is not defined.",k+min_id);
112         sprintf(Finley_ErrorMsg,"Node id %d is referenced by element but is not defined.",k+min_id);         Finley_setError(VALUE_ERROR,error_msg);
113       }       }
114    }    }
115    
116    if (Finley_ErrorCode==NO_ERROR) {    if (Finley_noError()) {
117        
118        /*  scatter the nodefile in->nodes into newNodeFile using index; */        /*  scatter the nodefile in->nodes into newNodeFile using index; */
119        #pragma omp parallel for private(k) schedule(static)        #pragma omp parallel for private(k) schedule(static)
# Line 116  void  Finley_Mesh_resolveNodeIds(Finley_ Line 129  void  Finley_Mesh_resolveNodeIds(Finley_
129        /*  create a new table of nodes: */        /*  create a new table of nodes: */
130        Finley_NodeFile_deallocTable(in->Nodes);        Finley_NodeFile_deallocTable(in->Nodes);
131        Finley_NodeFile_allocTable(in->Nodes,newNumNodes);        Finley_NodeFile_allocTable(in->Nodes,newNumNodes);
132        if (Finley_ErrorCode!=NO_ERROR) goto clean;        if (! Finley_noError()) goto clean;
133    
134        /* gather the new nodefile into in->Nodes */        /* gather the new nodefile into in->Nodes */
135        Finley_NodeFile_gather(index,newNodeFile,in->Nodes);        Finley_NodeFile_gather(index,newNodeFile,in->Nodes);
# Line 137  void  Finley_Mesh_resolveNodeIds(Finley_ Line 150  void  Finley_Mesh_resolveNodeIds(Finley_
150    
151  /*  /*
152  * $Log$  * $Log$
153  * Revision 1.1  2004/10/26 06:53:57  jgs  * Revision 1.6  2005/09/15 03:44:23  jgs
154  * Initial revision  * Merge of development branch dev-02 back to main trunk on 2005-09-15
155    *
156    * Revision 1.5.2.1  2005/09/07 06:26:20  gross
157    * the solver from finley are put into the standalone package paso now
158    *
159    * Revision 1.5  2005/07/08 04:07:54  jgs
160    * Merge of development branch back to main trunk on 2005-07-08
161    *
162    * Revision 1.4  2004/12/15 07:08:33  jgs
163    * *** empty log message ***
164    * Revision 1.1.1.1.2.2  2005/06/29 02:34:53  gross
165    * some changes towards 64 integers in finley
166    *
167    * Revision 1.1.1.1.2.1  2004/11/24 01:37:14  gross
168    * some changes dealing with the integer overflow in memory allocation. Finley solves 4M unknowns now
169  *  *
 * Revision 1.1.1.1  2004/06/24 04:00:40  johng  
 * Initial version of eys using boost-python.  
170  *  *
171  *  *
172  */  */

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

  ViewVC Help
Powered by ViewVC 1.1.26