LifeV
VectorEpetraStructured Class Reference

VectorEpetraStructured - class of block vector. More...

#include <VectorEpetraStructured.hpp>

+ Inheritance diagram for VectorEpetraStructured:
+ Collaboration diagram for VectorEpetraStructured:

Private Attributes

VectorBlockStructure M_blockStructure
 

Public Types

typedef Real data_type
 Type of data stored. More...
 
typedef MapEpetra map_Type
 Type of the map to be used. More...
 
typedef MapVector< map_TypemapVector_type
 Type of the MapVector to be used with this class. More...
 
typedef MapEpetraType mapType_type
 Type of the map (Unique/Repeated) More...
 
typedef Epetra_CombineMode combine_type
 Combine mode. More...
 
typedef VectorEpetraStructuredView block_type
 Type of the view. More...
 
typedef std::shared_ptr< block_typeblock_ptrType
 Pointer on the view. More...
 

Constructor & Destructor

 VectorEpetraStructured (const map_Type &map, const mapType_type &mapType=Unique, const combineMode_Type combineMode=Add)
 Constructor with the monolithic map. More...
 
 VectorEpetraStructured (const mapVector_type &mapVector, const mapType_type &mapType=Unique, const combineMode_Type combineMode=Add)
 Construction with a vector of map. More...
 
 VectorEpetraStructured (const VectorEpetraStructured &vector)
 Copy constructor. More...
 
 VectorEpetraStructured (const VectorEpetraStructured &vector, const mapType_type &mapType)
 Copy constructor with a specified map type (Repeated/Unique) More...
 
 VectorEpetraStructured (const VectorEpetraStructured &vector, const mapType_type &mapType, const combine_type &combineMode)
 Copy constructor with specified map type and combine mode. More...
 
 ~VectorEpetraStructured ()
 Destructor. More...
 

Set Methods

void setBlockStructure (const std::vector< UInt > &blockSizes)
 
void setBlockStructure (const mapVector_type &mapVector)
 Reset the block structure using the blocks of a vector of map. More...
 
void setBlockStructure (const VectorBlockStructure &blockStructure)
 

Get Methods

UInt blockSize (const UInt &index) const
 Getter for the size of the block index. More...
 
void blockView (const UInt &index, block_type &blockView)
 Getter for the block index. More...
 
block_ptrType block (const UInt &index)
 Getter for the block index. More...
 
VectorBlockStructure blockStructure () const
 

Additional Inherited Members

- Public Types inherited from VectorEpetra
typedef Epetra_FEVector vector_type
 
typedef std::shared_ptr< vector_typevectorPtr_Type
 
typedef Real data_type
 
typedef Epetra_CombineMode combineMode_Type
 
- Public Member Functions inherited from VectorEpetra
 VectorEpetra (const MapEpetraType &mapType=Unique, const combineMode_Type combineMode=Add)
 Empty Constructor. More...
 
 VectorEpetra (const MapEpetra &map, const MapEpetraType &mapType=Unique, const combineMode_Type combineMode=Add)
 Constructor - Using Maps. More...
 
 VectorEpetra (const std::shared_ptr< MapEpetra > &mapPtr, const MapEpetraType &mapType=Unique, const combineMode_Type combineMode=Add)
 Constructor - Using Maps. More...
 
 VectorEpetra (const VectorEpetra &vector)
 Copy constructor. More...
 
 VectorEpetra (const VectorEpetra &vector, const MapEpetraType &mapType)
 Copy constructor. More...
 
 VectorEpetra (const VectorEpetra &vector, const MapEpetraType &mapType, const combineMode_Type &combineMode)
 Copy constructor. More...
 
 VectorEpetra (const Epetra_MultiVector &vector, const std::shared_ptr< MapEpetra > map, const MapEpetraType &mapType, const combineMode_Type combineMode=Add)
 Copy constructor. More...
 
 VectorEpetra (const VectorEpetra &vector, const Int &reduceToProc)
 Copy constructor. More...
 
virtual ~VectorEpetra ()
 Destructor. More...
 
data_typeoperator[] (const UInt row)
 Access operators. More...
 
const data_typeoperator[] (const UInt row) const
 Access operators. More...
 
data_typeoperator() (const UInt row)
 Access operators. More...
 
const data_typeoperator() (const UInt row) const
 Access operators. More...
 
