moab
LloydSmoother.hpp
Go to the documentation of this file.
00001 
00015 #ifndef LLOYDSMOOTHER_HPP
00016 #define LLOYDSMOOTHER_HPP
00017 
00018 #include "moab/Interface.hpp"
00019 
00020 namespace moab {
00021 
00022 class ParallelComm;
00023 class Error;
00024 
00025 class LloydSmoother
00026 {
00027 public:
00028 
00029     /* \brief Constructor
00030      * Bare constructor, data input to this class through methods.
00031      * \param impl The MOAB instance for this smoother
00032      */
00033   LloydSmoother(Interface *impl);
00034   
00035     /* \brief Constructor
00036      * Convenience constructor, data input directly
00037      * \param impl The MOAB instance for this smoother
00038      * \param pc The ParallelComm instance by which this mesh is parallel
00039      * \param elems The mesh to be smoothed
00040      * \param cds_tag If specified, this tag is used to get/set coordinates, rather than 
00041      *     true vertex coordinates
00042      * \param fixed_tag The tag marking which vertices are fixed
00043      * \param abs_tol Absolute tolerance measuring convergence
00044      * \param rel_tol Relative tolerance measuring convergence
00045      */
00046   LloydSmoother(Interface *impl, ParallelComm *pc, Range &elems, Tag cds_tag = 0, Tag fixed_tag = 0,
00047                 double abs_tol = -1.0, double rel_tol = 1.0e-6);
00048 
00049     /* \brief Destructor
00050      */
00051   ~LloydSmoother();
00052 
00053     /* \brief perform smoothing operation
00054      */
00055   ErrorCode perform_smooth();
00056   
00057     /* \brief get instance
00058      */
00059   Interface *mb_impl() {return mbImpl;}
00060   
00061     /* \brief get/set ParallelComm
00062      */
00063   ParallelComm *pcomm() {return myPcomm;}
00064   
00065     /* \brief get/set ParallelComm
00066      */
00067   void pcomm(ParallelComm *pc) {myPcomm = pc;}
00068 
00069     /* \brief get/set elements
00070      */
00071   Range &elems() {return myElems;}
00072   
00073     /* \brief get/set elements
00074      */
00075   const Range &elems() const {return myElems;}
00076   
00077     /* \brief get/set fixed tag
00078      */
00079   Tag fixed_tag() {return fixedTag;}
00080 
00081     /* \brief get/set fixed tag
00082      */
00083   void fixed_tag(Tag fixed) {fixedTag = fixed;}
00084 
00085     /* \brief get/set coords tag
00086      */
00087   Tag coords_tag() {return coordsTag;}
00088 
00089     /* \brief get/set coords tag
00090      */
00091   void coords_tag(Tag coords) {coordsTag = coords;}
00092 
00093     /* \brief get/set tolerance
00094      */
00095   double abs_tol() {return absTol;}
00096   
00097     /* \brief get/set tolerance
00098      */
00099   void abs_tol(double tol) {absTol = tol;}
00100   
00101     /* \brief get/set tolerance
00102      */
00103   double rel_tol() {return relTol;}
00104   
00105     /* \brief get/set tolerance
00106      */
00107   void rel_tol(double tol) {relTol = tol;}
00108 
00109     /* \brief get/set numIts
00110      */
00111   int num_its() {return numIts;}
00112   void num_its(int num) {numIts = num;}
00113         
00114     /* \brief get/set reportIts
00115      */
00116   int report_its() {return reportIts;}
00117   void report_its(int num) {reportIts = num;}
00118         
00119   
00120 private:
00121 
00122     //- initialize some things in certain cases
00123   ErrorCode initialize();
00124   
00125     //- MOAB instance
00126   Interface *mbImpl;
00127 
00128     //- ParallelComm
00129   ParallelComm *myPcomm;
00130   
00131     //- elements to smooth
00132   Range myElems;
00133   
00134     //- tag for coordinates; if zero, true vertex coords are used
00135   Tag coordsTag;
00136   
00137     //- tag marking which vertices are fixed, 0 = not fixed, otherwise fixed
00138   Tag fixedTag;
00139   
00140     //- tolerances
00141   double absTol, relTol;
00142 
00143     //- error handler for this class
00144   Error *errorHandler;
00145 
00146     //- number of iterations between reporting
00147   int reportIts;
00148 
00149     //- number of iterations taken during smooth
00150   int numIts;
00151 
00152     //- keep track of whether I created the fixed tag
00153   bool iCreatedTag;
00154 };
00155     
00156 } // namespace moab
00157 
00158 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines