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

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

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

revision 123 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    /*
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"  #include "Util.h"
32    
33  /**************************************************************/  /**************************************************************/
34    
35  void  Finley_Mesh_resolveNodeIds(Finley_Mesh* in) {  void  Finley_Mesh_resolveNodeIds(Finley_Mesh* in) {
36      char error_msg[LenErrorMsg_MAX];
37    dim_t k,len,numDim,newNumNodes,n;    dim_t k,len,numDim,newNumNodes,n;
38    index_t min_id,max_id,min_id2,max_id2,*maskNodes=NULL,*maskElements=NULL,*index=NULL;    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: */
# Line 33  void  Finley_Mesh_resolveNodeIds(Finley_ Line 46  void  Finley_Mesh_resolveNodeIds(Finley_
46    max_id=-INDEX_T_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==INDEX_T_MAX || max_id2==-INDEX_T_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 60  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=TMPMEMALLOC(len,index_t);    maskNodes=TMPMEMALLOC(len,index_t);
78    if (Finley_checkPtr(maskNodes)) goto clean;    if (Finley_checkPtr(maskNodes)) goto clean;
# Line 72  void  Finley_Mesh_resolveNodeIds(Finley_ Line 84  void  Finley_Mesh_resolveNodeIds(Finley_
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 96  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 117  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 138  void  Finley_Mesh_resolveNodeIds(Finley_ Line 150  void  Finley_Mesh_resolveNodeIds(Finley_
150    
151  /*  /*
152  * $Log$  * $Log$
153    * Revision 1.6  2005/09/15 03:44:23  jgs
154    * 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  * Revision 1.5  2005/07/08 04:07:54  jgs
160  * Merge of development branch back to main trunk on 2005-07-08  * Merge of development branch back to main trunk on 2005-07-08
161  *  *

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

  ViewVC Help
Powered by ViewVC 1.1.26