VectorEpetraoperator= (const VectorEpetra &vector)
 Affectation operator. More...
 
VectorEpetraoperator= (const Epetra_MultiVector &vector)
 Affectation operator. More...
 
VectorEpetraoperator= (data_type scalar)
 Affectation operator. More...
 
VectorEpetraoperator+= (const VectorEpetra &vector)
 Addition operator. More...
 
VectorEpetraoperator-= (const VectorEpetra &vector)
 Subtraction operator. More...
 
VectorEpetraoperator*= (const VectorEpetra &vector)
 Multiplication operator. More...
 
VectorEpetraoperator/= (const VectorEpetra &vector)
 Division operator. More...
 
const VectorEpetra operator+ (const VectorEpetra &vector) const
 Addition operator. More...
 
const VectorEpetra operator- (const VectorEpetra &vector) const
 Subtraction operator. More...
 
const VectorEpetra operator* (const VectorEpetra &vector) const
 Multiplication operator. More...
 
const VectorEpetra operator/ (const VectorEpetra &vector) const
 Division operator. More...
 
VectorEpetraoperator+= (const data_type &scalar)
 Addition operator. More...
 
VectorEpetraoperator-= (const data_type &scalar)
 Subtraction operator. More...
 
VectorEpetraoperator*= (const data_type &scalar)
 Multiplication operator. More...
 
VectorEpetraoperator/= (const data_type &scalar)
 Division operator. More...
 
const VectorEpetra operator+ (const data_type &scalar) const
 Operations with scalar values (do not modify the vector of the class) More...
 
const VectorEpetra operator- (const data_type &scalar) const
 Subtraction operator. More...
 
const VectorEpetra operator* (const data_type &scalar) const
 Multiplication operator. More...
 
const VectorEpetra operator/ (const data_type &scalar) const
 Division operator. More...
 
VectorEpetra operator== (const Real &scalar) const
 Equality operator. More...
 
VectorEpetra operator!= (const Real &scalar) const
 Inequality operator. More...
 
VectorEpetra operator< (const Real &scalar) const
 Less than operator. More...
 
VectorEpetra operator> (const Real &scalar) const
 Greater than operator. More...
 
VectorEpetra operator<= (const Real &scalar) const
 Less than or equal to operator. More...
 
VectorEpetra operator>= (const Real &scalar) const
 Greater than or equal to operator. More...
 
VectorEpetra operator && (const VectorEpetra &vector) const
 Logical AND operator. More...
 
VectorEpetra operator|| (const VectorEpetra &vector) const
 Logical OR operator. More...
 
VectorEpetra operator! (void) const
 Logical NOT operator. More...
 
bool isGlobalIDPresent (const UInt row) const
 Access operators. More...
 
Int globalAssemble (combineMode_Type mode)
 Assemble the vector. More...
 
Int globalAssemble ()
 Assemble the vector. More...
 
Int globalToLocalRowId (const UInt row) const
 Return the local Id of a global row. More...
 
void zero ()
 set zero in all the vector entries More...
 
bool setCoefficient (const UInt row, const data_type &value, UInt offset=0)
 Look for the given global row and set its value. More...
 
Int setCoefficients (std::vector< Int > &rowsVector, std::vector< Real > &valuesVector)
 Set the row of the vector to the given value. More...
 
Int sumIntoGlobalValues (const Int GID, const Real value)
 insert a global value More...
 
VectorEpetraadd (const VectorEpetra &vector, const Int offset=0)
 Add a vector to the current vector with an offset. More...
 
VectorEpetrareplace (const VectorEpetra &vector, const Int &offset)
 Replace part of the vector with a given vector. More...
 
VectorEpetrasubset (const VectorEpetra &vector, const UInt offset=0)
 Set the current vector to a subset of the given vector with an offset. More...
 
VectorEpetrasubset (const VectorEpetra &vector, const MapEpetra &map, const UInt offset1, const UInt offset2)
 Set the current vector to a subset of vector with an offset. More...
 
VectorEpetrasubset (const Epetra_MultiVector &vector, const MapEpetra &map, const UInt offset1, const UInt offset2, const UInt column=0)
 Set the current vector to a subset of vector with an offset. More...
 
void meanValue (Real *result) const
 Compute the mean value of the vector components and store it in the given variable. More...
 
Real norm1 () const
 Compute and return the norm 1. More...
 
