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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 150 - (show annotations)
Thu Sep 15 03:44:45 2005 UTC (14 years, 5 months ago) by jgs
Original Path: trunk/esys2/finley/src/finleyC/Mesh_line3.c
File MIME type: text/plain
File size: 5824 byte(s)
Merge of development branch dev-02 back to main trunk on 2005-09-15

1 /*
2 ******************************************************************************
3 * *
4 * COPYRIGHT ACcESS 2003,2004,2005 - All Rights Reserved *
5 * *
6 * This software is the property of ACcESS. No part of this code *
7 * may be copied in any form or by any means without the expressed written *
8 * consent of ACcESS. Copying, use or modification of this software *
9 * by any unauthorised person is illegal unless that person has a software *
10 * license agreement with ACcESS. *
11 * *
12 ******************************************************************************
13 */
14
15 /**************************************************************/
16
17 /* Finley: generates rectangular meshes */
18
19 /* Generates numElements[0] mesh with second order elements (Line3) in the interval */
20 /* [0,Length[0]]. order is the desired accuracy of the integration scheme. */
21
22 /**************************************************************/
23
24 /* Author: gross@access.edu.au */
25 /* Version: $Id$ */
26
27 /**************************************************************/
28
29 #include "RectangularMesh.h"
30
31 /**************************************************************/
32
33 Finley_Mesh* Finley_RectangularMesh_Line3(dim_t* numElements,double* Length,bool_t* periodic,index_t order,bool_t useElementsOnFace) {
34 dim_t N0,NE0,i0,NDOF0,NFaceElements,NUMNODES;
35 index_t k,node0;
36 Finley_Mesh* out;
37 char name[50];
38 double time0=Finley_timer();
39 NE0=MAX(1,numElements[0]);
40 N0=2*NE0+1;
41 if (!periodic[0]) {
42 NDOF0=N0;
43 NFaceElements=2;
44 } else {
45 NDOF0=N0-1;
46 NFaceElements=0;
47 }
48
49 /* allocate mesh: */
50
51 sprintf(name,"Rectangular mesh with %d nodes",N0);
52 out=Finley_Mesh_alloc(name,1,order);
53 if (! Finley_noError()) return NULL;
54
55 out->Elements=Finley_ElementFile_alloc(Line3,out->order);
56 if (useElementsOnFace) {
57 out->FaceElements=Finley_ElementFile_alloc(Line3Face,out->order);
58 out->ContactElements=Finley_ElementFile_alloc(Line3Face_Contact,out->order);
59 } else {
60 out->FaceElements=Finley_ElementFile_alloc(Point1,out->order);
61 out->ContactElements=Finley_ElementFile_alloc(Point1_Contact,out->order);
62 }
63 out->Points=Finley_ElementFile_alloc(Point1,out->order);
64 if (! Finley_noError()) {
65 Finley_Mesh_dealloc(out);
66 return NULL;
67 }
68
69 /* allocate tables: */
70
71 Finley_NodeFile_allocTable(out->Nodes,N0);
72 Finley_ElementFile_allocTable(out->Elements,NE0);
73 Finley_ElementFile_allocTable(out->FaceElements,NFaceElements);
74 if (! Finley_noError()) {
75 Finley_Mesh_dealloc(out);
76 return NULL;
77 }
78
79 /* set nodes: */
80
81 #pragma omp parallel for private(i0,k)
82 for (i0=0;i0<N0;i0++) {
83 k=i0;
84 out->Nodes->Coordinates[INDEX2(0,k,1)]=DBLE(i0)/DBLE(N0-1)*Length[0];
85 out->Nodes->Id[k]=k;
86 out->Nodes->Tag[k]=0;
87 out->Nodes->degreeOfFreedom[k]=(i0%NDOF0);
88 }
89 if (!periodic[0]) {
90 out->Nodes->Tag[0]=1;
91 out->Nodes->Tag[N0-1]=2;
92 }
93
94 /* set the elements: */
95
96 #pragma omp parallel for private(i0,k,node0)
97 for (i0=0;i0<NE0;i0++) {
98 k=i0;
99 node0=2*i0;
100
101 out->Elements->Id[k]=k;
102 out->Elements->Tag[k]=0;
103 out->Elements->Color[k]=COLOR_MOD(i0);
104
105 out->Elements->Nodes[INDEX2(0,k,3)]=node0;
106 out->Elements->Nodes[INDEX2(1,k,3)]=node0+2;
107 out->Elements->Nodes[INDEX2(2,k,3)]=node0+1;
108 }
109 out->Elements->minColor=0;
110 out->Elements->maxColor=COLOR_MOD(0);
111
112 /* face elements: */
113 if (useElementsOnFace) {
114 NUMNODES=3;
115 } else {
116 NUMNODES=1;
117 }
118
119 if (!periodic[0]) {
120 out->FaceElements->Id[0]=NE0;
121 out->FaceElements->Tag[0]=1;
122 out->FaceElements->Color[0]=0;
123 if (useElementsOnFace) {
124 out->FaceElements->Nodes[INDEX2(0,0,NUMNODES)]=0;
125 out->FaceElements->Nodes[INDEX2(1,0,NUMNODES)]=2;
126 out->FaceElements->Nodes[INDEX2(2,0,NUMNODES)]=1;
127 } else {
128 out->FaceElements->Nodes[INDEX2(0,0,NUMNODES)]=0;
129 }
130
131 out->FaceElements->Id[1]=NE0+1;
132 out->FaceElements->Tag[1]=2;
133 out->FaceElements->Color[1]=1;
134 if (useElementsOnFace) {
135 out->FaceElements->Nodes[INDEX2(0,1,NUMNODES)]=N0-1;
136 out->FaceElements->Nodes[INDEX2(1,1,NUMNODES)]=N0-3;
137 out->FaceElements->Nodes[INDEX2(2,1,NUMNODES)]=N0-2;
138 } else {
139 out->FaceElements->Nodes[INDEX2(0,1,NUMNODES)]=N0-1;
140 }
141 }
142 out->FaceElements->minColor=0;
143 out->FaceElements->maxColor=1;
144
145 /* face elements done: */
146
147 /* condense the nodes: */
148
149 Finley_Mesh_resolveNodeIds(out);
150
151 /* prepare mesh for further calculations:*/
152
153 Finley_Mesh_prepare(out) ;
154
155 #ifdef Finley_TRACE
156 printf("timing: mesh generation: %.4e sec\n",Finley_timer()-time0);
157 #endif
158
159 if (! Finley_noError()) {
160 Finley_Mesh_dealloc(out);
161 return NULL;
162 }
163 return out;
164 }
165
166 /*
167 * Revision 1.3 2005/09/01 03:31:36 jgs
168 * Merge of development branch dev-02 back to main trunk on 2005-09-01
169 *
170 * Revision 1.2.2.2 2005/09/07 06:26:19 gross
171 * the solver from finley are put into the standalone package paso now
172 *
173 * Revision 1.2.2.1 2005/08/24 02:02:18 gross
174 * timing output switched off. solver output can be swiched through getSolution(verbose=True) now.
175 *
176 * Revision 1.2 2005/07/08 04:07:53 jgs
177 * Merge of development branch back to main trunk on 2005-07-08
178 *
179 * Revision 1.1.1.1.2.1 2005/06/29 02:34:52 gross
180 * some changes towards 64 integers in finley
181 *
182 * Revision 1.1.1.1 2004/10/26 06:53:57 jgs
183 * initial import of project esys2
184 *
185 * Revision 1.1.1.1 2004/06/24 04:00:40 johng
186 * Initial version of eys using boost-python.
187 *
188 *
189 */
190

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26