/[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 1764 by gross, Fri Aug 29 06:19:53 2008 UTC revision 1765 by gross, Mon Sep 8 02:49:57 2008 UTC
# Line 76  void  Finley_Mesh_resolveNodeIds(Finley_ Line 76  void  Finley_Mesh_resolveNodeIds(Finley_
76    /* allocate mappings for new local node labeling to global node labeling (newLocalToGlobalNodeLabels)    /* allocate mappings for new local node labeling to global node labeling (newLocalToGlobalNodeLabels)
77       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
78       new local id of global node i) */       new local id of global node i) */
79    len=max_id-min_id+1;    len=(max_id>min_id) ? max_id-min_id+1 : 0 ;
80    globalToNewLocalNodeLabels=TMPMEMALLOC(len,index_t); /* local mask for used nodes */    globalToNewLocalNodeLabels=TMPMEMALLOC(len,index_t); /* local mask for used nodes */
81    newLocalToGlobalNodeLabels=TMPMEMALLOC(len,index_t);    newLocalToGlobalNodeLabels=TMPMEMALLOC(len,index_t);
82    if (! ( (Finley_checkPtr(globalToNewLocalNodeLabels) && Finley_checkPtr(newLocalToGlobalNodeLabels) ) ) ) {    if (! ( (Finley_checkPtr(globalToNewLocalNodeLabels) && Finley_checkPtr(newLocalToGlobalNodeLabels) ) ) ) {
# Line 90  void  Finley_Mesh_resolveNodeIds(Finley_ Line 90  void  Finley_Mesh_resolveNodeIds(Finley_
90         }         }
91    
92         /*  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: */
   
93         Finley_Mesh_markNodes(globalToNewLocalNodeLabels,min_id,in,FALSE);         Finley_Mesh_markNodes(globalToNewLocalNodeLabels,min_id,in,FALSE);
94    
95         /* 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 99  void  Finley_Mesh_resolveNodeIds(Finley_
99         /* 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 */
100         #pragma omp parallel for private(n) schedule(static)         #pragma omp parallel for private(n) schedule(static)
101         for (n=0;n<newNumNodes;n++) {         for (n=0;n<newNumNodes;n++) {
102  #ifdef BOUNDS_CHECK                #ifdef BOUNDS_CHECK
103         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); }
104         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); }
105  #endif                #endif
106                globalToNewLocalNodeLabels[newLocalToGlobalNodeLabels[n]]=n;                globalToNewLocalNodeLabels[newLocalToGlobalNodeLabels[n]]=n;
107                newLocalToGlobalNodeLabels[n]+=min_id;                newLocalToGlobalNodeLabels[n]+=min_id;
108          }          }
# Line 112  void  Finley_Mesh_resolveNodeIds(Finley_ Line 111  void  Finley_Mesh_resolveNodeIds(Finley_
111          if (Finley_noError()) {          if (Finley_noError()) {
112             Finley_NodeFile_allocTable(newNodeFile,newNumNodes);             Finley_NodeFile_allocTable(newNodeFile,newNumNodes);
113          }          }
114          if (Finley_noError())          if (Finley_noError()) {
115              Finley_NodeFile_gather_global(newLocalToGlobalNodeLabels,in->Nodes, newNodeFile);              Finley_NodeFile_gather_global(newLocalToGlobalNodeLabels,in->Nodes, newNodeFile);
116            }
117          if (Finley_noError()) {          if (Finley_noError()) {
118             Finley_NodeFile_free(in->Nodes);             Finley_NodeFile_free(in->Nodes);
119             in->Nodes=newNodeFile;             in->Nodes=newNodeFile;

Legend:
Removed from v.1764  
changed lines
  Added in v.1765

  ViewVC Help
Powered by ViewVC 1.1.26