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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/finley/src/finley/Assemble_getAssembleParameters.c revision 201 by jgs, Wed Nov 23 04:10:21 2005 UTC trunk/finley/src/Assemble_getAssembleParameters.c revision 808 by ksteube, Fri Aug 11 01:25:16 2006 UTC
# Line 1  Line 1 
1  /*  /*
2   ******************************************************************************   ************************************************************
3   *                                                                            *   *          Copyright 2006 by ACcESS MNRF                   *
4   *       COPYRIGHT  ACcESS 2003,2004,2005 -  All Rights Reserved              *   *                                                          *
5   *                                                                            *   *              http://www.access.edu.au                    *
6   * This software is the property of ACcESS. No part of this code              *   *       Primary Business: Queensland, Australia            *
7   * may be copied in any form or by any means without the expressed written    *   *  Licensed under the Open Software License version 3.0    *
8   * consent of ACcESS.  Copying, use or modification of this software          *   *     http://www.opensource.org/licenses/osl-3.0.php       *
9   * by any unauthorised person is illegal unless that person has a software    *   *                                                          *
10   * license agreement with ACcESS.                                             *   ************************************************************
  *                                                                            *  
  ******************************************************************************  
11  */  */
12    
13  /**************************************************************/  /**************************************************************/
# Line 29  Line 27 
27  /**************************************************************/  /**************************************************************/
28    
29  void Assemble_getAssembleParameters(Finley_NodeFile* nodes,Finley_ElementFile* elements,Paso_SystemMatrix* S,  void Assemble_getAssembleParameters(Finley_NodeFile* nodes,Finley_ElementFile* elements,Paso_SystemMatrix* S,
30                                          escriptDataC* F,Assemble_Parameters *parm) {                                          escriptDataC* F, bool_t reducedIntegrationOrder, Assemble_Parameters *parm) {
31    Finley_resetError();    Finley_resetError();
32    
33    dim_t i;    dim_t i;
34    parm->NN=elements->ReferenceElement->Type->numNodes;    for (i=0;i<MAX_numNodes;i++) parm->id[i]=i;
   for (i=0;i<parm->NN;i++) parm->id[i]=i;  
   parm->NS=elements->ReferenceElement->Type->numShapes;  
   parm->referenceElement=elements->ReferenceElement;  
   parm->numQuad=parm->referenceElement->numQuadNodes;  
   parm->numDim=nodes->numDim;  
   parm->numElementDim=parm->referenceElement->Type->numDim;  
35    
36    if (!isEmpty(F) && !isExpanded(F) ) {    if (!isEmpty(F) && !isExpanded(F) ) {
37        Finley_setError(TYPE_ERROR,"__FILE__: Right hand side is not expanded.");        Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: Right hand side is not expanded.");
38        return;        return;
39    }    }
40    /*  check the dimensions of S and F */    /*  check the dimensions of S and F */
41    if (S!=NULL && !isEmpty(F)) {    if (S!=NULL && !isEmpty(F)) {
     if ( getDataPointSize(F)!=S->logical_row_block_size) {  
       Finley_setError(TYPE_ERROR,"__FILE__: matrix row block size and number of components of right hand side don't match.");  
       return;  
     }  
   
42      if (! numSamplesEqual(F,1,(S->num_rows*S->row_block_size)/S->logical_row_block_size)) {      if (! numSamplesEqual(F,1,(S->num_rows*S->row_block_size)/S->logical_row_block_size)) {
43        Finley_setError(TYPE_ERROR,"__FILE__: number of rows of matrix and length of right hand side don't match.");        Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: number of rows of matrix and length of right hand side don't match.");
44        return;        return;
45      }      }
46    }    }
47    /* get the number of equations and components */    /* get the number of equations and components */
48    if (S!=NULL) {    if (S==NULL) {
49      parm->numEqu=S->logical_row_block_size;       if (isEmpty(F)) {
50      parm->numComp=S->logical_col_block_size;          parm->numEqu=1;
51            parm->numComp=1;
52         } else {
53            parm->numEqu=getDataPointSize(F);
54            parm->numComp=parm->numEqu;
55         }
56    } else {    } else {
57      parm->numEqu=1;       if (isEmpty(F)) {
58      parm->numComp=1;          parm->numEqu=S->logical_row_block_size;
59    }          parm->numComp=S->logical_col_block_size;
60    if (!isEmpty(F)) parm->numEqu=getDataPointSize(F);       } else {
61              if ( getDataPointSize(F)!=S->logical_row_block_size) {
62    parm->label_col=nodes->degreeOfFreedom;            Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: matrix row block size and number of components of right hand side don't match.");
63    parm->label_row=nodes->degreeOfFreedom;            return;
64    parm->referenceElement_row=elements->ReferenceElement;          }
65    parm->referenceElement_col=elements->ReferenceElement;          parm->numEqu=S->logical_row_block_size;
66    /* get the information for the labeling of the degrees of freedom */          parm->numComp=S->logical_col_block_size;
67         }
68      }
69    
70      parm->col_DOF=nodes->degreeOfFreedom;
71      parm->row_DOF=nodes->degreeOfFreedom;
72      /* get the information for the labeling of the degrees of freedom from matrix */
73    if (S!=NULL) {    if (S!=NULL) {
74    #ifndef PASO_MPI
75        if (S->num_rows*S->row_block_size==parm->numEqu*nodes->numDegreesOfFreedom) {        if (S->num_rows*S->row_block_size==parm->numEqu*nodes->numDegreesOfFreedom) {
76             parm->label_row=nodes->degreeOfFreedom;             parm->row_DOF_UpperBound = nodes->numDegreesOfFreedom;
77    #else
78          if (S->num_rows*S->row_block_size==parm->numEqu*nodes->degreeOfFreedomDistribution->numLocal) {
79               parm->row_DOF_UpperBound = nodes->degreeOfFreedomDistribution->numLocal;
80    #endif
81               parm->row_DOF=nodes->degreeOfFreedom;
82             parm->row_node=&(parm->id[0]);             parm->row_node=&(parm->id[0]);
83             parm->referenceElement_row=elements->ReferenceElement;             parm->row_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,FALSE,reducedIntegrationOrder);
84        } else if (S->num_rows*S->row_block_size==parm->numEqu*nodes->reducedNumDegreesOfFreedom) {        }
85             parm->label_row=nodes->reducedDegreeOfFreedom;  #ifndef PASO_MPI
86             parm->row_node=parm->referenceElement->Type->linearNodes;        else if (S->num_rows*S->row_block_size==parm->numEqu*nodes->reducedNumDegreesOfFreedom) {
87             parm->referenceElement_row=elements->LinearReferenceElement;             parm->row_DOF_UpperBound = nodes->reducedNumDegreesOfFreedom;
88    #else
89          else if (S->num_rows*S->row_block_size==parm->numEqu*nodes->reducedDegreeOfFreedomDistribution->numLocal) {
90               parm->row_DOF_UpperBound = nodes->reducedDegreeOfFreedomDistribution->numLocal;
91    #endif
92               parm->row_DOF=nodes->reducedDegreeOfFreedom;
93               parm->row_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,TRUE,reducedIntegrationOrder);
94               parm->row_node=parm->row_jac->ReferenceElement->Type->linearNodes;
95        } else {        } else {
96             Finley_setError(TYPE_ERROR,"__FILE__: number of rows in matrix does not match the number of degrees of freedom in mesh");             Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: number of rows in matrix does not match the number of degrees of freedom in mesh");
            return;  
97        }        }
98    #ifndef PASO_MPI      
99        if (S->num_cols*S->col_block_size==parm->numComp*nodes->numDegreesOfFreedom) {        if (S->num_cols*S->col_block_size==parm->numComp*nodes->numDegreesOfFreedom) {
100             parm->label_col=nodes->degreeOfFreedom;             parm->col_DOF_UpperBound = nodes->numDegreesOfFreedom;
101    #else
102          if (S->num_cols*S->col_block_size==parm->numComp*nodes->degreeOfFreedomDistribution->numLocal) {
103               parm->col_DOF_UpperBound = nodes->degreeOfFreedomDistribution->numLocal;
104    #endif
105               parm->col_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,FALSE,reducedIntegrationOrder);
106               parm->col_DOF=nodes->degreeOfFreedom;
107             parm->col_node=&(parm->id[0]);             parm->col_node=&(parm->id[0]);
108             parm->referenceElement_col=elements->ReferenceElement;        }
109        } else if (S->num_cols*S->col_block_size==parm->numComp*nodes->reducedNumDegreesOfFreedom) {  #ifndef PASO_MPI
110             parm->label_col=nodes->reducedDegreeOfFreedom;        else if (S->num_cols*S->col_block_size==parm->numComp*nodes->reducedNumDegreesOfFreedom) {
111             parm->col_node=parm->referenceElement->Type->linearNodes;             parm->col_DOF_UpperBound = nodes->reducedNumDegreesOfFreedom;
112             parm->referenceElement_col=elements->LinearReferenceElement;  #else
113          else if (S->num_cols*S->col_block_size==parm->numComp*nodes->reducedDegreeOfFreedomDistribution->numLocal) {
114               parm->col_DOF_UpperBound = nodes->reducedDegreeOfFreedomDistribution->numLocal;
115    #endif
116               parm->col_DOF=nodes->reducedDegreeOfFreedom;
117               parm->col_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,TRUE,reducedIntegrationOrder);
118               parm->col_node=parm->row_jac->ReferenceElement->Type->linearNodes;
119        } else {        } else {
120             Finley_setError(TYPE_ERROR,"__FILE__: number of columns in matrix does not match the number of degrees of freedom in mesh");             Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: number of columns in matrix does not match the number of degrees of freedom in mesh");
            return;  
121        }        }
122    }    }
123      if (! Finley_noError()) return;
124      /* get the information from right hand side */
125    if (!isEmpty(F)) {    if (!isEmpty(F)) {
126    #ifndef PASO_MPI
127        if (numSamplesEqual(F,1,nodes->numDegreesOfFreedom)) {        if (numSamplesEqual(F,1,nodes->numDegreesOfFreedom)) {
128               parm->row_DOF_UpperBound=nodes->numDegreesOfFreedom;
129    #else
130          if (numSamplesEqual(F,1,nodes->degreeOfFreedomDistribution->numLocal)) {
131               parm->row_DOF_UpperBound = nodes->degreeOfFreedomDistribution->numLocal;
132    #endif
133               parm->row_DOF=nodes->degreeOfFreedom;
134               parm->row_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,FALSE,reducedIntegrationOrder);
135             parm->row_node=&(parm->id[0]);             parm->row_node=&(parm->id[0]);
136             parm->label_row=nodes->degreeOfFreedom;        }
137             parm->referenceElement_row=elements->ReferenceElement;  #ifndef PASO_MPI
138        } else if (numSamplesEqual(F,1,nodes->reducedNumDegreesOfFreedom)) {        else if (numSamplesEqual(F,1,nodes->reducedNumDegreesOfFreedom)) {
139             parm->label_row=nodes->reducedDegreeOfFreedom;             parm->row_DOF_UpperBound=nodes->reducedNumDegreesOfFreedom;
140             parm->row_node=parm->referenceElement->Type->linearNodes;  #else
141             parm->referenceElement_row=elements->LinearReferenceElement;        else if (numSamplesEqual(F,1,nodes->reducedDegreeOfFreedomDistribution->numLocal)) {
142               parm->row_DOF_UpperBound = nodes->reducedDegreeOfFreedomDistribution->numLocal;
143    #endif
144               parm->row_DOF=nodes->reducedDegreeOfFreedom;
145               parm->row_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,TRUE,reducedIntegrationOrder);
146               parm->row_node=parm->row_jac->ReferenceElement->Type->linearNodes;
147        } else {        } else {
148             Finley_setError(TYPE_ERROR,"__FILE__: length of RHS vector does not match the number of degrees of freedom in mesh");             Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: length of RHS vector does not match the number of degrees of freedom in mesh");
            return;  
149        }        }
150        if (S==NULL) {        if (S==NULL) {
151             parm->label_col=parm->label_row;             parm->col_DOF_UpperBound=parm->row_DOF_UpperBound;
152               parm->col_DOF=parm->row_DOF;
153             parm->col_node=parm->row_node;             parm->col_node=parm->row_node;
154             parm->referenceElement_col=parm->referenceElement_row;             parm->col_jac=parm->row_jac;
155        }        }
156    }    }
157    if (parm->referenceElement_row!=parm->referenceElement_col) {    if (! Finley_noError()) return;
158        Finley_setError(TYPE_ERROR,"__FILE__: assemblage cannot handel different shape functions for rows and columns (yet).");    if (parm->row_jac!=parm->col_jac) {
159        return;        Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: assemblage cannot handle different shape functions for rows and columns (yet).");
160    }    }
161    parm->NN_row=parm->referenceElement_row->Type->numNodes;    if (! Finley_noError()) return;
162    parm->NS_row=parm->referenceElement_row->Type->numShapes;    parm->NN=elements->ReferenceElement->Type->numNodes;
163    parm->NN_col=parm->referenceElement_col->Type->numNodes;    parm->numDim=parm->row_jac->numDim;
164    parm->NS_col=parm->referenceElement_col->Type->numShapes;    parm->numQuad=parm->row_jac->ReferenceElement->numQuadNodes;
165      parm->row_NN=parm->row_jac->ReferenceElement->Type->numNodes;
166      parm->row_NS=parm->row_jac->ReferenceElement->Type->numShapes;
167      parm->col_NN=parm->col_jac->ReferenceElement->Type->numNodes;
168      parm->col_NS=parm->col_jac->ReferenceElement->Type->numShapes;
169  }  }
170    
171  /*  /*

Legend:
Removed from v.201  
changed lines
  Added in v.808

  ViewVC Help
Powered by ViewVC 1.1.26