MueLu Version of the Day
Loading...
Searching...
No Matches
MueLu_AmalgamationInfo_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/*
47 * MueLu_AmalgamationInfo_decl.hpp
48 *
49 * Created on: Mar 28, 2012
50 * Author: wiesner
51 */
52
53#ifndef MUELU_AMALGAMATIONINFO_DECL_HPP_
54#define MUELU_AMALGAMATIONINFO_DECL_HPP_
55
56#include <Xpetra_ConfigDefs.hpp> // global_size_t
57#include <Xpetra_Map_fwd.hpp>
58#include <Xpetra_Vector_fwd.hpp>
59#include <Xpetra_MapFactory_fwd.hpp>
60
61#include "MueLu_ConfigDefs.hpp"
62
63#include "MueLu_BaseClass.hpp"
64
67
68namespace MueLu {
69
77
78 template<class LocalOrdinal = DefaultLocalOrdinal,
80 class Node = DefaultNode>
82 : public BaseClass {
83#undef MUELU_AMALGAMATIONINFO_SHORT
85
86 public:
87
89 AmalgamationInfo(RCP<Array<LO> > rowTranslation,
90 RCP<Array<LO> > colTranslation,
91 RCP<const Map> nodeRowMap,
92 RCP<const Map> nodeColMap,
93 RCP<const Map> const &columnMap,
94 LO fullblocksize, GO offset, LO blockid, LO nStridedOffset, LO stridedblocksize) :
95 rowTranslation_(rowTranslation),
96 colTranslation_(colTranslation),
97 nodeRowMap_(nodeRowMap),
98 nodeColMap_(nodeColMap),
99 columnMap_(columnMap),
100 fullblocksize_(fullblocksize),
101 offset_(offset),
102 blockid_(blockid),
103 nStridedOffset_(nStridedOffset),
104 stridedblocksize_(stridedblocksize),
105 indexBase_(columnMap->getIndexBase())
106 {}
107
109 virtual ~AmalgamationInfo() {}
110
112 std::string description() const { return "AmalgamationInfo"; }
113
115 //using MueLu::Describable::describe; // overloading, not hiding
116 //void describe(Teuchos::FancyOStream &out, const VerbLevel verbLevel = Default) const;;
117 void print(Teuchos::FancyOStream &out, const VerbLevel verbLevel = Default) const;
118
119 RCP<const Map> getNodeRowMap() const { return nodeRowMap_; }
120 RCP<const Map> getNodeColMap() const { return nodeColMap_; }
121
122 /* @brief Translation arrays
123 *
124 * Returns translation arrays providing local node ids given local dof ids built from either
125 * the non-overlapping (unique) row map or the overlapping (non-unique) column map.
126 * The getColTranslation routine, e.g., is used for the MergeRows routine in CoalesceDropFactory.
127 */
129 RCP<Array<LO> > getRowTranslation() const { return rowTranslation_; }
130 RCP<Array<LO> > getColTranslation() const { return colTranslation_; }
132
137 void UnamalgamateAggregates(const Aggregates& aggregates, Teuchos::ArrayRCP<LocalOrdinal>& aggStart, Teuchos::ArrayRCP<GlobalOrdinal>& aggToRowMap) const;
138 void UnamalgamateAggregatesLO(const Aggregates& aggregates, Teuchos::ArrayRCP<LocalOrdinal>& aggStart, Teuchos::ArrayRCP<LO>& aggToRowMap) const;
139
143 Teuchos::RCP< Xpetra::Map<LocalOrdinal, GlobalOrdinal, Node> > ComputeUnamalgamatedImportDofMap(const Aggregates& aggregates) const;
144
145 private:
146
147 void UnamalgamateAggregates(const Teuchos::RCP<const Map> &nodeMap,
148 const RCP<LOVector> &procWinnerVec,
149 const RCP<LOMultiVector> &vertex2AggIdVec,
150 const GO numAggregates,
151 Teuchos::ArrayRCP<LocalOrdinal>& aggStart,
152 Teuchos::ArrayRCP<GlobalOrdinal>& aggToRowMap) const;
153
154 void UnamalgamateAggregatesLO(const Teuchos::RCP<const Map> &nodeMap,
155 const RCP<LOVector> &procWinnerVec,
156 const RCP<LOMultiVector> &vertex2AggIdVec,
157 const GO numAggregates,
158 Teuchos::ArrayRCP<LocalOrdinal>& aggStart,
159 Teuchos::ArrayRCP<LO>& aggToRowMap) const;
160
161 Teuchos::RCP< Xpetra::Map<LocalOrdinal, GlobalOrdinal, Node> > ComputeUnamalgamatedImportDofMap(const Teuchos::RCP<const Map> &nodeMap) const;
162
163 public:
164
175 GO ComputeGlobalDOF(GO const &gNodeID, LO const &k=0) const;
176
184 LO ComputeLocalDOF(LocalOrdinal const &lNodeID, LocalOrdinal const &k) const;
185
186 LO ComputeLocalNode(LocalOrdinal const &ldofID) const;
187
189
191 GO GlobalOffset() { return offset_; }
192
194 void GetStridingInformation(LO& fullBlockSize, LO& blockID, LO& stridingOffset, LO& stridedBlockSize, GO& indexBase) {
195 fullBlockSize = fullblocksize_;
196 blockID = blockid_;
197 stridingOffset = nStridedOffset_;
198 stridedBlockSize = stridedblocksize_;
199 indexBase = indexBase_;
200 }
201
202 private:
203
205
206
208 RCP<Array<LO> > rowTranslation_;
209 RCP<Array<LO> > colTranslation_;
210
212 RCP<const Map> nodeRowMap_;
213 RCP<const Map> nodeColMap_;
214
219 RCP<const Map> columnMap_;
220
222
224
232
233 };
234
235} // namespace MueLu
236
237#define MUELU_AMALGAMATIONINFO_SHORT
238#endif /* MUELU_AMALGAMATIONINFO_DECL_HPP_ */
MueLu::DefaultLocalOrdinal LocalOrdinal
MueLu::DefaultGlobalOrdinal GlobalOrdinal
MueLu::DefaultNode Node
Container class for aggregation information.
Teuchos::RCP< Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > ComputeUnamalgamatedImportDofMap(const Teuchos::RCP< const Map > &nodeMap) const
LO ComputeLocalDOF(LocalOrdinal const &lNodeID, LocalOrdinal const &k) const
ComputeLocalDOF return locbal dof id associated with local node id lNodeID and dof index k.
void UnamalgamateAggregatesLO(const Teuchos::RCP< const Map > &nodeMap, const RCP< LOVector > &procWinnerVec, const RCP< LOMultiVector > &vertex2AggIdVec, const GO numAggregates, Teuchos::ArrayRCP< LocalOrdinal > &aggStart, Teuchos::ArrayRCP< LO > &aggToRowMap) const
void print(Teuchos::FancyOStream &out, const VerbLevel verbLevel=Default) const
Print the object with some verbosity level to an FancyOStream object.
RCP< Array< LO > > getColTranslation() const
AmalgamationInfo(RCP< Array< LO > > rowTranslation, RCP< Array< LO > > colTranslation, RCP< const Map > nodeRowMap, RCP< const Map > nodeColMap, RCP< const Map > const &columnMap, LO fullblocksize, GO offset, LO blockid, LO nStridedOffset, LO stridedblocksize)
Constructor.
RCP< const Map > getNodeColMap() const
< returns the node row map for the graph
GO GlobalOffset()
returns offset of global dof ids
void UnamalgamateAggregatesLO(const Aggregates &aggregates, Teuchos::ArrayRCP< LocalOrdinal > &aggStart, Teuchos::ArrayRCP< LO > &aggToRowMap) const
std::string description() const
Return a simple one-line description of this object.
GO ComputeGlobalDOF(GO const &gNodeID, LO const &k=0) const
ComputeGlobalDOF.
Teuchos::RCP< Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > ComputeUnamalgamatedImportDofMap(const Aggregates &aggregates) const
ComputeUnamalgamatedImportDofMap build overlapping dof row map from aggregates needed for overlapping...
RCP< const Map > getNodeRowMap() const
void GetStridingInformation(LO &fullBlockSize, LO &blockID, LO &stridingOffset, LO &stridedBlockSize, GO &indexBase)
returns striding information
RCP< Array< LO > > getRowTranslation() const
< returns the node column map for the graph
void UnamalgamateAggregates(const Aggregates &aggregates, Teuchos::ArrayRCP< LocalOrdinal > &aggStart, Teuchos::ArrayRCP< GlobalOrdinal > &aggToRowMap) const
UnamalgamateAggregates.
void UnamalgamateAggregates(const Teuchos::RCP< const Map > &nodeMap, const RCP< LOVector > &procWinnerVec, const RCP< LOMultiVector > &vertex2AggIdVec, const GO numAggregates, Teuchos::ArrayRCP< LocalOrdinal > &aggStart, Teuchos::ArrayRCP< GlobalOrdinal > &aggToRowMap) const
LO ComputeLocalNode(LocalOrdinal const &ldofID) const
Base class for MueLu classes.
Namespace for MueLu classes and methods.
Tpetra::KokkosClassic::DefaultNode::DefaultNodeType DefaultNode