SundanceHNMesher2D.hpp
Go to the documentation of this file.
00001 /* @HEADER@ */
00002 // ************************************************************************
00003 //
00004 //                              Sundance
00005 //                 Copyright (2005) Sandia Corporation
00006 //
00007 // Copyright (year first published) Sandia Corporation.  Under the terms
00008 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
00009 // retains certain rights in this software.
00010 //
00011 // This library is free software; you can redistribute it and/or modify
00012 // it under the terms of the GNU Lesser General Public License as
00013 // published by the Free Software Foundation; either version 2.1 of the
00014 // License, or (at your option) any later version.
00015 //
00016 // This library is distributed in the hope that it will be useful, but
00017 // WITHOUT ANY WARRANTY; without even the implied warranty of
00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019 // Lesser General Public License for more details.
00020 //
00021 // You should have received a copy of the GNU Lesser General Public
00022 // License along with this library; if not, write to the Free Software
00023 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00024 // USA
00025 // Questions? Contact Kevin Long (krlong@sandia.gov),
00026 // Sandia National Laboratories, Livermore, California, USA
00027 //
00028 // ************************************************************************
00029 /* @HEADER@ */
00030 
00031 #ifndef SUNDANCE_HNMESHER2D_H_
00032 #define SUNDANCE_HNMESHER2D_H_
00033 
00034 #include "SundanceDefs.hpp"
00035 #include "SundanceMeshSourceBase.hpp"
00036 #include "SundanceHNMesh2D.hpp"
00037 #include "SundanceRefinementBase.hpp"
00038 #include "SundanceRefinementClass.hpp"
00039 #include "SundanceDomainDefinition.hpp"
00040 
00041 namespace Sundance
00042 {
00043 /** forward declaration */
00044 class RefinementClass;
00045 class MeshDomainDef;
00046 
00047 class HNMesher2D : public MeshSourceBase
00048 {
00049 public:
00050   /**     */
00051   HNMesher2D(
00052     double position_x, double position_y,
00053     double offset_x , double offset_y,
00054     int resolution_x , int resolution_y ,
00055     const MeshType& meshType,
00056     const MPIComm& comm = MPIComm::world())
00057     :
00058     MeshSourceBase(meshType, 0, comm),
00059     _position_x(position_x), _position_y(position_y),
00060     _offset_x(offset_x), _offset_y(offset_y),
00061     _resolution_x(resolution_x) , _resolution_y(resolution_y) ,
00062     refineClass_(dummyRefineClass_) ,
00063     meshDomain_(dummyMeshDomain_) {;}
00064 
00065   /**     */
00066   HNMesher2D(
00067     double position_x, double position_y,
00068     double offset_x , double offset_y,
00069     int resolution_x , int resolution_y ,
00070     const MeshType& meshType,
00071     const RefinementClass& refineClass ,
00072     const MPIComm& comm = MPIComm::world())
00073     :
00074     MeshSourceBase(meshType, 0, comm),
00075     _position_x(position_x), _position_y(position_y),
00076     _offset_x(offset_x), _offset_y(offset_y),
00077     _resolution_x(resolution_x) , _resolution_y(resolution_y) ,
00078     refineClass_(refineClass) ,
00079     meshDomain_(dummyMeshDomain_) {;}
00080 
00081   /**     */
00082   HNMesher2D(
00083     double position_x, double position_y,
00084     double offset_x , double offset_y,
00085     int resolution_x , int resolution_y ,
00086     const MeshType& meshType,
00087     const MeshDomainDef& meshDomain ,
00088     const MPIComm& comm = MPIComm::world())
00089     :
00090     MeshSourceBase(meshType, 0, comm),
00091     _position_x(position_x), _position_y(position_y),
00092     _offset_x(offset_x), _offset_y(offset_y),
00093     _resolution_x(resolution_x) , _resolution_y(resolution_y) ,
00094     refineClass_(dummyRefineClass_) ,
00095     meshDomain_(meshDomain) {;}
00096 
00097   /**     */
00098   HNMesher2D(
00099     double position_x, double position_y,
00100     double offset_x , double offset_y,
00101     int resolution_x , int resolution_y ,
00102     const MeshType& meshType,
00103     const RefinementClass& refineClass ,
00104     const MeshDomainDef& meshDomain ,
00105     const MPIComm& comm = MPIComm::world())
00106     :
00107     MeshSourceBase(meshType, 0, comm),
00108     _position_x(position_x), _position_y(position_y),
00109     _offset_x(offset_x), _offset_y(offset_y),
00110     _resolution_x(resolution_x) , _resolution_y(resolution_y) ,
00111     refineClass_(refineClass) ,
00112     meshDomain_(meshDomain) {;}
00113 
00114   /** Create a rectangle mesher from a ParameterList */
00115   HNMesher2D(const ParameterList& params);
00116 
00117   /** */
00118   virtual ~HNMesher2D() {;}
00119 
00120   /** Print a short descriptive std::string */
00121   virtual std::string description() const
00122     {return "HNMesher2D[pos x =" + Teuchos::toString(_position_x)
00123         + ", pos y=" + Teuchos::toString(_position_y)
00124         + ", offset x=" + Teuchos::toString(_offset_x) +
00125         + ", offset y=" + Teuchos::toString(_offset_y)
00126         + ", resolution_x=" + Teuchos::toString(_resolution_x)
00127         + ", resolution_y=" + Teuchos::toString(_resolution_y)+"]";}
00128 
00129 
00130   /** Return a ref count pointer to self */
00131   virtual RCP<MeshSourceBase> getRcp() {return rcp(this);}
00132 
00133 
00134 protected:
00135 
00136   /** The method which all Mesher should have */
00137   virtual Mesh fillMesh() const ;
00138 
00139 private:
00140 
00141   /** X coordinate of the origin point (lower left)*/
00142   double _position_x;
00143   /** Y coordinate of the origin point (lower left)*/
00144   double _position_y;
00145   /** offset (length) of the grid in the X direction*/
00146   double _offset_x;
00147   /** offset (length) of the grid in the Y direction*/
00148   double _offset_y;
00149   /** On the coarse level the resolution on the X axis */
00150   int _resolution_x;
00151   /** On the coarse level the resolution on the Y axis */
00152   int _resolution_y;
00153 
00154   /** refinement class */
00155   const RefinementClass refineClass_;
00156 
00157   /** mesh domain (which must not coincide with the whole mesh)*/
00158   const MeshDomainDef meshDomain_;
00159 
00160 
00161   /** static dummy class if the user does not provide refinement class */
00162   static const RefinementClass dummyRefineClass_;
00163 
00164   /** static domain class if the user does not provide one */
00165   static const MeshDomainDef dummyMeshDomain_;
00166 };
00167 }
00168 #endif /* SUNDANCE_HNMESHER2D_H_ */

Site Contact