/[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 82 - (hide annotations)
Tue Oct 26 06:53:54 2004 UTC (15 years ago) by jgs
Original Path: trunk/esys2/finley/src/finleyC/Mesh_prepareNodes.c
File MIME type: text/plain
File size: 4016 byte(s)
Initial revision

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     #include "Mesh.h"
19     #include "Util.h"
20    
21     /**************************************************************/
22    
23     void Finley_Mesh_prepareNodes(Finley_Mesh* in) {
24     int n,id,max_id,min_id,len;
25     maybelong *maskReducedDOF=NULL,*maskDOF=NULL,*reducedNodesMask=NULL,*index=NULL;
26    
27     max_id=Finley_Util_getMaxInt(1,in->Nodes->numNodes,in->Nodes->degreeOfFreedom);
28     min_id=Finley_Util_getMinInt(1,in->Nodes->numNodes,in->Nodes->degreeOfFreedom);
29     len=max_id-min_id+1;
30    
31     reducedNodesMask=(maybelong*)TMPMEMALLOC(sizeof(maybelong)*in->Nodes->numNodes);
32     maskDOF=(maybelong*)TMPMEMALLOC(sizeof(maybelong)*len);
33     maskReducedDOF=(maybelong*)TMPMEMALLOC(sizeof(maybelong)*len);
34     index=(maybelong*)TMPMEMALLOC(sizeof(maybelong)*MAX(in->Nodes->numNodes,len));
35    
36     if (! (Finley_checkPtr(maskDOF) || Finley_checkPtr(maskReducedDOF)
37     || Finley_checkPtr(reducedNodesMask) || Finley_checkPtr(index) ) ) {
38     /* initialize everything */
39     #pragma omp parallel
40     {
41     #pragma omp for private(n) schedule(static)
42     for (n=0;n<in->Nodes->numNodes;n++) {
43     in->Nodes->toReduced[n]=-1;
44     in->Nodes->reducedDegreeOfFreedom[n]=-1;
45     reducedNodesMask[n]=-1;
46     }
47     #pragma omp for private(n) schedule(static)
48     for (n=0;n<len;n++) {
49     maskDOF[n]=-1;
50     maskReducedDOF[n]=-1;
51     }
52     }
53     /* mark all nodes used by reduced elements */
54     Finley_Mesh_markNodes(reducedNodesMask,0,in,TRUE);
55    
56     /* mark used degrees of freedom */
57     /* OMP */
58     for (n=0;n<in->Nodes->numNodes;n++) {
59     id=in->Nodes->degreeOfFreedom[n]-min_id;
60     maskDOF[id]=1;
61     if (reducedNodesMask[n]>=0) maskReducedDOF[id]=1;
62     }
63     /* get a list of all nodes used in the reduced mesh and convert into in->Nodes->toReduced: */
64     in->Nodes->reducedNumNodes=Finley_Util_packMask(in->Nodes->numNodes,reducedNodesMask,index);
65     #pragma omp parallel for private(n) schedule(static)
66     for (n=0;n<in->Nodes->reducedNumNodes;n++) in->Nodes->toReduced[index[n]]=n;
67     /* get a list of the DOFs in the reduced mesh and convert it into reducedDegreeOfFreedom */
68     in->Nodes->reducedNumDegreesOfFreedom=Finley_Util_packMask(len,maskReducedDOF,index);
69     #pragma omp parallel for private(n) schedule(static)
70     for (n=0;n<in->Nodes->reducedNumDegreesOfFreedom;n++) maskReducedDOF[index[n]]=n;
71     /* get a list of the DOFs and convert it into degreeOfFreedom */
72     in->Nodes->numDegreesOfFreedom=Finley_Util_packMask(len,maskDOF,index);
73     #pragma omp parallel
74     {
75     #pragma omp for private(n) schedule(static)
76     for (n=0;n<in->Nodes->numDegreesOfFreedom;n++) maskDOF[index[n]]=n;
77     #pragma omp for private(n,id) schedule(static)
78     for (n=0;n<in->Nodes->numNodes;n++) {
79     id=in->Nodes->degreeOfFreedom[n]-min_id;
80     in->Nodes->degreeOfFreedom[n]=maskDOF[id];
81     in->Nodes->reducedDegreeOfFreedom[n]=maskReducedDOF[id];
82     }
83     }
84     }
85     TMPMEMFREE(reducedNodesMask);
86     TMPMEMFREE(maskDOF);
87     TMPMEMFREE(maskReducedDOF);
88     TMPMEMFREE(index);
89     }
90    
91     /*
92     * $Log$
93     * Revision 1.1 2004/10/26 06:53:57 jgs
94     * Initial revision
95     *
96     * Revision 1.2 2004/07/30 04:37:06 gross
97     * escript and finley are linking now and RecMeshTest.py has been passed
98     *
99     * Revision 1.1.1.1 2004/06/24 04:00:40 johng
100     * Initial version of eys using boost-python.
101     *
102     *
103     */
104    

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26