/[escript]/branches/domexper/dudley/src/Assemble_getAssembleParameters.c
ViewVC logotype

Annotation of /branches/domexper/dudley/src/Assemble_getAssembleParameters.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3204 - (hide annotations)
Thu Sep 23 23:59:39 2010 UTC (8 years, 11 months ago) by jfenwick
File MIME type: text/plain
File size: 7836 byte(s)
More params collapsed

1 jgs 82
2 ksteube 1312 /*******************************************************
3 ksteube 1811 *
4 jfenwick 2881 * Copyright (c) 2003-2010 by University of Queensland
5 ksteube 1811 * Earth Systems Science Computational Center (ESSCC)
6     * http://www.uq.edu.au/esscc
7     *
8     * Primary Business: Queensland, Australia
9     * Licensed under the Open Software License version 3.0
10     * http://www.opensource.org/licenses/osl-3.0.php
11     *
12     *******************************************************/
13 jgs 82
14 ksteube 1811
15 jgs 82 /**************************************************************/
16    
17 ksteube 1312 /* assemblage routines: prepares the assemble parameter set */
18 jgs 82
19     /**************************************************************/
20    
21     #include "Assemble.h"
22 jfenwick 3202 #include "ShapeTable.h"
23 jgs 82
24     /**************************************************************/
25    
26 jfenwick 3086 void Assemble_getAssembleParameters(Dudley_NodeFile* nodes,Dudley_ElementFile* elements,Paso_SystemMatrix* S,
27 gross 798 escriptDataC* F, bool_t reducedIntegrationOrder, Assemble_Parameters *parm) {
28 jfenwick 3086 Dudley_resetError();
29 jfenwick 3202 parm->reducedIntegrationOrder=reducedIntegrationOrder;
30     parm->shapeFns=NULL;
31 jgs 102 if (!isEmpty(F) && !isExpanded(F) ) {
32 jfenwick 3086 Dudley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: Right hand side is not expanded.");
33 jgs 82 return;
34     }
35 jfenwick 3202
36     if (!getQuadShape(elements->numDim, reducedIntegrationOrder, &(parm->shapeFns)))
37     {
38     Dudley_setError(TYPE_ERROR, "Assemble_getAssembleParameters: Can not locate shape functions.");
39     }
40 jgs 82 /* check the dimensions of S and F */
41     if (S!=NULL && !isEmpty(F)) {
42 ksteube 1312 if (! numSamplesEqual(F,1,(Paso_Distribution_getMyNumComponents(S->row_distribution)*S->row_block_size)/S->logical_row_block_size)) {
43 jfenwick 3086 Dudley_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 jfenwick 3086 Dudley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: matrix row block size and number of components of right hand side don't match.");
63 gross 798 return;
64     }
65     parm->numEqu=S->logical_row_block_size;
66     parm->numComp=S->logical_col_block_size;
67     }
68 jgs 82 }
69 ksteube 1312 parm->col_DOF=nodes->degreesOfFreedomMapping->target;
70     parm->row_DOF=nodes->degreesOfFreedomMapping->target;
71 gross 798 /* get the information for the labeling of the degrees of freedom from matrix */
72 jgs 82 if (S!=NULL) {
73 ksteube 1312 /* Make sure # rows in matrix == num DOF for one of: full or reduced (use numLocalDOF for MPI) */
74     if ( Paso_Distribution_getMyNumComponents(S->row_distribution)*S->row_block_size==parm->numEqu* Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution)) {
75     parm->row_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution);
76     parm->row_DOF=nodes->degreesOfFreedomMapping->target;
77 jfenwick 3086 parm->row_jac=Dudley_ElementFile_borrowJacobeans(elements,nodes,FALSE,reducedIntegrationOrder);
78 bcumming 751 }
79 ksteube 1312 else if ( Paso_Distribution_getMyNumComponents(S->row_distribution)*S->row_block_size==parm->numEqu* Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution)) {
80     parm->row_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution);
81     parm->row_DOF=nodes->reducedDegreesOfFreedomMapping->target;
82 jfenwick 3086 parm->row_jac=Dudley_ElementFile_borrowJacobeans(elements,nodes,TRUE,reducedIntegrationOrder);
83 jgs 82 } else {
84 jfenwick 3086 Dudley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: number of rows in matrix does not match the number of degrees of freedom in mesh");
85 jgs 82 }
86 ksteube 1312 /* Make sure # cols in matrix == num DOF for one of: full or reduced (use numLocalDOF for MPI) */
87     if ( Paso_Distribution_getMyNumComponents(S->col_distribution)*S->col_block_size==parm->numComp* Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution)) {
88     parm->col_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution);
89 gross 2748 parm->col_DOF=nodes->degreesOfFreedomMapping->target;
90 jfenwick 3203 parm->row_jac=Dudley_ElementFile_borrowJacobeans(elements,nodes,FALSE,reducedIntegrationOrder);
91 gross 2748 } else if ( Paso_Distribution_getMyNumComponents(S->col_distribution)*S->col_block_size==parm->numComp* Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution)) {
92 ksteube 1312 parm->col_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution);
93     parm->col_DOF=nodes->reducedDegreesOfFreedomMapping->target;
94 jfenwick 3203 parm->row_jac=Dudley_ElementFile_borrowJacobeans(elements,nodes,TRUE,reducedIntegrationOrder);
95 jgs 82 } else {
96 jfenwick 3086 Dudley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: number of columns in matrix does not match the number of degrees of freedom in mesh");
97 jgs 82 }
98     }
99 jfenwick 3086 if (! Dudley_noError()) return;
100 gross 798 /* get the information from right hand side */
101 jgs 82 if (!isEmpty(F)) {
102 ksteube 1312 if (numSamplesEqual(F,1, Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution))) {
103     parm->row_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution);
104     parm->row_DOF=nodes->degreesOfFreedomMapping->target;
105 jfenwick 3086 parm->row_jac=Dudley_ElementFile_borrowJacobeans(elements,nodes,FALSE,reducedIntegrationOrder);
106 bcumming 751 }
107 ksteube 1312 else if (numSamplesEqual(F,1, Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution))) {
108     parm->row_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution);
109     parm->row_DOF=nodes->reducedDegreesOfFreedomMapping->target;
110 jfenwick 3086 parm->row_jac=Dudley_ElementFile_borrowJacobeans(elements,nodes,TRUE,reducedIntegrationOrder);
111 jgs 82 } else {
112 jfenwick 3086 Dudley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: length of RHS vector does not match the number of degrees of freedom in mesh");
113 jgs 82 }
114     if (S==NULL) {
115 gross 798 parm->col_DOF_UpperBound=parm->row_DOF_UpperBound;
116     parm->col_DOF=parm->row_DOF;
117 jfenwick 3203 parm->row_jac=parm->row_jac;
118 jgs 82 }
119     }
120 gross 2748
121 jfenwick 3203 if ( parm->row_jac->numDim !=parm->row_jac->numDim) {
122 jfenwick 3086 Dudley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: spacial dimension for row and column shape function must match.");
123 jgs 82 }
124 gross 2748
125 jfenwick 3204 if (elements->numNodes < parm->row_jac->numShapes) {
126 jfenwick 3086 Dudley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: too many nodes are expected by row.");
127 gross 2748 }
128 jfenwick 3204 if (elements->numNodes < parm->row_jac->numShapes) {
129 jfenwick 3086 Dudley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: too many nodes are expected by col.");
130 gross 2748 }
131     if ( parm->row_jac->numElements !=elements->numElements) {
132 jfenwick 3086 Dudley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: number of elements for row is wrong.");
133 gross 2748 }
134 jfenwick 3203 if ( parm->row_jac->numElements !=elements->numElements) {
135 jfenwick 3086 Dudley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: number of elements for column is wrong.");
136 gross 2748 }
137 jfenwick 3203 if ( parm->row_jac->numQuadTotal !=parm->row_jac->numQuadTotal) {
138 jfenwick 3086 Dudley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: number of quadrature points for row and column shape functions must match.");
139 gross 2748 }
140    
141     parm->numQuadTotal=parm->row_jac->numQuadTotal;
142     parm->NN=elements->numNodes;
143     parm->numElements=elements->numElements;
144 gross 798 parm->numDim=parm->row_jac->numDim;
145 jfenwick 3204 parm->numShapes=parm->row_jac->numShapes;
146     // parm->numShapes=parm->row_jac->BasisFunctions->Type->numShapes;
147 gross 2748
148    
149 jgs 82 }

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26