MOAB: Mesh Oriented datABase  (version 5.4.1)
ParallelHelperInterface.hpp
Go to the documentation of this file.
00001 /* *****************************************************************
00002     MESQUITE -- The Mesh Quality Improvement Toolkit
00003 
00004     Copyright 2004 Sandia Corporation and Argonne National
00005     Laboratory.  Under the terms of Contract DE-AC04-94AL85000
00006     with Sandia Corporation, the U.S. Government retains certain
00007     rights in this software.
00008 
00009     This library is free software; you can redistribute it and/or
00010     modify it under the terms of the GNU Lesser General Public
00011     License as published by the Free Software Foundation; either
00012     version 2.1 of the License, or (at your option) any later version.
00013 
00014     This library is distributed in the hope that it will be useful,
00015     but WITHOUT ANY WARRANTY; without even the implied warranty of
00016     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017     Lesser General Public License for more details.
00018 
00019     You should have received a copy of the GNU Lesser General Public License
00020     (lgpl.txt) along with this library; if not, write to the Free Software
00021     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 
00023     [email protected], [email protected], [email protected],
00024     [email protected], [email protected], [email protected]
00025 
00026   ***************************************************************** */
00027 /*!
00028   \file   ParallelHelperInterface.hpp
00029   \brief
00030 
00031   \author Martin Isenburg
00032   \date   2008-03-25
00033 */
00034 
00035 #ifndef Mesquite_ParallelHelperInterface_hpp
00036 #define Mesquite_ParallelHelperInterface_hpp
00037 
00038 #include "ParallelMeshInterface.hpp"
00039 
00040 namespace MBMesquite
00041 {
00042 /*! \class ParallelHelper \brief MBMesquite::ParallelHelper is an abstract class
00043  *  which defines methods used by VertexMover and QualityAssessor to parallelize
00044  *  operations so the details and includes for MPI communication do not need to
00045  *  be exposed when running Mesquite in serial mode.
00046  */
00047 class MESQUITE_EXPORT ParallelHelper
00048 {
00049   public:
00050     // function called by application during set-up
00051     virtual void set_parallel_mesh( ParallelMesh* mesh )           = 0;
00052     virtual void set_communicator( size_t comm )                   = 0;
00053     virtual void set_communication_model( int model, MsqError& )   = 0;
00054     virtual void set_generate_random_numbers( int grn, MsqError& ) = 0;
00055 
00056     virtual ~ParallelHelper() {}
00057 
00058   protected:
00059     friend class VertexMover;
00060     // functions called by VertexMover::loop_over_mesh()
00061     virtual void smoothing_init( MsqError& )                                                         = 0;
00062     virtual void compute_first_independent_set( std::vector< Mesh::VertexHandle >& fixed_vertices )  = 0;
00063     virtual void communicate_first_independent_set( MsqError& )                                      = 0;
00064     virtual bool compute_next_independent_set()                                                      = 0;
00065     virtual bool get_next_partition_boundary_vertex( MBMesquite::Mesh::VertexHandle& vertex_handle ) = 0;
00066     virtual void communicate_next_independent_set( MsqError& )                                       = 0;
00067     virtual void smoothing_close( MsqError& )                                                        = 0;
00068 
00069   protected:
00070     friend class QualityAssessor;
00071     // functions called by QualityAssessor::loop_over_mesh()
00072     virtual int get_rank() const                                                                  = 0;
00073     virtual int get_nprocs() const                                                                = 0;
00074     virtual bool is_our_element( Mesh::ElementHandle element_handle, MsqError& ) const            = 0;
00075     virtual bool is_our_vertex( Mesh::VertexHandle vertex_handle, MsqError& ) const               = 0;
00076     virtual void communicate_min_max_to_all( double* minimum, double* maximum, MsqError& ) const  = 0;
00077     virtual void communicate_min_max_to_zero( double* minimum, double* maximum, MsqError& ) const = 0;
00078     virtual void communicate_sums_to_zero( size_t* freeElementCount,
00079                                            int* invertedElementCount,
00080                                            size_t* elementCount,
00081                                            int* invertedSampleCount,
00082                                            size_t* sampleCount,
00083                                            long unsigned int* count,
00084                                            long unsigned int* invalid,
00085                                            double* sum,
00086                                            double* sqrSum,
00087                                            MsqError& ) const                                      = 0;
00088     virtual void communicate_power_sum_to_zero( double* pMean, MsqError& ) const                  = 0;
00089     virtual void communicate_histogram_to_zero( std::vector< int >& histogram, MsqError& ) const  = 0;
00090     virtual void communicate_all_true( bool& value, MsqError& err ) const                         = 0;
00091     virtual void communicate_any_true( bool& value, MsqError& err ) const                         = 0;
00092 };
00093 }  // namespace MBMesquite
00094 
00095 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines