MueLu  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MueLu_LeftoverAggregationAlgorithm_decl.hpp
Go to the documentation of this file.
1 // @HEADER
2 //
3 // ***********************************************************************
4 //
5 // MueLu: A package for multigrid based preconditioning
6 // Copyright 2012 Sandia Corporation
7 //
8 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9 // the U.S. Government retains certain rights in this software.
10 //
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions are
13 // met:
14 //
15 // 1. Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright
19 // notice, this list of conditions and the following disclaimer in the
20 // documentation and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of the Corporation nor the names of the
23 // contributors may be used to endorse or promote products derived from
24 // this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 // Questions? Contact
39 // Jonathan Hu (jhu@sandia.gov)
40 // Andrey Prokopenko (aprokop@sandia.gov)
41 // Ray Tuminaro (rstumin@sandia.gov)
42 //
43 // ***********************************************************************
44 //
45 // @HEADER
46 #ifndef MUELU_LEFTOVERAGGREGATIONALGORITHM_DECL_HPP
47 #define MUELU_LEFTOVERAGGREGATIONALGORITHM_DECL_HPP
48 
49 #include <Xpetra_Vector_fwd.hpp>
51 
52 #include "MueLu_ConfigDefs.hpp"
53 #include "MueLu_BaseClass.hpp"
55 
56 #include "MueLu_Aggregates_fwd.hpp"
57 #include "MueLu_GraphBase.hpp"
58 
60 
61 
62 
63 namespace MueLu {
64 
65  template<class LocalOrdinal = DefaultLocalOrdinal,
67  class Node = DefaultNode>
69 #undef MUELU_LEFTOVERAGGREGATIONALGORITHM_SHORT
71  typedef DefaultScalar SC;
72  typedef GO global_size_t; //TODO
73  typedef LO my_size_t; //TODO
74 
75  public:
76 
78 
79 
82 
85 
87 
89 
90 
91  void SetMinNodesPerAggregate(int minNodesPerAggregate) { minNodesPerAggregate_ = minNodesPerAggregate; }
92  void SetPhase3AggCreation(double phase3AggCreation) { phase3AggCreation_ = phase3AggCreation; }
93 
94  double GetPhase3AggCreation() const { return phase3AggCreation_; }
96 
97  // TODO: Set/GetGraphName
99 
101 
102 
103 #define MUELU_NOSCORE -100 /* indicates that a quality score has not */
104  /* yet been assigned when determining to */
105  /* which existing aggregate a vertex */
106  /* should be assigned. */
107 
108 #define MUELU_DISTONE_VERTEX_WEIGHT 100 /* Weights associated with all */
109  /* vertices that have a direct connection */
110  /* to the aggregate root. */
111 
112 #define INCR_SCALING 3 /* Determines how much of a penalty should */
113  /* be deduced from a score during Phase 5 */
114  /* for each Phase 5 vertex already added */
115  /* to this aggregate. Specifically the */
116  /* penalty associated with aggregate y is */
117  /* max (INCR_SCALING*NNewVtx, */
118  /* UnpenalizedScore*(1- */
119  /* MUELU_PENALTYFACTOR)) */
120  /* where NNewVtx is the number of phase 5 */
121  /* vertices already assigned to y. */
122 
123 #define MUELU_PENALTYFACTOR .30 /* Determines maximum allowable */
124  /* percentage of a score that can be */
125  /* deducted from this score for having */
126  /* already enlargened an aggregate to */
127  /* which we are contemplated adding another*/
128  /* vertex. Should be between 0 and 1. */
129 
130 
294  void AggregateLeftovers(GraphBase const &graph, Aggregates &aggregates) const; //AggregateLeftovers
295 
297 
299 
300 
305  void RootCandidates(my_size_t nVertices, ArrayView<const LO> & vertex2AggId, GraphBase const &graph,
306  ArrayRCP<LO> &candidates, my_size_t &nCandidates, global_size_t &nCandidatesGlobal) const; //RootCandidates
307 
309  int RemoveSmallAggs(Aggregates& aggregates, int min_size,
310  RCP<Xpetra::Vector<SC,LO,GO,NO> > & distWeights, const MueLu::CoupledAggregationCommHelper<LO,GO,NO> & myWidget) const; //RemoveSmallAggs
311 
313 
314  private:
317 
318  // JG TODO: rename variables:
319  // Adjacent-> adjacent
320  // homogenization of variables names :
321  // - colj and j
322  // - i and iNode
323  // - k->kNode
324  // - ...
325 
326  }; //class LeftoverAggregationAlgorithm
327 
328 } //namespace MueLu
329 
330 // graphName_("UC_CleanUp")
331 
332 #define MUELU_LEFTOVERAGGREGATIONALGORITHM_SHORT
333 #endif // MUELU_LEFTOVERAGGREGATIONALGORITHM_DECL_HPP
void RootCandidates(my_size_t nVertices, ArrayView< const LO > &vertex2AggId, GraphBase const &graph, ArrayRCP< LO > &candidates, my_size_t &nCandidates, global_size_t &nCandidatesGlobal) const
Build a list of candidate root nodes.
MueLu::DefaultLocalOrdinal LocalOrdinal
Tpetra::KokkosClassic::DefaultNode::DefaultNodeType DefaultNode
GlobalOrdinal GO
void AggregateLeftovers(GraphBase const &graph, Aggregates &aggregates) const
Take a partially aggregated graph and complete the aggregation.
LocalOrdinal LO
MueLu::DefaultNode Node
Helper class for providing arbitrated communication across processors.
Tpetra::Details::DefaultTypes::scalar_type DefaultScalar
MueLu::DefaultGlobalOrdinal GlobalOrdinal
int RemoveSmallAggs(Aggregates &aggregates, int min_size, RCP< Xpetra::Vector< SC, LO, GO, NO > > &distWeights, const MueLu::CoupledAggregationCommHelper< LO, GO, NO > &myWidget) const
Attempt to clean up aggregates that are too small.
size_t global_size_t
Base class for MueLu classes.