$extrastylesheet
partitioner.h
Go to the documentation of this file.
00001 // The libMesh Finite Element Library.
00002 // Copyright (C) 2002-2014 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
00003 
00004 // This library is free software; you can redistribute it and/or
00005 // modify it under the terms of the GNU Lesser General Public
00006 // License as published by the Free Software Foundation; either
00007 // version 2.1 of the License, or (at your option) any later version.
00008 
00009 // This library is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 // Lesser General Public License for more details.
00013 
00014 // You should have received a copy of the GNU Lesser General Public
00015 // License along with this library; if not, write to the Free Software
00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017 
00018 
00019 
00020 #ifndef LIBMESH_PARTITIONER_H
00021 #define LIBMESH_PARTITIONER_H
00022 
00023 // Local Includes -----------------------------------
00024 #include "libmesh/libmesh.h"
00025 #include "libmesh/auto_ptr.h"
00026 #include "libmesh/id_types.h"
00027 
00028 // C++ Includes   -----------------------------------
00029 #include <cstddef>
00030 
00031 namespace libMesh
00032 {
00033 
00034 // Forward Declarations
00035 class MeshBase;
00036 class ErrorVector;
00037 
00038 
00046 // ------------------------------------------------------------
00047 // Partitioner class definition
00048 class Partitioner
00049 {
00050 public:
00051 
00055   Partitioner ():_weights(NULL) {}
00056 
00060   virtual ~Partitioner() {}
00061 
00068   virtual UniquePtr<Partitioner> clone () const = 0;
00069 
00070 
00077   void partition (MeshBase& mesh,
00078                   const unsigned int n);
00079 
00086   void partition (MeshBase& mesh);
00087 
00094   void repartition (MeshBase& mesh,
00095                     const unsigned int n);
00096 
00102   void repartition (MeshBase& mesh);
00103 
00107   static void partition_unpartitioned_elements (MeshBase &mesh);
00108 
00109   static void partition_unpartitioned_elements (MeshBase &mesh,
00110                                                 const unsigned int n);
00111 
00117   static void set_parent_processor_ids(MeshBase& mesh);
00118 
00124   static void set_node_processor_ids(MeshBase& mesh);
00125 
00131   virtual void attach_weights(ErrorVector * /*weights*/) { libmesh_not_implemented(); }
00132 
00133 protected:
00134 
00141   void single_partition (MeshBase& mesh);
00142 
00148   virtual void _do_partition(MeshBase& mesh,
00149                              const unsigned int n) = 0;
00150 
00156   virtual void _do_repartition (MeshBase& mesh,
00157                                 const unsigned int n) { this->_do_partition (mesh, n); }
00158 
00163   static const dof_id_type communication_blocksize;
00164 
00168   ErrorVector * _weights;
00169 };
00170 
00171 
00172 } // namespace libMesh
00173 
00174 
00175 
00176 #endif // LIBMESH_PARTITIONER_H