LifeV
VectorEpetraStructured.cpp
Go to the documentation of this file.
1 //@HEADER
2 /*
3 *******************************************************************************
4 
5  Copyright (C) 2004, 2005, 2007 EPFL, Politecnico di Milano, INRIA
6  Copyright (C) 2010 EPFL, Politecnico di Milano, Emory University
7 
8  This file is part of LifeV.
9 
10  LifeV is free software; you can redistribute it and/or modify
11  it under the terms of the GNU Lesser General Public License as published by
12  the Free Software Foundation, either version 3 of the License, or
13  (at your option) any later version.
14 
15  LifeV is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public License
21  along with LifeV. If not, see <http://www.gnu.org/licenses/>.
22 
23 *******************************************************************************
24 */
25 //@HEADER
26 
27 /*!
28  @file
29  @brief Implementation file for VectorEpetraStructured
30 
31  @author Samuel Quinodoz <samuel.quinodoz@epfl.ch>
32  @date 01 Jun 2011
33  */
34 
35 #include <lifev/core/array/VectorEpetraStructured.hpp>
36 
37 namespace LifeV
38 {
39 
40 // ===================================================
41 // Constructors & Destructor
42 // ===================================================
43 
46  const mapType_type& mapType,
47  const combineMode_Type combineMode )
48  : VectorEpetra ( map, mapType, combineMode ),
50 {}
51 
54  const mapType_type& mapType,
55  const combineMode_Type combineMode )
56  : VectorEpetra ( mapType, combineMode ),
58 {
59  ASSERT ( mapVector.nbMap() > 0 , "Map vector empty, impossible to construct a VectorBlockMonolithicEpetra!" );
60 
61  map_Type myMap ( mapVector.totalMap() );
62 
63  // Set the global map
64  this->setMap ( myMap );
65 }
66 
69  : VectorEpetra ( vector ),
71 {}
72 
77 {}
78 
80 VectorEpetraStructured ( const VectorEpetraStructured& vector, const mapType_type& mapType, const combine_type& combineMode )
83 {}
84 
85 // ===================================================
86 // Set Methods
87 // ===================================================
88 
89 void
91 setBlockStructure ( const std::vector<UInt>& blockSizes )
92 {
93  M_blockStructure.setBlockStructure ( blockSizes );
94 
95  ASSERT ( M_blockStructure.totalSize() == static_cast<UInt> ( this->size() ), " Incompatible block structure (global size does not match) " );
96 }
97 
98 void
100 setBlockStructure ( const mapVector_type& mapVector )
101 {
102  M_blockStructure.setBlockStructure ( mapVector );
103 
104  ASSERT ( M_blockStructure.totalSize() == static_cast<UInt> ( this->size() ), " Incompatible block structure (global size does not match) " );
105 }
106 
107 void
109 setBlockStructure ( const VectorBlockStructure& blockStructure )
110 {
111  M_blockStructure.setBlockStructure ( blockStructure );
112 }
113 
114 // ===================================================
115 // Get Methods
116 // ===================================================
117 
118 UInt
120 blockSize ( const UInt& index ) const
121 {
122  return M_blockStructure.blockSize ( index );
123 }
124 
125 void
127 blockView ( const UInt& index, block_type& blockView )
128 {
129  blockView.setup ( M_blockStructure.blockFirstIndex ( index ), M_blockStructure.blockSize ( index ), this );
130 }
131 
134 block ( const UInt& index )
135 {
136  block_ptrType vectorBlockView ( new block_type );
137 
138  vectorBlockView->setup ( M_blockStructure.blockFirstIndex ( index ), M_blockStructure.blockSize ( index ), this );
139 
140  return vectorBlockView;
141 }
142 
146 {
147  return M_blockStructure;
148 }
149 
150 
151 } // Namespace LifeV
VectorEpetra - The Epetra Vector format Wrapper.
VectorEpetraStructuredView block_type
Type of the view.
Epetra_CombineMode combineMode_Type
void blockView(const UInt &index, block_type &blockView)
Getter for the block index.
VectorBlockStructure - class representing the structure of a vector.
VectorBlockStructure blockStructure() const
VectorEpetraStructured(const mapVector_type &mapVector, const mapType_type &mapType=Unique, const combineMode_Type combineMode=Add)
Construction with a vector of map.
VectorEpetraStructured(const VectorEpetraStructured &vector)
Copy constructor.
VectorEpetraStructured(const VectorEpetraStructured &vector, const mapType_type &mapType)
Copy constructor with a specified map type (Repeated/Unique)
VectorEpetra(const MapEpetra &map, const MapEpetraType &mapType=Unique, const combineMode_Type combineMode=Add)
Constructor - Using Maps.
void updateInverseJacobian(const UInt &iQuadPt)
VectorEpetraStructured(const map_Type &map, const mapType_type &mapType=Unique, const combineMode_Type combineMode=Add)
Constructor with the monolithic map.
void setBlockStructure(const std::vector< UInt > &blockSizes)
VectorEpetraStructured - class of block vector.
VectorEpetra(const MapEpetraType &mapType=Unique, const combineMode_Type combineMode=Add)
Empty Constructor.
MapEpetraType mapType_type
Type of the map (Unique/Repeated)
#define ASSERT(X, A)
Definition: LifeAssert.hpp:90
std::shared_ptr< block_type > block_ptrType
Pointer on the view.
Epetra_CombineMode combine_type
Combine mode.
MapVector< map_Type > mapVector_type
Type of the MapVector to be used with this class.
UInt blockSize(const UInt &index) const
Getter for the size of the block index.
void setBlockStructure(const VectorBlockStructure &blockStructure)
MapEpetra map_Type
Type of the map to be used.
block_ptrType block(const UInt &index)
Getter for the block index.
uint32_type UInt
generic unsigned integer (used mainly for addressing)
Definition: LifeV.hpp:191
VectorEpetraStructured(const VectorEpetraStructured &vector, const mapType_type &mapType, const combine_type &combineMode)
Copy constructor with specified map type and combine mode.
void setBlockStructure(const mapVector_type &mapVector)
Reset the block structure using the blocks of a vector of map.