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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3144 - (show annotations)
Fri Sep 3 00:49:02 2010 UTC (9 years, 2 months ago) by jfenwick
File MIME type: text/plain
File size: 7700 byte(s)
row_node, col_node (Assemble params), node_selection 
removed
1
2 /*******************************************************
3 *
4 * Copyright (c) 2003-2010 by University of Queensland
5 * 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
14
15 /**************************************************************/
16
17 /* assemblage routines: prepares the assemble parameter set */
18
19 /**************************************************************/
20
21 #include "Assemble.h"
22
23 /**************************************************************/
24
25 void Assemble_getAssembleParameters(Dudley_NodeFile* nodes,Dudley_ElementFile* elements,Paso_SystemMatrix* S,
26 escriptDataC* F, bool_t reducedIntegrationOrder, Assemble_Parameters *parm) {
27 Dudley_resetError();
28
29 if (!isEmpty(F) && !isExpanded(F) ) {
30 Dudley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: Right hand side is not expanded.");
31 return;
32 }
33 /* check the dimensions of S and F */
34 if (S!=NULL && !isEmpty(F)) {
35 if (! numSamplesEqual(F,1,(Paso_Distribution_getMyNumComponents(S->row_distribution)*S->row_block_size)/S->logical_row_block_size)) {
36 Dudley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: number of rows of matrix and length of right hand side don't match.");
37 return;
38 }
39 }
40 /* get the number of equations and components */
41 if (S==NULL) {
42 if (isEmpty(F)) {
43 parm->numEqu=1;
44 parm->numComp=1;
45 } else {
46 parm->numEqu=getDataPointSize(F);
47 parm->numComp=parm->numEqu;
48 }
49 } else {
50 if (isEmpty(F)) {
51 parm->numEqu=S->logical_row_block_size;
52 parm->numComp=S->logical_col_block_size;
53 } else {
54 if ( getDataPointSize(F)!=S->logical_row_block_size) {
55 Dudley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: matrix row block size and number of components of right hand side don't match.");
56 return;
57 }
58 parm->numEqu=S->logical_row_block_size;
59 parm->numComp=S->logical_col_block_size;
60 }
61 }
62 parm->col_DOF=nodes->degreesOfFreedomMapping->target;
63 parm->row_DOF=nodes->degreesOfFreedomMapping->target;
64 /* get the information for the labeling of the degrees of freedom from matrix */
65 if (S!=NULL) {
66 /* Make sure # rows in matrix == num DOF for one of: full or reduced (use numLocalDOF for MPI) */
67 if ( Paso_Distribution_getMyNumComponents(S->row_distribution)*S->row_block_size==parm->numEqu* Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution)) {
68 parm->row_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution);
69 parm->row_DOF=nodes->degreesOfFreedomMapping->target;
70 parm->row_jac=Dudley_ElementFile_borrowJacobeans(elements,nodes,FALSE,reducedIntegrationOrder);
71 }
72 else if ( Paso_Distribution_getMyNumComponents(S->row_distribution)*S->row_block_size==parm->numEqu* Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution)) {
73 parm->row_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution);
74 parm->row_DOF=nodes->reducedDegreesOfFreedomMapping->target;
75 parm->row_jac=Dudley_ElementFile_borrowJacobeans(elements,nodes,TRUE,reducedIntegrationOrder);
76 } else {
77 Dudley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: number of rows in matrix does not match the number of degrees of freedom in mesh");
78 }
79 /* Make sure # cols in matrix == num DOF for one of: full or reduced (use numLocalDOF for MPI) */
80 if ( Paso_Distribution_getMyNumComponents(S->col_distribution)*S->col_block_size==parm->numComp* Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution)) {
81 parm->col_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution);
82 parm->col_DOF=nodes->degreesOfFreedomMapping->target;
83 parm->col_jac=Dudley_ElementFile_borrowJacobeans(elements,nodes,FALSE,reducedIntegrationOrder);
84 } else if ( Paso_Distribution_getMyNumComponents(S->col_distribution)*S->col_block_size==parm->numComp* Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution)) {
85 parm->col_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution);
86 parm->col_DOF=nodes->reducedDegreesOfFreedomMapping->target;
87 parm->col_jac=Dudley_ElementFile_borrowJacobeans(elements,nodes,TRUE,reducedIntegrationOrder);
88 } else {
89 Dudley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: number of columns in matrix does not match the number of degrees of freedom in mesh");
90 }
91 }
92 if (! Dudley_noError()) return;
93 /* get the information from right hand side */
94 if (!isEmpty(F)) {
95 if (numSamplesEqual(F,1, Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution))) {
96 parm->row_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution);
97 parm->row_DOF=nodes->degreesOfFreedomMapping->target;
98 parm->row_jac=Dudley_ElementFile_borrowJacobeans(elements,nodes,FALSE,reducedIntegrationOrder);
99 }
100 else if (numSamplesEqual(F,1, Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution))) {
101 parm->row_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution);
102 parm->row_DOF=nodes->reducedDegreesOfFreedomMapping->target;
103 parm->row_jac=Dudley_ElementFile_borrowJacobeans(elements,nodes,TRUE,reducedIntegrationOrder);
104 } else {
105 Dudley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: length of RHS vector does not match the number of degrees of freedom in mesh");
106 }
107 if (S==NULL) {
108 parm->col_DOF_UpperBound=parm->row_DOF_UpperBound;
109 parm->col_DOF=parm->row_DOF;
110 parm->col_jac=parm->row_jac;
111 }
112 }
113
114 if ( parm->row_jac->numDim !=parm->col_jac->numDim) {
115 Dudley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: spacial dimension for row and column shape function must match.");
116 }
117
118 if (elements->numNodes < parm->row_jac->numShapesTotal) {
119 Dudley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: too many nodes are expected by row.");
120 }
121 if (elements->numNodes < parm->row_jac->numShapesTotal) {
122 Dudley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: too many nodes are expected by col.");
123 }
124 if ( parm->row_jac->numElements !=elements->numElements) {
125 Dudley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: number of elements for row is wrong.");
126 }
127 if ( parm->col_jac->numElements !=elements->numElements) {
128 Dudley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: number of elements for column is wrong.");
129 }
130 if ( parm->row_jac->numQuadTotal !=parm->col_jac->numQuadTotal) {
131 Dudley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: number of quadrature points for row and column shape functions must match.");
132 }
133
134 parm->numQuadTotal=parm->row_jac->numQuadTotal;
135 parm->NN=elements->numNodes;
136 parm->numElements=elements->numElements;
137 parm->numDim=parm->row_jac->numDim;
138 parm->row_numShapesTotal=parm->row_jac->numShapesTotal;
139 parm->row_numShapes=parm->row_jac->BasisFunctions->Type->numShapes;
140 parm->col_numShapesTotal=parm->col_jac->numShapesTotal;
141 parm->col_numShapes=parm->col_jac->BasisFunctions->Type->numShapes;
142
143
144 }

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26