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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 201 - (show annotations)
Wed Nov 23 04:10:21 2005 UTC (14 years, 6 months ago) by jgs
File MIME type: text/plain
File size: 5159 byte(s)
copy finleyC and CPPAdapter to finley and finley/CPPAdapter to
facilitate scons builds

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: Mesh */
18 /* prepare nodes does */
19
20 /* - creates a dense labeling of degressOfFreedom */
21 /* - creates/overwrites in->Nodes->reducedDegressOfFreedom */
22 /* - creates/overwrites in->Nodes->reducedTo */
23
24 /**************************************************************/
25
26 /* Author: gross@access.edu.au */
27 /* Version: $Id$ */
28
29 /**************************************************************/
30
31 #include "Mesh.h"
32 #include "Util.h"
33
34 /**************************************************************/
35
36 void Finley_Mesh_prepareNodes(Finley_Mesh* in) {
37 dim_t n,len;
38 index_t id,max_id,min_id,*maskReducedDOF=NULL,*maskDOF=NULL,*reducedNodesMask=NULL,*index=NULL;
39
40 max_id=Finley_Util_getMaxInt(1,in->Nodes->numNodes,in->Nodes->degreeOfFreedom);
41 min_id=Finley_Util_getMinInt(1,in->Nodes->numNodes,in->Nodes->degreeOfFreedom);
42 len=max_id-min_id+1;
43
44 reducedNodesMask=TMPMEMALLOC(in->Nodes->numNodes,index_t);
45 maskDOF=TMPMEMALLOC(len,index_t);
46 maskReducedDOF=TMPMEMALLOC(len,index_t);
47 index=TMPMEMALLOC(MAX(in->Nodes->numNodes,len),index_t);
48
49 if (! (Finley_checkPtr(maskDOF) || Finley_checkPtr(maskReducedDOF)
50 || Finley_checkPtr(reducedNodesMask) || Finley_checkPtr(index) ) ) {
51 /* initialize everything */
52 #pragma omp parallel
53 {
54 #pragma omp for private(n) schedule(static)
55 for (n=0;n<in->Nodes->numNodes;n++) {
56 in->Nodes->toReduced[n]=-1;
57 in->Nodes->reducedDegreeOfFreedom[n]=-1;
58 reducedNodesMask[n]=-1;
59 }
60 #pragma omp for private(n) schedule(static)
61 for (n=0;n<len;n++) {
62 maskDOF[n]=-1;
63 maskReducedDOF[n]=-1;
64 }
65 }
66 /* mark all nodes used by reduced elements */
67 Finley_Mesh_markNodes(reducedNodesMask,0,in,TRUE);
68
69 /* mark used degrees of freedom */
70 /* OMP */
71 for (n=0;n<in->Nodes->numNodes;n++) {
72 id=in->Nodes->degreeOfFreedom[n]-min_id;
73 maskDOF[id]=1;
74 if (reducedNodesMask[n]>=0) maskReducedDOF[id]=1;
75 }
76 /* get a list of all nodes used in the reduced mesh and convert into in->Nodes->toReduced: */
77 in->Nodes->reducedNumNodes=Finley_Util_packMask(in->Nodes->numNodes,reducedNodesMask,index);
78 #pragma omp parallel for private(n) schedule(static)
79 for (n=0;n<in->Nodes->reducedNumNodes;n++) in->Nodes->toReduced[index[n]]=n;
80 /* get a list of the DOFs in the reduced mesh and convert it into reducedDegreeOfFreedom */
81 in->Nodes->reducedNumDegreesOfFreedom=Finley_Util_packMask(len,maskReducedDOF,index);
82 #pragma omp parallel for private(n) schedule(static)
83 for (n=0;n<in->Nodes->reducedNumDegreesOfFreedom;n++) maskReducedDOF[index[n]]=n;
84 /* get a list of the DOFs and convert it into degreeOfFreedom */
85 in->Nodes->numDegreesOfFreedom=Finley_Util_packMask(len,maskDOF,index);
86 #pragma omp parallel
87 {
88 #pragma omp for private(n) schedule(static)
89 for (n=0;n<in->Nodes->numDegreesOfFreedom;n++) maskDOF[index[n]]=n;
90 #pragma omp for private(n,id) schedule(static)
91 for (n=0;n<in->Nodes->numNodes;n++) {
92 id=in->Nodes->degreeOfFreedom[n]-min_id;
93 in->Nodes->degreeOfFreedom[n]=maskDOF[id];
94 in->Nodes->reducedDegreeOfFreedom[n]=maskReducedDOF[id];
95 }
96 }
97 }
98 TMPMEMFREE(reducedNodesMask);
99 TMPMEMFREE(maskDOF);
100 TMPMEMFREE(maskReducedDOF);
101 TMPMEMFREE(index);
102 }
103
104 /*
105 * $Log$
106 * Revision 1.6 2005/09/15 03:44:22 jgs
107 * Merge of development branch dev-02 back to main trunk on 2005-09-15
108 *
109 * Revision 1.5.2.1 2005/09/07 06:26:19 gross
110 * the solver from finley are put into the standalone package paso now
111 *
112 * Revision 1.5 2005/07/08 04:07:53 jgs
113 * Merge of development branch back to main trunk on 2005-07-08
114 *
115 * Revision 1.4 2004/12/15 07:08:33 jgs
116 * *** empty log message ***
117 * Revision 1.1.1.1.2.3 2005/06/29 02:34:52 gross
118 * some changes towards 64 integers in finley
119 *
120 * Revision 1.1.1.1.2.2 2004/11/24 01:37:14 gross
121 * some changes dealing with the integer overflow in memory allocation. Finley solves 4M unknowns now
122 *
123 *
124 *
125 */
126

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26