/[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 682 - (show annotations)
Mon Mar 27 02:43:09 2006 UTC (12 years, 11 months ago) by robwdcock
File MIME type: text/plain
File size: 11693 byte(s)
+ NEW BUILD SYSTEM

This commit contains the new build system with cross-platform support.
Most things work are before though you can have more control.

ENVIRONMENT settings have changed:
+ You no longer require LD_LIBRARY_PATH or PYTHONPATH to point to the
esysroot for building and testing performed via scons
+ ACcESS altix users: It is recommended you change your modules to load
the latest intel compiler and other libraries required by boost to match
the setup in svn (you can override). The correct modules are as follows

module load intel_cc.9.0.026
export
MODULEPATH=${MODULEPATH}:/data/raid2/toolspp4/modulefiles/gcc-3.3.6
module load boost/1.33.0/python-2.4.1
module load python/2.4.1
module load numarray/1.3.3


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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26