LifeV
VectorEpetra Class Reference

VectorEpetra - The Epetra Vector format Wrapper. More...

#include <VectorEpetra.hpp>

+ Inheritance diagram for VectorEpetra:
+ Collaboration diagram for VectorEpetra:

Private Attributes

std::shared_ptr< MapEpetraM_epetraMap
 
MapEpetraType M_mapType
 
vectorPtr_Type M_epetraVector
 
combineMode_Type M_combineMode
 

Public Types

typedef Epetra_FEVector vector_type
 
typedef std::shared_ptr< vector_typevectorPtr_Type
 
typedef Real data_type
 
typedef Epetra_CombineMode combineMode_Type
 

Constructors & Destructor

 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...
 

Operators

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...
 

Methods

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)
 

Set Methods

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...
 

Get Methods

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...
 

Private Methods

VectorEpetraImport (const Epetra_FEVector &vector, combineMode_Type combineMode)
 Import the value of a vector. More...
 
VectorEpetraExport (const Epetra_FEVector &vector, combineMode_Type combineMode)
 Export the value of a vector. More...
 

Detailed Description

VectorEpetra - The Epetra Vector format Wrapper.

Author
Gilles Fourestey, Simone Deparis, Cristiano Malossi

The VectorEpetra class provides a general interface for the Epetra_Vector of Trilinos.

Visit http://trilinos.sandia.gov for more informations about Epetra_Vector.

Definition at line 62 of file VectorEpetra.hpp.

Member Typedef Documentation

◆ vector_type

typedef Epetra_FEVector vector_type

Definition at line 69 of file VectorEpetra.hpp.

◆ vectorPtr_Type

typedef std::shared_ptr< vector_type > vectorPtr_Type

Definition at line 70 of file VectorEpetra.hpp.

◆ data_type

typedef Real data_type

Definition at line 71 of file VectorEpetra.hpp.

◆ combineMode_Type

typedef Epetra_CombineMode combineMode_Type

Definition at line 72 of file VectorEpetra.hpp.

Constructor & Destructor Documentation

◆ VectorEpetra() [1/8]

VectorEpetra ( const MapEpetraType mapType = Unique,
const combineMode_Type  combineMode = Add 
)
explicit

Empty Constructor.

Parameters
mapTypeSpecify whether the map is Unique or Repeated

Definition at line 53 of file VectorEpetra.cpp.

+ Here is the caller graph for this function:

◆ VectorEpetra() [2/8]

VectorEpetra ( const MapEpetra map,
const MapEpetraType mapType = Unique,
const combineMode_Type  combineMode = Add 
)
explicit

Constructor - Using Maps.

This constructor uses maps to build the vector

Parameters
mapMap to be used to split the vector between the processors
mapTypeSpecify wether the map is Unique or Repeated

Definition at line 61 of file VectorEpetra.cpp.

+ Here is the caller graph for this function:

◆ VectorEpetra() [3/8]

VectorEpetra ( const std::shared_ptr< MapEpetra > &  mapPtr,
const MapEpetraType mapType = Unique,
const combineMode_Type  combineMode = Add 
)
explicit

Constructor - Using Maps.

This constructor uses maps to build the vector

Parameters
mapPtrPointer to the map which has to be used to split the vector between the processors
mapTypeSpecify wether the map is Unique or Repeated

Definition at line 73 of file VectorEpetra.cpp.

+ Here is the caller graph for this function:

◆ VectorEpetra() [4/8]

VectorEpetra ( const VectorEpetra vector)

Copy constructor.

Parameters
vectorVector to be used to create the new vector

Definition at line 85 of file VectorEpetra.cpp.

+ Here is the caller graph for this function:

◆ VectorEpetra() [5/8]

VectorEpetra ( const VectorEpetra vector,
const MapEpetraType mapType 
)

Copy constructor.

Parameters
vectorVector to be used to create the new vector
mapTypeSpecify whether the map is Unique or Repeated

Definition at line 94 of file VectorEpetra.cpp.

+ Here is the caller graph for this function:

◆ VectorEpetra() [6/8]

VectorEpetra ( const VectorEpetra vector,
const MapEpetraType mapType,
const combineMode_Type combineMode 
)

Copy constructor.

Parameters
vectorVector to be used to create the new vector
mapTypeSpecify wether the map is Unique or Repeated
combineModeParameter used during the copy, and not in subsequent calls.

Definition at line 106 of file VectorEpetra.cpp.

