/[escript]/trunk/bruce/src/BruceFactory.cpp
ViewVC logotype

Contents of /trunk/bruce/src/BruceFactory.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 475 - (show annotations)
Mon Jan 30 05:36:15 2006 UTC (14 years, 2 months ago) by jgs
File size: 2534 byte(s)
rationalise #includes

1 /* $Id$ */
2 /*
3 ******************************************************************************
4 * *
5 * COPYRIGHT ACcESS 2005 - All Rights Reserved *
6 * *
7 * This software is the property of ACcESS. No part of this code *
8 * may be copied in any form or by any means without the expressed written *
9 * consent of ACcESS. Copying, use or modification of this software *
10 * by any unauthorised person is illegal unless that person has a software *
11 * license agreement with ACcESS. *
12 * *
13 ******************************************************************************
14 */
15
16 #include "Bruce.h"
17
18 #include "BruceException.h"
19 #include "BruceFactory.h"
20
21 #include <boost/python/extract.hpp>
22
23 #include <iostream>
24 #include <sstream>
25
26 using namespace std;
27 using namespace escript;
28
29 namespace bruce {
30
31 AbstractContinuousDomain* brick(int n0, int n1, int n2,
32 double l0, double l1, double l2)
33 {
34 double v0_len, v1_len, v2_len;
35
36 Bruce::DimVec v0;
37 Bruce::DimVec v1;
38 Bruce::DimVec v2;
39 Bruce::DimVec origin;
40
41 origin.push_back(0);
42 origin.push_back(0);
43 origin.push_back(0);
44
45 if (n0<2) {
46 v0_len = 0;
47 } else {
48 v0_len = l0/(n0-1);
49 }
50
51 if (n1<2) {
52 v1_len = 0;
53 } else {
54 v1_len = l1/(n1-1);
55 }
56
57 if (n2<2) {
58 v2_len = 0;
59 } else {
60 v2_len = l2/(n2-1);
61 }
62
63 v0.push_back(v0_len);
64 v0.push_back(0);
65 v0.push_back(0);
66
67 v1.push_back(0);
68 v1.push_back(v1_len);
69 v1.push_back(0);
70
71 v2.push_back(0);
72 v2.push_back(0);
73 v2.push_back(v2_len);
74
75 AbstractContinuousDomain* temp=new Bruce(v0, v1, v2, n0, n1, n2, origin);
76 return temp;
77 }
78
79 AbstractContinuousDomain* rectangle(int n0, int n1,
80 double l0, double l1)
81 {
82 double v0_len, v1_len;
83
84 Bruce::DimVec v0;
85 Bruce::DimVec v1;
86 Bruce::DimVec v2;
87 Bruce::DimVec origin;
88
89 origin.push_back(0);
90 origin.push_back(0);
91
92 if (n0<2) {
93 v0_len = 0;
94 } else {
95 v0_len = l0/(n0-1);
96 }
97
98 if (n1<2) {
99 v1_len = 0;
100 } else {
101 v1_len = l1/(n1-1);
102 }
103
104 v0.push_back(v0_len);
105 v0.push_back(0);
106
107 v1.push_back(0);
108 v1.push_back(v1_len);
109
110 AbstractContinuousDomain* temp=new Bruce(v0, v1, v2, n0, n1, 0, origin);
111 return temp;
112 }
113
114 } // end of namespace

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26