Zoltan2
Loading...
Searching...
No Matches
Zoltan2_AlgSpectral.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// Zoltan2: A package of combinatorial algorithms for scientific computing
4//
5// Copyright 2012 NTESS and the Zoltan2 contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#ifndef _ZOLTAN2_ALGSPECTRAL_HPP_
11#define _ZOLTAN2_ALGSPECTRAL_HPP_
12
13#include <Zoltan2_Algorithm.hpp>
16
17
22
23
24namespace Zoltan2{
25
26template <typename Adapter>
28 const RCP<GraphModel<Adapter> > &model,
29 //const RCP<Adapter> &matrixadapter, // Hack: Use matrix adapter directly
30
31 // TO DO - update this algorithm to have the proper formatting like
32 // the others.
34 &solution,
35 const RCP<Teuchos::ParameterList> &pl,
36 const RCP<const Teuchos::Comm<int> > &comm
37)
38{
39#ifndef INCLUDE_ZOLTAN2_EXPERIMENTAL
40
41 Z2_THROW_EXPERIMENTAL("Zoltan2 Spectral ordering is strictly "
42 "experimental software "
43 "while it is being developed and tested.")
44
45#else //INCLUDE_ZOLTAN2_EXPERIMENTAL
46
47 typedef typename Adapter::lno_t lno_t;
48 typedef typename Adapter::gno_t gno_t;
49 typedef typename Adapter::offset_t offset_t;
50 typedef typename Adapter::scalar_t scalar_t;
51
52 int ierr= 0;
53
54 HELLO;
55
56// TODO: Check params to do local or global ordering.
57 bool localOrder = true;
58
59 const size_t nVtx = model->getLocalNumVertices();
60 lno_t *perm = solution->getPermutationView();
61 for (lno_t i=0; i<nVtx; i++){
62 perm[i] = -1;
63 }
64
65 // Get local graph.
66 ArrayView<const gno_t> edgeIds;
67 ArrayView<const offset_t> offsets;
68 ArrayView<StridedData<lno_t, scalar_t> > wgts;
69
70 model->getEdgeList(edgeIds, offsets, wgts);
71
72 //cout << "Debug: Local graph from getLocalEdgeList" << endl;
73 //cout << "edgeIds: " << edgeIds << endl;
74 //cout << "offsets: " << offsets << endl;
75
76 // Form the graph Laplacian: L = D-A
77 // Create a new Tpetra matrix, but use views of existing data when possible.
78 // TODO
79
80 // TODO: Find smallest eigenvalues using Anasazi
81
82 // TODO: Sort Fiedler vector.
83
84 solution->setHavePerm(true);
85 return ierr;
86#endif // INCLUDE_ZOLTAN2_EXPERIMENTAL
87}
88
89}
90#endif
#define Z2_THROW_EXPERIMENTAL(mystr)
Throw an error when experimental code is requested but not compiled.
Defines the GraphModel interface.
Defines the OrderingSolution class.
#define HELLO
GraphModel defines the interface required for graph models.
map_t::local_ordinal_type lno_t
map_t::global_ordinal_type gno_t
Created by mbenlioglu on Aug 31, 2020.
int AlgSpectral(const RCP< GraphModel< Adapter > > &model, const RCP< LocalOrderingSolution< typename Adapter::lno_t > > &solution, const RCP< Teuchos::ParameterList > &pl, const RCP< const Teuchos::Comm< int > > &comm)