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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 102 - (hide annotations)
Wed Dec 15 07:08:39 2004 UTC (14 years, 11 months ago) by jgs
Original Path: trunk/esys2/finley/src/finleyC/Mesh_prepareNodes.c
File MIME type: text/plain
File size: 3756 byte(s)
*** empty log message ***

1 jgs 82 /**************************************************************/
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 jgs 102 #include "Finley.h"
19 jgs 82 #include "Mesh.h"
20     #include "Util.h"
21    
22     /**************************************************************/
23    
24     void Finley_Mesh_prepareNodes(Finley_Mesh* in) {
25     int n,id,max_id,min_id,len;
26     maybelong *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 jgs 102 reducedNodesMask=TMPMEMALLOC(in->Nodes->numNodes,maybelong);
33     maskDOF=TMPMEMALLOC(len,maybelong);
34     maskReducedDOF=TMPMEMALLOC(len,maybelong);
35     index=TMPMEMALLOC(MAX(in->Nodes->numNodes,len),maybelong);
36 jgs 82
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 jgs 102 * Revision 1.4 2004/12/15 07:08:33 jgs
95 jgs 97 * *** empty log message ***
96 jgs 82 *
97 jgs 97 *
98 jgs 82 *
99     */
100    

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26