/[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 123 - (hide annotations)
Fri Jul 8 04:08:13 2005 UTC (14 years, 7 months ago) by jgs
Original Path: trunk/esys2/finley/src/finleyC/Assemble_getAssembleParameters.c
File MIME type: text/plain
File size: 6290 byte(s)
Merge of development branch back to main trunk on 2005-07-08

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 jgs 123 dim_t i;
26 jgs 82 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 123
47 jgs 102 if (! numSamplesEqual(F,1,(S->num_rows*S->row_block_size)/S->logical_row_block_size)) {
48 jgs 82 Finley_ErrorCode=TYPE_ERROR;
49     sprintf(Finley_ErrorMsg,"number of rows of matrix and length of right hand side don't match.");
50     return;
51     }
52     }
53     /* get the number of equations and components */
54     if (S!=NULL) {
55 jgs 102 parm->numEqu=S->logical_row_block_size;
56     parm->numComp=S->logical_col_block_size;
57 jgs 82 } else {
58     parm->numEqu=1;
59     parm->numComp=1;
60     }
61     if (!isEmpty(F)) parm->numEqu=getDataPointSize(F);
62    
63     parm->label_col=nodes->degreeOfFreedom;
64     parm->label_row=nodes->degreeOfFreedom;
65     parm->referenceElement_row=elements->ReferenceElement;
66     parm->referenceElement_col=elements->ReferenceElement;
67     /* get the information for the labeling of the degrees of freedom */
68     if (S!=NULL) {
69     if (S->num_rows*S->row_block_size==parm->numEqu*nodes->numDegreesOfFreedom) {
70     parm->label_row=nodes->degreeOfFreedom;
71     parm->row_node=&(parm->id[0]);
72     parm->referenceElement_row=elements->ReferenceElement;
73     } else if (S->num_rows*S->row_block_size==parm->numEqu*nodes->reducedNumDegreesOfFreedom) {
74     parm->label_row=nodes->reducedDegreeOfFreedom;
75     parm->row_node=parm->referenceElement->Type->linearNodes;
76     parm->referenceElement_row=elements->LinearReferenceElement;
77     } else {
78     Finley_ErrorCode=TYPE_ERROR;
79     sprintf(Finley_ErrorMsg,"number of rows in matrix does not match the number of degrees of freedom in mesh");
80     return;
81     }
82     if (S->num_cols*S->col_block_size==parm->numComp*nodes->numDegreesOfFreedom) {
83     parm->label_col=nodes->degreeOfFreedom;
84     parm->col_node=&(parm->id[0]);
85     parm->referenceElement_col=elements->ReferenceElement;
86     } else if (S->num_cols*S->col_block_size==parm->numComp*nodes->reducedNumDegreesOfFreedom) {
87     parm->label_col=nodes->reducedDegreeOfFreedom;
88     parm->col_node=parm->referenceElement->Type->linearNodes;
89     parm->referenceElement_col=elements->LinearReferenceElement;
90     } else {
91     Finley_ErrorCode=TYPE_ERROR;
92     sprintf(Finley_ErrorMsg,"number of columns in matrix does not match the number of degrees of freedom in mesh");
93     return;
94     }
95     }
96     if (!isEmpty(F)) {
97     if (numSamplesEqual(F,1,nodes->numDegreesOfFreedom)) {
98     parm->row_node=&(parm->id[0]);
99     parm->label_row=nodes->degreeOfFreedom;
100     parm->referenceElement_row=elements->ReferenceElement;
101     } else if (numSamplesEqual(F,1,nodes->reducedNumDegreesOfFreedom)) {
102     parm->label_row=nodes->reducedDegreeOfFreedom;
103     parm->row_node=parm->referenceElement->Type->linearNodes;
104     parm->referenceElement_row=elements->LinearReferenceElement;
105     } else {
106     Finley_ErrorCode=TYPE_ERROR;
107     sprintf(Finley_ErrorMsg,"length of RHS vector does not match the number of degrees of freedom in mesh");
108     return;
109     }
110     if (S==NULL) {
111     parm->label_col=parm->label_row;
112     parm->col_node=parm->row_node;
113     parm->referenceElement_col=parm->referenceElement_row;
114     }
115     }
116     if (parm->referenceElement_row!=parm->referenceElement_col) {
117     Finley_ErrorCode=TYPE_ERROR;
118     sprintf(Finley_ErrorMsg,"assemblage cannot handel different shape functions for rows and columns (yet).");
119     return;
120     }
121     parm->NN_row=parm->referenceElement_row->Type->numNodes;
122     parm->NS_row=parm->referenceElement_row->Type->numShapes;
123     parm->NN_col=parm->referenceElement_col->Type->numNodes;
124     parm->NS_col=parm->referenceElement_col->Type->numShapes;
125     }
126    
127     /*
128     * $Log$
129 jgs 123 * Revision 1.5 2005/07/08 04:07:47 jgs
130     * Merge of development branch back to main trunk on 2005-07-08
131     *
132 jgs 102 * Revision 1.4 2004/12/15 07:08:32 jgs
133 jgs 97 * *** empty log message ***
134 jgs 123 * Revision 1.1.1.1.2.4 2005/07/01 07:02:13 gross
135     * some bug with OPENMP fixed
136 jgs 82 *
137 jgs 123 * Revision 1.1.1.1.2.3 2005/06/29 02:34:48 gross
138     * some changes towards 64 integers in finley
139 jgs 97 *
140 jgs 123 * Revision 1.1.1.1.2.2 2004/11/12 06:58:18 gross
141     * a lot of changes to get the linearPDE class running: most important change is that there is no matrix format exposed to the user anymore. the format is chosen by the Domain according to the solver and symmetry
142     *
143     * Revision 1.1.1.1.2.1 2004/10/28 22:59:24 gross
144     * finley's RecTest.py is running now: problem in SystemMatrixAdapater fixed
145     *
146     * Revision 1.1.1.1 2004/10/26 06:53:57 jgs
147     * initial import of project esys2
148     *
149     * Revision 1.2 2004/07/21 05:00:54 gross
150     * name changes in DataC
151     *
152     * Revision 1.1 2004/07/02 04:21:13 gross
153     * Finley C code has been included
154     *
155     *
156 jgs 82 */
157    

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26