/[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 102 - (hide annotations)
Wed Dec 15 07:08:39 2004 UTC (15 years, 2 months ago) by jgs
Original Path: trunk/esys2/finley/src/finleyC/Assemble_getAssembleParameters.c
File MIME type: text/plain
File size: 5357 byte(s)
*** empty log message ***

1 jgs 82 /* $Id$ */
2    
3     /**************************************************************/
4    
5     /* assemblage routines: prepares the assemble parameter set */
6    
7     /**************************************************************/
8    
9     /* Copyrights by ACcESS Australia, 2003,2004 */
10     /* author: gross@access.edu.au */
11     /* Version: $Id$ */
12    
13     /**************************************************************/
14    
15     #include "escript/Data/DataC.h"
16     #include "Finley.h"
17     #include "Assemble.h"
18     #include "NodeFile.h"
19     #include "ElementFile.h"
20    
21     /**************************************************************/
22    
23     void Assemble_getAssembleParameters(Finley_NodeFile* nodes,Finley_ElementFile* elements,Finley_SystemMatrix* S,
24     escriptDataC* F,Assemble_Parameters *parm) {
25     int i;
26     parm->NN=elements->ReferenceElement->Type->numNodes;
27     for (i=0;i<parm->NN;i++) parm->id[i]=i;
28     parm->NS=elements->ReferenceElement->Type->numShapes;
29     parm->referenceElement=elements->ReferenceElement;
30     parm->numQuad=parm->referenceElement->numQuadNodes;
31     parm->numDim=nodes->numDim;
32     parm->numElementDim=parm->referenceElement->Type->numDim;
33    
34 jgs 102 if (!isEmpty(F) && !isExpanded(F) ) {
35 jgs 82 Finley_ErrorCode=TYPE_ERROR;
36     sprintf(Finley_ErrorMsg,"Right hand side is not expanded.");
37     return;
38     }
39     /* check the dimensions of S and F */
40     if (S!=NULL && !isEmpty(F)) {
41 jgs 102 if ( getDataPointSize(F)!=S->logical_row_block_size) {
42 jgs 82 Finley_ErrorCode=TYPE_ERROR;
43 jgs 102 sprintf(Finley_ErrorMsg,"matrix row block size and number of components of right hand side don't match.");
44 jgs 82 return;
45     }
46 jgs 102 if (! numSamplesEqual(F,1,(S->num_rows*S->row_block_size)/S->logical_row_block_size)) {
47 jgs 82 Finley_ErrorCode=TYPE_ERROR;
48     sprintf(Finley_ErrorMsg,"number of rows of matrix and length of right hand side don't match.");
49     return;
50     }
51     }
52     /* get the number of equations and components */
53     if (S!=NULL) {
54 jgs 102 parm->numEqu=S->logical_row_block_size;
55     parm->numComp=S->logical_col_block_size;
56 jgs 82 } else {
57     parm->numEqu=1;
58     parm->numComp=1;
59     }
60     if (!isEmpty(F)) parm->numEqu=getDataPointSize(F);
61    
62     parm->label_col=nodes->degreeOfFreedom;
63     parm->label_row=nodes->degreeOfFreedom;
64     parm->referenceElement_row=elements->ReferenceElement;
65     parm->referenceElement_col=elements->ReferenceElement;
66     /* get the information for the labeling of the degrees of freedom */
67     if (S!=NULL) {
68     if (S->num_rows*S->row_block_size==parm->numEqu*nodes->numDegreesOfFreedom) {
69     parm->label_row=nodes->degreeOfFreedom;
70     parm->row_node=&(parm->id[0]);
71     parm->referenceElement_row=elements->ReferenceElement;
72     } else if (S->num_rows*S->row_block_size==parm->numEqu*nodes->reducedNumDegreesOfFreedom) {
73     parm->label_row=nodes->reducedDegreeOfFreedom;
74     parm->row_node=parm->referenceElement->Type->linearNodes;
75     parm->referenceElement_row=elements->LinearReferenceElement;
76     } else {
77     Finley_ErrorCode=TYPE_ERROR;
78     sprintf(Finley_ErrorMsg,"number of rows in matrix does not match the number of degrees of freedom in mesh");
79     return;
80     }
81     if (S->num_cols*S->col_block_size==parm->numComp*nodes->numDegreesOfFreedom) {
82     parm->label_col=nodes->degreeOfFreedom;
83     parm->col_node=&(parm->id[0]);
84     parm->referenceElement_col=elements->ReferenceElement;
85     } else if (S->num_cols*S->col_block_size==parm->numComp*nodes->reducedNumDegreesOfFreedom) {
86     parm->label_col=nodes->reducedDegreeOfFreedom;
87     parm->col_node=parm->referenceElement->Type->linearNodes;
88     parm->referenceElement_col=elements->LinearReferenceElement;
89     } else {
90     Finley_ErrorCode=TYPE_ERROR;
91     sprintf(Finley_ErrorMsg,"number of columns in matrix does not match the number of degrees of freedom in mesh");
92     return;
93     }
94     }
95     if (!isEmpty(F)) {
96     if (numSamplesEqual(F,1,nodes->numDegreesOfFreedom)) {
97     parm->row_node=&(parm->id[0]);
98     parm->label_row=nodes->degreeOfFreedom;
99     parm->referenceElement_row=elements->ReferenceElement;
100     } else if (numSamplesEqual(F,1,nodes->reducedNumDegreesOfFreedom)) {
101     parm->label_row=nodes->reducedDegreeOfFreedom;
102     parm->row_node=parm->referenceElement->Type->linearNodes;
103     parm->referenceElement_row=elements->LinearReferenceElement;
104     } else {
105     Finley_ErrorCode=TYPE_ERROR;
106     sprintf(Finley_ErrorMsg,"length of RHS vector does not match the number of degrees of freedom in mesh");
107     return;
108     }
109     if (S==NULL) {
110     parm->label_col=parm->label_row;
111     parm->col_node=parm->row_node;
112     parm->referenceElement_col=parm->referenceElement_row;
113     }
114     }
115     if (parm->referenceElement_row!=parm->referenceElement_col) {
116     Finley_ErrorCode=TYPE_ERROR;
117     sprintf(Finley_ErrorMsg,"assemblage cannot handel different shape functions for rows and columns (yet).");
118     return;
119     }
120     parm->NN_row=parm->referenceElement_row->Type->numNodes;
121     parm->NS_row=parm->referenceElement_row->Type->numShapes;
122     parm->NN_col=parm->referenceElement_col->Type->numNodes;
123     parm->NS_col=parm->referenceElement_col->Type->numShapes;
124     }
125    
126     /*
127     * $Log$
128 jgs 102 * Revision 1.4 2004/12/15 07:08:32 jgs
129 jgs 97 * *** empty log message ***
130 jgs 82 *
131 jgs 97 *
132 jgs 82 */
133    

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26