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

Annotation of /temp_trunk_copy/finley/src/CPPAdapter/MeshAdapter.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 682 - (hide annotations)
Mon Mar 27 02:43:09 2006 UTC (13 years, 1 month ago) by robwdcock
Original Path: trunk/finley/src/CPPAdapter/MeshAdapter.h
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 jgs 102 // $Id$
2 jgs 82 /*
3 elspeth 626 ************************************************************
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 jgs 82 */
13    
14 jgs 149 #if !defined finley_MeshAdapter_20040526_H
15 jgs 82 #define finley_MeshAdapter_20040526_H
16    
17     extern "C" {
18 robwdcock 682 #include "../Mesh.h"
19     #include "../Finley.h"
20     #include "../Assemble.h"
21     #include "paso/SystemMatrix.h"
22 jgs 82 }
23 jgs 472
24     #include "FinleyError.h"
25     #include "FinleyAdapterException.h"
26 jgs 149
27 jgs 480 #include "SystemMatrixAdapter.h"
28 robwdcock 682 #include "escript/AbstractContinuousDomain.h"
29     #include "escript/FunctionSpace.h"
30     #include "escript/FunctionSpaceFactory.h"
31 jgs 472
32 jgs 82 #include <boost/shared_ptr.hpp>
33 jgs 153 #include <boost/python/dict.hpp>
34 jgs 472 #include <boost/python/extract.hpp>
35    
36 jgs 82 #include <map>
37     #include <vector>
38     #include <string>
39 jgs 472 #include <sstream>
40 jgs 82
41 jgs 480 //
42     // forward declarations
43     class Data;
44    
45     //using namespace escript;
46    
47 jgs 82 namespace finley {
48    
49 jgs 123 struct null_deleter
50     {
51     void operator()(void const *ptr) const
52     {
53     }
54     };
55    
56    
57 jgs 82 /**
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 jgs 480 class MeshAdapter : public escript::AbstractContinuousDomain {
68 jgs 82
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 jgs 149
102 jgs 82 /**
103     \brief
104     Copy constructor.
105     */
106     MeshAdapter(const MeshAdapter& in);
107 jgs 149
108 jgs 82 /**
109     \brief
110     Destructor for MeshAdapter. As specified in the constructor
111 jgs 149 this calls Finley_Mesh_deallocate for the pointer given to the
112 jgs 82 constructor.
113     */
114     ~MeshAdapter();
115 jgs 149
116 jgs 82 /**
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 jgs 149
134 jgs 82 /**
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 jgs 149
141 jgs 82 /**
142     \brief
143 jgs 149 return the pointer to the underlying finley mesh structure
144 jgs 82 */
145     Finley_Mesh* getFinley_Mesh() const;
146 jgs 149
147 jgs 110 /**
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 jgs 149
155 jgs 110 /**
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 jgs 82 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 jgs 149
170 jgs 82 /**
171     \brief
172     Return a description for this domain
173     */
174     virtual std::string getDescription() const;
175 jgs 149
176 jgs 82 /**
177     \brief
178     Return a description for the given function space type code
179     */
180     virtual std::string functionSpaceTypeAsString(int functionSpaceType) const;
181 jgs 110
182 jgs 82 /**
183     \brief
184     Build the table of function space type names
185     */
186     void setFunctionSpaceTypeNames();
187 jgs 149
188 jgs 82 /**
189     \brief
190     Return a continuous FunctionSpace code
191     */
192     virtual int getContinuousFunctionCode() const;
193 jgs 149
194 jgs 82 /**
195     \brief
196     Return a functon FunctionSpace code
197     */
198     virtual int getFunctionCode() const;
199 jgs 149
200 jgs 82 /**
201     \brief
202     Return a function on boundary FunctionSpace code
203     */
204     virtual int getFunctionOnBoundaryCode() const;
205 jgs 149
206 jgs 82 /**
207     \brief
208     Return a FunctionOnContactZero code
209     */
210     virtual int getFunctionOnContactZeroCode() const;
211 jgs 149
212 jgs 82 /**
213     \brief
214     Return a FunctionOnContactOne code
215     */
216     virtual int getFunctionOnContactOneCode() const;
217 jgs 149
218 jgs 82 /**
219     \brief
220     Return a Solution code
221     */
222     virtual int getSolutionCode() const;
223 jgs 149
224 jgs 82 /**
225     \brief
226     Return a ReducedSolution code
227     */
228     virtual int getReducedSolutionCode() const;
229 jgs 149
230 jgs 82 /**
231     \brief
232     Return a DiracDeltaFunction code
233     */
234     virtual int getDiracDeltaFunctionCode() const;
235 jgs 149
236     /**
237     \brief
238     */
239 jgs 82 typedef std::map<int, std::string> FunctionSpaceNamesMapType;
240 jgs 149
241 jgs 82 /**
242     \brief
243     */
244     virtual int getDim() const;
245 jgs 149
246     /**
247 jgs 82 \brief
248     Return the number of data points per sample, and the number of samples as a pair.
249 jgs 121 \param functionSpaceCode Input -
250 jgs 82 */
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 jgs 149
260 jgs 82 /**
261     \brief
262     assigns new location to the domain
263     */
264     virtual void setNewX(const escript::Data& arg);
265 jgs 149
266 jgs 82 /**
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 jgs 149
273 jgs 82 /**
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 jgs 149
281 jgs 82 /**
282     \brief
283 jgs 149 copies the surface normals at data points into out. The actual function space to be considered
284 jgs 82 is defined by out. out has to be defined on this.
285     */
286     virtual void setToNormal(escript::Data& out) const;
287 jgs 149
288 jgs 82 /**
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 jgs 149 /**
310 jgs 102 \brief
311 jgs 150 return the identifier of the matrix type to be used for the global stiffness matrix when a particular solver, package
312 jgs 102 and symmetric matrix is used.
313     \param solver
314     \param symmetry
315     */
316 jgs 150 virtual int getSystemMatrixTypeId(const int solver, const int package, const bool symmetry) const;
317 jgs 102
318 jgs 82 /**
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 jgs 149
325 jgs 82 /**
326     \brief
327 jgs 153 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 jgs 82 */
331 jgs 153 virtual void saveDX(const std::string& filename,const boost::python::dict& arg) const;
332 jgs 149
333 jgs 153
334 jgs 82 /**
335     \brief
336 jgs 153 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 jgs 110 */
340 jgs 153 virtual void saveVTK(const std::string& filename,const boost::python::dict& arg) const;
341 jgs 149
342 jgs 110 /**
343     \brief
344 jgs 82 returns the function space representation of the type functionSpaceCode on this domain
345     as a vtkObject.
346     */
347     // vtkObject createVtkObject(int functionSpaceCode) const;
348 jgs 149
349 jgs 82 /**
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 jgs 102 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 jgs 149
360 jgs 82 /**
361     \brief
362 jgs 102 adds a PDE onto the stiffness matrix mat and a rhs
363 jgs 82 */
364 jgs 102 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 jgs 149
368 jgs 82 /**
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 jgs 102 const int type) const;
378 jgs 82
379 jgs 102 /**
380     \brief returns locations in the FEM nodes
381     */
382     virtual escript::Data getX() const;
383 jgs 149
384 jgs 102 /**
385     \brief return boundary normals at the quadrature point on the face elements
386     */
387     virtual escript::Data getNormal() const;
388 jgs 149
389 jgs 102 /**
390     \brief returns the element size
391     */
392     virtual escript::Data getSize() const;
393    
394 jgs 149 /**
395     \brief comparison operators
396     */
397 jgs 121 virtual bool operator==(const AbstractDomain& other) const;
398     virtual bool operator!=(const AbstractDomain& other) const;
399 jgs 102
400 jgs 82 protected:
401    
402     private:
403 jgs 149
404 jgs 82 //
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 jgs 149
414 jgs 82 #endif

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26