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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 153 - (show annotations)
Tue Oct 25 01:51:20 2005 UTC (17 years, 5 months ago) by jgs
Original Path: trunk/esys2/bruce/src/Bruce/BruceFactory.cpp
File size: 2537 byte(s)
Merge of development branch dev-02 back to main trunk on 2005-10-25

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/Bruce/BruceFactory.h"
17 #include "bruce/Bruce/BruceException.h"
18
19 #include <iostream>
20 #include <sstream>
21 #include <boost/python/extract.hpp>
22
23 using namespace std;
24 using namespace escript;
25
26 namespace bruce {
27
28 AbstractContinuousDomain* brick(int n0, int n1, int n2,
29 double l0, double l1, double l2)
30 {
31 double v0_len, v1_len, v2_len;
32
33 Bruce::DimVec v0;
34 Bruce::DimVec v1;
35 Bruce::DimVec v2;
36 Bruce::DimVec origin;
37
38 origin.push_back(0);
39 origin.push_back(0);
40 origin.push_back(0);
41
42 if (n0<2) {
43 v0_len = 0;
44 } else {
45 v0_len = l0/(n0-1);
46 }
47
48 if (n1<2) {
49 v1_len = 0;
50 } else {
51 v1_len = l1/(n1-1);
52 }
53
54 if (n2<2) {
55 v2_len = 0;
56 } else {
57 v2_len = l2/(n2-1);
58 }
59
60 v0.push_back(v0_len);
61 v0.push_back(0);
62 v0.push_back(0);
63
64 v1.push_back(0);
65 v1.push_back(v1_len);
66 v1.push_back(0);
67
68 v2.push_back(0);
69 v2.push_back(0);
70 v2.push_back(v2_len);
71
72 AbstractContinuousDomain* temp=new Bruce(v0, v1, v2, n0, n1, n2, origin);
73 return temp;
74 }
75
76 AbstractContinuousDomain* rectangle(int n0, int n1,
77 double l0, double l1)
78 {
79 double v0_len, v1_len;
80
81 Bruce::DimVec v0;
82 Bruce::DimVec v1;
83 Bruce::DimVec v2;
84 Bruce::DimVec origin;
85
86 origin.push_back(0);
87 origin.push_back(0);
88
89 if (n0<2) {
90 v0_len = 0;
91 } else {
92 v0_len = l0/(n0-1);
93 }
94
95 if (n1<2) {
96 v1_len = 0;
97 } else {
98 v1_len = l1/(n1-1);
99 }
100
101 v0.push_back(v0_len);
102 v0.push_back(0);
103
104 v1.push_back(0);
105 v1.push_back(v1_len);
106
107 AbstractContinuousDomain* temp=new Bruce(v0, v1, v2, n0, n1, 0, origin);
108 return temp;
109 }
110
111 } // end of namespace

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26