+ Here is the caller graph for this function:

◆ VectorEpetra() [7/8]

VectorEpetra ( const Epetra_MultiVector vector,
const std::shared_ptr< MapEpetra map,
const MapEpetraType mapType,
const combineMode_Type  combineMode = Add 
)

Copy constructor.

Copies vector to FEvector that comes as Multivector

Parameters
vectorVector to be used to create the new vector
mapMap to be used to split the vector between the processors
mapTypeSpecify wether the map is Unique or Repeated

Definition at line 135 of file VectorEpetra.cpp.

+ Here is the caller graph for this function:

◆ VectorEpetra() [8/8]

VectorEpetra ( const VectorEpetra vector,
const Int reduceToProc 
)

Copy constructor.

Copies vector to a vector which resides only on the processor "reduceToProc".

Parameters
vectorVector to be used to create the new vector
mapMap to be used to split the vector between the processors
mapTypeSpecify wether the map is Unique or Repeated

Definition at line 151 of file VectorEpetra.cpp.

+ Here is the caller graph for this function:

◆ ~VectorEpetra()

virtual ~VectorEpetra ( )
inlinevirtual

Destructor.

Definition at line 151 of file VectorEpetra.hpp.

Member Function Documentation

◆ operator[]() [1/2]

VectorEpetra::data_type & operator[] ( const UInt  row)

Access operators.

Parameters
rowIndex of the entry to be accessed

Definition at line 168 of file VectorEpetra.cpp.

+ Here is the caller graph for this function:

◆ operator[]() [2/2]

const VectorEpetra::data_type & operator[] ( const UInt  row) const

Access operators.

Parameters
rowIndex of the entry to be accessed

Definition at line 184 of file VectorEpetra.cpp.

+ Here is the caller graph for this function:

◆ operator()() [1/2]

VectorEpetra::data_type & operator() ( const UInt  row)

Access operators.

Parameters
rowIndex of the entry to be accessed

Definition at line 201 of file VectorEpetra.cpp.

+ Here is the caller graph for this function:

◆ operator()() [2/2]

const VectorEpetra::data_type & operator() ( const UInt  row) const

Access operators.

Parameters
rowIndex of the entry to be accessed

Definition at line 208 of file VectorEpetra.cpp.

+ Here is the caller graph for this function:

◆ operator=() [1/3]

VectorEpetra & operator= ( const VectorEpetra vector)

Affectation operator.

Copies the value of the given vector inside the vector. If the map is not the same, try to import the values. Calls Import with Add.

Parameters
vectorVector to be affected to the current vector

Definition at line 216 of file VectorEpetra.cpp.

+ Here is the caller graph for this function:

◆ operator=() [2/3]

VectorEpetra & operator= ( const Epetra_MultiVector vector)

Affectation operator.

Copies the value of the given vector inside the vector. If the map is not the same, try to import the values. Calls Import with Add.

Parameters
vectorVector to be affected to the current vector

Definition at line 275 of file VectorEpetra.cpp.

◆ operator=() [3/3]

VectorEpetra & operator= ( data_type  scalar)

Affectation operator.

Put the given scalar in each component of the vector

Parameters
scalarScalar to be used to fill the current vector

Definition at line 293 of file VectorEpetra.cpp.

+ Here is the caller graph for this function:

◆ operator+=() [1/2]

VectorEpetra & operator+= ( const VectorEpetra vector)

Addition operator.

Element by Element addition (if the map is not the same, try to import values)

Parameters
vectorVector to be added to the current vector

Definition at line 301 of file VectorEpetra.cpp.

+ Here is the caller graph for this function:

◆ operator-=() [1/2]

VectorEpetra & operator-= ( const VectorEpetra vector)

Subtraction operator.

Element by Element subtraction (if the map is not the same, try to import values)

Parameters
vectorVector to be subtracted to the current vector

Definition at line 317 of file VectorEpetra.cpp.

+ Here is the caller graph for this function:

◆ operator*=() [1/2]

VectorEpetra & operator*= ( const VectorEpetra vector)

Multiplication operator.

Element by Element multiplication (if the map is not the same, try to import values)

Parameters
vectorVector to be perform the multiplication

Definition at line 333 of file VectorEpetra.cpp.

+ Here is the caller graph for this function:

◆ operator/=() [1/2]

VectorEpetra & operator/= ( const VectorEpetra vector)

Division operator.

