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

Annotation of /trunk/finley/src/Assemble_getAssembleParameters.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1388 - (hide annotations)
Fri Jan 11 07:45:58 2008 UTC (11 years, 9 months ago) by trankine
File MIME type: text/plain
File size: 7375 byte(s)
And get the *(&(*&(* name right
1 jgs 82
2 ksteube 1312 /* $Id$ */
3 jgs 82
4 ksteube 1312 /*******************************************************
5     *
6     * Copyright 2003-2007 by ACceSS MNRF
7     * Copyright 2007 by University of Queensland
8     *
9     * http://esscc.uq.edu.au
10     * Primary Business: Queensland, Australia
11     * Licensed under the Open Software License version 3.0
12     * http://www.opensource.org/licenses/osl-3.0.php
13     *
14     *******************************************************/
15 jgs 82
16     /**************************************************************/
17    
18 ksteube 1312 /* assemblage routines: prepares the assemble parameter set */
19 jgs 82
20     /**************************************************************/
21    
22     #include "Assemble.h"
23    
24     /**************************************************************/
25    
26 jgs 150 void Assemble_getAssembleParameters(Finley_NodeFile* nodes,Finley_ElementFile* elements,Paso_SystemMatrix* S,
27 gross 798 escriptDataC* F, bool_t reducedIntegrationOrder, Assemble_Parameters *parm) {
28 gross 1028 dim_t i;
29 jgs 150 Finley_resetError();
30 jgs 82
31 ksteube 808 for (i=0;i<MAX_numNodes;i++) parm->id[i]=i;
32 gross 798
33 jgs 102 if (!isEmpty(F) && !isExpanded(F) ) {
34 gross 798 Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: Right hand side is not expanded.");
35 jgs 82 return;
36     }
37     /* check the dimensions of S and F */
38     if (S!=NULL && !isEmpty(F)) {
39 ksteube 1312 if (! numSamplesEqual(F,1,(Paso_Distribution_getMyNumComponents(S->row_distribution)*S->row_block_size)/S->logical_row_block_size)) {
40 gross 798 Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: number of rows of matrix and length of right hand side don't match.");
41 jgs 82 return;
42     }
43     }
44     /* get the number of equations and components */
45 gross 798 if (S==NULL) {
46     if (isEmpty(F)) {
47     parm->numEqu=1;
48     parm->numComp=1;
49     } else {
50     parm->numEqu=getDataPointSize(F);
51     parm->numComp=parm->numEqu;
52     }
53 jgs 82 } else {
54 gross 798 if (isEmpty(F)) {
55     parm->numEqu=S->logical_row_block_size;
56     parm->numComp=S->logical_col_block_size;
57     } else {
58     if ( getDataPointSize(F)!=S->logical_row_block_size) {
59     Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: matrix row block size and number of components of right hand side don't match.");
60     return;
61     }
62     parm->numEqu=S->logical_row_block_size;
63     parm->numComp=S->logical_col_block_size;
64     }
65 jgs 82 }
66 gross 798
67 ksteube 1312 parm->col_DOF=nodes->degreesOfFreedomMapping->target;
68     parm->row_DOF=nodes->degreesOfFreedomMapping->target;
69 gross 798 /* get the information for the labeling of the degrees of freedom from matrix */
70 jgs 82 if (S!=NULL) {
71 ksteube 1312 /* Make sure # rows in matrix == num DOF for one of: full or reduced (use numLocalDOF for MPI) */
72     if ( Paso_Distribution_getMyNumComponents(S->row_distribution)*S->row_block_size==parm->numEqu* Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution)) {
73     parm->row_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution);
74     parm->row_DOF=nodes->degreesOfFreedomMapping->target;
75    
76 jgs 82 parm->row_node=&(parm->id[0]);
77 gross 798 parm->row_jac=Finley_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 gross 798 parm->row_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,TRUE,reducedIntegrationOrder);
83     parm->row_node=parm->row_jac->ReferenceElement->Type->linearNodes;
84 jgs 82 } else {
85 gross 798 Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: number of rows in matrix does not match the number of degrees of freedom in mesh");
86 jgs 82 }
87 ksteube 1312 /* Make sure # cols in matrix == num DOF for one of: full or reduced (use numLocalDOF for MPI) */
88     if ( Paso_Distribution_getMyNumComponents(S->col_distribution)*S->col_block_size==parm->numComp* Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution)) {
89     parm->col_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution);
90 gross 798 parm->col_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,FALSE,reducedIntegrationOrder);
91 ksteube 1312 parm->col_DOF=nodes->degreesOfFreedomMapping->target;
92 jgs 82 parm->col_node=&(parm->id[0]);
93 bcumming 751 }
94 ksteube 1312 else if ( Paso_Distribution_getMyNumComponents(S->col_distribution)*S->col_block_size==parm->numComp* Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution)) {
95     parm->col_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution);
96     parm->col_DOF=nodes->reducedDegreesOfFreedomMapping->target;
97 gross 798 parm->col_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,TRUE,reducedIntegrationOrder);
98     parm->col_node=parm->row_jac->ReferenceElement->Type->linearNodes;
99 jgs 82 } else {
100 gross 798 Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: number of columns in matrix does not match the number of degrees of freedom in mesh");
101 jgs 82 }
102     }
103 gross 798 if (! Finley_noError()) return;
104     /* get the information from right hand side */
105 jgs 82 if (!isEmpty(F)) {
106 ksteube 1312 if (numSamplesEqual(F,1, Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution))) {
107     parm->row_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution);
108     parm->row_DOF=nodes->degreesOfFreedomMapping->target;
109 gross 798 parm->row_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,FALSE,reducedIntegrationOrder);
110 jgs 82 parm->row_node=&(parm->id[0]);
111 bcumming 751 }
112 ksteube 1312 else if (numSamplesEqual(F,1, Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution))) {
113     parm->row_DOF_UpperBound = Paso_Distribution_getMyNumComponents(nodes->reducedDegreesOfFreedomDistribution);
114     parm->row_DOF=nodes->reducedDegreesOfFreedomMapping->target;
115 gross 798 parm->row_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,TRUE,reducedIntegrationOrder);
116     parm->row_node=parm->row_jac->ReferenceElement->Type->linearNodes;
117 jgs 82 } else {
118 gross 798 Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: length of RHS vector does not match the number of degrees of freedom in mesh");
119 jgs 82 }
120     if (S==NULL) {
121 gross 798 parm->col_DOF_UpperBound=parm->row_DOF_UpperBound;
122     parm->col_DOF=parm->row_DOF;
123 jgs 82 parm->col_node=parm->row_node;
124 gross 798 parm->col_jac=parm->row_jac;
125 jgs 82 }
126     }
127 gross 798 if (! Finley_noError()) return;
128     if (parm->row_jac!=parm->col_jac) {
129     Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: assemblage cannot handle different shape functions for rows and columns (yet).");
130 jgs 82 }
131 gross 798 if (! Finley_noError()) return;
132     parm->NN=elements->ReferenceElement->Type->numNodes;
133     parm->numDim=parm->row_jac->numDim;
134     parm->numQuad=parm->row_jac->ReferenceElement->numQuadNodes;
135     parm->row_NN=parm->row_jac->ReferenceElement->Type->numNodes;
136     parm->row_NS=parm->row_jac->ReferenceElement->Type->numShapes;
137     parm->col_NN=parm->col_jac->ReferenceElement->Type->numNodes;
138     parm->col_NS=parm->col_jac->ReferenceElement->Type->numShapes;
139 jgs 82 }

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26