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

revision 1739 by gross, Fri Aug 29 06:19:53 2008 UTC revision 2881 by jfenwick, Thu Jan 28 02:03:15 2010 UTC
# Line 1  Line 1 
1    
 /* $Id$ */  
   
2  /*******************************************************  /*******************************************************
3   *  *
4   *           Copyright 2003-2007 by ACceSS MNRF  * Copyright (c) 2003-2010 by University of Queensland
5   *       Copyright 2007 by University of Queensland  * Earth Systems Science Computational Center (ESSCC)
6   *  * http://www.uq.edu.au/esscc
7   *                http://esscc.uq.edu.au  *
8   *        Primary Business: Queensland, Australia  * Primary Business: Queensland, Australia
9   *  Licensed under the Open Software License version 3.0  * Licensed under the Open Software License version 3.0
10   *     http://www.opensource.org/licenses/osl-3.0.php  * http://www.opensource.org/licenses/osl-3.0.php
11   *  *
12   *******************************************************/  *******************************************************/
13    
14    
15  /**************************************************************/  /**************************************************************/
16    
# Line 76  void  Finley_Mesh_resolveNodeIds(Finley_ Line 75  void  Finley_Mesh_resolveNodeIds(Finley_
75    /* allocate mappings for new local node labeling to global node labeling (newLocalToGlobalNodeLabels)    /* allocate mappings for new local node labeling to global node labeling (newLocalToGlobalNodeLabels)
76       and global node labeling to the new local node labeling (globalToNewLocalNodeLabels[i-min_id] is the       and global node labeling to the new local node labeling (globalToNewLocalNodeLabels[i-min_id] is the
77       new local id of global node i) */       new local id of global node i) */
78    len=max_id-min_id+1;    len=(max_id>=min_id) ? max_id-min_id+1 : 0 ;
79    globalToNewLocalNodeLabels=TMPMEMALLOC(len,index_t); /* local mask for used nodes */    globalToNewLocalNodeLabels=TMPMEMALLOC(len,index_t); /* local mask for used nodes */
80    newLocalToGlobalNodeLabels=TMPMEMALLOC(len,index_t);    newLocalToGlobalNodeLabels=TMPMEMALLOC(len,index_t);
81    if (! ( (Finley_checkPtr(globalToNewLocalNodeLabels) && Finley_checkPtr(newLocalToGlobalNodeLabels) ) ) ) {    if (! ( (Finley_checkPtr(globalToNewLocalNodeLabels) && Finley_checkPtr(newLocalToGlobalNodeLabels) ) ) ) {
# Line 90  void  Finley_Mesh_resolveNodeIds(Finley_ Line 89  void  Finley_Mesh_resolveNodeIds(Finley_
89         }         }
90    
91         /*  mark the nodes referred by elements in globalToNewLocalNodeLabels which is currently used as a mask: */         /*  mark the nodes referred by elements in globalToNewLocalNodeLabels which is currently used as a mask: */
   
92         Finley_Mesh_markNodes(globalToNewLocalNodeLabels,min_id,in,FALSE);         Finley_Mesh_markNodes(globalToNewLocalNodeLabels,min_id,in,FALSE);
93    
94         /* create a local labeling newLocalToGlobalNodeLabels of the local nodes by packing the mask globalToNewLocalNodeLabels*/         /* create a local labeling newLocalToGlobalNodeLabels of the local nodes by packing the mask globalToNewLocalNodeLabels*/
# Line 100  void  Finley_Mesh_resolveNodeIds(Finley_ Line 98  void  Finley_Mesh_resolveNodeIds(Finley_
98         /* invert the new labeling and shift the index newLocalToGlobalNodeLabels to global node ids */         /* invert the new labeling and shift the index newLocalToGlobalNodeLabels to global node ids */
99         #pragma omp parallel for private(n) schedule(static)         #pragma omp parallel for private(n) schedule(static)
100         for (n=0;n<newNumNodes;n++) {         for (n=0;n<newNumNodes;n++) {
101  #ifdef BOUNDS_CHECK                #ifdef BOUNDS_CHECK
102         if (n >= len || n < 0) { printf("BOUNDS_CHECK %s %d n=%d\n", __FILE__, __LINE__, n); exit(1); }                       if (n >= len || n < 0) { printf("BOUNDS_CHECK %s %d n=%d\n", __FILE__, __LINE__, n); exit(1); }
103         if (newLocalToGlobalNodeLabels[n] >= len || newLocalToGlobalNodeLabels[n] < 0) { printf("BOUNDS_CHECK %s %d n=%d\n", __FILE__, __LINE__, n); exit(1); }                       if (newLocalToGlobalNodeLabels[n] >= len || newLocalToGlobalNodeLabels[n] < 0) { printf("BOUNDS_CHECK %s %d n=%d\n", __FILE__, __LINE__, n); exit(1); }
104  #endif                #endif
105                globalToNewLocalNodeLabels[newLocalToGlobalNodeLabels[n]]=n;                globalToNewLocalNodeLabels[newLocalToGlobalNodeLabels[n]]=n;
106                newLocalToGlobalNodeLabels[n]+=min_id;                newLocalToGlobalNodeLabels[n]+=min_id;
107          }          }
# Line 112  void  Finley_Mesh_resolveNodeIds(Finley_ Line 110  void  Finley_Mesh_resolveNodeIds(Finley_
110          if (Finley_noError()) {          if (Finley_noError()) {
111             Finley_NodeFile_allocTable(newNodeFile,newNumNodes);             Finley_NodeFile_allocTable(newNodeFile,newNumNodes);
112          }          }
113          if (Finley_noError())          if (Finley_noError()) {
114              Finley_NodeFile_gather_global(newLocalToGlobalNodeLabels,in->Nodes, newNodeFile);              Finley_NodeFile_gather_global(newLocalToGlobalNodeLabels,in->Nodes, newNodeFile);
115            }
116          if (Finley_noError()) {          if (Finley_noError()) {
117             Finley_NodeFile_free(in->Nodes);             Finley_NodeFile_free(in->Nodes);
118             in->Nodes=newNodeFile;             in->Nodes=newNodeFile;

Legend:
Removed from v.1739  
changed lines
  Added in v.2881

  ViewVC Help
Powered by ViewVC 1.1.26