/[escript]/temp/finley/src/Assemble_setNormal.c
ViewVC logotype

Diff of /temp/finley/src/Assemble_setNormal.c

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

trunk/esys2/finley/src/finleyC/Assemble_setNormal.c revision 123 by jgs, Fri Jul 8 04:08:13 2005 UTC trunk/finley/src/Assemble_setNormal.c revision 1062 by gross, Mon Mar 26 06:17:53 2007 UTC
# Line 1  Line 1 
1  /* $Id$ */  /*
2     ************************************************************
3     *          Copyright 2006 by ACcESS MNRF                   *
4     *                                                          *
5     *              http://www.access.edu.au                    *
6     *       Primary Business: Queensland, Australia            *
7     *  Licensed under the Open Software License version 3.0    *
8     *     http://www.opensource.org/licenses/osl-3.0.php       *
9     *                                                          *
10     ************************************************************
11    */
12    
13  /**************************************************************/  /**************************************************************/
14    
# Line 6  Line 16 
16    
17  /**************************************************************/  /**************************************************************/
18    
19  /*   Copyrights by ACcESS Australia, 2003,2004 */  /*  Author: gross@access.edu.au */
20  /*   author: gross@access.edu.au */  /*  Version: $Id$ */
 /*   Version: $Id$ */  
21    
22  /**************************************************************/  /**************************************************************/
23    
 #include "escript/Data/DataC.h"  
 #include "Finley.h"  
24  #include "Assemble.h"  #include "Assemble.h"
 #include "NodeFile.h"  
 #include "ElementFile.h"  
