/[escript]/branches/RW_WIN32/finley/src/finleyC/IndexList.c
ViewVC logotype

Contents of /branches/RW_WIN32/finley/src/finleyC/IndexList.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 186 - (show annotations)
Sun Nov 20 10:51:16 2005 UTC (13 years, 11 months ago) by robwdcock
File MIME type: text/plain
File size: 5389 byte(s)
PARTIAL WIN32 PORT
+ Paso, ext_math and mmio libraries build using scons in top level directory
+ Scons build system currently hard coded against RW's third-party library paths.
+ Still lots TODO to complete port and build system 
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 *row_node,*col_node;
42 /* win32 refactor */
43 index_t *id = (NN>0) ? TMPMEMALLOC(NN,index_t) : (index_t*)NULL;
44 for (i=0;i<NN;i++) id[i]=i;
45 if (reduce_col_order) {
46 col_node=elements->ReferenceElement->Type->linearNodes;
47 NN_col=elements->LinearReferenceElement->Type->numNodes;
48 } else {
49 col_node=id;
50 NN_col=elements->ReferenceElement->Type->numNodes;
51 }
52 if (reduce_row_order) {
53 row_node=elements->ReferenceElement->Type->linearNodes;
54 NN_row=elements->LinearReferenceElement->Type->numNodes;
55 } else {
56 row_node=id;
57 NN_row=elements->ReferenceElement->Type->numNodes;
58 }
59 for (color=elements->minColor;color<=elements->maxColor;color++) {
60 #pragma omp for private(e,irow,kr,kc,icol) schedule(static)
61 for (e=0;e<elements->numElements;e++) {
62 if (elements->Color[e]==color) {
63 for (kr=0;kr<NN_row;kr++) {
64 irow=row_Label[elements->Nodes[INDEX2(row_node[kr],e,NN)]];
65 for (kc=0;kc<NN_col;kc++) {
66 icol=col_Label[elements->Nodes[INDEX2(col_node[kc],e,NN)]];
67 Finley_IndexList_insertIndex(&(index_list[irow]),icol);
68 }
69 }
70 }
71 }
72 }
73 /* win32 refactor */
74 TMPMEMFREE(id);
75 }
76 return;
77 }
78
79 /* inserts row index row into the Finley_IndexList in if it does not exist */
80
81 void Finley_IndexList_insertIndex(Finley_IndexList* in, index_t index) {
82 dim_t i;
83 /* is index in in? */
84 for (i=0;i<in->n;i++) {
85 if (in->index[i]==index) return;
86 }
87 /* index could not be found */
88 if (in->n==INDEXLIST_LENGTH) {
89 /* if in->index is full check the extension */
90 if (in->extension==NULL) {
91 in->extension=TMPMEMALLOC(1,Finley_IndexList);
92 if (Finley_checkPtr(in->extension)) return;
93 in->extension->n=0;
94 in->extension->extension=NULL;
95 }
96 Finley_IndexList_insertIndex(in->extension,index);
97 } else {
98 /* insert index into in->index*/
99 in->index[in->n]=index;
100 in->n++;
101 }
102 }
103
104 /* counts the number of row indices in the Finley_IndexList in */
105
106 dim_t Finley_IndexList_count(Finley_IndexList* in) {
107 if (in==NULL) {
108 return 0;
109 } else {
110 return (in->n)+Finley_IndexList_count(in->extension);
111 }
112 }
113
114 /* count the number of row indices in the Finley_IndexList in */
115
116 void Finley_IndexList_toArray(Finley_IndexList* in, index_t* array) {
117 dim_t i;
118 if (in!=NULL) {
119 for (i=0;i<in->n;i++) array[i]=in->index[i]+INDEX_OFFSET;
120 Finley_IndexList_toArray(in->extension,&(array[in->n]));
121 }
122 }
123
124 /* deallocates the Finley_IndexList in by recursive calls */
125
126 void Finley_IndexList_free(Finley_IndexList* in) {
127 if (in!=NULL) {
128 Finley_IndexList_free(in->extension);
129 TMPMEMFREE(in);
130 }
131 }
132
133 /*
134 * $Log$
135 * Revision 1.6 2005/09/15 03:44:22 jgs
136 * Merge of development branch dev-02 back to main trunk on 2005-09-15
137 *
138 * Revision 1.5.2.1 2005/09/07 06:26:18 gross
139 * the solver from finley are put into the standalone package paso now
140 *
141 * Revision 1.5 2005/07/08 04:07:51 jgs
142 * Merge of development branch back to main trunk on 2005-07-08
143 *
144 * Revision 1.4 2004/12/15 07:08:32 jgs
145 * *** empty log message ***
146 * Revision 1.1.1.1.2.3 2005/06/29 02:34:50 gross
147 * some changes towards 64 integers in finley
148 *
149 * Revision 1.1.1.1.2.2 2004/11/24 01:37:13 gross
150 * some changes dealing with the integer overflow in memory allocation. Finley solves 4M unknowns now
151 *
152 *
153 *
154 */

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26