/[escript]/trunk/finley/src/CPPAdapter/MeshAdapter.h
ViewVC logotype

Contents of /trunk/finley/src/CPPAdapter/MeshAdapter.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 110 - (show annotations)
Mon Feb 14 04:14:42 2005 UTC (13 years, 11 months ago) by jgs
Original Path: trunk/esys2/finley/src/CPPAdapter/MeshAdapter.h
File MIME type: text/plain
File size: 11609 byte(s)
*** empty log message ***

1 // $Id$
2 /*
3 ******************************************************************************
4 * *
5 * COPYRIGHT ACcESS 2004 - 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 finley_MeshAdapter_20040526_H
17 #define finley_MeshAdapter_20040526_H
18
19 #include "escript/Data/AbstractContinuousDomain.h"
20 #include "escript/Data/Data.h"
21 #include "escript/Data/FunctionSpace.h"
22 extern "C" {
23 #include "finley/finleyC/Mesh.h"
24 }
25 #include "finley/CPPAdapter/SystemMatrixAdapter.h"
26 #include <boost/shared_ptr.hpp>
27 #include <boost/python/object.hpp>
28 #include <map>
29 #include <vector>
30 #include <string>
31
32 namespace finley {
33
34 /**
35 \brief
36 MeshAdapter implements the AbstractContinuousDomain
37 interface for the Finley library.
38
39 Description:
40 MeshAdapter implements the AbstractContinuousDomain
41 interface for the Finley library.
42 */
43
44 class MeshAdapter:public escript::AbstractContinuousDomain {
45
46 public:
47
48 //
49 // Codes for function space types supported
50 static const int DegreesOfFreedom;
51 static const int ReducedDegreesOfFreedom;
52 static const int Nodes;
53 static const int Elements;
54 static const int FaceElements;
55 static const int Points;
56 static const int ContactElementsZero;
57 static const int ContactElementsOne;
58
59 /**
60 \brief
61 Constructor for MeshAdapter
62
63 Description:
64 Constructor for MeshAdapter. The pointer passed to MeshAdapter
65 is deleted using a call to Finley_Mesh_deallocate in the
66 MeshAdapter destructor.
67
68 Throws:
69 May throw an exception derived from EsysException
70
71 \param finleyMesh Input - A pointer to the externally constructed
72 finley mesh.The pointer passed to MeshAdapter
73 is deleted using a call to
74 Finley_Mesh_deallocate in the MeshAdapter
75 destructor.
76 */
77 MeshAdapter(Finley_Mesh* finleyMesh=0);
78 /**
79 \brief
80 Copy constructor.
81 */
82 MeshAdapter(const MeshAdapter& in);
83 /**
84 \brief
85 Destructor for MeshAdapter. As specified in the constructor
86 this calls Finley_Mesh_deallocate for the pointer given to the
87 constructor.
88 */
89 ~MeshAdapter();
90 /**
91 \brief
92 return this as an AbstractContinuousDomain.
93 */
94 inline const AbstractContinuousDomain& asAbstractContinuousDomain() const
95 {
96 return *(static_cast<const AbstractContinuousDomain*>(this));
97 }
98
99 /**
100 \brief
101 return this as an AbstractDomain.
102 */
103 inline const AbstractDomain& asAbstractDomain() const
104 {
105 return *(static_cast<const AbstractDomain*>(this));
106 }
107 /**
108 \brief
109 Write the current mesh to a file with the given name.
110 \param fileName Input - The name of the file to write to.
111 */
112 void write(const std::string& fileName) const;
113 /**
114 \brief
115 return the pointer of the underlying finley mesh structure
116 */
117 Finley_Mesh* getFinley_Mesh() const;
118 /**
119 \brief
120 Return the tag list indexed by sampleNo.
121 \param functionSpaceType Input
122 \param tagList Output
123 \param numTags Output
124 */
125
126 void getTagList(int functionSpaceType, int** tagList,
127 int* numTags) const;
128 /**
129 \brief
130 Return the reference number list indexed by sampleNo.
131 \param functionSpaceType Input
132 \param referenceNoList Output
133 \param numReferenceNo Output
134 */
135 void getReferenceNoList(int functionSpaceType, int** referenceNoList,
136 int* numReferenceNo) const;
137
138 /**
139 \brief
140 Return the tag key for the given sample number.
141 \param functionSpaceType Input - The function space type.
142 \param sampleNo Input - The sample number.
143 */
144 int getTagFromSampleNo(int functionSpaceType, int sampleNo) const;
145 /**
146 \brief
147 Return the reference number of the given sample number.
148 \param functionSpaceType Input - The function space type.
149 \param sampleNo Input - The sample number.
150 */
151 int getReferenceNoFromSampleNo(int functionSpaceType, int sampleNo) const;
152
153 /**
154 \brief
155 Returns true if the given integer is a valid function space type
156 for this domain.
157 */
158 virtual bool isValidFunctionSpaceType(int functionSpaceType) const;
159 /**
160 \brief
161 Return a description for this domain
162 */
163 virtual std::string getDescription() const;
164 /**
165 \brief
166 Return a description for the given function space type code
167 */
168 virtual std::string functionSpaceTypeAsString(int functionSpaceType) const;
169
170 /**
171 \brief
172 Build the table of function space type names
173 */
174 void setFunctionSpaceTypeNames();
175 /**
176 \brief
177 Return a continuous FunctionSpace code
178 */
179 virtual int getContinuousFunctionCode() const;
180 /**
181 \brief
182 Return a functon FunctionSpace code
183 */
184 virtual int getFunctionCode() const;
185 /**
186 \brief
187 Return a function on boundary FunctionSpace code
188 */
189 virtual int getFunctionOnBoundaryCode() const;
190 /**
191 \brief
192 Return a FunctionOnContactZero code
193 */
194 virtual int getFunctionOnContactZeroCode() const;
195 /**
196 \brief
197 Return a FunctionOnContactOne code
198 */
199 virtual int getFunctionOnContactOneCode() const;
200 /**
201 \brief
202 Return a Solution code
203 */
204 virtual int getSolutionCode() const;
205 /**
206 \brief
207 Return a ReducedSolution code
208 */
209 virtual int getReducedSolutionCode() const;
210 /**
211 \brief
212 Return a DiracDeltaFunction code
213 */
214 virtual int getDiracDeltaFunctionCode() const;
215 //
216 //
217 typedef std::map<int, std::string> FunctionSpaceNamesMapType;
218 /**
219 \brief
220 */
221 virtual int getDim() const;
222 /**
223 \brief
224 Return the number of data points per sample, and the number of samples as a pair.
225 \param functionSpace Input -
226 */
227 virtual std::pair<int,int> getDataShape(int functionSpaceCode) const;
228
229 /**
230 \brief
231 copies the location of data points into arg. The domain of arg has to match this.
232 has to be implemented by the actual Domain adapter.
233 */
234 virtual void setToX(escript::Data& arg) const;
235 /**
236 \brief
237 assigns new location to the domain
238 */
239 virtual void setNewX(const escript::Data& arg);
240 /**
241 \brief
242 interpolates data given on source onto target where source and target have to be given on the same domain.
243 */
244 virtual void interpolateOnDomain(escript::Data& target,const escript::Data& source) const;
245 virtual bool probeInterpolationOnDomain(int functionSpaceType_source,int functionSpaceType_target) const;
246 /**
247 \brief
248 interpolates data given on source onto target where source and target are given on different domains.
249 has to be implemented by the actual Domain adapter.
250 */
251 virtual void interpolateACross(escript::Data& target, const escript::Data& source) const;
252 virtual bool probeInterpolationACross(int functionSpaceType_source,const AbstractDomain& targetDomain, int functionSpaceType_target) const;
253 /**
254 \brief
255 copies the surface normals at data points into out. The actual function space to be considered
256 is defined by out. out has to be defined on this.
257 */
258 virtual void setToNormal(escript::Data& out) const;
259 /**
260 \brief
261 copies the size of samples into out. The actual function space to be considered
262 is defined by out. out has to be defined on this.
263 */
264 virtual void setToSize(escript::Data& out) const;
265
266 /**
267 \brief
268 copies the gradient of arg into grad. The actual function space to be considered
269 for the gradient is defined by grad. arg and grad have to be defined on this.
270 */
271 virtual void setToGradient(escript::Data& grad,const escript::Data& arg) const;
272
273 /**
274 \brief
275 copies the integrals of the function defined by arg into integrals.
276 arg has to be defined on this.
277 */
278 virtual void setToIntegrals(std::vector<double>& integrals,const escript::Data& arg) const;
279
280 /**
281 \brief
282 return the identifier of the matrix type to be used for the global stiffness matrix when a particular solver, preconditioner
283 and symmetric matrix is used.
284 \param solver
285 \param symmetry
286 */
287 virtual int getSystemMatrixTypeId(const int solver, const bool symmetry) const;
288
289 /**
290 \brief
291 returns true if data on this domain and a function space of type functionSpaceCode has to
292 considered as cell centered data.
293 */
294 virtual bool isCellOriented(int functionSpaceCode) const;
295 /**
296 \brief
297 saves data arg to an OpenDX input file.
298 considered as cell centered data.
299 */
300 virtual void saveDX(const std::string& filename,const escript::Data& arg) const;
301 /**
302 \brief
303 saves data arg to a VTK input file.
304 considered as cell centered data.
305 */
306 virtual void saveVTK(const std::string& filename,const escript::Data& arg) const;
307 /**
308 \brief
309 returns the function space representation of the type functionSpaceCode on this domain
310 as a vtkObject.
311 */
312 // vtkObject createVtkObject(int functionSpaceCode) const;
313 /**
314 \brief
315 adds a PDE onto the stiffness matrix mat and a rhs
316 */
317 virtual void addPDEToSystem(
318 SystemMatrixAdapter& mat, escript::Data& rhs,
319 const escript::Data& A, const escript::Data& B, const escript::Data& C,
320 const escript::Data& D, const escript::Data& X, const escript::Data& Y,
321 const escript::Data& d, const escript::Data& y,
322 const escript::Data& d_contact, const escript::Data& y_contact) const;
323 /**
324 \brief
325 adds a PDE onto the stiffness matrix mat and a rhs
326 */
327 virtual void addPDEToRHS(escript::Data& rhs,
328 const escript::Data& X, const escript::Data& Y,
329 const escript::Data& y, const escript::Data& y_contact) const;
330 /**
331 \brief
332 creates a SystemMatrixAdapter stiffness matrix an initializes it with zeros:
333 */
334 SystemMatrixAdapter newSystemMatrix(
335 const int row_blocksize,
336 const escript::FunctionSpace& row_functionspace,
337 const int column_blocksize,
338 const escript::FunctionSpace& column_functionspace,
339 const int type) const;
340
341 /**
342 \brief returns locations in the FEM nodes
343 */
344 virtual escript::Data getX() const;
345 /**
346 \brief return boundary normals at the quadrature point on the face elements
347 */
348 virtual escript::Data getNormal() const;
349 /**
350 \brief returns the element size
351 */
352 virtual escript::Data getSize() const;
353
354 bool operator==(const MeshAdapter& other) const;
355 bool operator!=(const MeshAdapter& other) const;
356
357 protected:
358
359 private:
360 //
361 // pointer to the externally created finley mesh
362 boost::shared_ptr<Finley_Mesh> m_finleyMesh;
363
364 static FunctionSpaceNamesMapType m_functionSpaceTypeNames;
365
366 };
367
368 } // end of namespace
369 #endif

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26