Element by Element division (if the map is not the same, try to import values)

Parameters
vectorVector to be perform the division

Definition at line 349 of file VectorEpetra.cpp.

+ Here is the caller graph for this function:

◆ operator+() [1/2]

const VectorEpetra operator+ ( const VectorEpetra vector) const

Addition operator.

Element by Element addition (do not modify the vector of the class)

Parameters
vectorVector to be added to the current vector

Definition at line 365 of file VectorEpetra.cpp.

+ Here is the caller graph for this function:

◆ operator-() [1/2]

const VectorEpetra operator- ( const VectorEpetra vector) const

Subtraction operator.

Element by Element subtraction (do not modify the vector of the class)

Parameters
vectorVector to be subtracted to the current vector

Definition at line 375 of file VectorEpetra.cpp.

◆ operator*() [1/2]

const VectorEpetra operator* ( const VectorEpetra vector) const

Multiplication operator.

Element by Element multiplication (do not modify the vector of the class)

Parameters
vectorVector to be perform the multiplication

Definition at line 385 of file VectorEpetra.cpp.

◆ operator/() [1/2]

const VectorEpetra operator/ ( const VectorEpetra vector) const

Division operator.

Element by Element division (do not modify the vector of the class)

Parameters
vectorVector to be perform the division

Definition at line 395 of file VectorEpetra.cpp.

◆ operator+=() [2/2]

VectorEpetra & operator+= ( const data_type scalar)

Addition operator.

Add a scalar value to the components of the current vector. (modify the vector of the class)

Parameters
scalarValue to be added

Definition at line 405 of file VectorEpetra.cpp.

+ Here is the caller graph for this function:

◆ operator-=() [2/2]

VectorEpetra & operator-= ( const data_type scalar)

Subtraction operator.

Subtract a scalar value to the components of the current vector. (modify the vector of the class)

Parameters
scalarValue to be subtracted

Definition at line 418 of file VectorEpetra.cpp.

+ Here is the caller graph for this function:

◆ operator*=() [2/2]

VectorEpetra & operator*= ( const data_type scalar)

Multiplication operator.

Multiply by a scalar value the components of the current vector. (modify the vector of the class)

Parameters
scalarValue for the multiplication

Definition at line 426 of file VectorEpetra.cpp.

+ Here is the caller graph for this function:

◆ operator/=() [2/2]

VectorEpetra & operator/= ( const data_type scalar)

Division operator.

Division by a scalar value the components of the current vector. (modify the vector of the class)

Parameters
scalarValue for the division

Definition at line 434 of file VectorEpetra.cpp.

+ Here is the caller graph for this function:

◆ operator+() [2/2]

const VectorEpetra operator+ ( const data_type scalar) const

Operations with scalar values (do not modify the vector of the class)

Addition operator

Add a scalar value to the components of the current vector. (do not modify the vector of the class)

Parameters
scalarValue to be added

Definition at line 442 of file VectorEpetra.cpp.

◆ operator-() [2/2]

const VectorEpetra operator- ( const data_type scalar) const

Subtraction operator.

Subtract a scalar value to the components of the current vector. (do not modify the vector of the class)

Parameters
scalarValue to be subtracted

Definition at line 452 of file VectorEpetra.cpp.

◆ operator*() [2/2]

const VectorEpetra operator* ( const data_type scalar) const

Multiplication operator.

Multiply by a scalar value the components of the current vector. (do not modify the vector of the class)

Parameters
scalarValue for the multiplication

Definition at line 462 of file VectorEpetra.cpp.

◆ operator/() [2/2]

const VectorEpetra operator/ ( const data_type scalar) const

Division operator.

Division by a scalar value the components of the current vector. (do not modify the vector of the class)

Parameters
scalarValue for the division

Definition at line 472 of file VectorEpetra.cpp.

◆ operator==()

VectorEpetra operator== ( const Real scalar) const

Equality operator.

Return a vector containing 1 where vector elements are == scalar

Parameters
scalarValue for the comparison.

Definition at line 482 of file VectorEpetra.cpp.

◆ operator!=()

VectorEpetra operator!= ( const Real scalar) const

Inequality operator.

Return a vector containing 1 where vector elements are != scalar

Parameters
scalarValue for the comparison.

Definition at line 497 of file VectorEpetra.cpp.

◆ operator<()

VectorEpetra operator< ( const Real scalar) const

Less than operator.

Return a vector containing 1 where vector elements are < scalar

