Zoltan2
Loading...
Searching...
No Matches
Zoltan2_EvaluateMapping.hpp
Go to the documentation of this file.
1// @HEADER
2//
3// ***********************************************************************
4//
5// Zoltan2: A package of combinatorial algorithms for scientific computing
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 Karen Devine (kddevin@sandia.gov)
39// Erik Boman (egboman@sandia.gov)
40// Siva Rajamanickam (srajama@sandia.gov)
41//
42// ***********************************************************************
43//
44// @HEADER
45// @HEADER
46//
47// ***********************************************************************
48//
49// Zoltan2: A package of combinatorial algorithms for scientific computing
50// Copyright 2012 Sandia Corporation
51//
52// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
53// the U.S. Government retains certain rights in this software.
54//
55// Redistribution and use in source and binary forms, with or without
56// modification, are permitted provided that the following conditions are
57// met:
58//
59// 1. Redistributions of source code must retain the above copyright
60// notice, this list of conditions and the following disclaimer.
61//
62// 2. Redistributions in binary form must reproduce the above copyright
63// notice, this list of conditions and the following disclaimer in the
64// documentation and/or other materials provided with the distribution.
65//
66// 3. Neither the name of the Corporation nor the names of the
67// contributors may be used to endorse or promote products derived from
68// this software without specific prior written permission.
69//
70// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
71// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
72// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
73// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
74// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
75// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
76// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
77// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
78// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
79// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
80// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
81//
82// Questions? Contact Karen Devine (kddevin@sandia.gov)
83// Erik Boman (egboman@sandia.gov)
84// Siva Rajamanickam (srajama@sandia.gov)
85//
86// ***********************************************************************
87//
88// @HEADER
89
94#ifndef ZOLTAN2_EVALUATEMAPPING_HPP
95#define ZOLTAN2_EVALUATEMAPPING_HPP
96
100
101namespace Zoltan2{
102
110template<typename Adapter,
111 typename MachineRep = // Default MachineRep type
112 MachineRepresentation<typename Adapter::scalar_t,
113 typename Adapter::part_t> >
114class EvaluateMapping : public EvaluatePartition<Adapter> {
115
116
117 const RCP <const MachineRep> machine;
118public:
119
129 const Adapter *ia,
130 ParameterList *p,
131 const RCP<const Comm<int> > &ucomm_,
132 const MappingSolution<Adapter> *soln,
133 const MachineRep *machine_ ,
134 const RCP<const GraphModel<typename Adapter::base_adapter_t> > &graphModel= Teuchos::null):
135 EvaluatePartition<Adapter>(ia, p, ucomm_, soln, false, graphModel),
136 machine(Teuchos::rcp(machine_, false)){
137 this->sharedConstructor(ia, p, ucomm_, soln, graphModel);
138 }
139
141
142protected:
144 const RCP<const Environment> &_env,
145 const RCP<const Comm<int> > &_problemComm,
146 const RCP<const GraphModel<typename Adapter::base_adapter_t> > &_graph,
147 const ArrayView<const typename Adapter::part_t> &_partArray,
148 typename Adapter::part_t &_numGlobalParts,
149 ArrayRCP<RCP<BaseClassMetrics<typename Adapter::scalar_t> > > &_metricsBase,
150 ArrayRCP<typename Adapter::scalar_t> &_globalSums) {
151 globalWeightedByPart <Adapter,MachineRep>(_env,
152 _problemComm, _graph, _partArray, _numGlobalParts, _metricsBase,
153 _globalSums, true, this->machine);
154 }
155};
156
157} // namespace Zoltan2
158
159#endif
Defines the EvaluatePartition class.
Defines the MappingSolution class.
A class that computes and returns quality metrics.
EvaluateMapping(const Adapter *ia, ParameterList *p, const RCP< const Comm< int > > &ucomm_, const MappingSolution< Adapter > *soln, const MachineRep *machine_, const RCP< const GraphModel< typename Adapter::base_adapter_t > > &graphModel=Teuchos::null)
Constructor where communicator is Teuchos default.
virtual void calculate_graph_metrics(const RCP< const Environment > &_env, const RCP< const Comm< int > > &_problemComm, const RCP< const GraphModel< typename Adapter::base_adapter_t > > &_graph, const ArrayView< const typename Adapter::part_t > &_partArray, typename Adapter::part_t &_numGlobalParts, ArrayRCP< RCP< BaseClassMetrics< typename Adapter::scalar_t > > > &_metricsBase, ArrayRCP< typename Adapter::scalar_t > &_globalSums)
A class that computes and returns quality metrics.
void sharedConstructor(const Adapter *ia, ParameterList *p, const RCP< const Comm< int > > &problemComm, const PartitioningSolution< Adapter > *soln, const RCP< const GraphModel< typename Adapter::base_adapter_t > > &graphModel)
GraphModel defines the interface required for graph models.
PartitionMapping maps a solution or an input distribution to ranks.
Created by mbenlioglu on Aug 31, 2020.