MueLu
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
MueLu_LWGraph_def.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_LWGRAPH_DEF_HPP
47
#define MUELU_LWGRAPH_DEF_HPP
48
49
#include "
MueLu_LWGraph_decl.hpp
"
50
#include <Xpetra_CrsGraph.hpp>
51
#include <Xpetra_CrsGraphFactory.hpp>
52
53
namespace
MueLu
{
54
56
//using MueLu::Describable::describe; // overloading, not hiding
57
//void describe(Teuchos::FancyOStream &out, const VerbLevel verbLevel = Default) const {
58
template
<
class
LocalOrdinal,
class
GlobalOrdinal,
class
Node>
59
void
LWGraph<LocalOrdinal, GlobalOrdinal, Node>::print
(Teuchos::FancyOStream &out,
const
VerbLevel
verbLevel)
const
{
60
// MUELU_DESCRIBE;
61
62
if
(verbLevel &
Parameters0
) {
63
//out0 << "Prec. type: " << type_ << std::endl;
64
}
65
66
if
(verbLevel &
Parameters1
) {
67
//out0 << "Linear Algebra: " << toString(lib_) << std::endl;
68
//out0 << "PrecType: " << type_ << std::endl;
69
//out0 << "Parameter list: " << std::endl; { Teuchos::OSTab tab2(out); out << paramList_; }
70
//out0 << "Overlap: " << overlap_ << std::endl;
71
}
72
73
if
(verbLevel &
Debug
) {
74
RCP<const Map> col_map =
importMap_
.is_null() ?
domainMap_
:
importMap_
;
75
76
for
(LO i = 0; i <
rows_
.size()-1; i++) {
77
for
(LO j =
rows_
[i]; j <
rows_
[i+1]; j++)
78
out<<
domainMap_
->getGlobalElement(i) <<
" "
<< col_map->getGlobalElement(
columns_
[j])<<std::endl;
79
}
80
}
81
}
82
83
84
template
<
class
LocalOrdinal,
class
GlobalOrdinal,
class
Node>
85
RCP<Xpetra::CrsGraph<LocalOrdinal,GlobalOrdinal,Node> >
LWGraph<LocalOrdinal, GlobalOrdinal, Node>::GetCrsGraph
()
const
{
86
ArrayRCP<size_t> rowPtrs;
87
rowPtrs.resize(
rows_
.size());
88
for
(
size_t
i=0; i<Teuchos::as<size_t>(
rows_
.size()); i++)
89
rowPtrs[i] =
rows_
[i];
90
auto
graph = Xpetra::CrsGraphFactory<LocalOrdinal,GlobalOrdinal,Node>::Build(
GetDomainMap
(),
GetImportMap
(), rowPtrs, Teuchos::arcp_const_cast<LO>(
getEntries
()));
91
graph->fillComplete();
92
return
graph;
93
}
94
95
}
96
97
#endif
// MUELU_LWGRAPH_DEF_HPP
MueLu_LWGraph_decl.hpp
MueLu::LWGraph::rows_
const ArrayRCP< const LO > rows_
Indices into columns_ array. Part of local graph information.
Definition
MueLu_LWGraph_decl.hpp:163
MueLu::LWGraph::domainMap_
const RCP< const Map > domainMap_
Graph maps.
Definition
MueLu_LWGraph_decl.hpp:167
MueLu::LWGraph::GetImportMap
const RCP< const Map > GetImportMap() const
Returns overlapping import map (nodes).
Definition
MueLu_LWGraph_decl.hpp:119
MueLu::LWGraph::columns_
const ArrayRCP< const LO > columns_
Columns corresponding to connections. Part of local graph information.
Definition
MueLu_LWGraph_decl.hpp:165
MueLu::LWGraph::getEntries
const ArrayRCP< const LO > getEntries() const
Return the list entries in the local graph.
Definition
MueLu_LWGraph_decl.hpp:148
MueLu::LWGraph::GetDomainMap
const RCP< const Map > GetDomainMap() const
Definition
MueLu_LWGraph_decl.hpp:117
MueLu::LWGraph::print
void print(Teuchos::FancyOStream &out, const VerbLevel verbLevel=Default) const
Print the Graph with some verbosity level to an FancyOStream object.
Definition
MueLu_LWGraph_def.hpp:59
MueLu::LWGraph::GetCrsGraph
RCP< CrsGraph > GetCrsGraph() const
Definition
MueLu_LWGraph_def.hpp:85
MueLu::LWGraph::importMap_
const RCP< const Map > importMap_
Definition
MueLu_LWGraph_decl.hpp:167
MueLu
Namespace for MueLu classes and methods.
Definition
MueLu_BrickAggregationFactory_decl.hpp:78
MueLu::VerbLevel
int VerbLevel
Definition
MueLu_VerbosityLevel.hpp:113
MueLu::Debug
@ Debug
Print additional debugging information.
Definition
MueLu_VerbosityLevel.hpp:79
MueLu::Parameters0
@ Parameters0
Print class parameters.
Definition
MueLu_VerbosityLevel.hpp:67
MueLu::Parameters1
@ Parameters1
Print class parameters (more parameters, more verbose).
Definition
MueLu_VerbosityLevel.hpp:68
src
Graph
Containers
MueLu_LWGraph_def.hpp
Generated by
1.17.0