/[escript]/branches/domexper/finley/src/Assemble_getAssembleParameters.c
ViewVC logotype

Diff of /branches/domexper/finley/src/Assemble_getAssembleParameters.c

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

revision 3246 by jfenwick, Mon Oct 4 01:46:30 2010 UTC revision 3247 by caltinay, Wed Oct 6 05:53:06 2010 UTC
# Line 22  Line 22 
22    
23  /**************************************************************/  /**************************************************************/
24    
25  void Assemble_getAssembleParameters(Finley_NodeFile* nodes,Finley_ElementFile* elements,Paso_SystemMatrix* S,  void Finley_Assemble_getAssembleParameters(Finley_NodeFile* nodes,Finley_ElementFile* elements,Paso_SystemMatrix* S,
26                                          escriptDataC* F, bool_t reducedIntegrationOrder, Assemble_Parameters *parm) {                                          escriptDataC* F, bool_t reducedIntegrationOrder, Finley_Assemble_Parameters *parm) {
27    dim_t  numSub,  numQuadSub;    dim_t  numSub,  numQuadSub;
28    Finley_resetError();    Finley_resetError();
29        
30    if (!isEmpty(F) && !isExpanded(F) ) {    if (!isEmpty(F) && !isExpanded(F) ) {
31        Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: Right hand side is not expanded.");        Finley_setError(TYPE_ERROR,"Finley_Assemble_getAssembleParameters: Right hand side is not expanded.");
32        return;        return;
33    }    }
34    /*  check the dimensions of S and F */    /*  check the dimensions of S and F */
35    if (S!=NULL && !isEmpty(F)) {    if (S!=NULL && !isEmpty(F)) {
36      if (! numSamplesEqual(F,1,(Paso_Distribution_getMyNumComponents(S->row_distribution)*S->row_block_size)/S->logical_row_block_size)) {      if (! numSamplesEqual(F,1,(Paso_Distribution_getMyNumComponents(S->row_distribution)*S->row_block_size)/S->logical_row_block_size)) {
37        Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: number of rows of matrix and length of right hand side don't match.");        Finley_setError(TYPE_ERROR,"Finley_Assemble_getAssembleParameters: number of rows of matrix and length of right hand side don't match.");
38        return;        return;
39      }      }
40    }    }
# Line 53  void Assemble_getAssembleParameters(Finl Line 53  void Assemble_getAssembleParameters(Finl
53          parm->numComp=S->logical_col_block_size;          parm->numComp=S->logical_col_block_size;
54       } else {       } else {
55          if ( getDataPointSize(F)!=S->logical_row_block_size) {          if ( getDataPointSize(F)!=S->logical_row_block_size) {
56            Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: matrix row block size and number of components of right hand side don't match.");            Finley_setError(TYPE_ERROR,"Finley_Assemble_getAssembleParameters: matrix row block size and number of components of right hand side don't match.");
57            return;            return;
58          }          }
59          parm->numEqu=S->logical_row_block_size;          parm->numEqu=S->logical_row_block_size;
# Line 75  void Assemble_getAssembleParameters(Finl Line 75  void Assemble_getAssembleParameters(Finl
75             parm->row_DOF=nodes->reducedDegreesOfFreedomMapping->target;             parm->row_DOF=nodes->reducedDegreesOfFreedomMapping->target;
76         parm->row_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,TRUE,reducedIntegrationOrder);         parm->row_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,TRUE,reducedIntegrationOrder);
77        } else {        } else {
78             Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: number of rows in matrix does not match the number of degrees of freedom in mesh");             Finley_setError(TYPE_ERROR,"Finley_Assemble_getAssembleParameters: number of rows in matrix does not match the number of degrees of freedom in mesh");
79        }        }
80        /* Make sure # cols in matrix == num DOF for one of: full or reduced (use numLocalDOF for MPI) */        /* Make sure # cols in matrix == num DOF for one of: full or reduced (use numLocalDOF for MPI) */
81        if ( Paso_Distribution_getMyNumComponents(S->col_distribution)*S->col_block_size==parm->numComp* Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution)) {        if ( Paso_Distribution_getMyNumComponents(S->col_distribution)*S->col_block_size==parm->numComp* Paso_Distribution_getMyNumComponents(nodes->degreesOfFreedomDistribution)) {
# Line 87  void Assemble_getAssembleParameters(Finl Line 87  void Assemble_getAssembleParameters(Finl
87             parm->col_DOF=nodes->reducedDegreesOfFreedomMapping->target;             parm->col_DOF=nodes->reducedDegreesOfFreedomMapping->target;
88             parm->col_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,TRUE,reducedIntegrationOrder);             parm->col_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,TRUE,reducedIntegrationOrder);
89        } else {        } else {
90             Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: number of columns in matrix does not match the number of degrees of freedom in mesh");             Finley_setError(TYPE_ERROR,"Finley_Assemble_getAssembleParameters: number of columns in matrix does not match the number of degrees of freedom in mesh");
91        }        }
92    }    }
93    if (! Finley_noError()) return;    if (! Finley_noError()) return;
# Line 103  void Assemble_getAssembleParameters(Finl Line 103  void Assemble_getAssembleParameters(Finl
103             parm->row_DOF=nodes->reducedDegreesOfFreedomMapping->target;             parm->row_DOF=nodes->reducedDegreesOfFreedomMapping->target;
104         parm->row_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,TRUE,reducedIntegrationOrder);         parm->row_jac=Finley_ElementFile_borrowJacobeans(elements,nodes,TRUE,reducedIntegrationOrder);
105        } else {        } else {
106             Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: length of RHS vector does not match the number of degrees of freedom in mesh");             Finley_setError(TYPE_ERROR,"Finley_Assemble_getAssembleParameters: length of RHS vector does not match the number of degrees of freedom in mesh");
107        }        }
108        if (S==NULL) {        if (S==NULL) {
109             parm->col_DOF_UpperBound=parm->row_DOF_UpperBound;             parm->col_DOF_UpperBound=parm->row_DOF_UpperBound;
# Line 115  void Assemble_getAssembleParameters(Finl Line 115  void Assemble_getAssembleParameters(Finl
115    numSub=MIN(parm->row_jac->numSub, parm->col_jac->numSub);    numSub=MIN(parm->row_jac->numSub, parm->col_jac->numSub);
116    numQuadSub=parm->row_jac->numQuadTotal/numSub;    numQuadSub=parm->row_jac->numQuadTotal/numSub;
117    if ( parm->row_jac->numSides !=parm->col_jac->numSides) {    if ( parm->row_jac->numSides !=parm->col_jac->numSides) {
118        Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: number of sides for row and column shape functions must match.");        Finley_setError(TYPE_ERROR,"Finley_Assemble_getAssembleParameters: number of sides for row and column shape functions must match.");
119    }    }
120    if ( parm->row_jac->numDim !=parm->col_jac->numDim) {    if ( parm->row_jac->numDim !=parm->col_jac->numDim) {
121        Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: spacial dimension for row and column shape function must match.");        Finley_setError(TYPE_ERROR,"Finley_Assemble_getAssembleParameters: spacial dimension for row and column shape function must match.");
122    }    }
123        
124    if (elements->numNodes < parm->row_jac->numShapesTotal) {    if (elements->numNodes < parm->row_jac->numShapesTotal) {
125        Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: too many nodes are expected by row.");          Finley_setError(TYPE_ERROR,"Finley_Assemble_getAssembleParameters: too many nodes are expected by row.");  
126    }    }
127    if (elements->numNodes < parm->row_jac->numShapesTotal) {    if (elements->numNodes < parm->row_jac->numShapesTotal) {
128        Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: too many nodes are expected by col.");          Finley_setError(TYPE_ERROR,"Finley_Assemble_getAssembleParameters: too many nodes are expected by col.");  
129    }    }
130    if ( parm->row_jac->numElements !=elements->numElements) {    if ( parm->row_jac->numElements !=elements->numElements) {
131        Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: number of elements for row is wrong.");        Finley_setError(TYPE_ERROR,"Finley_Assemble_getAssembleParameters: number of elements for row is wrong.");
132    }    }
133    if ( parm->col_jac->numElements !=elements->numElements) {    if ( parm->col_jac->numElements !=elements->numElements) {
134        Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: number of elements for column is wrong.");        Finley_setError(TYPE_ERROR,"Finley_Assemble_getAssembleParameters: number of elements for column is wrong.");
135    }    }
136    if ( parm->row_jac->numQuadTotal !=parm->col_jac->numQuadTotal) {    if ( parm->row_jac->numQuadTotal !=parm->col_jac->numQuadTotal) {
137        Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: number of quadrature points for row and column shape functions must match.");        Finley_setError(TYPE_ERROR,"Finley_Assemble_getAssembleParameters: number of quadrature points for row and column shape functions must match.");
138    }    }
139      /* to consider different basis function for rows and columns this will require some work :*/      /* to consider different basis function for rows and columns this will require some work :*/
140    if (numQuadSub * numSub != parm->row_jac->numQuadTotal) {    if (numQuadSub * numSub != parm->row_jac->numQuadTotal) {
141       Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: number of quadrature points for row is not correct.");       Finley_setError(TYPE_ERROR,"Finley_Assemble_getAssembleParameters: number of quadrature points for row is not correct.");
142    }    }
143    if (numQuadSub  * numSub != parm->row_jac->numQuadTotal) {    if (numQuadSub  * numSub != parm->row_jac->numQuadTotal) {
144       Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters:   number of quadrature points for column is not correct.");       Finley_setError(TYPE_ERROR,"Finley_Assemble_getAssembleParameters:   number of quadrature points for column is not correct.");
145    }    }
146    if (numQuadSub != parm->row_jac->BasisFunctions->numQuadNodes) {    if (numQuadSub != parm->row_jac->BasisFunctions->numQuadNodes) {
147       Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: Incorrect number of quadrature points for row.");       Finley_setError(TYPE_ERROR,"Finley_Assemble_getAssembleParameters: Incorrect number of quadrature points for row.");
148    }    }
149    if (numQuadSub != parm->col_jac->BasisFunctions->numQuadNodes) {    if (numQuadSub != parm->col_jac->BasisFunctions->numQuadNodes) {
150       Finley_setError(TYPE_ERROR,"Assemble_getAssembleParameters: Incorrect number of quadrature points for row.");       Finley_setError(TYPE_ERROR,"Finley_Assemble_getAssembleParameters: Incorrect number of quadrature points for row.");
151    }    }
152        
153    parm->numQuadSub=numQuadSub;    parm->numQuadSub=numQuadSub;

Legend:
Removed from v.3246  
changed lines
  Added in v.3247

  ViewVC Help
Powered by ViewVC 1.1.26