/[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 1059 by gross, Fri Mar 23 11:01:53 2007 UTC revision 2635 by jfenwick, Thu Aug 27 04:54:41 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 74  class MeshAdapter : public escript::Abst Line 78  class MeshAdapter : public escript::Abst
78    static const int DegreesOfFreedom;    static const int DegreesOfFreedom;
79    static const int ReducedDegreesOfFreedom;    static const int ReducedDegreesOfFreedom;
80    static const int Nodes;    static const int Nodes;
81      static const int ReducedNodes;
82    static const int Elements;    static const int Elements;
83    static const int ReducedElements;    static const int ReducedElements;
84    static const int FaceElements;    static const int FaceElements;
# Line 90  class MeshAdapter : public escript::Abst Line 95  class MeshAdapter : public escript::Abst
95    
96       Description:       Description:
97       Constructor for MeshAdapter. The pointer passed to MeshAdapter       Constructor for MeshAdapter. The pointer passed to MeshAdapter
98       is deleted using a call to Finley_Mesh_deallocate in the       is deleted using a call to Finley_Mesh_free in the
99       MeshAdapter destructor.       MeshAdapter destructor.
100    
101       Throws:       Throws:
# Line 99  class MeshAdapter : public escript::Abst Line 104  class MeshAdapter : public escript::Abst
104       \param finleyMesh Input - A pointer to the externally constructed       \param finleyMesh Input - A pointer to the externally constructed
105                                 finley mesh.The pointer passed to MeshAdapter                                 finley mesh.The pointer passed to MeshAdapter
106                                 is deleted using a call to                                 is deleted using a call to
107                                 Finley_Mesh_deallocate in the MeshAdapter                                 Finley_Mesh_free in the MeshAdapter
108                                 destructor.                                 destructor.
109    */    */
110    FINLEY_DLL_API    FINLEY_DLL_API
# Line 115  class MeshAdapter : public escript::Abst Line 120  class MeshAdapter : public escript::Abst
120    /**    /**
121       \brief       \brief
122       Destructor for MeshAdapter. As specified in the constructor       Destructor for MeshAdapter. As specified in the constructor
123       this calls Finley_Mesh_deallocate for the pointer given to the       this calls Finley_Mesh_free for the pointer given to the
124       constructor.       constructor.
125    */    */
126    FINLEY_DLL_API    FINLEY_DLL_API
# Line 123  class MeshAdapter : public escript::Abst Line 128  class MeshAdapter : public escript::Abst
128    
129    /**    /**
130       \brief       \brief
131         return the number of processors used for this domain
132      */
133      FINLEY_DLL_API
134      virtual int getMPISize() const;
135      /**
136         \brief
137         return the number MPI rank of this processor
138      */
139    
140      FINLEY_DLL_API
141      virtual int getMPIRank() const;
142    
143      /**
144         \brief
145         If compiled for MPI then execute an MPI_Barrier, else do nothing
146      */
147    
148      FINLEY_DLL_API
149      virtual void MPIBarrier() const;
150    
151      /**
152         \brief
153         Return true if on MPI processor 0, else false
154      */
155    
156      FINLEY_DLL_API
157      virtual bool onMasterProcessor() const;
158    
159      /**
160         \brief
161       return this as an AbstractContinuousDomain.       return this as an AbstractContinuousDomain.
162    */    */
163    inline const AbstractContinuousDomain& asAbstractContinuousDomain() const    inline const AbstractContinuousDomain& asAbstractContinuousDomain() const
# Line 149  class MeshAdapter : public escript::Abst Line 184  class MeshAdapter : public escript::Abst
184    
185    /**    /**
186       \brief       \brief
187         \param full
188      */
189      FINLEY_DLL_API
190      void Print_Mesh_Info(const bool full=false) const;
191    
192      /**
193         \brief
194         dumps the mesh to a file with the given name.
195         \param fileName Input - The name of the file
196      */
197      FINLEY_DLL_API
198      void dump(const std::string& fileName) const;
199    
200      /**
201         \brief
202       return the pointer to the underlying finley mesh structure       return the pointer to the underlying finley mesh structure
203    */    */
204    FINLEY_DLL_API    FINLEY_DLL_API
# Line 169  class MeshAdapter : public escript::Abst Line 219  class MeshAdapter : public escript::Abst
219       \param functionSpaceType Input - The function space type.       \param functionSpaceType Input - The function space type.
220    */    */
221    FINLEY_DLL_API    FINLEY_DLL_API
222    int* borrowSampleReferenceIDs(int functionSpaceType) const;    const int* borrowSampleReferenceIDs(int functionSpaceType) const;
223    
224    /**    /**
225       \brief       \brief
# Line 209  class MeshAdapter : public escript::Abst Line 259  class MeshAdapter : public escript::Abst
259    
260    /**    /**
261       \brief       \brief
262         Return a continuous on reduced order nodes FunctionSpace code
263      */
264      FINLEY_DLL_API
265      virtual int getReducedContinuousFunctionCode() const;
266    
267      /**
268         \brief
269       Return a function FunctionSpace code       Return a function FunctionSpace code
270    */    */
271    FINLEY_DLL_API    FINLEY_DLL_API
# Line 298  class MeshAdapter : public escript::Abst Line 355  class MeshAdapter : public escript::Abst
355    
356    /**    /**
357       \brief       \brief
358          Returns a status indicator of the domain. The status identifier should be unique over
359          the live time if the object but may be updated if changes to the domain happen, e.g.
360          modifications to its geometry.
361    
362         This has to be implemented by the actual Domain adapter.
363      */
364      FINLEY_DLL_API
365      virtual StatusType getStatus() const;
366    
367    
368      /**
369         \brief
370         Return the number of data points summed across all MPI processes
371      */
372      FINLEY_DLL_API
373      virtual int getNumDataPointsGlobal() const;
374    
375      /**
376         \brief
377       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.
378       \param functionSpaceCode Input -       \param functionSpaceCode Input -
379    */    */
# Line 357  class MeshAdapter : public escript::Abst Line 433  class MeshAdapter : public escript::Abst
433    */    */
434    FINLEY_DLL_API    FINLEY_DLL_API
435    virtual void interpolateOnDomain(escript::Data& target,const escript::Data& source) const;    virtual void interpolateOnDomain(escript::Data& target,const escript::Data& source) const;
436    
437    
438    FINLEY_DLL_API    FINLEY_DLL_API
439    virtual bool probeInterpolationOnDomain(int functionSpaceType_source,int functionSpaceType_target) const;    virtual bool probeInterpolationOnDomain(int functionSpaceType_source,int functionSpaceType_target) const;
440    
441    /**    /**
442        \brief given a vector of FunctionSpace typecodes, pass back a code which then can all be interpolated to.
443        \return true is result is valid, false if not
444      */
445      FINLEY_DLL_API
446      bool
447      commonFunctionSpace(const std::vector<int>& fs, int& resultcode) const;
448    
449      /**
450       \brief       \brief
451       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.
452       has to be implemented by the actual Domain adapter.       has to be implemented by the actual Domain adapter.
453    */    */
454    FINLEY_DLL_API    FINLEY_DLL_API
455    virtual void interpolateACross(escript::Data& target, const escript::Data& source) const;    virtual void interpolateACross(escript::Data& target, const escript::Data& source) const;
456    
457      /**
458      \brief determines whether interpolation from source to target is possible.
459      Must be implemented by the actual Domain adapter
460      */
461    FINLEY_DLL_API    FINLEY_DLL_API
462    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;
463    
464    /**    /**
465       \brief       \brief
# Line 404  class MeshAdapter : public escript::Abst Line 495  class MeshAdapter : public escript::Abst
495    
496    /**    /**
497       \brief       \brief
498       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,
499       and symmetric matrix is used.       and symmetric matrix is used.
500       \param solver       \param solver
501         \param preconditioner
502         \param package
503       \param symmetry       \param symmetry
504    */    */
505    FINLEY_DLL_API    FINLEY_DLL_API
506    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;
507    
508      /**
509         \brief
510         return the identifier of the transport problem type to be used when a particular solver, perconditioner, package
511         and symmetric matrix is used.
512         \param solver
513         \param preconditioner
514         \param package
515         \param symmetry
516      */
517      FINLEY_DLL_API
518      virtual int getTransportTypeId(const int solver, const int preconditioner, const int package, const bool symmetry) const;
519    
520    /**    /**
521       \brief       \brief
# Line 437  class MeshAdapter : public escript::Abst Line 542  class MeshAdapter : public escript::Abst
542       This has to be implemented by the actual Domain adapter.       This has to be implemented by the actual Domain adapter.
543    */    */
544    FINLEY_DLL_API    FINLEY_DLL_API
545    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;
546    
547    /**    /**
548       \brief       \brief
# Line 457  class MeshAdapter : public escript::Abst Line 562  class MeshAdapter : public escript::Abst
562                       const escript::Data& D, const escript::Data& X, const escript::Data& Y,                       const escript::Data& D, const escript::Data& X, const escript::Data& Y,
563                       const escript::Data& d, const escript::Data& y,                       const escript::Data& d, const escript::Data& y,
564                       const escript::Data& d_contact, const escript::Data& y_contact) const;                       const escript::Data& d_contact, const escript::Data& y_contact) const;
565      /**
566         \brief
567         adds a PDE onto the lumped stiffness matrix matrix
568      */
569      FINLEY_DLL_API
570      virtual void addPDEToLumpedSystem(
571                         escript::Data& mat,
572                         const escript::Data& D,
573                         const escript::Data& d) const;
574    
575    /**    /**
576       \brief       \brief
# Line 466  class MeshAdapter : public escript::Abst Line 580  class MeshAdapter : public escript::Abst
580    virtual void addPDEToRHS(escript::Data& rhs,    virtual void addPDEToRHS(escript::Data& rhs,
581                       const escript::Data& X, const escript::Data& Y,                       const escript::Data& X, const escript::Data& Y,
582                       const escript::Data& y, const escript::Data& y_contact) const;                       const escript::Data& y, const escript::Data& y_contact) const;
583      /**
584         \brief
585         adds a PDE onto a transport problem
586      */
587    
588      FINLEY_DLL_API
589      virtual void addPDEToTransportProblem(
590                         TransportProblemAdapter& tp, escript::Data& source,
591                         const escript::Data& M,
592                         const escript::Data& A, const escript::Data& B, const escript::Data& C,const  escript::Data& D,
593                         const  escript::Data& X,const  escript::Data& Y,
594                         const escript::Data& d, const escript::Data& y,
595                         const escript::Data& d_contact,const escript::Data& y_contact) const;
596    
597    
598    /**    /**
599       \brief       \brief
600      creates a SystemMatrixAdapter stiffness matrix an initializes it with zeros:      creates a SystemMatrixAdapter stiffness matrix and initializes it with zeros:
601    */    */
602    FINLEY_DLL_API    FINLEY_DLL_API
603    SystemMatrixAdapter newSystemMatrix(    SystemMatrixAdapter newSystemMatrix(
# Line 478  class MeshAdapter : public escript::Abst Line 606  class MeshAdapter : public escript::Abst
606                        const int column_blocksize,                        const int column_blocksize,
607                        const escript::FunctionSpace& column_functionspace,                        const escript::FunctionSpace& column_functionspace,
608                        const int type) const;                        const int type) const;
609      /**
610       \brief
611        creates a TransportProblemAdapter
612    
613      */
614    
615      FINLEY_DLL_API
616      TransportProblemAdapter newTransportProblem(
617                          const double theta,
618                          const int blocksize,
619                          const escript::FunctionSpace& functionspace,
620                          const int type) const;
621    
622    /**    /**
623       \brief returns locations in the FEM nodes       \brief returns locations in the FEM nodes
# Line 501  class MeshAdapter : public escript::Abst Line 641  class MeshAdapter : public escript::Abst
641       \brief comparison operators       \brief comparison operators
642    */    */
643    FINLEY_DLL_API    FINLEY_DLL_API
644    virtual bool operator==(const AbstractDomain& other) const;    virtual bool operator==(const escript::AbstractDomain& other) const;
645    FINLEY_DLL_API    FINLEY_DLL_API
646    virtual bool operator!=(const AbstractDomain& other) const;    virtual bool operator!=(const escript::AbstractDomain& other) const;
647    
648    /**    /**
649       \brief assigns new tag newTag to all samples of functionspace with a positive       \brief assigns new tag newTag to all samples of functionspace with a positive
# Line 513  class MeshAdapter : public escript::Abst Line 653  class MeshAdapter : public escript::Abst
653    FINLEY_DLL_API    FINLEY_DLL_API
654    virtual void setTags(const int functionSpaceType, const int newTag, const escript::Data& mask) const;    virtual void setTags(const int functionSpaceType, const int newTag, const escript::Data& mask) const;
655    
656      /**
657          \brief
658              return the number of tags in use and a pointer to an array with the number of tags in use
659      */
660      FINLEY_DLL_API
661      virtual int getNumberOfTagsInUse(int functionSpaceCode) const;
662    
663      FINLEY_DLL_API
664      virtual const int* borrowListOfTagsInUse(int functionSpaceCode) const;
665    
666    
667      /**
668         \brief Checks if this domain allows tags for the specified functionSpaceCode.
669      */
670      FINLEY_DLL_API
671      virtual
672      bool canTag(int functionSpaceCode) const;
673    
674    
675   protected:   protected:
676    
677   private:   private:
678      void extractArgsFromDict(const boost::python::dict& arg, int& numData,
679                                 char**& names, escriptDataC*& data,
680                                 escriptDataC**& dataPtr) const;
681    
682    //    //
683    // pointer to the externally created finley mesh    // pointer to the externally created finley mesh

Legend:
Removed from v.1059  
changed lines
  Added in v.2635

  ViewVC Help
Powered by ViewVC 1.1.26