LifeV
BlockEpetra_Map.hpp
Go to the documentation of this file.
1 /*
2  * BlockEpetra_Map.hpp
3  *
4  * Created on: Aug 14, 2011
5  * Author: uvilla
6  */
7 
8 //@ HEADER
9 
10 /*!
11  * \file BlockEpetra_Map.hpp
12  * \author Umberto Villa
13  * \date 2011-08-13
14  * A special map object to handle parallel block structured Vectors.
15  */
16 
17 #ifndef BLOCKEPETRA_MAP_HPP_
18 #define BLOCKEPETRA_MAP_HPP_
19 
20 #include <lifev/core/linear_algebra/LinearOperatorAlgebra.hpp>
21 #include <Epetra_Import.h>
22 
23 
24 namespace LifeV
25 {
26 
28 
29 //! @class
30 /*! @brief This class handles block access to parallel monolithic Vectors with an underling block structure.
31  *
32  * The goal of BlockEpetra_Map is to provide block or monolithic access to block structured parallel Vectors.
33  * The BlockEpetra_Map takes as input a list of Epetra_BlockMap and construct a monolithic map by striding
34  * them together.
35  */
37 {
38 public:
39 
40  //@name Public Typedefs
41  //@{
45  typedef Operators::LinearOperatorAlgebra::constMapPtr_Type constMapPtr_Type;
49 
51  typedef boost::shared_ptr<import_Type> importPtr_Type;
55  //@}
56 
57  //@name Constructors
58  //@{
59  //! Default Constructor
61  //! Copy constructor
62  BlockEpetra_Map(const BlockEpetra_Map & map);
63  //! Construct a BlockEpetra_Map from an ordered list of Epetra_BlockMap objects
64  BlockEpetra_Map(const mapPtrContainer_Type & mapPtrContainer);
65  //@}
66 
67  //@name SetUp
68  //@{
69  //! simplified setup for the case of only 2 blocks
70  void setUp(const mapPtr_Type & map1, const mapPtr_Type & map2);
71  //! simplified setup for the case of only 3 blocks
72  void setUp(const mapPtr_Type & map1, const mapPtr_Type & map2, const mapPtr_Type & map3);
73  //! general setup for arbitrary number of blocks. The maps of the block to stride are collected in a mapPtrContainer_Type object
74  void setUp(const mapPtrContainer_Type & mapPtrContainer);
75  //! other set up routines to overcome a design problem in Trilinos (2 blocks)
76  void setUp(const Epetra_BlockMap & map1, const Epetra_BlockMap & map2);
77  //! other set up routines to overcome a design problem in Trilinos (3 blocks)
78  void setUp(const Epetra_BlockMap & map1, const Epetra_BlockMap & map2, const Epetra_BlockMap & map3);
79  //@}
80 
81  //@name Getters
82  //@{
83  //! get the number of blocks
84  UInt nBlocks() const;
85 
86  //! returns the monolithicMap
87  mapPtr_Type & monolithicMap();
88  //! const version
89  const constMapPtr_Type monolithicMap() const;
90 
91  //! returns the original map of block iblock
92  mapPtr_Type & blockMap(UInt iblock);
93  //! const version
94  const constMapPtr_Type blockMap(UInt iblock) const;
95 
96  //! returns the map relative to block iblock in the numbering of the monolithic map
97  mapPtr_Type & blockShiftedMap(UInt iblock);
98  //! const version
99  const constMapPtr_Type blockShiftedMap(UInt iblock) const;
100 
101  //! return an Trilinos import_Type object from block \c iblock map to the monolithic map
102  const import_Type & block2monoImporter(UInt iblock) const;
103  //! return an Trilinos import_Type object from the monolithic map to block \c iblock map.
104  const import_Type & mono2blockImporter(UInt iblock) const;
105  //@}
106 
107  //! Print debug info
108  void showMe();
109 
111 
112 
113 
114 private:
115 
116  void build();
117 
120  mapPtr_Type M_monolithicMap;
123 
124  //! @name Importers
125  //@{
126  //! merge block vectors in the monolithic vector
128  //! split the monolithic vector in the block vectors
130  //@}
131 
132 };
133 
134 //! @func
135 /*!
136  * Utility function to transform a Epetra_BlockMap in a Epetra_Map.
137  * Used to overcome a bad design in Trilinos.
138  */
140 
141 }
142 #endif /* BLOCKEPETRA_MAP_HPP_ */
const import_Type & mono2blockImporter(UInt iblock) const
return an Trilinos import_Type object from the monolithic map to block iblock map.
This class handles block access to parallel monolithic Vectors with an underling block structure...
mapPtr_Type & blockMap(UInt iblock)
returns the original map of block iblock
void setUp(const Epetra_BlockMap &map1, const Epetra_BlockMap &map2, const Epetra_BlockMap &map3)
other set up routines to overcome a design problem in Trilinos (3 blocks)
mapPtrContainer_Type::const_iterator mapPtrConstIterator_Type
mapPtr_Type & blockShiftedMap(UInt iblock)
returns the map relative to block iblock in the numbering of the monolithic map
const constMapPtr_Type blockMap(UInt iblock) const
const version
void setUp(const mapPtrContainer_Type &mapPtrContainer)
general setup for arbitrary number of blocks. The maps of the block to stride are collected in a mapP...
std::vector< importPtr_Type > importPtrContainer_Type
BlockEpetra_Map(const mapPtrContainer_Type &mapPtrContainer)
Construct a BlockEpetra_Map from an ordered list of Epetra_BlockMap objects.
boost::shared_ptr< import_Type > importPtr_Type
std::shared_ptr< const map_Type > constMapPtr_Type
importPtrContainer_Type M_mono2block
split the monolithic vector in the block vectors
const constMapPtr_Type monolithicMap() const
const version
Abstract class which defines the interface of a Linear Operator.
importPtrContainer_Type::iterator importPtrIterator_Type
void updateInverseJacobian(const UInt &iQuadPt)
mapPtrContainer_Type M_blockMap
std::vector< UInt > M_myLocalOffsets
const constMapPtr_Type blockShiftedMap(UInt iblock) const
const version
BlockEpetra_Map(const BlockEpetra_Map &map)
Copy constructor.
std::vector< mapPtr_Type > mapPtrContainer_Type
BlockEpetra_Map()
Default Constructor.
importPtrContainer_Type M_block2mono
merge block vectors in the monolithic vector
mapPtrContainer_Type M_blockShiftedMap
const import_Type & block2monoImporter(UInt iblock) const
return an Trilinos import_Type object from block iblock map to the monolithic map ...
A derived class from Epetra_MultiVector specialized to handle parallel block structured Vectors...
importPtrContainer_Type::const_iterator importPtrConstIterator_Type
void setUp(const Epetra_BlockMap &map1, const Epetra_BlockMap &map2)
other set up routines to overcome a design problem in Trilinos (2 blocks)
mapPtr_Type & monolithicMap()
returns the monolithicMap
void showMe()
Print debug info.
UInt nBlocks() const
get the number of blocks
Epetra_Map * blockMap2Map(const Epetra_BlockMap *blockMap)
uint32_type UInt
generic unsigned integer (used mainly for addressing)
Definition: LifeV.hpp:191
mapPtrContainer_Type::iterator mapPtrIterator_Type