void norm1 (Real *result) const
 Compute and store the norm 1 in the given pointed variable. More...
 
void norm1 (Real &result) const
 Compute and store the norm 1 in the given variable. More...
 
Real norm2 () const
 Compute and return the norm 2. More...
 
void norm2 (Real *result) const
 Compute and store the norm 2 in the given pointed variable. More...
 
void norm2 (Real &result) const
 Compute and store the norm 2 in the given variable. More...
 
Real normInf () const
 Compute and return the norm inf. More...
 
void normInf (Real *result) const
 Compute and store the norm inf in the given pointed variable. More...
 
void normInf (Real &result) const
 Compute and store the norm inf in the given variable. More...
 
Real minValue () const
 Compute and return the minimum value in the vector. More...
 
void minValue (Real *result) const
 Compute and store the minimum value of the vector in the given pointed variable. More...
 
void minValue (Real &result) const
 Compute and store the minimum value of the vector in the given variable. More...
 
Real maxValue () const
 Compute and return the maximum value in the vector. More...
 
void maxValue (Real *result) const
 Compute and store the maximum value of the vector in the given pointed variable. More...
 
void maxValue (Real &result) const
 Compute and store the maximum value of the vector in the given variable. More...
 
void abs (void)
 Replace the vector with his absolute value. More...
 
void abs (VectorEpetra &vector)
 Compute the absolute value of a vector and store it in an other vector. More...
 
void sqrt ()
 Apply the square root to of each element in the vector. More...
 
data_type dot (const VectorEpetra &vector) const
 Compute the scalar product of two vectors. More...
 
void dot (const VectorEpetra &vector, data_type &scalarProduct)
 Compute the scalar product of two vectors and store the result in a given variable. More...
 
void matrixMarket (std::string const &fileName, const bool headers=true) const
 Save the values of the matrix into a file. More...
 
void spy (std::string const &fileName) const
 Save the values of the matrix into a file. More...
 
void showMe (std::ostream &output=std::cout) const
 Print the contents of the vector. More...
 
void apply (const std::function< Real(Real)> &f)
 
void setCombineMode (combineMode_Type combineMode)
 Sets the combine mode for the import/export operations. More...
 
void setDefaultCombineMode ()
 Sets the combine mode for the import/export operations to default. More...
 
void setMap (const MapEpetra &map)
 Sets the map to use for the epetra vector. More...
 
const Epetra_Comm & comm () const
 Return the communicator of the vector. More...
 
vector_typeepetraVector ()
 Return the VectorEpetra in the wrapper. More...
 
const vector_typeepetraVector () const
 Return the VectorEpetra in the wrapper. More...
 
const vectorPtr_TypeepetraVectorPtr () const
 Return the shared pointer on the raw VectorEpetra. More...
 
const Epetra_BlockMap & blockMap () const
 Return the Epetra_BlockMap of the vector. More...
 
MapEpetraType mapType () const
 Return the map type of the vector (Unique or Repeated) More...
 
const MapEpetramap () const
 Return the MapEpetra of the vector. More...
 
const std::shared_ptr< MapEpetramapPtr () const
 Return a shared pointer on the MapEpetra. More...
 
const Epetra_Map & epetraMap () const
 Return the MapEpetra of the vector. More...
 
void setMapType (MapEpetraType type)
 
Int size () const
 Return the size of the vector. More...
 

Detailed Description

VectorEpetraStructured - class of block vector.

Author
Samuel Quinodoz samue.nosp@m.l.qu.nosp@m.inodo.nosp@m.z@ep.nosp@m.fl.ch

The VectorEpetraStructured class contains data related to block vector. It is an extension to VectorEpetra where data about blocks have been set. For an introduction to the block structures in LifeV, see this page.

There are mainly two ways to define a VectorEpetraStructured:

  • Construct it using the same syntax as for LifeV::VectorEpetra and the use a setter for the structure.
  • Construct it directly with the maps of the blocks.

Both ways are equivalent.

To access the blocks, one uses then the blockView or block methods.

Definition at line 70 of file VectorEpetraStructured.hpp.

Member Typedef Documentation

◆ data_type

typedef Real data_type

Type of data stored.

Definition at line 79 of file VectorEpetraStructured.hpp.

◆ map_Type

Type of the map to be used.

Definition at line 82 of file VectorEpetraStructured.hpp.

