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

Contents of /trunk/finley/src/IndexList.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 155 - (show annotations)
Wed Nov 9 02:02:19 2005 UTC (13 years, 11 months ago) by jgs
Original Path: trunk/finley/src/finleyC/IndexList.c
File MIME type: text/plain
File size: 5266 byte(s)
move all directories from trunk/esys2 into trunk and remove esys2

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: Converting an element list into a matrix shape */
18
19 /**************************************************************/
20
21 /* Author: gross@access.edu.au */
22 /* Version: $Id$ */
23
24 /**************************************************************/
25
26 #include "IndexList.h"
27
28 /**************************************************************/
29 /* inserts the contributions from the element matrices of elements
30 into the row index col. If symmetric is set, only the upper
31 triangle of the matrix is stored. */
32
33 void Finley_IndexList_insertElements(Finley_IndexList* index_list, Finley_ElementFile* elements,
34 bool_t reduce_row_order, index_t* row_Label,
35 bool_t reduce_col_order, index_t* col_Label) {
36 index_t color;
37 dim_t e,kr,kc,NN_row,NN_col,i,icol,irow;
38
39 if (elements!=NULL) {
40 dim_t NN=elements->ReferenceElement->Type->numNodes;
41 index_t id[NN],*row_node,*col_node;
42 for (i=0;i<NN;i++) id[i]=i;
43 if (reduce_col_order) {
44 col_node=elements->ReferenceElement->Type->linearNodes;
45 NN_col=elements->LinearReferenceElement->Type->numNodes;
46 } else {
47 col_node=id;
48 NN_col=elements->ReferenceElement->Type->numNodes;
49 }
50 if (reduce_row_order) {
51 row_node=elements->ReferenceElement->Type->linearNodes;
52 NN_row=elements->LinearReferenceElement->Type->numNodes;
53 } else {
54 row_node=id;
55 NN_row=elements->ReferenceElement->Type->numNodes;
56 }
57 for (color=elements->minColor;color<=elements->maxColor;color++) {
58 #pragma omp for private(e,irow,kr,kc,icol) schedule(static)
59 for (e=0;e<elements->numElements;e++) {
60 if (elements->Color[e]==color) {
61 for (kr=0;kr<NN_row;kr++) {
62 irow=row_Label[elements->Nodes[INDEX2(row_node[kr],e,NN)]];
63 for (kc=0;kc<NN_col;kc++) {
64 icol=col_Label[elements->Nodes[INDEX2(col_node[kc],e,NN)]];
65 Finley_IndexList_insertIndex(&(index_list[irow]),icol);
66 }
67 }
68 }
69 }
70 }
71 }
72 return;
73 }
74
75 /* inserts row index row into the Finley_IndexList in if it does not exist */
76
77 void Finley_IndexList_insertIndex(Finley_IndexList* in, index_t index) {
78 dim_t i;
79 /* is index in in? */
80 for (i=0;i<in->n;i++) {
81 if (in->index[i]==index) return;
82 }
83 /* index could not be found */
84 if (in->n==INDEXLIST_LENGTH) {
85 /* if in->index is full check the extension */
86 if (in->extension==NULL) {
87 in->extension=TMPMEMALLOC(1,Finley_IndexList);
88 if (Finley_checkPtr(in->extension)) return;
89 in->extension->n=0;
90 in->extension->extension=NULL;
91 }
92 Finley_IndexList_insertIndex(in->extension,index);
93 } else {
94 /* insert index into in->index*/
95 in->index[in->n]=index;
96 in->n++;
97 }
98 }
99
100 /* counts the number of row indices in the Finley_IndexList in */
101
102 dim_t Finley_IndexList_count(Finley_IndexList* in) {
103 if (in==NULL) {
104 return 0;
105 } else {
106 return (in->n)+Finley_IndexList_count(in->extension);
107 }
108 }
109
110 /* count the number of row indices in the Finley_IndexList in */
111
112 void Finley_IndexList_toArray(Finley_IndexList* in, index_t* array) {
113 dim_t i;
114 if (in!=NULL) {
115 for (i=0;i<in->n;i++) array[i]=in->index[i]+INDEX_OFFSET;
116 Finley_IndexList_toArray(in->extension,&(array[in->n]));
117 }
118 }
119
120 /* deallocates the Finley_IndexList in by recursive calls */
121
122 void Finley_IndexList_free(Finley_IndexList* in) {
123 if (in!=NULL) {
124 Finley_IndexList_free(in->extension);
125 TMPMEMFREE(in);
126 }
127 }
128
129 /*
130 * $Log$
131 * Revision 1.6 2005/09/15 03:44:22 jgs
132 * Merge of development branch dev-02 back to main trunk on 2005-09-15
133 *
134 * Revision 1.5.2.1 2005/09/07 06:26:18 gross
135 * the solver from finley are put into the standalone package paso now
136 *
137 * Revision 1.5 2005/07/08 04:07:51 jgs
138 * Merge of development branch back to main trunk on 2005-07-08
139 *
140 * Revision 1.4 2004/12/15 07:08:32 jgs
141 * *** empty log message ***
142 * Revision 1.1.1.1.2.3 2005/06/29 02:34:50 gross
143 * some changes towards 64 integers in finley
144 *
145 * Revision 1.1.1.1.2.2 2004/11/24 01:37:13 gross
146 * some changes dealing with the integer overflow in memory allocation. Finley solves 4M unknowns now
147 *
148 *
149 *
150 */

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26