Parameters
scalarValue for the comparison.

Definition at line 512 of file VectorEpetra.cpp.

◆ operator>()

VectorEpetra operator> ( const Real scalar) const

Greater than operator.

Return a vector containing 1 where vector elements are > scalar

Parameters
scalarValue for the comparison.

Definition at line 527 of file VectorEpetra.cpp.

◆ operator<=()

VectorEpetra operator<= ( const Real scalar) const

Less than or equal to operator.

Return a vector containing 1 where vector elements are <= scalar

Parameters
scalarValue for the comparison.

Definition at line 542 of file VectorEpetra.cpp.

◆ operator>=()

VectorEpetra operator>= ( const Real scalar) const

Greater than or equal to operator.

Return a vector containing 1 where vector elements are >= scalar

Parameters
scalarValue for the comparison.

Definition at line 557 of file VectorEpetra.cpp.

◆ operator &&()

VectorEpetra operator&& ( const VectorEpetra vector) const

Logical AND operator.

Return a vector containing one where both elements are != zero

Parameters
vectorVector for the logical comparison.

◆ operator||()

VectorEpetra operator|| ( const VectorEpetra vector) const

Logical OR operator.

Return a vector containing one where one of the elements is != zero

Parameters
vectorVector for the logical comparison.

Definition at line 587 of file VectorEpetra.cpp.

◆ operator!()

VectorEpetra operator! ( void  ) const

Logical NOT operator.

Return a vector containing one where the vector is equal to zero

Definition at line 602 of file VectorEpetra.cpp.

◆ isGlobalIDPresent()

bool isGlobalIDPresent ( const UInt  row) const

Access operators.

It returns true if the element is present in the vector

Parameters
rowThe element to test

Definition at line 620 of file VectorEpetra.cpp.

+ Here is the caller graph for this function:

◆ globalAssemble() [1/2]

Int globalAssemble ( combineMode_Type  mode)
inline

Assemble the vector.

Gather any shared data into the non-overlapping partitioning defined by the Map that was passed to this vector at construction time. Data imported from other processors is stored on the owning processor with a the given operation

Parameters
modeCombining mode used to gather the data

Definition at line 412 of file VectorEpetra.hpp.

◆ globalAssemble() [2/2]

Int globalAssemble ( )
inline

Assemble the vector.

Specialization of the globalAssemble ( combineMode_Type mode ) that uses M_combineMode as default value

Definition at line 423 of file VectorEpetra.hpp.

+ Here is the caller graph for this function:

◆ globalToLocalRowId()

Int globalToLocalRowId ( const UInt  row) const

Return the local Id of a global row.

Parameters
rowGlobal row Id
  1. if row is mine returns the LID
  2. if row is not mine and if the numCpus > 1, returns -1
  3. if row is not mine and if the numCpus == 1, asserts

Definition at line 625 of file VectorEpetra.cpp.

+ Here is the caller graph for this function:

◆ zero()

void zero ( )
inline

set zero in all the vector entries

Definition at line 440 of file VectorEpetra.hpp.

+ Here is the caller graph for this function:

◆ setCoefficient()

bool setCoefficient ( const UInt  row,
const data_type value,
UInt  offset = 0 
)

Look for the given global row and set its value.

Parameters
rowGlobal row Id
  1. if row is mine sets this[row] = value and return true
  2. if row is not mine and if the numCpus > 1, returns false
  3. if row is not mine and if the numCpus == 1, asserts
valueValue to be set at the given row
offsetOffset used in the map numbering

Definition at line 638 of file VectorEpetra.cpp.

+ Here is the caller graph for this function:

◆ setCoefficients()

Int setCoefficients ( std::vector< Int > &  rowsVector,
std::vector< Real > &  valuesVector 
)

Set the row of the vector to the given value.

Parameters
rowsVectorVector containing the row Ids
valuesVectorVector containing the values

vectors must be of the same size

Definition at line 650 of file VectorEpetra.cpp.

◆ sumIntoGlobalValues()

Int sumIntoGlobalValues ( const Int  GID,
const Real  value 
)

insert a global value

After insertion, you will have to call global assemble

Parameters
GIDGlobal Id of the row where the value should be inserted
valueValue to be inserted

Definition at line 713 of file VectorEpetra.cpp.

+ Here is the caller graph for this function:

◆ add()

VectorEpetra & add ( const VectorEpetra vector,
const Int  offset = 0 
)

