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