/[escript]/branches/domexper/paso/src/BlockOps.c
ViewVC logotype

Contents of /branches/domexper/paso/src/BlockOps.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3234 - (show annotations)
Mon Oct 4 01:46:30 2010 UTC (9 years, 2 months ago) by jfenwick
File MIME type: text/plain
File size: 2032 byte(s)
Some subdirs need to have changes pulled over but all of the unit tests 
except for modellib appear to work

1
2 /*******************************************************
3 *
4 * Copyright (c) 2003-2010 by University of Queensland
5 * Earth Systems Science Computational Center (ESSCC)
6 * http://www.uq.edu.au/esscc
7 *
8 * Primary Business: Queensland, Australia
9 * Licensed under the Open Software License version 3.0
10 * http://www.opensource.org/licenses/osl-3.0.php
11 *
12 *******************************************************/
13
14
15 #include "BlockOps.h"
16 #include "Paso.h"
17
18 /**************************************************************
19
20 PASO block operations
21
22 **************************************************************/
23
24 void Paso_BlockOps_allMV(dim_t n_block,dim_t n,double* D,index_t* pivot,double* x) {
25 dim_t i;
26 register dim_t i3,i9;
27 register double b0,b1,b2,D00,D10,D20,D01,D11,D21,D02,D12,D22;
28
29 if (n_block==1) {
30 #pragma omp parallel for private(i) schedule(static)
31 for (i=0;i<n;++i) {
32 x[i]=D[i]*x[i];
33 }
34 } else if (n_block==2) {
35 #pragma omp parallel for private(i,b0,b1,D00,D10,D01,D11,i3,i9) schedule(static)
36 for (i=0;i<n;++i) {
37 i3=2*i;
38 i9=4*i;
39 b0=x[i3];
40 b1=x[i3+1];
41 D00=D[i9 ];
42 D10=D[i9+1];
43 D01=D[i9+2];
44 D11=D[i9+3];
45 x[i3 ]=D00*b0+D01*b1;
46 x[i3+1]=D10*b0+D11*b1;
47 }
48 } else if (n_block==3) {
49 #pragma omp parallel for private(i,b0,b1,b2,D00,D10,D20,D01,D11,D21,D02,D12,D22,i3,i9) schedule(static)
50 for (i=0;i<n;++i) {
51 i3=3*i;
52 i9=9*i;
53 b0=x[i3];
54 b1=x[i3+1];
55 b2=x[i3+2];
56 D00=D[i9 ];
57 D10=D[i9+1];
58 D20=D[i9+2];
59 D01=D[i9+3];
60 D11=D[i9+4];
61 D21=D[i9+5];
62 D02=D[i9+6];
63 D12=D[i9+7];
64 D22=D[i9+8];
65 x[i3 ]=D00*b0+D01*b1+D02*b2;
66 x[i3+1]=D10*b0+D11*b1+D12*b2;
67 x[i3+2]=D20*b0+D21*b1+D22*b2;
68 }
69 }
70 return;
71 }

  ViewVC Help
Powered by ViewVC 1.1.26