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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 757 by woo409, Mon Jun 26 13:12:56 2006 UTC revision 2751 by caltinay, Wed Nov 18 00:30:47 2009 UTC
# Line 1  Line 1 
1  // $Id$  
2  /*  /*******************************************************
3   ************************************************************  *
4   *          Copyright 2006 by ACcESS MNRF                   *  * Copyright (c) 2003-2009 by University of Queensland
5   *                                                          *  * Earth Systems Science Computational Center (ESSCC)
6   *              http://www.access.edu.au                    *  * http://www.uq.edu.au/esscc
7   *       Primary Business: Queensland, Australia            *  *
8   *  Licensed under the Open Software License version 3.0    *  * Primary Business: Queensland, Australia
9   *     http://www.opensource.org/licenses/osl-3.0.php       *  * Licensed under the Open Software License version 3.0
10   *                                                          *  * http://www.opensource.org/licenses/osl-3.0.php
11   ************************************************************  *
12  */  *******************************************************/
13                                                                              
14    
15  #if !defined finley_MeshAdapter_20040526_H  #if !defined finley_MeshAdapter_20040526_H
16  #define finley_MeshAdapter_20040526_H  #define finley_MeshAdapter_20040526_H
17  #include "system_dep.h"  #include "system_dep.h"
# Line 20  extern "C" { Line 21  extern "C" {
21  #include "../Finley.h"  #include "../Finley.h"
22  #include "../Assemble.h"  #include "../Assemble.h"
23  #include "paso/SystemMatrix.h"  #include "paso/SystemMatrix.h"
24    #include "paso/SolverFCT.h"
25    #include "paso/Paso_MPI.h"
26  }  }
27    
28  #include "FinleyError.h"  #include "FinleyError.h"
29  #include "FinleyAdapterException.h"  #include "FinleyAdapterException.h"
30    
31  #include "SystemMatrixAdapter.h"  #include "SystemMatrixAdapter.h"
32    #include "TransportProblemAdapter.h"
33  #include "escript/AbstractContinuousDomain.h"  #include "escript/AbstractContinuousDomain.h"
34  #include "escript/FunctionSpace.h"  #include "escript/FunctionSpace.h"
35  #include "escript/FunctionSpaceFactory.h"  #include "escript/FunctionSpaceFactory.h"
# Line 39  extern "C" { Line 43  extern "C" {
43  #include <string>  #include <string>
44  #include <sstream>  #include <sstream>
45    
 //  
 // forward declarations  
 class Data;  
   
 //using namespace escript;  
   
