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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 97 - (hide annotations)
Tue Dec 14 05:39:33 2004 UTC (14 years, 3 months ago) by jgs
Original Path: trunk/esys2/finley/src/CPPAdapter/MeshAdapter.h
File MIME type: text/plain
File size: 10929 byte(s)
*** empty log message ***

1 jgs 97 // $Id$
2 jgs 82 /*
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     Returns true if the given integer is a valid function space type
131     for this domain.
132     */
133     virtual bool isValidFunctionSpaceType(int functionSpaceType) const;
134     /**
135     \brief
136     Return a description for this domain
137     */
138     virtual std::string getDescription() const;
139     /**
140     \brief
141     Return a description for the given function space type code
142     */
143     virtual std::string functionSpaceTypeAsString(int functionSpaceType) const;
144     /**
145     \brief
146     Return the tag key for the given sample number.
147     \param functionSpaceType Input - The function space type.
148     \param sampleNo Input - The sample number.
149     */
150     virtual int getTagFromSampleNo(int functionSpaceType, int sampleNo) const;
151     /**
152     \brief
153     Build the table of function space type names
154     */
155     void setFunctionSpaceTypeNames();
156     /**
157     \brief
158     Return a continuous FunctionSpace code
159     */
160     virtual int getContinuousFunctionCode() const;
161     /**
162     \brief
163     Return a functon FunctionSpace code
164     */
165     virtual int getFunctionCode() const;
166     /**
167     \brief
168     Return a function on boundary FunctionSpace code
169     */
170     virtual int getFunctionOnBoundaryCode() const;
171     /**
172     \brief
173     Return a FunctionOnContactZero code
174     */
175     virtual int getFunctionOnContactZeroCode() const;
176     /**
177     \brief
178     Return a FunctionOnContactOne code
179     */
180     virtual int getFunctionOnContactOneCode() const;
181     /**
182     \brief
183     Return a Solution code
184     */
185     virtual int getSolutionCode() const;
186     /**
187     \brief
188     Return a ReducedSolution code
189     */
190     virtual int getReducedSolutionCode() const;
191     /**
192     \brief
193     Return a DiracDeltaFunction code
194     */
195     virtual int getDiracDeltaFunctionCode() const;
196     //
197     //
198     typedef std::map<int, std::string> FunctionSpaceNamesMapType;
199     /**
200     \brief
201     */
202     virtual int getDim() const;
203     /**
204     \brief
205     Return the number of data points per sample, and the number of samples as a pair.
206     \param functionSpace Input -
207     */
208     virtual std::pair<int,int> getDataShape(int functionSpaceCode) const;
209    
210     /**
211     \brief
212     copies the location of data points into arg. The domain of arg has to match this.
213     has to be implemented by the actual Domain adapter.
214     */
215     virtual void setToX(escript::Data& arg) const;
216     /**
217     \brief
218     assigns new location to the domain
219     */
220     virtual void setNewX(const escript::Data& arg);
221     /**
222     \brief
223     interpolates data given on source onto target where source and target have to be given on the same domain.
224     */
225     virtual void interpolateOnDomain(escript::Data& target,const escript::Data& source) const;
226     virtual bool probeInterpolationOnDomain(int functionSpaceType_source,int functionSpaceType_target) const;
227     /**
228     \brief
229     interpolates data given on source onto target where source and target are given on different domains.
230     has to be implemented by the actual Domain adapter.
231     */
232     virtual void interpolateACross(escript::Data& target, const escript::Data& source) const;
233     virtual bool probeInterpolationACross(int functionSpaceType_source,const AbstractDomain& targetDomain, int functionSpaceType_target) const;
234     /**
235     \brief
236     copies the surface normals at data points into out. The actual function space to be considered
237     is defined by out. out has to be defined on this.
238     */
239     virtual void setToNormal(escript::Data& out) const;
240     /**
241     \brief
242     copies the size of samples into out. The actual function space to be considered
243     is defined by out. out has to be defined on this.
244     */
245     virtual void setToSize(escript::Data& out) const;
246    
247     /**
248     \brief
249     copies the gradient of arg into grad. The actual function space to be considered
250     for the gradient is defined by grad. arg and grad have to be defined on this.
251     */
252     virtual void setToGradient(escript::Data& grad,const escript::Data& arg) const;
253    
254     /**
255     \brief
256     copies the integrals of the function defined by arg into integrals.
257     arg has to be defined on this.
258     */
259     virtual void setToIntegrals(std::vector<double>& integrals,const escript::Data& arg) const;
260    
261 jgs 97 /**
262     \brief
263     return the identifier of the matrix type to be used for the global stiffness matrix when a particular solver, preconditioner
264     and symmetric matrix is used.
265     \param solver
266     \param symmetry
267     */
268     virtual int getSystemMatrixTypeId(const int solver, const bool symmetry) const;
269    
270 jgs 82 /**
271     \brief
272     returns true if data on this domain and a function space of type functionSpaceCode has to
273     considered as cell centered data.
274     */
275     virtual bool isCellOriented(int functionSpaceCode) const;
276     /**
277     \brief
278     saves data arg to a OpenDX input file.
279     considered as cell centered data.
280     */
281     virtual void saveDX(const std::string& filename,const escript::Data& arg) const;
282     /**
283     \brief
284     returns the function space representation of the type functionSpaceCode on this domain
285     as a vtkObject.
286     */
287     // vtkObject createVtkObject(int functionSpaceCode) const;
288     /**
289     \brief
290     adds a PDE onto the stiffness matrix mat and a rhs
291     */
292     virtual void addPDEToSystem(
293     SystemMatrixAdapter& mat, escript::Data& rhs,
294     const escript::Data& A, const escript::Data& B, const escript::Data& C,
295 jgs 97 const escript::Data& D, const escript::Data& X, const escript::Data& Y,
296     const escript::Data& d, const escript::Data& y,
297     const escript::Data& d_contact, const escript::Data& y_contact) const;
298 jgs 82 /**
299     \brief
300 jgs 97 adds a PDE onto the stiffness matrix mat and a rhs
301 jgs 82 */
302 jgs 97 virtual void addPDEToRHS(escript::Data& rhs,
303     const escript::Data& X, const escript::Data& Y,
304     const escript::Data& y, const escript::Data& y_contact) const;
305 jgs 82 /**
306     \brief
307     creates a SystemMatrixAdapter stiffness matrix an initializes it with zeros:
308     */
309     SystemMatrixAdapter newSystemMatrix(
310     const int row_blocksize,
311     const escript::FunctionSpace& row_functionspace,
312     const int column_blocksize,
313     const escript::FunctionSpace& column_functionspace,
314 jgs 97 const int type) const;
315 jgs 82
316 jgs 97 /**
317     \brief returns locations in the FEM nodes
318     */
319     virtual escript::Data getX() const;
320     /**
321     \brief return boundary normals at the quadrature point on the face elements
322     */
323     virtual escript::Data getNormal() const;
324     /**
325     \brief returns the element size
326     */
327     virtual escript::Data getSize() const;
328    
329    
330 jgs 82 // `virtual bool operator==(const escript::AbstractDomain& other) const;
331     bool operator==(const MeshAdapter& other) const;
332     bool operator!=(const MeshAdapter& other) const;
333 jgs 97
334 jgs 82 protected:
335    
336     private:
337     //
338     // pointer to the externally created finley mesh
339     boost::shared_ptr<Finley_Mesh> m_finleyMesh;
340    
341     static FunctionSpaceNamesMapType m_functionSpaceTypeNames;
342    
343     };
344    
345     } // end of namespace
346     #endif

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26