SundanceHNMesher2D.hpp
Go to the documentation of this file.
00001 /* @HEADER@ */
00002 // ************************************************************************
00003 // 
00004 //                             Sundance
00005 //                 Copyright 2011 Sandia Corporation
00006 // 
00007 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00008 // the U.S. Government retains certain rights in this software.
00009 //
00010 // Redistribution and use in source and binary forms, with or without
00011 // modification, are permitted provided that the following conditions are
00012 // met:
00013 //
00014 // 1. Redistributions of source code must retain the above copyright
00015 // notice, this list of conditions and the following disclaimer.
00016 //
00017 // 2. Redistributions in binary form must reproduce the above copyright
00018 // notice, this list of conditions and the following disclaimer in the
00019 // documentation and/or other materials provided with the distribution.
00020 //
00021 // 3. Neither the name of the Corporation nor the names of the
00022 // contributors may be used to endorse or promote products derived from
00023 // this software without specific prior written permission.
00024 //
00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00036 //
00037 // Questions? Contact Kevin Long (kevin.long@ttu.edu)
00038 // 
00039 
00040 /* @HEADER@ */
00041 
00042 #ifndef SUNDANCE_HNMESHER2D_H_
00043 #define SUNDANCE_HNMESHER2D_H_
00044 
00045 #include "SundanceDefs.hpp"
00046 #include "SundanceMeshSourceBase.hpp"
00047 #include "SundanceHNMesh2D.hpp"
00048 #include "SundanceRefinementBase.hpp"
00049 #include "SundanceRefinementClass.hpp"
00050 #include "SundanceDomainDefinition.hpp"
00051 
00052 namespace Sundance
00053 {
00054 /** forward declaration */
00055 class RefinementClass;
00056 class MeshDomainDef;
00057 
00058 class HNMesher2D : public MeshSourceBase
00059 {
00060 public:
00061   /**     */
00062   HNMesher2D(
00063     double position_x, double position_y,
00064     double offset_x , double offset_y,
00065     int resolution_x , int resolution_y ,
00066     const MeshType& meshType,
00067     const MPIComm& comm = MPIComm::world())
00068     :
00069     MeshSourceBase(meshType, 0, comm),
00070     _position_x(position_x), _position_y(position_y),
00071     _offset_x(offset_x), _offset_y(offset_y),
00072     _resolution_x(resolution_x) , _resolution_y(resolution_y) ,
00073     refineClass_(dummyRefineClass_) ,
00074     meshDomain_(dummyMeshDomain_) {;}
00075 
00076   /**     */
00077   HNMesher2D(
00078     double position_x, double position_y,
00079     double offset_x , double offset_y,
00080     int resolution_x , int resolution_y ,
00081     const MeshType& meshType,
00082     const RefinementClass& refineClass ,
00083     const MPIComm& comm = MPIComm::world())
00084     :
00085     MeshSourceBase(meshType, 0, comm),
00086     _position_x(position_x), _position_y(position_y),
00087     _offset_x(offset_x), _offset_y(offset_y),
00088     _resolution_x(resolution_x) , _resolution_y(resolution_y) ,
00089     refineClass_(refineClass) ,
00090     meshDomain_(dummyMeshDomain_) {;}
00091 
00092   /**     */
00093   HNMesher2D(
00094     double position_x, double position_y,
00095     double offset_x , double offset_y,
00096     int resolution_x , int resolution_y ,
00097     const MeshType& meshType,
00098     const MeshDomainDef& meshDomain ,
00099     const MPIComm& comm = MPIComm::world())
00100     :
00101     MeshSourceBase(meshType, 0, comm),
00102     _position_x(position_x), _position_y(position_y),
00103     _offset_x(offset_x), _offset_y(offset_y),
00104     _resolution_x(resolution_x) , _resolution_y(resolution_y) ,
00105     refineClass_(dummyRefineClass_) ,
00106     meshDomain_(meshDomain) {;}
00107 
00108   /**     */
00109   HNMesher2D(
00110     double position_x, double position_y,
00111     double offset_x , double offset_y,
00112     int resolution_x , int resolution_y ,
00113     const MeshType& meshType,
00114     const RefinementClass& refineClass ,
00115     const MeshDomainDef& meshDomain ,
00116     const MPIComm& comm = MPIComm::world())
00117     :
00118     MeshSourceBase(meshType, 0, comm),
00119     _position_x(position_x), _position_y(position_y),
00120     _offset_x(offset_x), _offset_y(offset_y),
00121     _resolution_x(resolution_x) , _resolution_y(resolution_y) ,
00122     refineClass_(refineClass) ,
00123     meshDomain_(meshDomain) {;}
00124 
00125   /** Create a rectangle mesher from a ParameterList */
00126   HNMesher2D(const ParameterList& params);
00127 
00128   /** */
00129   virtual ~HNMesher2D() {;}
00130 
00131   /** Print a short descriptive std::string */
00132   virtual std::string description() const
00133     {return "HNMesher2D[pos x =" + Teuchos::toString(_position_x)
00134         + ", pos y=" + Teuchos::toString(_position_y)
00135         + ", offset x=" + Teuchos::toString(_offset_x) +
00136         + ", offset y=" + Teuchos::toString(_offset_y)
00137         + ", resolution_x=" + Teuchos::toString(_resolution_x)
00138         + ", resolution_y=" + Teuchos::toString(_resolution_y)+"]";}
00139 
00140 
00141   /** Return a ref count pointer to self */
00142   virtual RCP<MeshSourceBase> getRcp() {return rcp(this);}
00143 
00144 
00145 protected:
00146 
00147   /** The method which all Mesher should have */
00148   virtual Mesh fillMesh() const ;
00149 
00150 private:
00151 
00152   /** X coordinate of the origin point (lower left)*/
00153   double _position_x;
00154   /** Y coordinate of the origin point (lower left)*/
00155   double _position_y;
00156   /** offset (length) of the grid in the X direction*/
00157   double _offset_x;
00158   /** offset (length) of the grid in the Y direction*/
00159   double _offset_y;
00160   /** On the coarse level the resolution on the X axis */
00161   int _resolution_x;
00162   /** On the coarse level the resolution on the Y axis */
00163   int _resolution_y;
00164 
00165   /** refinement class */
00166   const RefinementClass refineClass_;
00167 
00168   /** mesh domain (which must not coincide with the whole mesh)*/
00169   const MeshDomainDef meshDomain_;
00170 
00171 
00172   /** static dummy class if the user does not provide refinement class */
00173   static const RefinementClass dummyRefineClass_;
00174 
00175   /** static domain class if the user does not provide one */
00176   static const MeshDomainDef dummyMeshDomain_;
00177 };
00178 }
00179 #endif /* SUNDANCE_HNMESHER2D_H_ */

Site Contact