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 |
/* assemblage routines: prepares the assemble parameter set */ |
16 |
|
17 |
/**************************************************************/ |
18 |
|
19 |
/* Copyrights by ACcESS Australia, 2003,2004,2005 */ |
20 |
/* author: gross@access.edu.au */ |
21 |
/* Version: $Id$ */ |
22 |
|
23 |
/**************************************************************/ |
24 |
|
25 |
#include "Assemble.h" |
26 |
|
27 |
/**************************************************************/ |
28 |
|
29 |
void Assemble_getAssembleParameters(Finley_NodeFile* nodes,Finley_ElementFile* elements,Paso_SystemMatrix* S, |
30 |
escriptDataC* F, bool_t reducedIntegrationOrder, Assemble_Parameters *parm) { |
31 |
Finley_resetError(); |
32 |
|
33 |
for (dim_t i=0;i<MAX_numNodes;i++) parm->id[i]=i; |
34 |
|
35 |
if (!isEmpty(F) && !isExpanded(F) ) { |
36 |
Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: Right hand side is not expanded."); |
37 |
return; |
38 |
} |
39 |
/* check the dimensions of S and F */ |
40 |
if (S!=NULL && !isEmpty(F)) { |
41 |
if (! numSamplesEqual(F,1,(S->num_rows*S->row_block_size)/S->logical_row_block_size)) { |
42 |
Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: number of rows of matrix and length of right hand side don't match."); |
43 |
return; |
44 |
} |
45 |
} |
46 |
/* get the number of equations and components */ |
47 |
if (S==NULL) { |
48 |
if (isEmpty(F)) { |
49 |
parm->numEqu=1; |
50 |
parm->numComp=1; |
51 |
} else { |
52 |
parm->numEqu=getDataPointSize(F); |
53 |
parm->numComp=parm->numEqu; |
54 |
} |
55 |
} else { |
56 |
if (isEmpty(F)) { |
57 |
parm->numEqu=S->logical_row_block_size; |
58 |
parm->numComp=S->logical_col_block_size; |
59 |
} else { |
60 |
if ( getDataPointSize(F)!=S->logical_row_block_size) { |
61 |
Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: matrix row block size and number of components of right hand side don't match."); |
62 |
return; |
63 |
} |
64 |
parm->numEqu=S->logical_row_block_size; |
65 |
parm->numComp=S->logical_col_block_size; |
66 |
} |
67 |
} |
68 |
|
69 |
parm->col_DOF=nodes->degreeOfFreedom; |
70 |
parm->row_DOF=nodes->degreeOfFreedom; |
71 |
/* get the information for the labeling of the degrees of freedom from matrix */ |
72 |
if (S!=NULL) { |
73 |
#ifndef PASO_MPI |
74 |
if (S->num_rows*S->row_block_size==parm->numEqu*nodes->numDegreesOfFreedom) { |
75 |
parm->row_DOF_UpperBound = nodes->numDegreesOfFreedom; |
76 |
#else |
77 |
if (S->num_rows*S->row_block_size==parm->numEqu*nodes->degreeOfFreedomDistribution->numLocal) { |
78 |
parm->row_DOF_UpperBound = nodes->degreeOfFreedomDistribution->numLocal; |
79 |
#endif |
80 |
parm->row_DOF=nodes->degreeOfFreedom; |
81 |
parm->row_node=&(parm->id[0]); |
82 |
parm->row_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,FALSE,reducedIntegrationOrder); |
83 |
} |
84 |
#ifndef PASO_MPI |
85 |
else if (S->num_rows*S->row_block_size==parm->numEqu*nodes->reducedNumDegreesOfFreedom) { |
86 |
parm->row_DOF_UpperBound = nodes->reducedNumDegreesOfFreedom; |
87 |
#else |
88 |
else if (S->num_rows*S->row_block_size==parm->numEqu*nodes->reducedDegreeOfFreedomDistribution->numLocal) { |
89 |
parm->row_DOF_UpperBound = nodes->reducedDegreeOfFreedomDistribution->numLocal; |
90 |
#endif |
91 |
parm->row_DOF=nodes->reducedDegreeOfFreedom; |
92 |
parm->row_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,TRUE,reducedIntegrationOrder); |
93 |
parm->row_node=parm->row_jac->ReferenceElement->Type->linearNodes; |
94 |
} else { |
95 |
Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: number of rows in matrix does not match the number of degrees of freedom in mesh"); |
96 |
} |
97 |
#ifndef PASO_MPI |
98 |
if (S->num_cols*S->col_block_size==parm->numComp*nodes->numDegreesOfFreedom) { |
99 |
parm->col_DOF_UpperBound = nodes->numDegreesOfFreedom; |
100 |
#else |
101 |
if (S->num_cols*S->col_block_size==parm->numComp*nodes->degreeOfFreedomDistribution->numLocal) { |
102 |
parm->col_DOF_UpperBound = nodes->degreeOfFreedomDistribution->numLocal; |
103 |
#endif |
104 |
parm->col_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,FALSE,reducedIntegrationOrder); |
105 |
parm->col_DOF=nodes->degreeOfFreedom; |
106 |
parm->col_node=&(parm->id[0]); |
107 |
} |
108 |
#ifndef PASO_MPI |
109 |
else if (S->num_cols*S->col_block_size==parm->numComp*nodes->reducedNumDegreesOfFreedom) { |
110 |
parm->col_DOF_UpperBound = nodes->reducedNumDegreesOfFreedom; |
111 |
#else |
112 |
else if (S->num_cols*S->col_block_size==parm->numComp*nodes->reducedDegreeOfFreedomDistribution->numLocal) { |
113 |
parm->col_DOF_UpperBound = nodes->reducedDegreeOfFreedomDistribution->numLocal; |
114 |
#endif |
115 |
parm->col_DOF=nodes->reducedDegreeOfFreedom; |
116 |
parm->col_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,TRUE,reducedIntegrationOrder); |
117 |
parm->col_node=parm->row_jac->ReferenceElement->Type->linearNodes; |
118 |
} else { |
119 |
Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: number of columns in matrix does not match the number of degrees of freedom in mesh"); |
120 |
} |
121 |
} |
122 |
if (! Finley_noError()) return; |
123 |
/* get the information from right hand side */ |
124 |
if (!isEmpty(F)) { |
125 |
#ifndef PASO_MPI |
126 |
if (numSamplesEqual(F,1,nodes->numDegreesOfFreedom)) { |
127 |
parm->row_DOF_UpperBound=nodes->numDegreesOfFreedom; |
128 |
#else |
129 |
if (numSamplesEqual(F,1,nodes->degreeOfFreedomDistribution->numLocal)) { |
130 |
parm->row_DOF_UpperBound = nodes->degreeOfFreedomDistribution->numLocal; |
131 |
#endif |
132 |
parm->row_DOF=nodes->degreeOfFreedom; |
133 |
parm->row_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,FALSE,reducedIntegrationOrder); |
134 |
parm->row_node=&(parm->id[0]); |
135 |
} |
136 |
#ifndef PASO_MPI |
137 |
else if (numSamplesEqual(F,1,nodes->reducedNumDegreesOfFreedom)) { |
138 |
parm->row_DOF_UpperBound=nodes->reducedNumDegreesOfFreedom; |
139 |
#else |
140 |
else if (numSamplesEqual(F,1,nodes->reducedDegreeOfFreedomDistribution->numLocal)) { |
141 |
parm->row_DOF_UpperBound = nodes->reducedDegreeOfFreedomDistribution->numLocal; |
142 |
#endif |
143 |
parm->row_DOF=nodes->reducedDegreeOfFreedom; |
144 |
parm->row_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,TRUE,reducedIntegrationOrder); |
145 |
parm->row_node=parm->row_jac->ReferenceElement->Type->linearNodes; |
146 |
} else { |
147 |
Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: length of RHS vector does not match the number of degrees of freedom in mesh"); |
148 |
} |
149 |
if (S==NULL) { |
150 |
parm->col_DOF_UpperBound=parm->row_DOF_UpperBound; |
151 |
parm->col_DOF=parm->row_DOF; |
152 |
parm->col_node=parm->row_node; |
153 |
parm->col_jac=parm->row_jac; |
154 |
} |
155 |
} |
156 |
if (! Finley_noError()) return; |
157 |
if (parm->row_jac!=parm->col_jac) { |
158 |
Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: assemblage cannot handle different shape functions for rows and columns (yet)."); |
159 |
} |
160 |
if (! Finley_noError()) return; |
161 |
parm->NN=elements->ReferenceElement->Type->numNodes; |
162 |
parm->numDim=parm->row_jac->numDim; |
163 |
parm->numQuad=parm->row_jac->ReferenceElement->numQuadNodes; |
164 |
parm->row_NN=parm->row_jac->ReferenceElement->Type->numNodes; |
165 |
parm->row_NS=parm->row_jac->ReferenceElement->Type->numShapes; |
166 |
parm->col_NN=parm->col_jac->ReferenceElement->Type->numNodes; |
167 |
parm->col_NS=parm->col_jac->ReferenceElement->Type->numShapes; |
168 |
} |
169 |
|
170 |
/* |
171 |
* $Log$ |
172 |
* Revision 1.6 2005/09/15 03:44:21 jgs |
173 |
* Merge of development branch dev-02 back to main trunk on 2005-09-15 |
174 |
* |
175 |
* Revision 1.5.2.1 2005/09/07 06:26:17 gross |
176 |
* the solver from finley are put into the standalone package paso now |
177 |
* |
178 |
* Revision 1.5 2005/07/08 04:07:47 jgs |
179 |
* Merge of development branch back to main trunk on 2005-07-08 |
180 |
* |
181 |
* Revision 1.4 2004/12/15 07:08:32 jgs |
182 |
* *** empty log message *** |
183 |
* Revision 1.1.1.1.2.4 2005/07/01 07:02:13 gross |
184 |
* some bug with OPENMP fixed |
185 |
* |
186 |
* Revision 1.1.1.1.2.3 2005/06/29 02:34:48 gross |
187 |
* some changes towards 64 integers in finley |
188 |
* |
189 |
* Revision 1.1.1.1.2.2 2004/11/12 06:58:18 gross |
190 |
* a lot of changes to get the linearPDE class running: most important change is that there is no matrix format exposed to the user anymore. the format is chosen by the Domain according to the solver and symmetry |
191 |
* |
192 |
* Revision 1.1.1.1.2.1 2004/10/28 22:59:24 gross |
193 |
* finley's RecTest.py is running now: problem in SystemMatrixAdapater fixed |
194 |
* |
195 |
* Revision 1.1.1.1 2004/10/26 06:53:57 jgs |
196 |
* initial import of project esys2 |
197 |
* |
198 |
* Revision 1.2 2004/07/21 05:00:54 gross |
199 |
* name changes in DataC |
200 |
* |
201 |
* Revision 1.1 2004/07/02 04:21:13 gross |
202 |
* Finley C code has been included |
203 |
* |
204 |
* |
205 |
*/ |
206 |
|