/[escript]/trunk/bruce/src/Bruce/Bruce.h
ViewVC logotype

Annotation of /trunk/bruce/src/Bruce/Bruce.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 153 - (hide annotations)
Tue Oct 25 01:51:20 2005 UTC (15 years, 1 month ago) by jgs
Original Path: trunk/esys2/bruce/src/Bruce/Bruce.h
File MIME type: text/plain
File size: 6190 byte(s)
Merge of development branch dev-02 back to main trunk on 2005-10-25

1 jgs 149 // $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 jgs 151
16 jgs 149 #if !defined bruce_Bruce_20050829_H
17     #define bruce_Bruce_20050829_H
18    
19     #include "escript/Data/AbstractContinuousDomain.h"
20     #include "escript/Data/FunctionSpaceFactory.h"
21     #include "escript/Data/FunctionSpace.h"
22     #include "escript/Data/Data.h"
23    
24     #include <string>
25 jgs 150 #include <vector>
26 jgs 149
27     namespace bruce {
28    
29     /**
30     \brief
31 jgs 151 Bruce implements a structured AbstractContinuousDomain.
32 jgs 149
33     Description:
34 jgs 151 Bruce implements a structured AbstractContinuousDomain.
35 jgs 149 */
36    
37     class Bruce : public escript::AbstractContinuousDomain {
38    
39     public:
40    
41     //
42     // Codes for function space types supported
43 jgs 150 static const int ContinuousFunction;
44     static const int Function;
45 jgs 149
46 jgs 150 //
47     // Type of FunctionSpaceNamesMap
48     typedef std::map<int, std::string> FunctionSpaceNamesMapType;
49    
50     //
51     // Types for the dimension vectors
52     typedef std::vector<double> DimVec;
53    
54 jgs 149 /**
55     \brief
56 jgs 150 Default constructor for Bruce.
57    
58     Description:
59     Default constructor for Bruce.
60     Creates a null Bruce object.
61     */
62     Bruce();
63    
64     /**
65     \brief
66 jgs 149 Constructor for Bruce.
67    
68     Description:
69     Constructor for Bruce.
70 jgs 150
71     The point "origin" specifies the location of the origin
72     of the domain specified by this object. The dimensionality of this
73     point determines the dimensionality of the space the domain occupies.
74    
75     The vectors v0,v1,v2 specify the axis in
76     of the domain of this Bruce object. If v2 is an empty vector, this
77     object is a two dimensional domain. If v1 is also an empty vector,
78     this object is a one dimensional domain. If v0 is also an empty
79     vector, this is a point domain.
80    
81     The integers n0,n1,n2 specify the dumber of data-points along each
82     axis in the domain.
83 jgs 149 */
84 jgs 150 Bruce(DimVec v0, DimVec v1, DimVec v2,
85     int n0, int n1, int n2,
86     DimVec origin);
87 jgs 149
88     /**
89     \brief
90     Copy constructor.
91     */
92     Bruce(const Bruce& other);
93    
94     /**
95     \brief
96     Destructor for Bruce.
97     */
98     ~Bruce();
99    
100     /**
101     \brief
102     Return this as an AbstractContinuousDomain.
103     */
104     inline
105     const AbstractContinuousDomain&
106     asAbstractContinuousDomain() const
107     {
108 jgs 150 return *(static_cast<const AbstractContinuousDomain*>(this));
109 jgs 149 }
110    
111     /**
112     \brief
113     Return this as an AbstractDomain.
114     */
115     inline
116     const AbstractDomain&
117     asAbstractDomain() const
118     {
119 jgs 150 return *(static_cast<const AbstractDomain*>(this));
120 jgs 149 }
121    
122     /**
123     \brief
124 jgs 150 Return a description for this domain.
125     */
126     virtual
127 jgs 151 inline
128 jgs 150 std::string
129 jgs 151 getDescription() const
130     {
131     return "Bruce";
132     }
133 jgs 150
134     /**
135     \brief
136 jgs 149 Returns true if the given integer is a valid function space type
137     for this domain.
138     */
139     virtual
140     bool
141 jgs 150 isValidFunctionSpaceType(int functionSpaceCode) const;
142 jgs 149
143     /**
144     \brief
145 jgs 150 Return a description for the given function space type code.
146     */
147     virtual
148     std::string
149     functionSpaceTypeAsString(int functionSpaceCode) const;
150    
151     /**
152     \brief
153     Return a continuous FunctionSpace code.
154     */
155     virtual
156 jgs 151 inline
157 jgs 150 int
158 jgs 151 getContinuousFunctionCode() const
159     {
160     return ContinuousFunction;
161     }
162 jgs 150
163     /**
164     \brief
165     Return a function FunctionSpace code.
166     */
167     virtual
168 jgs 151 inline
169 jgs 150 int
170 jgs 151 getFunctionCode() const
171     {
172     return Function;
173     }
174 jgs 150
175     /**
176     \brief
177 jgs 149 Return the spatial dimension of the mesh.
178     */
179     virtual
180 jgs 151 inline
181 jgs 149 int
182 jgs 151 getDim() const
183     {
184     return m_origin.size();
185     }
186 jgs 149
187     /**
188     \brief
189     Return the number of data points per sample, and the number of samples
190     needed to represent data on parts of the mesh.
191     */
192     virtual
193     std::pair<int,int>
194     getDataShape(int functionSpaceCode) const;
195    
196     /**
197     \brief
198     Returns the locations in the domain of the FEM nodes.
199     */
200     virtual
201     escript::Data
202     getX() const;
203    
204     /**
205     \brief
206 jgs 150 Copies the location of data points on the domain into out.
207     */
208     virtual
209     void
210     setToX(escript::Data& out) const;
211    
212     /**
213     \brief
214 jgs 149 Returns the element size.
215     */
216     virtual
217     escript::Data
218     getSize() const;
219    
220     /**
221     \brief
222 jgs 150 Copies the size of samples into out.
223     */
224     virtual
225     void
226     setToSize(escript::Data& out) const;
227    
228     /**
229     \brief
230 jgs 149 Comparison operators.
231     */
232     virtual bool operator==(const AbstractDomain& other) const;
233     virtual bool operator!=(const AbstractDomain& other) const;
234    
235 jgs 153 /*
236     \brief
237     Return the tag key for the given sample number.
238     */
239     virtual
240     int
241     getTagFromSampleNo(int functionSpaceCode, int sampleNo) const;
242    
243     /**
244     \brief
245     Return the reference number of the given sample number.
246     */
247     virtual
248     int
249     getReferenceNoFromSampleNo(int functionSpaceCode, int sampleNo) const;
250    
251    
252 jgs 149 protected:
253    
254 jgs 150 /**
255     \brief
256     Build the table of function space type names.
257     */
258     void
259     setFunctionSpaceTypeNames();
260    
261     /**
262     \brief
263     Ensure the parameters supplied to the constructor are valid.
264     */
265     bool
266     checkParameters();
267    
268     /**
269     \brief
270     Check if all components of vector are zero.
271     */
272 jgs 151 static
273 jgs 150 bool
274 jgs 151 isZero(DimVec vec);
275 jgs 150
276 jgs 149 private:
277    
278 jgs 150 //
279     // vectors describing axis of the domain
280     DimVec m_v0, m_v1, m_v2;
281    
282     //
283     // number of data points in each axial direction of the domain
284     int m_n0, m_n1, m_n2;
285    
286     //
287     // the coordinates of the origin of the domain
288     DimVec m_origin;
289    
290     //
291     // map from FunctionSpace codes to names
292     static FunctionSpaceNamesMapType m_functionSpaceTypeNames;
293    
294 jgs 149 };
295    
296     } // end of namespace
297    
298     #endif

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26