46  namespace finley {  namespace finley {
47    
48  struct null_deleter  struct null_deleter
# Line 74  class MeshAdapter : public escript::Abst Line 72  class MeshAdapter : public escript::Abst
72    static const int DegreesOfFreedom;    static const int DegreesOfFreedom;
73    static const int ReducedDegreesOfFreedom;    static const int ReducedDegreesOfFreedom;
74    static const int Nodes;    static const int Nodes;
75      static const int ReducedNodes;
76    static const int Elements;    static const int Elements;
77      static const int ReducedElements;
78    static const int FaceElements;    static const int FaceElements;
79      static const int ReducedFaceElements;
80    static const int Points;    static const int Points;
81    static const int ContactElementsZero;    static const int ContactElementsZero;
82      static const int ReducedContactElementsZero;
83    static const int ContactElementsOne;    static const int ContactElementsOne;
84      static const int ReducedContactElementsOne;
85    
86    /**    /**
87       \brief       \brief
# Line 86  class MeshAdapter : public escript::Abst Line 89  class MeshAdapter : public escript::Abst
89    
90       Description:       Description:
91       Constructor for MeshAdapter. The pointer passed to MeshAdapter       Constructor for MeshAdapter. The pointer passed to MeshAdapter
92       is deleted using a call to Finley_Mesh_deallocate in the       is deleted using a call to Finley_Mesh_free in the
93       MeshAdapter destructor.       MeshAdapter destructor.
94    
95       Throws:       Throws:
# Line 95  class MeshAdapter : public escript::Abst Line 98  class MeshAdapter : public escript::Abst
98       \param finleyMesh Input - A pointer to the externally constructed       \param finleyMesh Input - A pointer to the externally constructed
99                                 finley mesh.The pointer passed to MeshAdapter                                 finley mesh.The pointer passed to MeshAdapter
100                                 is deleted using a call to                                 is deleted using a call to
101                                 Finley_Mesh_deallocate in the MeshAdapter                                 Finley_Mesh_free in the MeshAdapter
102                                 destructor.                                 destructor.
103    */    */
104    FINLEY_DLL_API    FINLEY_DLL_API
# Line 111  class MeshAdapter : public escript::Abst Line 114  class MeshAdapter : public escript::Abst
114    /**    /**
115       \brief       \brief
116       Destructor for MeshAdapter. As specified in the constructor       Destructor for MeshAdapter. As specified in the constructor
117       this calls Finley_Mesh_deallocate for the pointer given to the       this calls Finley_Mesh_free for the pointer given to the
118       constructor.       constructor.
119    */    */
120    FINLEY_DLL_API    FINLEY_DLL_API
# Line 119  class MeshAdapter : public escript::Abst Line 122  class MeshAdapter : public escript::Abst
122    
123    /**    /**
124       \brief       \brief
125         return the number of processors used for this domain
126      */
127      FINLEY_DLL_API
128      virtual int getMPISize() const;
129      /**
130         \brief
131         return the number MPI rank of this processor
132      */
133    
134      FINLEY_DLL_API
135      virtual int getMPIRank() const;
136    
137      /**
138         \brief
139         If compiled for MPI then execute an MPI_Barrier, else do nothing
140      */
141    
142      FINLEY_DLL_API
143      virtual void MPIBarrier() const;
144    
145      /**
146         \brief
147         Return true if on MPI processor 0, else false
148      */
149    
150      FINLEY_DLL_API
151      virtual bool onMasterProcessor() const;
152    
153      FINLEY_DLL_API
154    #ifdef PASO_MPI
155      MPI_Comm
156    #else
157      unsigned int
158    #endif
159      getMPIComm() const;
160    
161      /**
162         \brief
163       return this as an AbstractContinuousDomain.       return this as an AbstractContinuousDomain.
164    */    */
165    inline const AbstractContinuousDomain& asAbstractContinuousDomain() const    inline const AbstractContinuousDomain& asAbstractContinuousDomain() const
# Line 145  class MeshAdapter : public escript::Abst Line 186  class MeshAdapter : public escript::Abst
186    
187    /**    /**
188       \brief       \brief
189         \param full
190      */
191      FINLEY_DLL_API
192      void Print_Mesh_Info(const bool full=false) const;
193    
194      /**
195         \brief
196         dumps the mesh to a file with the given name.
197         \param fileName Input - The name of the file
198      */
199      FINLEY_DLL_API
200      void dump(const std::string& fileName) const;
201    
202      /**
203         \brief
204       return the pointer to the underlying finley mesh structure       return the pointer to the underlying finley mesh structure
205    */    */
206    FINLEY_DLL_API    FINLEY_DLL_API
# Line 163  class MeshAdapter : public escript::Abst Line 219  class MeshAdapter : public escript::Abst
219       \brief       \brief
220       Return the reference number of  the given sample number.       Return the reference number of  the given sample number.
221       \param functionSpaceType Input - The function space type.       \param functionSpaceType Input - The function space type.
      \param sampleNo Input - The sample number.  
222    */    */
223    FINLEY_DLL_API    FINLEY_DLL_API
224    int getReferenceNoFromSampleNo(int functionSpaceType, int sampleNo) const;    const int* borrowSampleReferenceIDs(int functionSpaceType) const;
225    
226    /**    /**
227       \brief       \brief
# Line 206  class MeshAdapter : public escript::Abst Line 261  class MeshAdapter : public escript::Abst
261    
262    /**    /**
263       \brief       \brief
264       Return a functon FunctionSpace code       Return a continuous on reduced order nodes FunctionSpace code
265      */
266      FINLEY_DLL_API
267      virtual int getReducedContinuousFunctionCode() const;
268    
269      /**
270         \brief
271         Return a function FunctionSpace code
272    */    */
273    FINLEY_DLL_API    FINLEY_DLL_API
274    virtual int getFunctionCode() const;    virtual int getFunctionCode() const;
275    
276    /**    /**
277       \brief       \brief
278         Return a function with reduced integration order FunctionSpace code
279      */
280      FINLEY_DLL_API
281      virtual int getReducedFunctionCode() const;
282    
283      /**
284         \brief
285       Return a function on boundary FunctionSpace code       Return a function on boundary FunctionSpace code
286    */    */
287    FINLEY_DLL_API    FINLEY_DLL_API
# Line 220  class MeshAdapter : public escript::Abst Line 289  class MeshAdapter : public escript::Abst
289    
290    /**    /**
291       \brief       \brief
292         Return a function on boundary with reduced integration order FunctionSpace code
293      */
294      FINLEY_DLL_API
295      virtual int getReducedFunctionOnBoundaryCode() const;
296    
297      /**
298         \brief
299       Return a FunctionOnContactZero code       Return a FunctionOnContactZero code
300    */    */
301    FINLEY_DLL_API    FINLEY_DLL_API
# Line 227  class MeshAdapter : public escript::Abst Line 303  class MeshAdapter : public escript::Abst
303    
304    /**    /**
305       \brief       \brief
306         Return a FunctionOnContactZero code  with reduced integration order
307      */
308      FINLEY_DLL_API
309      virtual int getReducedFunctionOnContactZeroCode() const;
310    
311      /**
312         \brief
313       Return a FunctionOnContactOne code       Return a FunctionOnContactOne code
314    */    */
315    FINLEY_DLL_API    FINLEY_DLL_API
# Line 234  class MeshAdapter : public escript::Abst Line 317  class MeshAdapter : public escript::Abst
317    
318    /**    /**
319       \brief       \brief
320         Return a FunctionOnContactOne code  with reduced integration order
321      */
322      FINLEY_DLL_API
323      virtual int getReducedFunctionOnContactOneCode() const;
324    
325      /**
326         \brief
327       Return a Solution code       Return a Solution code
328    */    */
329    FINLEY_DLL_API    FINLEY_DLL_API
# Line 254  class MeshAdapter : public escript::Abst Line 344  class MeshAdapter : public escript::Abst
344    virtual int getDiracDeltaFunctionCode() const;    virtual int getDiracDeltaFunctionCode() const;
345    
346    /**    /**
347             5B
348       \brief       \brief
349    */    */
350    typedef std::map<int, std::string> FunctionSpaceNamesMapType;    typedef std::map<int, std::string> FunctionSpaceNamesMapType;
# Line 266  class MeshAdapter : public escript::Abst Line 357  class MeshAdapter : public escript::Abst
357    
358    /**    /**
359       \brief       \brief
360          Returns a status indicator of the domain. The status identifier should be unique over
361          the live time if the object but may be updated if changes to the domain happen, e.g.
362          modifications to its geometry.
363    
364         This has to be implemented by the actual Domain adapter.
365      */
366      FINLEY_DLL_API
367      virtual StatusType getStatus() const;
368    
369    
370      /**
371         \brief
372         Return the number of data points summed across all MPI processes
373      */
374      FINLEY_DLL_API
375      virtual int getNumDataPointsGlobal() const;
376    
377      /**
378         \brief
379       Return the number of data points per sample, and the number of samples as a pair.       Return the number of data points per sample, and the number of samples as a pair.
380       \param functionSpaceCode Input -       \param functionSpaceCode Input -
381    */    */
# Line 282  class MeshAdapter : public escript::Abst Line 392  class MeshAdapter : public escript::Abst
392    
393    /**    /**
394       \brief       \brief
395         sets a map from a clear tag name to a tag key
396         \param name Input - tag name.
397         \param tag Input - tag key.
398      */
399      FINLEY_DLL_API
400      virtual void setTagMap(const std::string& name,  int tag);
401    
402      /**
403         \brief
404         Return the tag key for tag name.
405         \param name Input - tag name
406      */
407      FINLEY_DLL_API
408      virtual int getTag(const std::string& name) const;
409    
410      /**
411         \brief
412         Returns true if name is a defined tage name.
413         \param name Input - tag name to be checked.
414      */
415      FINLEY_DLL_API
416      virtual bool isValidTagName(const std::string& name) const;
417    
418      /**
419         \brief
420         Returns all tag names in a single string sperated by commas
421      */
422      FINLEY_DLL_API
423      virtual std::string showTagNames() const;
424    
425      /**
426         \brief
427       assigns new location to the domain       assigns new location to the domain
428    */    */
429    FINLEY_DLL_API    FINLEY_DLL_API
# Line 293  class MeshAdapter : public escript::Abst Line 435  class MeshAdapter : public escript::Abst
435    */    */
436    FINLEY_DLL_API    FINLEY_DLL_API
437    virtual void interpolateOnDomain(escript::Data& target,const escript::Data& source) const;    virtual void interpolateOnDomain(escript::Data& target,const escript::Data& source) const;
438    
439    
440    FINLEY_DLL_API    FINLEY_DLL_API
441    virtual bool probeInterpolationOnDomain(int functionSpaceType_source,int functionSpaceType_target) const;    virtual bool probeInterpolationOnDomain(int functionSpaceType_source,int functionSpaceType_target) const;
442    
443    /**    /**
444        \brief given a vector of FunctionSpace typecodes, pass back a code which then can all be interpolated to.
445        \return true is result is valid, false if not
446      */
447      FINLEY_DLL_API
448      bool
449      commonFunctionSpace(const std::vector<int>& fs, int& resultcode) const;
450    
451      /**
452       \brief       \brief
453       interpolates data given on source onto target where source and target are given on different domains.       interpolates data given on source onto target where source and target are given on different domains.
454       has to be implemented by the actual Domain adapter.       has to be implemented by the actual Domain adapter.
455    */    */
456    FINLEY_DLL_API    FINLEY_DLL_API
457    virtual void interpolateACross(escript::Data& target, const escript::Data& source) const;    virtual void interpolateACross(escript::Data& target, const escript::Data& source) const;
458    
459      /**
460      \brief determines whether interpolation from source to target is possible.
461      Must be implemented by the actual Domain adapter
462      */
463    FINLEY_DLL_API    FINLEY_DLL_API
464    virtual bool probeInterpolationACross(int functionSpaceType_source,const AbstractDomain& targetDomain, int functionSpaceType_target) const;    virtual bool probeInterpolationACross(int functionSpaceType_source,const escript::AbstractDomain& targetDomain, int functionSpaceType_target) const;
465    
466    /**    /**
467       \brief       \brief
# Line 340  class MeshAdapter : public escript::Abst Line 497  class MeshAdapter : public escript::Abst
497    
498    /**    /**
499       \brief       \brief
500       return the identifier of the matrix type to be used for the global stiffness matrix when a particular solver, package       return the identifier of the matrix type to be used for the global stiffness matrix when a particular solver, package, perconditioner,
501       and symmetric matrix is used.       and symmetric matrix is used.
502       \param solver       \param solver
503         \param preconditioner
504         \param package
505       \param symmetry       \param symmetry
506    */    */
507    FINLEY_DLL_API    FINLEY_DLL_API
508    virtual int getSystemMatrixTypeId(const int solver, const int package, const bool symmetry) const;    virtual int getSystemMatrixTypeId(const int solver, const int preconditioner, const int package, const bool symmetry) const;
509    
510      /**
511         \brief
512         return the identifier of the transport problem type to be used when a particular solver, perconditioner, package
513         and symmetric matrix is used.
514         \param solver
515         \param preconditioner
516         \param package
517         \param symmetry
518      */
519      FINLEY_DLL_API
520      virtual int getTransportTypeId(const int solver, const int preconditioner, const int package, const bool symmetry) const;
521    
522    /**    /**
523       \brief       \brief
# Line 373  class MeshAdapter : public escript::Abst Line 544  class MeshAdapter : public escript::Abst
544       This has to be implemented by the actual Domain adapter.       This has to be implemented by the actual Domain adapter.
545    */    */
546    FINLEY_DLL_API    FINLEY_DLL_API
547    virtual void saveVTK(const std::string& filename,const boost::python::dict& arg) const;    virtual void saveVTK(const std::string& filename,const boost::python::dict& arg,  const std::string& metadata, const std::string& metadata_schema) const;
548    
549      FINLEY_DLL_API
550      virtual bool ownSample(int fs_code, index_t id) const;
551    
552    /**    /**
553       \brief       \brief
# Line 393  class MeshAdapter : public escript::Abst Line 567  class MeshAdapter : public escript::Abst
567                       const escript::Data& D, const escript::Data& X, const escript::Data& Y,                       const escript::Data& D, const escript::Data& X, const escript::Data& Y,
568                       const escript::Data& d, const escript::Data& y,                       const escript::Data& d, const escript::Data& y,
569                       const escript::Data& d_contact, const escript::Data& y_contact) const;                       const escript::Data& d_contact, const escript::Data& y_contact) const;
570      /**
571         \brief
572         adds a PDE onto the lumped stiffness matrix matrix
573      */
574      FINLEY_DLL_API
575      virtual void addPDEToLumpedSystem(
576                         escript::Data& mat,
577                         const escript::Data& D,
578                         const escript::Data& d) const;
579    
580    /**    /**
581       \brief       \brief
# Line 402  class MeshAdapter : public escript::Abst Line 585  class MeshAdapter : public escript::Abst
585    virtual void addPDEToRHS(escript::Data& rhs,    virtual void addPDEToRHS(escript::Data& rhs,
586                       const escript::Data& X, const escript::Data& Y,                       const escript::Data& X, const escript::Data& Y,
587                       const escript::Data& y, const escript::Data& y_contact) const;                       const escript::Data& y, const escript::Data& y_contact) const;
588      /**
589         \brief
590         adds a PDE onto a transport problem
591      */
592    
593      FINLEY_DLL_API
594      virtual void addPDEToTransportProblem(
595                         TransportProblemAdapter& tp, escript::Data& source,
596                         const escript::Data& M,
597                         const escript::Data& A, const escript::Data& B, const escript::Data& C,const  escript::Data& D,
598                         const  escript::Data& X,const  escript::Data& Y,
599                         const escript::Data& d, const escript::Data& y,
600                         const escript::Data& d_contact,const escript::Data& y_contact) const;
601    
602    
603    /**    /**
604       \brief       \brief
605      creates a SystemMatrixAdapter stiffness matrix an initializes it with zeros:      creates a SystemMatrixAdapter stiffness matrix and initializes it with zeros:
606    */    */
607    FINLEY_DLL_API    FINLEY_DLL_API
608    SystemMatrixAdapter newSystemMatrix(    SystemMatrixAdapter newSystemMatrix(
# Line 414  class MeshAdapter : public escript::Abst Line 611  class MeshAdapter : public escript::Abst
611                        const int column_blocksize,                        const int column_blocksize,
612                        const escript::FunctionSpace& column_functionspace,                        const escript::FunctionSpace& column_functionspace,
613                        const int type) const;                        const int type) const;
614      /**
615       \brief
616        creates a TransportProblemAdapter
617    
618      */
619    
620      FINLEY_DLL_API
621      TransportProblemAdapter newTransportProblem(
622                          const double theta,
623                          const int blocksize,
624                          const escript::FunctionSpace& functionspace,
625                          const int type) const;
626    
627    /**    /**
628       \brief returns locations in the FEM nodes       \brief returns locations in the FEM nodes
# Line 437  class MeshAdapter : public escript::Abst Line 646  class MeshAdapter : public escript::Abst
646       \brief comparison operators       \brief comparison operators
647    */    */
648    FINLEY_DLL_API    FINLEY_DLL_API
649    virtual bool operator==(const AbstractDomain& other) const;    virtual bool operator==(const escript::AbstractDomain& other) const;
650      FINLEY_DLL_API
651      virtual bool operator!=(const escript::AbstractDomain& other) const;
652    
653      /**
654         \brief assigns new tag newTag to all samples of functionspace with a positive
655         value of mask for any its sample point.
656    
657      */
658      FINLEY_DLL_API
659      virtual void setTags(const int functionSpaceType, const int newTag, const escript::Data& mask) const;
660    
661      /**
662          \brief
663              return the number of tags in use and a pointer to an array with the number of tags in use
664      */
665      FINLEY_DLL_API
666      virtual int getNumberOfTagsInUse(int functionSpaceCode) const;
667    
668      FINLEY_DLL_API
669      virtual const int* borrowListOfTagsInUse(int functionSpaceCode) const;
670    
671    
672      /**
673         \brief Checks if this domain allows tags for the specified functionSpaceCode.
674      */
675    FINLEY_DLL_API    FINLEY_DLL_API
676    virtual bool operator!=(const AbstractDomain& other) const;    virtual
677      bool canTag(int functionSpaceCode) const;
678    
679    
680   protected:   protected:
681    
682   private:   private:
683      void extractArgsFromDict(const boost::python::dict& arg, int& numData,
684                                 char**& names, escriptDataC*& data,
685                                 escriptDataC**& dataPtr) const;
686    
687    //    //
688    // pointer to the externally created finley mesh    // pointer to the externally created finley mesh

Legend:
Removed from v.757  
changed lines
  Added in v.2751

  ViewVC Help
Powered by ViewVC 1.1.26