25  #include "Util.h"  #include "Util.h"
26  #ifdef _OPENMP  #ifdef _OPENMP
27  #include <omp.h>  #include <omp.h>
# Line 28  Line 33 
33  void Finley_Assemble_setNormal(Finley_NodeFile* nodes, Finley_ElementFile* elements, escriptDataC* normal) {  void Finley_Assemble_setNormal(Finley_NodeFile* nodes, Finley_ElementFile* elements, escriptDataC* normal) {
34    double *local_X=NULL, *dVdv=NULL,*normal_array;    double *local_X=NULL, *dVdv=NULL,*normal_array;
35    index_t sign,node_offset;    index_t sign,node_offset;
36    dim_t e,q;    Finley_RefElement* reference_element=NULL;
37      dim_t e,q, NN, NS, numDim, numQuad, numDim_local;
38    if (nodes==NULL || elements==NULL) return;    if (nodes==NULL || elements==NULL) return;
39    dim_t NN=elements->ReferenceElement->Type->numNodes;    NN=elements->ReferenceElement->Type->numNodes;
40    dim_t NS=elements->ReferenceElement->Type->numShapes;    NS=elements->ReferenceElement->Type->numShapes;
41    dim_t numDim=nodes->numDim;    numDim=nodes->numDim;
42    dim_t numQuad=elements->ReferenceElement->numQuadNodes;    Finley_resetError();
43    dim_t numDim_local=elements->ReferenceElement->Type->numDim;    if (Finley_Assemble_reducedIntegrationOrder(normal)) {
44         reference_element=elements->ReferenceElementReducedOrder;
45      } else {
46         reference_element=elements->ReferenceElement;
47      }
48      numQuad=reference_element->numQuadNodes;
49      numDim_local=reference_element->Type->numDim;
50    
51    /* set some parameter */    /* set some parameter */
52    
# Line 47  void Finley_Assemble_setNormal(Finley_No Line 59  void Finley_Assemble_setNormal(Finley_No
59    }    }
60    /* check the dimensions of normal */    /* check the dimensions of normal */
61    if (! (numDim==numDim_local || numDim-1==numDim_local)) {    if (! (numDim==numDim_local || numDim-1==numDim_local)) {
62         Finley_ErrorCode=TYPE_ERROR;         Finley_setError(TYPE_ERROR,"Finley_Assemble_setNormal: Cannot calculate normal vector");
        sprintf(Finley_ErrorMsg,"Cannot calculate normal vector");  
63    } else if (! isDataPointShapeEqual(normal,1,&(numDim))) {    } else if (! isDataPointShapeEqual(normal,1,&(numDim))) {
64         Finley_ErrorCode=TYPE_ERROR;         Finley_setError(TYPE_ERROR,"Finley_Assemble_setNormal: illegal number of samples of normal Data object");
        sprintf(Finley_ErrorMsg,"illegal number of samples of normal Data object");  
65    } else if (! numSamplesEqual(normal,numQuad,elements->numElements)) {    } else if (! numSamplesEqual(normal,numQuad,elements->numElements)) {
66         Finley_ErrorCode=TYPE_ERROR;         Finley_setError(TYPE_ERROR,"Finley_Assemble_setNormal: illegal number of samples of normal Data object");
        sprintf(Finley_ErrorMsg,"illegal number of samples of normal Data object");  
67    } else if (! isDataPointShapeEqual(normal,1,&(numDim))) {    } else if (! isDataPointShapeEqual(normal,1,&(numDim))) {
68         Finley_ErrorCode=TYPE_ERROR;         Finley_setError(TYPE_ERROR,"Finley_Assemble_setNormal: illegal point data shape of normal Data object");
        sprintf(Finley_ErrorMsg,"illegal point data shape of normal Data object");  
69    }  else if (!isExpanded(normal)) {    }  else if (!isExpanded(normal)) {
70         Finley_ErrorCode=TYPE_ERROR;         Finley_setError(TYPE_ERROR,"Finley_Assemble_setNormal: expanded Data object is expected for normal.");
        sprintf(Finley_ErrorMsg,"expanded Data object is expected for normal.");  
71    }    }
72        
73    /* now we can start */    /* now we can start */
74      if (Finley_ErrorCode==NO_ERROR) {      if (Finley_noError()) {
75            #pragma omp parallel private(local_X,dVdv)            #pragma omp parallel private(local_X,dVdv)
76            {            {
77               local_X=dVdv=NULL;               local_X=dVdv=NULL;
# Line 78  void Finley_Assemble_setNormal(Finley_No Line 85  void Finley_Assemble_setNormal(Finley_No
85                            /* gather local coordinates of nodes into local_X: */                            /* gather local coordinates of nodes into local_X: */
86                            Finley_Util_Gather_double(NS,&(elements->Nodes[INDEX2(node_offset,e,NN)]),numDim,nodes->Coordinates,local_X);                            Finley_Util_Gather_double(NS,&(elements->Nodes[INDEX2(node_offset,e,NN)]),numDim,nodes->Coordinates,local_X);
87                            /*  calculate dVdv(i,j,q)=local_X(i,n)*DSDv(n,j,q) */                            /*  calculate dVdv(i,j,q)=local_X(i,n)*DSDv(n,j,q) */
88                            Finley_Util_SmallMatMult(numDim,numDim_local*numQuad,dVdv,NS,local_X,elements->ReferenceElement->dSdv);                            Finley_Util_SmallMatMult(numDim,numDim_local*numQuad,dVdv,NS,local_X,reference_element->dSdv);
89                            /* get normalized vector:  */                            /* get normalized vector:  */
90                            normal_array=getSampleData(normal,e);                            normal_array=getSampleData(normal,e);
91                            Finley_NormalVector(numQuad,numDim,numDim_local,dVdv,normal_array);                            Finley_NormalVector(numQuad,numDim,numDim_local,dVdv,normal_array);
# Line 92  void Finley_Assemble_setNormal(Finley_No Line 99  void Finley_Assemble_setNormal(Finley_No
99  }  }
100  /*  /*
101   * $Log$   * $Log$
102     * Revision 1.6  2005/09/15 03:44:21  jgs
103     * Merge of development branch dev-02 back to main trunk on 2005-09-15
104     *
105     * Revision 1.5.2.1  2005/09/07 06:26:18  gross
106     * the solver from finley are put into the standalone package paso now
107     *
108   * Revision 1.5  2005/07/08 04:07:48  jgs   * Revision 1.5  2005/07/08 04:07:48  jgs
109   * Merge of development branch back to main trunk on 2005-07-08   * Merge of development branch back to main trunk on 2005-07-08
110   *   *

Legend:
Removed from v.123  
changed lines
  Added in v.1062

  ViewVC Help
Powered by ViewVC 1.1.26