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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 616 - (show annotations)
Wed Mar 22 02:46:56 2006 UTC (13 years, 8 months ago) by elspeth
File MIME type: text/plain
File size: 4837 byte(s)
Copyright added to more source files.

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26