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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1312 - (hide annotations)
Mon Sep 24 06:18:44 2007 UTC (12 years ago) by ksteube
Original Path: trunk/finley/src/Assemble_setNormal.c
File MIME type: text/plain
File size: 4763 byte(s)
The MPI branch is hereby closed. All future work should be in trunk.

Previously in revision 1295 I merged the latest changes to trunk into trunk-mpi-branch.
In this revision I copied all files from trunk-mpi-branch over the corresponding
trunk files. I did not use 'svn merge', it was a copy.

1 jgs 82
2 ksteube 1312 /* $Id$ */
3 jgs 82
4 ksteube 1312 /*******************************************************
5     *
6     * Copyright 2003-2007 by ACceSS MNRF
7     * Copyright 2007 by University of Queensland
8     *
9     * http://esscc.uq.edu.au
10     * Primary Business: Queensland, Australia
11     * Licensed under the Open Software License version 3.0
12     * http://www.opensource.org/licenses/osl-3.0.php
13     *
14     *******************************************************/
15 jgs 82
16     /**************************************************************/
17    
18 ksteube 1312 /* assemblage routines: calculates the normal vector at quadrature points on face elements */
19 jgs 82
20     /**************************************************************/
21    
22     #include "Assemble.h"
23     #include "Util.h"
24     #ifdef _OPENMP
25     #include <omp.h>
26     #endif
27    
28     /**************************************************************/
29    
30    
31     void Finley_Assemble_setNormal(Finley_NodeFile* nodes, Finley_ElementFile* elements, escriptDataC* normal) {
32     double *local_X=NULL, *dVdv=NULL,*normal_array;
33 jgs 123 index_t sign,node_offset;
34 gross 1062 Finley_RefElement* reference_element=NULL;
35 gross 1028 dim_t e,q, NN, NS, numDim, numQuad, numDim_local;
36 jgs 82 if (nodes==NULL || elements==NULL) return;
37 gross 1028 NN=elements->ReferenceElement->Type->numNodes;
38     NS=elements->ReferenceElement->Type->numShapes;
39     numDim=nodes->numDim;
40 jgs 150 Finley_resetError();
41 gross 1062 if (Finley_Assemble_reducedIntegrationOrder(normal)) {
42     reference_element=elements->ReferenceElementReducedOrder;
43     } else {
44     reference_element=elements->ReferenceElement;
45     }
46     numQuad=reference_element->numQuadNodes;
47     numDim_local=reference_element->Type->numDim;
48 jgs 82
49     /* set some parameter */
50    
51     if (getFunctionSpaceType(normal)==FINLEY_CONTACT_ELEMENTS_2) {
52     node_offset=NN-NS;
53     sign=-1;
54     } else {
55     node_offset=0;
56     sign=1;
57     }
58     /* check the dimensions of normal */
59 jgs 102 if (! (numDim==numDim_local || numDim-1==numDim_local)) {
60 gross 777 Finley_setError(TYPE_ERROR,"Finley_Assemble_setNormal: Cannot calculate normal vector");
61 jgs 82 } else if (! isDataPointShapeEqual(normal,1,&(numDim))) {
62 gross 777 Finley_setError(TYPE_ERROR,"Finley_Assemble_setNormal: illegal number of samples of normal Data object");
63 jgs 82 } else if (! numSamplesEqual(normal,numQuad,elements->numElements)) {
64 gross 777 Finley_setError(TYPE_ERROR,"Finley_Assemble_setNormal: illegal number of samples of normal Data object");
65 jgs 82 } else if (! isDataPointShapeEqual(normal,1,&(numDim))) {
66 gross 777 Finley_setError(TYPE_ERROR,"Finley_Assemble_setNormal: illegal point data shape of normal Data object");
67 jgs 82 } else if (!isExpanded(normal)) {
68 gross 777 Finley_setError(TYPE_ERROR,"Finley_Assemble_setNormal: expanded Data object is expected for normal.");
69 jgs 82 }
70    
71     /* now we can start */
72 jgs 150 if (Finley_noError()) {
73 jgs 82 #pragma omp parallel private(local_X,dVdv)
74     {
75     local_X=dVdv=NULL;
76     /* allocation of work arrays */
77 jgs 102 local_X=THREAD_MEMALLOC(NS*numDim,double);
78     dVdv=THREAD_MEMALLOC(numQuad*numDim*numDim_local,double);
79 jgs 82 if (!(Finley_checkPtr(local_X) || Finley_checkPtr(dVdv) ) ) {
80     /* open the element loop */
81     #pragma omp for private(e,q,normal_array) schedule(static)
82     for(e=0;e<elements->numElements;e++) {
83     /* gather local coordinates of nodes into local_X: */
84     Finley_Util_Gather_double(NS,&(elements->Nodes[INDEX2(node_offset,e,NN)]),numDim,nodes->Coordinates,local_X);
85     /* calculate dVdv(i,j,q)=local_X(i,n)*DSDv(n,j,q) */
86 gross 1062 Finley_Util_SmallMatMult(numDim,numDim_local*numQuad,dVdv,NS,local_X,reference_element->dSdv);
87 jgs 82 /* get normalized vector: */
88     normal_array=getSampleData(normal,e);
89     Finley_NormalVector(numQuad,numDim,numDim_local,dVdv,normal_array);
90     for (q=0;q<numQuad*numDim;q++) normal_array[q]*=sign;
91     }
92     }
93     THREAD_MEMFREE(local_X);
94     THREAD_MEMFREE(dVdv);
95     }
96     }
97     }
98     /*
99     * $Log$
100 jgs 150 * Revision 1.6 2005/09/15 03:44:21 jgs
101     * Merge of development branch dev-02 back to main trunk on 2005-09-15
102     *
103     * Revision 1.5.2.1 2005/09/07 06:26:18 gross
104     * the solver from finley are put into the standalone package paso now
105     *
106 jgs 123 * Revision 1.5 2005/07/08 04:07:48 jgs
107     * Merge of development branch back to main trunk on 2005-07-08
108     *
109 jgs 102 * Revision 1.4 2004/12/15 07:08:32 jgs
110 jgs 97 * *** empty log message ***
111 jgs 123 * Revision 1.1.1.1.2.3 2005/06/29 02:34:48 gross
112     * some changes towards 64 integers in finley
113 jgs 82 *
114 jgs 123 * Revision 1.1.1.1.2.2 2004/11/24 01:37:13 gross
115     * some changes dealing with the integer overflow in memory allocation. Finley solves 4M unknowns now
116 jgs 97 *
117 jgs 82 *
118 jgs 123 *
119 jgs 82 */

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26