/[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 150 - (hide annotations)
Thu Sep 15 03:44:45 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: 5818 byte(s)
Merge of development branch dev-02 back to main trunk on 2005-09-15

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26