Add a vector to the current vector with an offset.

typically to do: (u,p) += p or (u,p) += u. Note: the nodes to add are taken by the map of vector, hence:

  1. if this has a unique map: then vector should also (otherwise run time error)
  2. if this has a repeated map: then vector should also. (otherwise wrong)
Parameters
vectorVector to be added
offsetOffset to shift the value

Definition at line 719 of file VectorEpetra.cpp.

◆ replace()

VectorEpetra & replace ( const VectorEpetra vector,
const Int offset 
)

Replace part of the vector with a given vector.

Typical examples are: (u,p) = p or (u,p) = u. Note: the nodes to add are taken by the map of vector, hence:

  1. if this has a unique map: then vector should also (otherwise run time error)
  2. if this has a repeated map: then vector should also. (otherwise wrong)
Parameters
vectorgiven vector
offsetidentify the first element to be replaced

Definition at line 735 of file VectorEpetra.cpp.

+ Here is the caller graph for this function:

◆ subset() [1/3]

VectorEpetra & subset ( const VectorEpetra vector,
const UInt  offset = 0 
)

Set the current vector to a subset of the given vector with an offset.

typically to do: p = (u,p) or u = (u,p). Note: the nodes to add are taken by the map of this, hence:

  1. if vector has a unique map: then this should also (otherwise run time error)
  2. if vector has a repeated map: then this should also. (otherwise wrong)
    Parameters
    vectorVector of value to set the current vector
    offsetOffset to shift the value

Definition at line 751 of file VectorEpetra.cpp.

+ Here is the caller graph for this function:

◆ subset() [2/3]

VectorEpetra & subset ( const VectorEpetra vector,
const MapEpetra map,
const UInt  offset1,
const UInt  offset2 
)

Set the current vector to a subset of vector with an offset.

similar to subset( const VectorEpetra& , const Int ), but with additional parameters:

Parameters
vectorvector from which to copy data
mapmap from which to select indeces to copy
offset1offset to apply to input vector
offset2offset to apply to this vector

Definition at line 758 of file VectorEpetra.cpp.

+ Here is the caller graph for this function:

◆ subset() [3/3]

