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

Annotation of /branches/domexper/dudley/src/ElementFile_markNodes.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1770 - (hide annotations)
Mon Sep 8 06:58:47 2008 UTC (10 years, 9 months ago) by ksteube
Original Path: trunk/finley/src/ElementFile_markNodes.c
File MIME type: text/plain
File size: 3334 byte(s)
Detects an array reference out of bounds when running run_inputOutput.py

1 jgs 150
2 ksteube 1312 /* $Id$ */
3    
4     /*******************************************************
5     *
6     * Copyright 2003-2007 by ACceSS MNRF
7     * Copyright 2007 by University of Queensland
8     *
9     * http://esscc.uq.edu.au
10     * Primary Business: Queensland, Australia
11     * Licensed under the Open Software License version 3.0
12     * http://www.opensource.org/licenses/osl-3.0.php
13     *
14     *******************************************************/
15    
16 jgs 82 /**************************************************************/
17    
18     /* Finley: ElementFile */
19    
20     /* mark the used nodes with offeset: */
21    
22     /**************************************************************/
23    
24     #include "ElementFile.h"
25    
26     /**************************************************************/
27    
28 ksteube 1770 void Finley_ElementFile_markNodes(index_t* mask,index_t offset,dim_t numNodes,Finley_ElementFile* in,bool_t useLinear) {
29 jgs 123 dim_t i,NN,NN2,e;
30 phornby 1628 index_t *lin_node,*id=NULL;
31 gross 1763
32 jgs 82 if (in!=NULL) {
33 gross 1028 id=TMPMEMALLOC(in->ReferenceElement->Type->numNodes, index_t);
34     if (! Finley_checkPtr(id) ){
35     if (useLinear) {
36     NN=in->LinearReferenceElement->Type->numNodes;
37     lin_node=in->ReferenceElement->Type->linearNodes;
38     } else {
39     NN=in->ReferenceElement->Type->numNodes;
40     lin_node=id;
41 gross 1763 for (i=0;i<in->ReferenceElement->Type->numNodes;i++) id[i]=i;
42 gross 1028 }
43 ksteube 1312 NN2=in->numNodes;
44     #pragma omp parallel for private(e,i) schedule(static)
45     for (e=0;e<in->numElements;e++) {
46     for (i=0;i<NN;i++) {
47 ksteube 1770 #ifdef BOUNDS_CHECK
48     if ((in->Nodes[INDEX2(lin_node[i],e,NN2)]-offset) >= numNodes) { printf("BOUNDS_CHECK %s %d i=%d e=%d NN2=%d offset=%d index=%d\n", __FILE__, __LINE__, i, e, NN2, offset, in->Nodes[INDEX2(lin_node[i],e,NN2)]-offset); exit(1); }
49     #endif
50 gross 1028 mask[in->Nodes[INDEX2(lin_node[i],e,NN2)]-offset]=1;
51     }
52 jgs 82 }
53 gross 1028 TMPMEMFREE(id);
54     }
55 jgs 82 }
56     }
57 bcumming 751
58 ksteube 1312 void Finley_ElementFile_markDOFsConnectedToRange(index_t* mask,index_t offset,index_t marker,index_t firstDOF,index_t lastDOF,index_t *dofIndex,Finley_ElementFile*in ,bool_t useLinear)
59     {
60     dim_t i,NN,NN2,e,j;
61     index_t color,*lin_node,*id=NULL,k;
62     if (in!=NULL) {
63     id=TMPMEMALLOC(in->ReferenceElement->Type->numNodes, index_t);
64     if (! Finley_checkPtr(id) ){
65     if (useLinear) {
66     NN=in->LinearReferenceElement->Type->numNodes;
67     lin_node=in->ReferenceElement->Type->linearNodes;
68     } else {
69     NN=in->ReferenceElement->Type->numNodes;
70     lin_node=id;
71 gross 1763 for (i=0;i<in->ReferenceElement->Type->numNodes;i++) id[i]=i;
72 ksteube 1312 }
73     NN2=in->numNodes;
74     for (color=in->minColor;color<=in->maxColor;color++) {
75     #pragma omp parallel for private(e,i,j,k) schedule(static)
76     for (e=0;e<in->numElements;e++) {
77     if (in->Color[e]==color) {
78     for (i=0;i<NN;i++) {
79     k=dofIndex[in->Nodes[INDEX2(lin_node[i],e,NN2)]];
80     if ( (firstDOF<=k) && (k<lastDOF) ) {
81 gross 1763 for (j=0;j<NN;j++) {
82     mask[dofIndex[in->Nodes[INDEX2(lin_node[j],e,NN2)]]-offset]=marker;
83     }
84 ksteube 1312 break;
85     }
86     }
87     }
88     }
89     }
90     }
91     TMPMEMFREE(id);
92     }
93     }
94    

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26