SundanceHNMesher3D.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_HNMESHER3D_H_
00043 #define SUNDANCE_HNMESHER3D_H_
00044 
00045 #include "SundanceDefs.hpp"
00046 #include "SundanceMeshSourceBase.hpp"
00047 #include "SundanceHNMesh3D.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 HNMesher3D : public MeshSourceBase
00059   {
00060   public:
00061     /**     */
00062   HNMesher3D(
00063          double position_x , double position_y , double position_z,
00064                double offset_x , double offset_y, double offset_z,
00065                int resolution_x , int resolution_y , int resolution_z,
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), _position_z(position_z),
00071       _offset_x(offset_x), _offset_y(offset_y), _offset_z(offset_z),
00072       _resolution_x(resolution_x) , _resolution_y(resolution_y) , _resolution_z(resolution_z) ,
00073       refineClass_(dummyRefineClass_) ,
00074       meshDomain_(dummyMeshDomain_) {;}
00075 
00076     /**     */
00077   HNMesher3D(
00078          double position_x, double position_y, double position_z,
00079                double offset_x , double offset_y, double offset_z,
00080                int resolution_x , int resolution_y , int resolution_z ,
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),_position_z(position_z),
00087       _offset_x(offset_x), _offset_y(offset_y), _offset_z(offset_z),
00088       _resolution_x(resolution_x) , _resolution_y(resolution_y) ,_resolution_z(resolution_z) ,
00089       refineClass_(refineClass) ,
00090       meshDomain_(dummyMeshDomain_) {;}
00091 
00092     /**     */
00093   HNMesher3D(
00094          double position_x, double position_y, double position_z,
00095                double offset_x , double offset_y, double offset_z,
00096                int resolution_x , int resolution_y , int resolution_z ,
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), _position_z(position_z),
00103       _offset_x(offset_x), _offset_y(offset_y), _offset_z(offset_z),
00104       _resolution_x(resolution_x) , _resolution_y(resolution_y) , _resolution_z(resolution_z) ,
00105       refineClass_(dummyRefineClass_) ,
00106       meshDomain_(meshDomain) {;}
00107 
00108     /**     */
00109   HNMesher3D(
00110          double position_x, double position_y,  double position_z,
00111                double offset_x , double offset_y, double offset_z,
00112                int resolution_x , int resolution_y , int resolution_z ,
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), _position_z(position_z),
00120       _offset_x(offset_x), _offset_y(offset_y), _offset_z(offset_z),
00121       _resolution_x(resolution_x) , _resolution_y(resolution_y) , _resolution_z(resolution_z) ,
00122       refineClass_(refineClass) ,
00123       meshDomain_(meshDomain) {;}
00124 
00125     /** Create a rectangle mesher from a ParameterList */
00126   HNMesher3D(const ParameterList& params);
00127 
00128     /** */
00129     virtual ~HNMesher3D() {;}
00130 
00131     /** Print a short descriptive std::string */
00132     virtual std::string description() const
00133     {return "HNMesher3D[pos x =" + Teuchos::toString(_position_x)
00134        + ", pos y=" + Teuchos::toString(_position_y)
00135        + ", pos z=" + Teuchos::toString(_position_z)
00136        + ", offset x=" + Teuchos::toString(_offset_x) +
00137        + ", offset y=" + Teuchos::toString(_offset_y)
00138        + ", offset z=" + Teuchos::toString(_offset_z)
00139        + ", resolution_x=" + Teuchos::toString(_resolution_x)
00140        + ", resolution_y=" + Teuchos::toString(_resolution_y)
00141        + ", resolution_z=" + Teuchos::toString(_resolution_z)
00142        +"]";}
00143 
00144 
00145     /** Return a ref count pointer to self */
00146     virtual RCP<MeshSourceBase> getRcp() {return rcp(this);}
00147 
00148 
00149   protected:
00150 
00151     /** The method which all Mesher should have */
00152     virtual Mesh fillMesh() const ;
00153 
00154   private:
00155 
00156     /** X coordinate of the origin point (lower left)*/
00157     double _position_x;
00158     /** Y coordinate of the origin point (lower left)*/
00159     double _position_y;
00160     /** Z coordinate of the origin point (lower left)*/
00161     double _position_z;
00162     /** offset (length) of the grid in the X direction*/
00163     double _offset_x;
00164     /** offset (length) of the grid in the Y direction*/
00165     double _offset_y;
00166     /** offset (length) of the grid in the Z direction*/
00167     double _offset_z;
00168     /** On the coarse level the resolution on the X axis */
00169     int _resolution_x;
00170     /** On the coarse level the resolution on the Y axis */
00171     int _resolution_y;
00172     /** On the coarse level the resolution on the Z axis */
00173     int _resolution_z;
00174 
00175     /** refinement class */
00176     const RefinementClass refineClass_;
00177 
00178     /** mesh domain (which must not coincide with the whole mesh)*/
00179     const MeshDomainDef meshDomain_;
00180 
00181 
00182     /** static dummy class if the user does not provide refinement class */
00183     static const RefinementClass dummyRefineClass_;
00184 
00185     /** static domain class if the user does not provide one */
00186     static const MeshDomainDef dummyMeshDomain_;
00187   };
00188 }
00189 #endif /* SUNDANCE_HNMESHER3D_H_ */

Site Contact