◆ mapVector_type

Type of the MapVector to be used with this class.

Definition at line 85 of file VectorEpetraStructured.hpp.

◆ mapType_type

Type of the map (Unique/Repeated)

Definition at line 88 of file VectorEpetraStructured.hpp.

◆ combine_type

typedef Epetra_CombineMode combine_type

Combine mode.

Definition at line 91 of file VectorEpetraStructured.hpp.

◆ block_type

Type of the view.

Definition at line 94 of file VectorEpetraStructured.hpp.

◆ block_ptrType

typedef std::shared_ptr<block_type> block_ptrType

Pointer on the view.

Definition at line 97 of file VectorEpetraStructured.hpp.

Constructor & Destructor Documentation

◆ VectorEpetraStructured() [1/5]

VectorEpetraStructured ( const map_Type map,
const mapType_type mapType = Unique,
const combineMode_Type  combineMode = Add 
)
explicit

Constructor with the monolithic map.

Definition at line 45 of file VectorEpetraStructured.cpp.

+ Here is the caller graph for this function:

◆ VectorEpetraStructured() [2/5]

VectorEpetraStructured ( const mapVector_type mapVector,
const mapType_type mapType = Unique,
const combineMode_Type  combineMode = Add 
)
explicit

Construction with a vector of map.

With this constructor, the block structure is automatically deduced from the maps in the vector. The monolithic map and vectors are also built by concatenating the different maps in the vector.

Definition at line 53 of file VectorEpetraStructured.cpp.

+ Here is the caller graph for this function:

◆ VectorEpetraStructured() [3/5]

Copy constructor.

Definition at line 68 of file VectorEpetraStructured.cpp.

+ Here is the caller graph for this function:

◆ VectorEpetraStructured() [4/5]

VectorEpetraStructured ( const VectorEpetraStructured vector,
const mapType_type mapType 
)

Copy constructor with a specified map type (Repeated/Unique)

Definition at line 74 of file VectorEpetraStructured.cpp.

+ Here is the caller graph for this function:

◆ VectorEpetraStructured() [5/5]

VectorEpetraStructured ( const VectorEpetraStructured vector,
const mapType_type mapType,
const combine_type combineMode 
)

Copy constructor with specified map type and combine mode.

Definition at line 80 of file VectorEpetraStructured.cpp.

+ Here is the caller graph for this function:

◆ ~VectorEpetraStructured()

Destructor.

Definition at line 132 of file VectorEpetraStructured.hpp.

Member Function Documentation

◆ setBlockStructure() [1/3]

void setBlockStructure ( const std::vector< UInt > &  blockSizes)

Set the size of the blocks of the vector

Parameters
blockSizesSizes of the blocks

Definition at line 91 of file VectorEpetraStructured.cpp.

◆ setBlockStructure() [2/3]

void setBlockStructure ( const mapVector_type mapVector)

Reset the block structure using the blocks of a vector of map.

Definition at line 100 of file VectorEpetraStructured.cpp.

◆ setBlockStructure() [3/3]

void setBlockStructure ( const VectorBlockStructure blockStructure)

Set the block structure of the vector

Parameters
blockStructureStructure of the vector

Definition at line 109 of file VectorEpetraStructured.cpp.

◆ blockSize()

UInt blockSize ( const UInt index) const

Getter for the size of the block index.

Parameters
indexIndex of the block
Returns
size of the index-th block

Definition at line 120 of file VectorEpetraStructured.cpp.

◆ blockView()

void blockView ( const UInt index,
block_type blockView 
)

Getter for the block index.

Parameters
indexIndex of the block
blockViewThe blockView to be filled

Definition at line 127 of file VectorEpetraStructured.cpp.

◆ block()

VectorEpetraStructured::block_ptrType block ( const UInt index)

Getter for the block index.

Parameters
indexIndex of the block
Returns
The index-th block

Definition at line 134 of file VectorEpetraStructured.cpp.

◆ blockStructure()

VectorBlockStructure blockStructure ( ) const

Get the block structure of the vector

Parameters
blockStructureStructure of the vector

Definition at line 145 of file VectorEpetraStructured.cpp.

Field Documentation

◆ M_blockStructure

VectorBlockStructure M_blockStructure
private

Definition at line 198 of file VectorEpetraStructured.hpp.


The documentation for this class was generated from the following files: