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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 471 - (show annotations)
Fri Jan 27 01:33:02 2006 UTC (13 years, 7 months ago) by jgs
File MIME type: text/plain
File size: 4211 byte(s)
reorganise finley src tree to remove inc dir and src/finley directory

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: ElementFile */
18 /* */
19 /* reorders the elements in the element file such that the elements are stored close to the nodes */
20 /* */
21 /**************************************************************/
22
23 /* Author: gross@access.edu.au */
24 /* Version: $Id$ */
25
26 /**************************************************************/
27
28 #include "Util.h"
29 #include "ElementFile.h"
30
31 /**************************************************************/
32
33 void Finley_ElementFile_optimizeDistribution(Finley_ElementFile** in) {
34 Finley_Util_ValueAndIndex* item_list=NULL;
35 Finley_ElementFile* out=NULL;
36 dim_t e,i;
37 index_t *index=NULL;
38
39 if (*in != NULL) {
40 if ((*in)->numElements<1) return;
41 dim_t NN=(*in)->ReferenceElement->Type->numNodes;
42 item_list=TMPMEMALLOC((*in)->numElements,Finley_Util_ValueAndIndex);
43 index=TMPMEMALLOC((*in)->numElements,index_t);
44 if (! (Finley_checkPtr(item_list) || Finley_checkPtr(index)) ) {
45 out=Finley_ElementFile_alloc((*in)->ReferenceElement->Type->TypeId,(*in)->order);
46 if (Finley_noError()) {
47 Finley_ElementFile_allocTable(out,(*in)->numElements);
48 if (Finley_noError()) {
49 #pragma omp parallel for private(e,i) schedule(static)
50 for (e=0;e<(*in)->numElements;e++) {
51 item_list[e].index=e;
52 item_list[e].value=(*in)->Nodes[INDEX2(0,e,NN)];
53 for (i=1;i<NN;i++) item_list[e].value=MIN(item_list[e].value,(*in)->Nodes[INDEX2(i,e,NN)]);
54 }
55 Finley_Util_sortValueAndIndex((*in)->numElements,item_list);
56 #pragma omp parallel for private(e) schedule(static)
57 for (e=0;e<(*in)->numElements;e++) index[e]=item_list[e].index;
58 Finley_ElementFile_gather(index,*in,out);
59 Finley_ElementFile_dealloc(*in);
60 *in=out;
61 } else {
62 Finley_ElementFile_dealloc(out);
63 }
64 }
65 }
66 TMPMEMFREE(item_list);
67 TMPMEMFREE(index);
68 }
69 }
70 /*
71 * $Log$
72 * Revision 1.6 2005/09/15 03:44:22 jgs
73 * Merge of development branch dev-02 back to main trunk on 2005-09-15
74 *
75 * Revision 1.5.2.1 2005/09/07 06:26:18 gross
76 * the solver from finley are put into the standalone package paso now
77 *
78 * Revision 1.5 2005/07/08 04:07:50 jgs
79 * Merge of development branch back to main trunk on 2005-07-08
80 *
81 * Revision 1.4 2004/12/15 07:08:32 jgs
82 * *** empty log message ***
83 * Revision 1.1.1.1.2.2 2005/06/29 02:34:50 gross
84 * some changes towards 64 integers in finley
85 *
86 * Revision 1.1.1.1.2.1 2004/11/24 01:37:13 gross
87 * some changes dealing with the integer overflow in memory allocation. Finley solves 4M unknowns now
88 *
89 *
90 *
91 */

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26