Ifpack2 Templated Preconditioning Package
Version 1.0
Toggle main menu visibility
Loading...
Searching...
No Matches
src
Ifpack2_LinearPartitioner_def.hpp
1
// @HEADER
2
// *****************************************************************************
3
// Ifpack2: Templated Object-Oriented Algebraic Preconditioner Package
4
//
5
// Copyright 2009 NTESS and the Ifpack2 contributors.
6
// SPDX-License-Identifier: BSD-3-Clause
7
// *****************************************************************************
8
// @HEADER
9
10
#ifndef IFPACK2_LINEAR_PARTITIONER_DEF_HPP
11
#define IFPACK2_LINEAR_PARTITIONER_DEF_HPP
12
#include "Ifpack2_ConfigDefs.hpp"
13
#include "Ifpack2_LinearPartitioner_decl.hpp"
14
15
namespace
Ifpack2
{
16
17
//==============================================================================
18
// Constructor
19
template
<
class
GraphType>
20
LinearPartitioner<GraphType>::
21
LinearPartitioner
(
const
Teuchos::RCP<const row_graph_type>& graph)
22
:
OverlappingPartitioner
<GraphType>(graph) {}
23
24
template
<
class
GraphType>
25
LinearPartitioner<GraphType>::~LinearPartitioner
() {}
26
27
template
<
class
GraphType>
28
void
LinearPartitioner<GraphType>::
29
setPartitionParameters
(Teuchos::ParameterList&
/* List */
) {}
30
31
template
<
class
GraphType>
32
void
LinearPartitioner<GraphType>::computePartitions
() {
33
using
Teuchos::as;
34
// Partition_ is an array of local_ordinal_type. local_ordinal_type
35
// may be signed or unsigned. NumLocalParts_ is int, and needs to
36
// be signed, since negative values are significant. Comparisons
37
// between signed and unsigned integers often result in compiler
38
// warnings, which is why we use as() for explicit conversions
39
// below. We also use as() because in a debug build, it checks for
40
// overflow.
41
const
int
mod = as<int>(this->
Graph_
->getLocalNumRows() /
42
this->NumLocalParts_);
43
for
(
size_t
i = 0; i < this->
Graph_
->getLocalNumRows(); ++i) {
44
this->
Partition_
[i] = as<local_ordinal_type>(i / mod);
45
if
(this->
Partition_
[i] >= as<local_ordinal_type>(this->
NumLocalParts_
)) {
46
this->
Partition_
[i] = this->
NumLocalParts_
- 1;
47
}
48
}
49
}
50
51
}
// namespace Ifpack2
52
53
#define IFPACK2_LINEARPARTITIONER_INSTANT(LO, GO, N) \
54
template class Ifpack2::LinearPartitioner<Tpetra::CrsGraph<LO, GO, N> >; \
55
template class Ifpack2::LinearPartitioner<Tpetra::RowGraph<LO, GO, N> >;
56
57
#endif
// IFPACK2_LINEARPARTITIONER_DEF_HPP
Ifpack2::LinearPartitioner::~LinearPartitioner
virtual ~LinearPartitioner()
Destructor.
Definition
Ifpack2_LinearPartitioner_def.hpp:25
Ifpack2::LinearPartitioner::LinearPartitioner
LinearPartitioner(const Teuchos::RCP< const row_graph_type > &graph)
Constructor.
Definition
Ifpack2_LinearPartitioner_def.hpp:21
Ifpack2::LinearPartitioner::setPartitionParameters
void setPartitionParameters(Teuchos::ParameterList &List)
Set the partitioner's parameters (none for linear partitioning).
Definition
Ifpack2_LinearPartitioner_def.hpp:29
Ifpack2::LinearPartitioner::computePartitions
void computePartitions()
Compute the partitions.
Definition
Ifpack2_LinearPartitioner_def.hpp:32
Ifpack2::OverlappingPartitioner::Partition_
Teuchos::Array< local_ordinal_type > Partition_
Mapping from local row to partition number.
Definition
Ifpack2_OverlappingPartitioner_decl.hpp:144
Ifpack2::OverlappingPartitioner::OverlappingPartitioner
OverlappingPartitioner(const Teuchos::RCP< const row_graph_type > &graph)
Constructor.
Definition
Ifpack2_OverlappingPartitioner_def.hpp:25
Ifpack2::OverlappingPartitioner::Graph_
Teuchos::RCP< const row_graph_type > Graph_
The graph to be partitioned.
Definition
Ifpack2_OverlappingPartitioner_decl.hpp:154
Ifpack2::OverlappingPartitioner::NumLocalParts_
int NumLocalParts_
Number of local subgraphs.
Definition
Ifpack2_OverlappingPartitioner_decl.hpp:137
Ifpack2
Preconditioners and smoothers for Tpetra sparse matrices.
Definition
Ifpack2_AdditiveSchwarz_decl.hpp:40
Generated by
1.17.0