40 #ifndef _EPETRAVECTOR_HPP_ 41 #define _EPETRAVECTOR_HPP_ 44 #include <Epetra_FEVector.h> 45 #include <Epetra_Export.h> 48 #include <lifev/core/LifeV.hpp> 49 #include <lifev/core/array/MapEpetra.hpp> 102 explicit VectorEpetra (
const std::shared_ptr< MapEpetra >& mapPtr,
137 const std::shared_ptr< MapEpetra > map,
414 return M_epetraVector->GlobalAssemble ( mode );
425 return M_epetraVector->GlobalAssemble ( M_combineMode );
442 M_epetraVector->PutScalar (0.);
463 Int setCoefficients ( std::vector< Int >& rowsVector, std::vector< Real >& valuesVector );
523 const UInt offset2 );
539 const UInt column = 0);
652 void matrixMarket ( std::string
const& fileName,
const bool headers =
true )
const;
659 void spy ( std::string
const& fileName )
const;
665 void showMe ( std::ostream& output = std::cout )
const;
667 void apply (
const std::function<Real (Real)>& f);
707 return blockMap().Comm();
713 return *M_epetraVector;
719 return *M_epetraVector;
731 return M_epetraVector->Map();
755 return * ( M_epetraMap->map ( M_mapType ) );
VectorEpetra & operator-=(const data_type &scalar)
Subtraction operator.
bool isGlobalIDPresent(const UInt row) const
Access operators.
VectorEpetra - The Epetra Vector format Wrapper.
VectorEpetra operator*(const VectorEpetra::data_type &scalar, const VectorEpetra &vector)
void normInf(Real *result) const
Compute and store the norm inf in the given pointed variable.
void minValue(Real *result) const
Compute and store the minimum value of the vector in the given pointed variable.
Epetra_CombineMode combineMode_Type
VectorEpetra operator-(const VectorEpetra::data_type &scalar, const VectorEpetra &vector)
const VectorEpetra operator*(const data_type &scalar) const
Multiplication operator.
VectorEpetra & operator+=(const data_type &scalar)
Addition operator.
VectorEpetra operator>=(const Real &scalar) const
Greater than or equal to operator.
const VectorEpetra operator-(const VectorEpetra &vector) const
Subtraction operator.
VectorEpetra(const VectorEpetra &vector, const MapEpetraType &mapType)
Copy constructor.
const Epetra_Map & epetraMap() const
Return the MapEpetra of the vector.
std::shared_ptr< vector_type > vectorPtr_Type
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.
VectorEpetra & subset(const VectorEpetra &vector, const UInt offset=0)
Set the current vector to a subset of the given vector with an offset.
data_type & operator()(const UInt row)
Access operators.
const VectorEpetra operator+(const data_type &scalar) const
Operations with scalar values (do not modify the vector of the class)
VectorEpetra & add(const VectorEpetra &vector, const Int offset=0)
Add a vector to the current vector with an offset.
data_type dot(const VectorEpetra &vector) const
Compute the scalar product of two vectors.
vectorPtr_Type M_epetraVector
void abs(void)
Replace the vector with his absolute value.
const vectorPtr_Type & epetraVectorPtr() const
Return the shared pointer on the raw VectorEpetra.
VectorEpetra & Export(const Epetra_FEVector &vector, combineMode_Type combineMode)
Export the value of a vector.
bool setCoefficient(const UInt row, const data_type &value, UInt offset=0)
Look for the given global row and set its value.
void abs(VectorEpetra &vector)
Compute the absolute value of a vector and store it in an other vector.
VectorEpetra & Import(const Epetra_FEVector &vector, combineMode_Type combineMode)
Import the value of a vector.
Int globalToLocalRowId(const UInt row) const
Return the local Id of a global row.
Real norm1() const
Compute and return the norm 1.
int32_type Int
Generic integer data.
void dot(const VectorEpetra &vector, data_type &scalarProduct)
Compute the scalar product of two vectors and store the result in a given variable.
void maxValue(Real &result) const
Compute and store the maximum value of the vector in the given variable.
MapEpetraType mapType() const
Return the map type of the vector (Unique or Repeated)
const data_type & operator[](const UInt row) const
Access operators.
VectorEpetra(const MapEpetra &map, const MapEpetraType &mapType=Unique, const combineMode_Type combineMode=Add)
Constructor - Using Maps.
void updateInverseJacobian(const UInt &iQuadPt)
virtual ~VectorEpetra()
Destructor.
VectorEpetra & operator/=(const data_type &scalar)
Division operator.
const VectorEpetra operator-(const data_type &scalar) const
Subtraction operator.
VectorEpetra operator!(void) const
Logical NOT operator.
VectorEpetra operator-(const VectorEpetra &vector)
void apply(const std::function< Real(Real)> &f)
const Epetra_BlockMap & blockMap() const
Return the Epetra_BlockMap of the vector.
VectorEpetra & operator*=(const VectorEpetra &vector)
Multiplication operator.
void setCombineMode(combineMode_Type combineMode)
Sets the combine mode for the import/export operations.
VectorEpetra operator &&(const VectorEpetra &vector) const
Logical AND operator.
Int globalAssemble()
Assemble the vector.
VectorEpetra operator||(const VectorEpetra &vector) const
Logical OR operator.
VectorEpetra & operator+=(const VectorEpetra &vector)
Addition operator.
Epetra_Import const & importer()
Getter for the Epetra_Import.
Real normInf() const
Compute and return the norm inf.
std::shared_ptr< MapEpetra > M_epetraMap
VectorEpetra(const MapEpetraType &mapType=Unique, const combineMode_Type combineMode=Add)
Empty Constructor.
void norm2(Real *result) const
Compute and store the norm 2 in the given pointed variable.
VectorEpetra operator>(const Real &scalar) const
Greater than operator.
VectorEpetra & replace(const VectorEpetra &vector, const Int &offset)
Replace part of the vector with a given vector.
Int globalAssemble(combineMode_Type mode)
Assemble the vector.
const VectorEpetra operator+(const VectorEpetra &vector) const
Addition operator.
const MapEpetra & map() const
Return the MapEpetra of the vector.
void sqrt()
Apply the square root to of each element in the vector.
Int setCoefficients(std::vector< Int > &rowsVector, std::vector< Real > &valuesVector)
Set the row of the vector to the given value.
VectorEpetra operator+(const VectorEpetra::data_type &scalar, const VectorEpetra &vector)
void norm1(Real *result) const
Compute and store the norm 1 in the given pointed variable.
Epetra_FEVector vector_type
VectorEpetra & operator-=(const VectorEpetra &vector)
Subtraction operator.
VectorEpetra & operator=(data_type scalar)
Affectation operator.
vector_type & epetraVector()
Return the VectorEpetra in the wrapper.
Real minValue() const
Compute and return the minimum value in the vector.
Real maxValue() const
Compute and return the maximum value in the vector.
Int size() const
Return the size of the vector.
double Real
Generic real data.
const std::shared_ptr< MapEpetra > mapPtr() const
Return a shared pointer on the MapEpetra.
const VectorEpetra operator/(const data_type &scalar) const
Division operator.
VectorEpetra(const VectorEpetra &vector, const Int &reduceToProc)
Copy constructor.
VectorEpetra(const std::shared_ptr< MapEpetra > &mapPtr, const MapEpetraType &mapType=Unique, const combineMode_Type combineMode=Add)
Constructor - Using Maps.
void setDefaultCombineMode()
Sets the combine mode for the import/export operations to default.
VectorEpetra & operator=(const Epetra_MultiVector &vector)
Affectation operator.
void norm2(Real &result) const
Compute and store the norm 2 in the given variable.
const VectorEpetra operator/(const VectorEpetra &vector) const
Division operator.
void maxValue(Real *result) const
Compute and store the maximum value of the vector in the given pointed variable.
VectorEpetra & operator*=(const data_type &scalar)
Multiplication operator.
const vector_type & epetraVector() const
Return the VectorEpetra in the wrapper.
void meanValue(Real *result) const
Compute the mean value of the vector components and store it in the given variable.
VectorEpetra operator==(const Real &scalar) const
Equality operator.
void norm1(Real &result) const
Compute and store the norm 1 in the given variable.
VectorEpetra(const VectorEpetra &vector)
Copy constructor.
VectorEpetra(const Epetra_MultiVector &vector, const std::shared_ptr< MapEpetra > map, const MapEpetraType &mapType, const combineMode_Type combineMode=Add)
Copy constructor.
VectorEpetra & operator=(const VectorEpetra &vector)
Affectation operator.
Int sumIntoGlobalValues(const Int GID, const Real value)
insert a global value
void setMap(const MapEpetra &map)
Sets the map to use for the epetra vector.
void normInf(Real &result) const
Compute and store the norm inf in the given variable.
combineMode_Type M_combineMode
VectorEpetra operator!=(const Real &scalar) const
Inequality operator.
const Epetra_Comm & comm() const
Return the communicator of the vector.
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.
void showMe(std::ostream &output=std::cout) const
Print the contents of the vector.
void zero()
set zero in all the vector entries
const VectorEpetra operator*(const VectorEpetra &vector) const
Multiplication operator.
VectorEpetra(const VectorEpetra &vector, const MapEpetraType &mapType, const combineMode_Type &combineMode)
Copy constructor.
const data_type & operator()(const UInt row) const
Access operators.
uint32_type UInt
generic unsigned integer (used mainly for addressing)
void setMapType(MapEpetraType type)
void minValue(Real &result) const
Compute and store the minimum value of the vector in the given variable.
data_type & operator[](const UInt row)
Access operators.
VectorEpetra & operator/=(const VectorEpetra &vector)
Division operator.
Real norm2() const
Compute and return the norm 2.