/[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 123 - (show annotations)
Fri Jul 8 04:08:13 2005 UTC (14 years, 4 months ago) by jgs
Original Path: trunk/esys2/finley/src/finleyC/Mesh_prepareNodes.c
File MIME type: text/plain
File size: 4104 byte(s)
Merge of development branch back to main trunk on 2005-07-08

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26