Sierra Toolkit  Version of the Day
Partition.hpp
Go to the documentation of this file.
1 
2 /*--------------------------------------------------------------------*/
3 /* Copyright 2001, 2002 Sandia Corporation. */
4 /* Under the terms of Contract DE-AC04-94AL85000, there is a */
5 /* non-exclusive license for use of this work by or on behalf */
6 /* of the U.S. Government. Export of this program may require */
7 /* a license from the United States Government. */
8 /*--------------------------------------------------------------------*/
9 
10 // Copyright 2001, 2002 Sandia Corporation, Albuquerque, NM.
11 
12 #ifndef stk_rebalance_Partition_hpp
13 #define stk_rebalance_Partition_hpp
14 
42 #include <stdexcept>
43 
44 // STL components
45 #include <vector>
46 #include <utility>
47 
48 #include <stk_mesh/base/Entity.hpp>
49 #include <stk_mesh/base/Field.hpp>
50 #include <stk_mesh/base/Types.hpp>
51 #include <stk_mesh/fem/CoordinateSystems.hpp>
52 #include <stk_mesh/fem/TopologyDimensions.hpp>
53 
54 namespace stk_classic {
55 namespace rebalance {
56 
57 typedef mesh::Field<double, mesh::Cartesian> VectorField ;
58 typedef mesh::Field<double> ScalarField ;
59 
60 
81 class Partition {
82 
83 public:
84 
87 private:
88  Partition(const Partition &p);
89 public:
90 
103  virtual void set_mesh_info ( const std::vector<mesh::Entity *> &mesh_entities,
104  const VectorField * nodal_coord_ref,
105  const ScalarField * elem_weight_ref=NULL) = 0;
106 
108  virtual ~Partition();
109 
111  ParallelMachine parallel() const { return comm_; }
112 
114  virtual unsigned num_elems() const = 0;
115 
128  virtual void determine_new_partition(bool &RebalancingNeeded) = 0;
129 
144  virtual int get_new_partition(stk_classic::mesh::EntityProcVec &new_partition) = 0;
145 
147  virtual bool partition_dependents_needed() const = 0;
148 
149 
150 protected:
151 
152  const stk_classic::ParallelMachine comm_;
153 };
154 
157 }
158 } // namespace stk_classic
159 
160 #endif
bool rebalance(mesh::BulkData &bulk_data, const mesh::Selector &selector, const VectorField *coord_ref, const ScalarField *elem_weight_ref, Partition &partition, const stk_classic::mesh::EntityRank rank=stk_classic::mesh::InvalidEntityRank)
Rebalance with a Partition object.
Definition: Rebalance.cpp:164
virtual int get_new_partition(stk_classic::mesh::EntityProcVec &new_partition)=0
Perform communication to create new partition.
Partition(stk_classic::ParallelMachine comm)
Constructors.
Definition: Partition.cpp:20
ParallelMachine parallel() const
Return the parallel communicator for this partition entity.
Definition: Partition.hpp:111
Field with defined data type and multi-dimensions (if any)
Definition: Field.hpp:118
virtual bool partition_dependents_needed() const =0
Query whether element dependents need to be rebalanced outside this Partition.
Initialized with a list of mesh entities unique to each processor.
Definition: Partition.hpp:81
Sierra Toolkit.
MPI_Comm ParallelMachine
Definition: Parallel.hpp:32
virtual void set_mesh_info(const std::vector< mesh::Entity *> &mesh_entities, const VectorField *nodal_coord_ref, const ScalarField *elem_weight_ref=NULL)=0
Define mesh entities to balance.
virtual unsigned num_elems() const =0
Return the total number of mesh entities in all lists.
virtual ~Partition()
Destructor.
Definition: Partition.cpp:21
virtual void determine_new_partition(bool &RebalancingNeeded)=0
determine New Partition.