VectorEpetra & subset ( 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.

similar to subset( const VectorEpetra& , const Int ), but with additional parameters:

Parameters
vectorEpetra_MultiVector, instead of VectorEpetra, from which to copy data
mapmap from which to select indeces to copy
offset1offset to apply to input vector
offset2offset to apply to this vector
columncolumn of the multivector from which to extract the data

Definition at line 771 of file VectorEpetra.cpp.

◆ meanValue()

void meanValue ( Real result) const

Compute the mean value of the vector components and store it in the given variable.

Parameters
resultVariable where the result should be stored

Definition at line 796 of file VectorEpetra.cpp.

◆ norm1() [1/3]

Real norm1 ( ) const

Compute and return the norm 1.

Definition at line 802 of file VectorEpetra.cpp.

◆ norm1() [2/3]

void norm1 ( Real result) const

Compute and store the norm 1 in the given pointed variable.

Parameters
resultPointer on the variable where the result should be stored

Definition at line 810 of file VectorEpetra.cpp.

+ Here is the caller graph for this function:

◆ norm1() [3/3]

void norm1 ( Real result) const

Compute and store the norm 1 in the given variable.

Parameters
resultVariable where the result should be stored

Definition at line 816 of file VectorEpetra.cpp.

+ Here is the caller graph for this function:

◆ norm2() [1/3]

Real norm2 ( ) const

Compute and return the norm 2.

Definition at line 830 of file VectorEpetra.cpp.

+ Here is the caller graph for this function:

◆ norm2() [2/3]

void norm2 ( Real result) const

Compute and store the norm 2 in the given pointed variable.

Parameters
resultPointer on the variable where the result should be stored

Definition at line 838 of file VectorEpetra.cpp.

+ Here is the caller graph for this function:

◆ norm2() [3/3]

void norm2 ( Real result) const

Compute and store the norm 2 in the given variable.

Parameters
resultVariable where the result should be stored

Definition at line 844 of file VectorEpetra.cpp.

+ Here is the caller graph for this function:

◆ normInf() [1/3]

Real normInf ( ) const

Compute and return the norm inf.

Definition at line 857 of file VectorEpetra.cpp.

+ Here is the caller graph for this function:

◆ normInf() [2/3]

void normInf ( Real result) const

Compute and store the norm inf in the given pointed variable.

Parameters
resultPointer on the variable where the result should be stored

Definition at line 865 of file VectorEpetra.cpp.

◆ normInf() [3/3]

void normInf ( Real result) const

Compute and store the norm inf in the given variable.

Parameters
resultVariable where the result should be stored

Definition at line 871 of file VectorEpetra.cpp.

◆ minValue() [1/3]

Real minValue ( ) const

Compute and return the minimum value in the vector.

Definition at line 877 of file VectorEpetra.cpp.

◆ minValue() [2/3]

void minValue ( Real result) const

Compute and store the minimum value of the vector in the given pointed variable.

Parameters
resultPointer on the variable where the result should be stored

Definition at line 893 of file VectorEpetra.cpp.

◆ minValue() [3/3]

void minValue ( Real result) const

Compute and store the minimum value of the vector in the given variable.

Parameters
resultVariable where the result should be stored

Definition at line 905 of file VectorEpetra.cpp.

◆ maxValue() [1/3]

Real maxValue ( ) const

Compute and return the maximum value in the vector.

Definition at line 885 of file VectorEpetra.cpp.

◆ maxValue() [2/3]

void maxValue ( Real result) const

Compute and store the maximum value of the vector in the given pointed variable.

Parameters
resultPointer on the variable where the result should be stored

Definition at line 899 of file VectorEpetra.cpp.

◆ maxValue() [3/3]

void maxValue ( Real result) const

Compute and store the maximum value of the vector in the given variable.

Parameters
resultVariable where the result should be stored

Definition at line 911 of file VectorEpetra.cpp.

◆ abs() [1/2]

void abs ( void  )

Replace the vector with his absolute value.

Definition at line 917 of file VectorEpetra.cpp.

◆ abs() [2/2]

void abs ( VectorEpetra vector)

Compute the absolute value of a vector and store it in an other vector.

Parameters
vectorOutput vector to store the absolute value of the vector

Definition at line 923 of file VectorEpetra.cpp.

◆ sqrt()

void sqrt ( )

Apply the square root to of each element in the vector.

Definition at line 929 of file VectorEpetra.cpp.

◆ dot() [1/2]

VectorEpetra::data_type dot ( const VectorEpetra vector) const

Compute the scalar product of two vectors.

Parameters
vectorSecond vector for the scalar product

Definition at line 942 of file VectorEpetra.cpp.

◆ dot() [2/2]

void dot ( const VectorEpetra vector,
data_type scalarProduct 
)

Compute the scalar product of two vectors and store the result in a given variable.

Parameters
vectorSecond vector for the scalar product
scalarProductVariable to store the result

Definition at line 951 of file VectorEpetra.cpp.

◆ matrixMarket()

void matrixMarket ( std::string const &  fileName,
const bool  headers = true 
) const

Save the values of the matrix into a file.

To read the file in Matlab type load filename;

Parameters
filenameFile where to save the vector

Definition at line 956 of file VectorEpetra.cpp.

◆ spy()

void spy ( std::string const &  fileName) const

Save the values of the matrix into a file.

To read the file in Matlab type load filename;

Parameters
filenameFile where to save the vector

Definition at line 978 of file VectorEpetra.cpp.

◆ showMe()

void showMe ( std::ostream &  output = std::cout) const

Print the contents of the vector.

Parameters
outputStream where the informations must be printed

Definition at line 1001 of file VectorEpetra.cpp.

◆ apply()

void apply ( const std::function< Real(Real)> &  f)

Definition at line 1017 of file VectorEpetra.cpp.

◆ setCombineMode()

void setCombineMode ( combineMode_Type  combineMode)

Sets the combine mode for the import/export operations.

Most of the LifeV library is structured to use combine mode equal to Add. In some cases (cf test_filters) it is necessary to discard the data coming from other processors.

Parameters
combineModecombien mode to use for this vector from now on

Definition at line 1032 of file VectorEpetra.cpp.

◆ setDefaultCombineMode()

void setDefaultCombineMode ( )

Sets the combine mode for the import/export operations to default.

Most of the LifeV library is structured to use combine mode equal to Add.

Definition at line 1038 of file VectorEpetra.cpp.

◆ setMap()

void setMap ( const MapEpetra map)

Sets the map to use for the epetra vector.

This method can be used when building the VectorEpetra using empty constructor.

Parameters
mapthe map of the vector

Definition at line 1044 of file VectorEpetra.cpp.

◆ comm()

const Epetra_Comm& comm ( ) const
inline

Return the communicator of the vector.

Definition at line 705 of file VectorEpetra.hpp.

◆ epetraVector() [1/2]

vector_type& epetraVector ( )
inline

Return the VectorEpetra in the wrapper.

Definition at line 711 of file VectorEpetra.hpp.

+ Here is the caller graph for this function:

◆ epetraVector() [2/2]

const vector_type& epetraVector ( ) const
inline

Return the VectorEpetra in the wrapper.

Definition at line 717 of file VectorEpetra.hpp.

+ Here is the caller graph for this function:

◆ epetraVectorPtr()

const vectorPtr_Type& epetraVectorPtr ( ) const
inline

Return the shared pointer on the raw VectorEpetra.

Definition at line 723 of file VectorEpetra.hpp.

◆ blockMap()

const Epetra_BlockMap& blockMap ( ) const
inline

Return the Epetra_BlockMap of the vector.

Definition at line 729 of file VectorEpetra.hpp.

◆ mapType()

MapEpetraType mapType ( ) const
inline

Return the map type of the vector (Unique or Repeated)

Definition at line 735 of file VectorEpetra.hpp.

+ Here is the caller graph for this function:

◆ map()

const MapEpetra& map ( ) const
inline

Return the MapEpetra of the vector.

Definition at line 741 of file VectorEpetra.hpp.

+ Here is the caller graph for this function:

◆ mapPtr()

const std::shared_ptr< MapEpetra > mapPtr ( ) const
inline

Return a shared pointer on the MapEpetra.

Definition at line 747 of file VectorEpetra.hpp.

◆ epetraMap()

const Epetra_Map& epetraMap ( ) const
inline

Return the MapEpetra of the vector.

Definition at line 753 of file VectorEpetra.hpp.

◆ setMapType()

void setMapType ( MapEpetraType  type)
inline

Definition at line 759 of file VectorEpetra.hpp.

◆ size()

Int size ( ) const

Return the size of the vector.

Definition at line 1054 of file VectorEpetra.cpp.

+ Here is the caller graph for this function:

◆ Import()

VectorEpetra & Import ( const Epetra_FEVector &  vector,
combineMode_Type  combineMode 
)
private

Import the value of a vector.

Copies the value of a vector u. If the map is not the same, try to import the values. Let you decide wether to add or replace shared nodes: note:

  1. if the original source vector vector is not repeated : use Import
  2. if the original source vector vector is repeated : use Export

CombineMode Values:

  1. Add - Components on the receiving processor will be added together.
  2. Insert - Off-processor components will be inserted into locations on receiving processor replacing existing values.
  3. InsertAdd - Off-processor components will be inserted into locations on receiving processor and added to existing values.
  4. Average - Off-processor components will be averaged with existing components on the receiving processor.
  5. (+ Zero and AbsMax, probably never useful)
Parameters
vectorVector to be imported
combineModeMode to be used to combine the vector

Definition at line 1067 of file VectorEpetra.cpp.

◆ Export()

VectorEpetra & Export ( const Epetra_FEVector &  vector,
combineMode_Type  combineMode 
)
private

Export the value of a vector.

Copies the value of this to a vector vector. If the map is not the same, try to import the values. Let you decide wether to add or replace shared nodes: note: tested only if the destination source vector vector is not repeated CombineMode Values:

  1. Add - Components on the receiving processor will be added together.
  2. Insert - Off-processor components will be inserted into locations on receiving processor replacing existing values.
  3. InsertAdd - Off-processor components will be inserted into locations on receiving processor and added to existing values.
  4. Average - Off-processor components will be averaged with existing components on the receiving processor.
  5. (+ Zero and AbsMax, probably never useful)
Parameters
vectorVector where to store the exportation
combineModeMode to be used to combine the vector

Definition at line 1089 of file VectorEpetra.cpp.

Field Documentation

◆ M_epetraMap

std::shared_ptr< MapEpetra > M_epetraMap
private

Definition at line 815 of file VectorEpetra.hpp.

◆ M_mapType

MapEpetraType M_mapType
private

Definition at line 816 of file VectorEpetra.hpp.

◆ M_epetraVector

vectorPtr_Type M_epetraVector
private

Definition at line 817 of file VectorEpetra.hpp.

◆ M_combineMode

combineMode_Type M_combineMode
private

Definition at line 818 of file VectorEpetra.hpp.


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