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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 782 - (show annotations)
Tue Jul 18 00:47:47 2006 UTC (13 years ago) by bcumming
File MIME type: text/plain
File size: 6878 byte(s)
Large number of changes to Finley for meshing in MPI.

- optimisation and neatening up of rectcanglular mesh generation code
- first and second order 1D, 2D and 3D rectangular meshes are now
  available in finley and escript using MPI.
- reduced meshes now generated in MPI, and interpolation to and from 
  reduced data types now supported.  

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: ElementFile */
16
17 /* mark the used nodes with offeset: */
18
19 /**************************************************************/
20
21 /* Copyrights by ACcESS Australia 2003,2004,2005 */
22 /* Author: gross@access.edu.au */
23 /* Version: $Id$ */
24
25 /**************************************************************/
26
27 #include "ElementFile.h"
28
29 /**************************************************************/
30
31 void Finley_ElementFile_markNodes(index_t* mask,index_t offset,Finley_ElementFile* in,bool_t useLinear) {
32 dim_t i,NN,NN2,e;
33 index_t color,*lin_node;
34 if (in!=NULL) {
35 index_t id[in->ReferenceElement->Type->numNodes];
36 for (i=0;i<in->ReferenceElement->Type->numNodes;i++) id[i]=i;
37 if (useLinear) {
38 NN=in->LinearReferenceElement->Type->numNodes;
39 lin_node=in->ReferenceElement->Type->linearNodes;
40 } else {
41 NN=in->ReferenceElement->Type->numNodes;
42 lin_node=id;
43 }
44 NN2=in->ReferenceElement->Type->numNodes;
45 /* knock out the OpenMP directives for the MPI version, get the OpenMP running
46 after the MPI is working satisfactorily */
47 #ifndef PASO_MPI
48 if ((in->maxColor-in->minColor+1)*NN<in->numElements) {
49 #pragma omp parallel private(color)
50 {
51 for (color=in->minColor;color<=in->maxColor;color++) {
52 #pragma omp for private(e,i) schedule(static)
53 for (e=0;e<in->numElements;e++) {
54 if (in->Color[e]==color) {
55 for (i=0;i<NN;i++)
56 mask[in->Nodes[INDEX2(lin_node[i],e,NN2)]-offset]=1;
57 }
58 }
59 }
60 #pragma omp barrier
61 }
62 } else {
63 #pragma omp parallel for private(e,i) schedule(static)
64 #endif
65 for (e=0;e<in->numElements;e++) {
66 for (i=0;i<NN;i++)
67 mask[in->Nodes[INDEX2(lin_node[i],e,NN2)]-offset]=1;
68 }
69 #ifndef PASO_MPI
70 }
71 #endif
72 }
73 }
74
75 #ifdef PASO_MPI
76
77 /* these have been trimmed down from the colors-based scheme for simplicity of testing
78 in the MPI scheme. */
79 void Finley_ElementFile_markBoundaryElementNodes(index_t* mask,index_t offset,Finley_ElementFile* in,bool_t useLinear) {
80 dim_t i,NN,NN2,e;
81 index_t color,*lin_node;
82 if (in!=NULL&& in->numElements>0) {
83 index_t id[in->ReferenceElement->Type->numNodes];
84 for (i=0;i<in->ReferenceElement->Type->numNodes;i++) id[i]=i;
85 if (useLinear) {
86 NN=in->LinearReferenceElement->Type->numNodes;
87 lin_node=in->ReferenceElement->Type->linearNodes;
88 } else {
89 NN=in->ReferenceElement->Type->numNodes;
90 lin_node=id;
91 }
92 NN2=in->ReferenceElement->Type->numNodes;
93 for (e=0;e<in->elementDistribution->numLocal;e++)
94 if( in->Id[e]>=in->elementDistribution->numInternal )
95 for (i=0;i<NN;i++)
96 mask[in->Nodes[INDEX2(lin_node[i],e,NN2)]-offset]=1;
97 }
98 }
99
100 void Finley_ElementFile_markInternalElementNodes(index_t* mask,index_t offset,Finley_ElementFile* in,bool_t useLinear) {
101 dim_t i,NN,NN2,e;
102 index_t color,*lin_node;
103 if (in!=NULL && in->numElements>0) {
104 index_t id[in->ReferenceElement->Type->numNodes];
105 for (i=0;i<in->ReferenceElement->Type->numNodes;i++) id[i]=i;
106 if (useLinear) {
107 NN=in->LinearReferenceElement->Type->numNodes;
108 lin_node=in->ReferenceElement->Type->linearNodes;
109 } else {
110 NN=in->ReferenceElement->Type->numNodes;
111 lin_node=id;
112 }
113 NN2=in->ReferenceElement->Type->numNodes;
114
115 for (e=0;e<in->elementDistribution->numLocal;e++)
116 if( in->Id[e]<in->elementDistribution->numInternal )
117 for (i=0;i<NN;i++)
118 mask[in->Nodes[INDEX2(lin_node[i],e,NN2)]-offset]=1;
119 }
120 }
121
122 void Finley_ElementFile_markBoundaryElementDOF(index_t* mask,index_t offset,index_t *degreeOfFreedom, Finley_ElementFile* in,bool_t useLinear, index_t startElement) {
123 dim_t i,NN,NN2,e;
124 index_t color,*lin_node;
125 if (in!=NULL&& in->numElements>0) {
126
127 index_t id[in->ReferenceElement->Type->numNodes];
128 for (i=0;i<in->ReferenceElement->Type->numNodes;i++) id[i]=i;
129 if (useLinear) {
130 NN=in->LinearReferenceElement->Type->numNodes;
131 lin_node=in->ReferenceElement->Type->linearNodes;
132 } else {
133 NN=in->ReferenceElement->Type->numNodes;
134 lin_node=id;
135 }
136 NN2=in->ReferenceElement->Type->numNodes;
137 for (e=0;e<in->elementDistribution->numLocal;e++)
138 if( in->Id[e]-startElement>=in->elementDistribution->numInternal )
139 for (i=0;i<NN;i++)
140 mask[degreeOfFreedom[in->Nodes[INDEX2(lin_node[i],e,NN2)]]-offset]=1;
141 }
142
143 }
144
145 void Finley_ElementFile_markInternalElementDOF(index_t* mask,index_t offset,index_t *degreeOfFreedom, Finley_ElementFile* in,bool_t useLinear, index_t startElement) {
146 dim_t i,NN,NN2,e;
147 index_t color,*lin_node;
148 if (in!=NULL && in->numElements>0) {
149 index_t id[in->ReferenceElement->Type->numNodes];
150 for (i=0;i<in->ReferenceElement->Type->numNodes;i++) id[i]=i;
151 if (useLinear) {
152 NN=in->LinearReferenceElement->Type->numNodes;
153 lin_node=in->ReferenceElement->Type->linearNodes;
154 } else {
155 NN=in->ReferenceElement->Type->numNodes;
156 lin_node=id;
157 }
158 NN2=in->ReferenceElement->Type->numNodes;
159
160 for (e=0;e<in->elementDistribution->numLocal;e++)
161 if( in->Id[e]-startElement<in->elementDistribution->numInternal )
162 for (i=0;i<NN;i++)
163 mask[degreeOfFreedom[in->Nodes[INDEX2(lin_node[i],e,NN2)]]-offset]=1;
164 }
165 }
166 #endif
167
168 /*
169 * $Log$
170 * Revision 1.4 2005/09/15 03:44:22 jgs
171 * Merge of development branch dev-02 back to main trunk on 2005-09-15
172 *
173 * Revision 1.3.2.1 2005/09/07 06:26:18 gross
174 * the solver from finley are put into the standalone package paso now
175 *
176 * Revision 1.3 2005/07/22 03:53:08 jgs
177 * Merge of development branch back to main trunk on 2005-07-22
178 *
179 * Revision 1.2 2005/07/08 04:07:50 jgs
180 * Merge of development branch back to main trunk on 2005-07-08
181 *
182 * Revision 1.1.1.1.2.2 2005/07/18 10:34:54 gross
183 * some informance improvements when reading meshes
184 *
185 * Revision 1.1.1.1.2.1 2005/06/29 02:34:49 gross
186 * some changes towards 64 integers in finley
187 *
188 * Revision 1.1.1.1 2004/10/26 06:53:57 jgs
189 * initial import of project esys2
190 *
191 * Revision 1.1.1.1 2004/06/24 04:00:40 johng
192 * Initial version of eys using boost-python.
193 *
194 *
195 */

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26