LifeV
VectorBlockMonolithicEpetraView.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 A short description of the file content
30 
31  @author Samuel Quinodoz <samuel.quinodoz@epfl.ch>
32  @date 07 Jun 2011
33 
34  A more detailed description of the file (if necessary)
35  */
36 
38 
39 namespace LifeV
40 {
41 
42 // ===================================================
43 // Constructors & Destructor
44 // ===================================================
45 
48  : M_blockSize(),
49  M_firstIndex(),
51  M_vector()
52 {}
53 
56  : M_blockSize (otherView.M_blockSize),
57  M_firstIndex (otherView.M_firstIndex),
59  M_vector (otherView.M_vector)
60 {}
61 
64 {}
65 
66 // ===================================================
67 // Methods
68 // ===================================================
69 
70 void
72 showMe ( std::ostream& output ) const
73 {
74  output << "VectorBlockViewEpetra informations:" << std::endl
75  << "Size = " << M_blockSize << std::endl
76  << "First index = " << M_firstIndex << std::endl
77  << "Last (valid) index = " << M_lastValidIndex << std::endl;
78 }
79 
80 Int
82 sumIntoGlobalValues ( const Int GID, const Real value ) const
83 {
84  ASSERT (GID < static_cast<Int> (M_blockSize), " Error in assembling the block vector: global id to large for the block")
85 
86  // Compute the global ID in the monolithic vector:
87  // size of the block + location in the block
88  const Int TotalGID (GID + M_firstIndex);
89  return M_vector->sumIntoGlobalValues ( TotalGID, value );
90 }
91 
92 // ===================================================
93 // Set Methods
94 // ===================================================
95 
96 void
98 setup ( const UInt& firstIndex, const UInt& blockSize, vector_Type* vector )
99 {
100  M_blockSize = blockSize;
101  M_firstIndex = firstIndex;
102  M_lastValidIndex = firstIndex + blockSize - 1;
103  M_vector = vector;
104 }
105 
106 } // Namespace LifeV
void setup(const UInt &firstIndex, const UInt &blockSize, vector_Type *vector)
Int sumIntoGlobalValues(const Int GID, const Real value) const
Assembly procedure.
VectorBlockMonolithicEpetraView - class representing a block in a VectorBlockMonolithicEpetra.
int32_type Int
Generic integer data.
Definition: LifeV.hpp:188
void updateInverseJacobian(const UInt &iQuadPt)
VectorBlockMonolithicEpetraView(const VectorBlockMonolithicEpetraView &otherView)
Copy constructor.
#define ASSERT(X, A)
Definition: LifeAssert.hpp:90
double Real
Generic real data.
Definition: LifeV.hpp:175
VectorEpetra vector_Type
Typedef for the underlying vector type.
void showMe(std::ostream &output=std::cout) const
Print the informations about the VectorBlockMonolithicEpetraView.
Int sumIntoGlobalValues(const Int GID, const Real value)
insert a global value
uint32_type UInt
generic unsigned integer (used mainly for addressing)
Definition: LifeV.hpp:191