LifeV
VectorEpetraStructuredView.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 This file contains the the VectorEpetraStructuredView implementation.
30 
31  @author Samuel Quinodoz <samuel.quinodoz@epfl.ch>
32  @date 07 Jun 2011
33  */
34 
35 #include <lifev/core/array/VectorEpetraStructuredView.hpp>
36 
37 namespace LifeV
38 {
39 
40 // ===================================================
41 // Constructors & Destructor
42 // ===================================================
43 
46  : M_blockSize(),
47  M_firstIndex(),
49  M_vector()
50 {}
51 
54  : M_blockSize (otherView.M_blockSize),
55  M_firstIndex (otherView.M_firstIndex),
57  M_vector (otherView.M_vector)
58 {}
59 
62 {}
63 
64 // ===================================================
65 // Methods
66 // ===================================================
67 
68 void
70 showMe ( std::ostream& output ) const
71 {
72  output << "VectorBlockViewEpetra informations:" << std::endl
73  << "Size = " << M_blockSize << std::endl
74  << "First index = " << M_firstIndex << std::endl
75  << "Last (valid) index = " << M_lastValidIndex << std::endl;
76 }
77 
78 Int
80 sumIntoGlobalValues ( const Int GID, const Real value ) const
81 {
82  ASSERT (GID < static_cast<Int> (M_blockSize), " Error in assembling the block vector: global id to large for the block")
83 
84  // Compute the global ID in the monolithic vector:
85  // size of the block + location in the block
86  const Int TotalGID (GID + M_firstIndex);
87  return M_vector->sumIntoGlobalValues ( TotalGID, value );
88 }
89 
90 // ===================================================
91 // Set Methods
92 // ===================================================
93 
94 void
96 setup ( const UInt& firstIndex, const UInt& blockSize, vector_Type* vector )
97 {
98  M_blockSize = blockSize;
99  M_firstIndex = firstIndex;
100  M_lastValidIndex = firstIndex + blockSize - 1;
101  M_vector = vector;
102 }
103 
104 } // Namespace LifeV
Int sumIntoGlobalValues(const Int GID, const Real value) const
Assembly procedure.
void showMe(std::ostream &output=std::cout) const
Print the informations about the VectorEpetraStructuredView.
VectorEpetra vector_Type
Typedef for the underlying vector type.
int32_type Int
Generic integer data.
Definition: LifeV.hpp:188
VectorEpetraStructuredView - class representing a block in a VectorEpetraStructuredView.
void updateInverseJacobian(const UInt &iQuadPt)
#define ASSERT(X, A)
Definition: LifeAssert.hpp:90
VectorEpetraStructuredView(const VectorEpetraStructuredView &otherView)
Copy constructor.
double Real
Generic real data.
Definition: LifeV.hpp:175
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
void setup(const UInt &firstIndex, const UInt &blockSize, vector_Type *vector)