/[escript]/trunk-mpi-branch/finley/src/Assemble_getAssembleParameters.c
ViewVC logotype

Annotation of /trunk-mpi-branch/finley/src/Assemble_getAssembleParameters.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1223 - (hide annotations)
Fri Aug 3 02:40:39 2007 UTC (11 years, 9 months ago) by gross
File MIME type: text/plain
File size: 7680 byte(s)
first attemt towards an improved MPI version.  

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 ksteube 1140 dim_t i;
32 jgs 150 Finley_resetError();
33 jgs 82
34 ksteube 808 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 gross 1223 if (! numSamplesEqual(F,1,(Paso_Distribution_getMyNumComponents(S->row_distribution)*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 gross 1223 parm->col_DOF=nodes->degreesOfFreedomMapping->target;
71     parm->row_DOF=nodes->degreesOfFreedomMapping->target;
72 gross 798 /* get the information for the labeling of the degrees of freedom from matrix */
73 jgs 82 if (S!=NULL) {
74 ksteube 989 /* Make sure # rows in matrix == num DOF for one of: full or reduced (use numLocalDOF for MPI) */
75 gross 1223 if ( Paso_Distribution_getMyNumComponents(S->row_distribution)*S->row_block_size==parm->numEqu* Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution)) {
76     parm->row_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution);
77     parm->row_DOF=nodes->degreesOfFreedomMapping->target;
78    
79 jgs 82 parm->row_node=&(parm->id[0]);
80 gross 798 parm->row_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,FALSE,reducedIntegrationOrder);
81 bcumming 751 }
82 gross 1223 else if ( Paso_Distribution_getMyNumComponents(S->row_distribution)*S->row_block_size==parm->numEqu* Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution)) {
83     parm->row_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution);
84     parm->row_DOF=nodes->reducedDegreesOfFreedomMapping->target;
85 gross 798 parm->row_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,TRUE,reducedIntegrationOrder);
86     parm->row_node=parm->row_jac->ReferenceElement->Type->linearNodes;
87 jgs 82 } else {
88 gross 798 Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: number of rows in matrix does not match the number of degrees of freedom in mesh");
89 jgs 82 }
90 ksteube 989 /* Make sure # cols in matrix == num DOF for one of: full or reduced (use numLocalDOF for MPI) */
91 gross 1223 if ( Paso_Distribution_getMyNumComponents(S->col_distribution)*S->col_block_size==parm->numComp* Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution)) {
92     parm->col_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution);
93 gross 798 parm->col_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,FALSE,reducedIntegrationOrder);
94 gross 1223 parm->col_DOF=nodes->degreesOfFreedomMapping->target;
95 jgs 82 parm->col_node=&(parm->id[0]);
96 bcumming 751 }
97 gross 1223 else if ( Paso_Distribution_getMyNumComponents(S->col_distribution)*S->col_block_size==parm->numComp* Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution)) {
98     parm->col_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution);
99     parm->col_DOF=nodes->reducedDegreesOfFreedomMapping->target;
100 gross 798 parm->col_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,TRUE,reducedIntegrationOrder);
101     parm->col_node=parm->row_jac->ReferenceElement->Type->linearNodes;
102 jgs 82 } else {
103 gross 798 Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: number of columns in matrix does not match the number of degrees of freedom in mesh");
104 jgs 82 }
105     }
106 gross 798 if (! Finley_noError()) return;
107     /* get the information from right hand side */
108 jgs 82 if (!isEmpty(F)) {
109 gross 1223 if (numSamplesEqual(F,1, Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution))) {
110     parm->row_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution);
111     parm->row_DOF=nodes->degreesOfFreedomMapping->target;
112 gross 798 parm->row_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,FALSE,reducedIntegrationOrder);
113 jgs 82 parm->row_node=&(parm->id[0]);
114 bcumming 751 }
115 gross 1223 else if (numSamplesEqual(F,1, Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution))) {
116     parm->row_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution);
117     parm->row_DOF=nodes->reducedDegreesOfFreedomMapping->target;
118 gross 798 parm->row_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,TRUE,reducedIntegrationOrder);
119     parm->row_node=parm->row_jac->ReferenceElement->Type->linearNodes;
120 jgs 82 } else {
121 gross 798 Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: length of RHS vector does not match the number of degrees of freedom in mesh");
122 jgs 82 }
123     if (S==NULL) {
124 gross 798 parm->col_DOF_UpperBound=parm->row_DOF_UpperBound;
125     parm->col_DOF=parm->row_DOF;
126 jgs 82 parm->col_node=parm->row_node;
127 gross 798 parm->col_jac=parm->row_jac;
128 jgs 82 }
129     }
130 gross 798 if (! Finley_noError()) return;
131     if (parm->row_jac!=parm->col_jac) {
132     Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: assemblage cannot handle different shape functions for rows and columns (yet).");
133 jgs 82 }
134 gross 798 if (! Finley_noError()) return;
135     parm->NN=elements->ReferenceElement->Type->numNodes;
136     parm->numDim=parm->row_jac->numDim;
137     parm->numQuad=parm->row_jac->ReferenceElement->numQuadNodes;
138     parm->row_NN=parm->row_jac->ReferenceElement->Type->numNodes;
139     parm->row_NS=parm->row_jac->ReferenceElement->Type->numShapes;
140     parm->col_NN=parm->col_jac->ReferenceElement->Type->numNodes;
141     parm->col_NS=parm->col_jac->ReferenceElement->Type->numShapes;
142 jgs 82 }

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26