MFEM v2.0
|
#include <vector.hpp>
Public Member Functions | |
Vector () | |
Default constructor for Vector. Sets size = 0 and data = NULL. | |
Vector (const Vector &) | |
Copy constructor. | |
Vector (int s) | |
Creates vector of size s. | |
Vector (double *_data, int _size) | |
void | Load (istream **in, int np, int *dim) |
Reads a vector from multpile files. | |
void | Load (istream &in, int Size) |
Load a vector from an input stream. | |
void | Load (istream &in) |
Load a vector from an input stream. | |
void | SetSize (int s) |
Resizes the vector if the new size is different. | |
void | SetData (double *d) |
void | SetDataAndSize (double *d, int s) |
void | MakeDataOwner () |
void | Destroy () |
Destroy a vector. | |
int | Size () const |
Returns the size of the vector. | |
double * | GetData () const |
operator double * () | |
operator const double * () const | |
void | StealData (double **p) |
Changes the ownership of the the data. | |
double & | Elem (int i) |
Sets value in vector. Index i = 0 .. size-1. | |
const double & | Elem (int i) const |
Sets value in vector. Index i = 0 .. size-1. | |
double & | operator() (int i) |
Sets value in vector. Index i = 0 .. size-1. | |
const double & | operator() (int i) const |
Sets value in vector. Index i = 0 .. size-1. | |
double | operator* (const double *) const |
double | operator* (const Vector &v) const |
Return the inner-product. | |
Vector & | operator= (const Vector &v) |
Redefine '=' for vector = vector. | |
Vector & | operator= (double value) |
Redefine '=' for vector = constant. | |
Vector & | operator*= (double c) |
Vector & | operator/= (double c) |
Vector & | operator-= (double c) |
Vector & | operator-= (const Vector &v) |
Vector & | operator+= (const Vector &v) |
Vector & | Add (const double a, const Vector &Va) |
(*this) += a * Va | |
Vector & | Set (const double a, const Vector &x) |
(*this) = a * x | |
void | SetVector (const Vector &v, int offset) |
void | Neg () |
(*this) = -(*this) | |
void | GetSubVector (const Array< int > &dofs, Vector &elemvect) const |
void | GetSubVector (const Array< int > &dofs, double *elem_data) const |
void | SetSubVector (const Array< int > &dofs, const Vector &elemvect) |
void | SetSubVector (const Array< int > &dofs, double *elem_data) |
void | AddElementVector (const Array< int > &dofs, const Vector &elemvect) |
Add (element) subvector to the vector. | |
void | AddElementVector (const Array< int > &dofs, double *elem_data) |
void | AddElementVector (const Array< int > &dofs, const double a, const Vector &elemvect) |
void | Print (ostream &out=cout, int width=8) const |
Prints vector to stream out. | |
void | Print_HYPRE (ostream &out) const |
Prints vector to stream out in HYPRE_Vector format. | |
void | Randomize (int seed=0) |
Set random values in the vector. | |
double | Norml2 () |
Returns the l2 norm of the vector. | |
double | Normlinf () |
Returns the l_infinity norm of the vector. | |
double | Norml1 () |
Returns the l_1 norm of the vector. | |
double | Max () |
Returns the maximal element of the vector. | |
double | Min () |
Returns the minimal element of the vector. | |
double | DistanceTo (const double *p) const |
Compute the Euclidian distance to another vector. | |
~Vector () | |
Destroys vector. | |
Protected Attributes | |
int | size |
int | allocsize |
double * | data |
Friends | |
void | swap (Vector *v1, Vector *v2) |
Swap v1 and v2. | |
void | add (const Vector &v1, const Vector &v2, Vector &v) |
Do v = v1 + v2. | |
void | add (const Vector &v1, double alpha, const Vector &v2, Vector &v) |
Do v = v1 + alpha * v2. | |
void | add (const double a, const Vector &x, const Vector &y, Vector &z) |
z = a * (x + y) | |
void | add (const double a, const Vector &x, const double b, const Vector &y, Vector &z) |
z = a * x + b * y | |
void | subtract (const Vector &v1, const Vector &v2, Vector &v) |
Do v = v1 - v2. | |
void | subtract (const double a, const Vector &x, const Vector &y, Vector &z) |
z = a * (x - y) |
Vector data type.
Definition at line 21 of file vector.hpp.
Vector::Vector | ( | ) | [inline] |
Vector::Vector | ( | const Vector & | v | ) |
Vector::Vector | ( | int | s | ) | [inline, explicit] |
Creates vector of size s.
Definition at line 184 of file vector.hpp.
Vector::Vector | ( | double * | _data, |
int | _size | ||
) | [inline] |
Definition at line 39 of file vector.hpp.
Vector::~Vector | ( | ) | [inline] |
(*this) += a * Va
Definition at line 157 of file vector.cpp.
References data, mfem_error(), and size.
Referenced by BiCGSTAB(), GridFunction::ProjectBdrCoefficientNormal(), and Update().
Add (element) subvector to the vector.
Definition at line 425 of file vector.cpp.
References data, and Array< T >::Size().
Referenced by LinearForm::Assemble(), and ComputeFlux().
void Vector::AddElementVector | ( | const Array< int > & | dofs, |
double * | elem_data | ||
) |
Definition at line 436 of file vector.cpp.
References data, and Array< T >::Size().
void Vector::AddElementVector | ( | const Array< int > & | dofs, |
const double | a, | ||
const Vector & | elemvect | ||
) |
Definition at line 447 of file vector.cpp.
References data, and Array< T >::Size().
void Vector::Destroy | ( | ) | [inline] |
Destroy a vector.
Definition at line 213 of file vector.hpp.
References allocsize, data, and size.
Referenced by Mesh::Load().
double Vector::DistanceTo | ( | const double * | p | ) | const |
Compute the Euclidian distance to another vector.
Definition at line 553 of file vector.cpp.
References data, Distance(), and size.
double & Vector::Elem | ( | int | i | ) |
Sets value in vector. Index i = 0 .. size-1.
Definition at line 63 of file vector.cpp.
References operator()().
const double & Vector::Elem | ( | int | i | ) | const |
Sets value in vector. Index i = 0 .. size-1.
Definition at line 68 of file vector.cpp.
References operator()().
double* Vector::GetData | ( | ) | const [inline] |
Definition at line 69 of file vector.hpp.
References data.
Referenced by SparseMatrix::AddMult(), SparseMatrix::AddMultTranspose(), DenseMatrix::AddToVector(), DenseMatrixEigensystem::DenseMatrixEigensystem(), dsyev_Eigensystem(), dsyevr_Eigensystem(), DenseMatrixSVD::Eval(), DenseMatrixEigensystem::Eval(), SparseMatrix::Gauss_Seidel_back(), SparseMatrix::Gauss_Seidel_forw(), DenseMatrix::GetColumn(), DenseMatrix::GetFromVector(), DenseMatrix::GradToDiv(), GridFunction::GridFunction(), DenseMatrixSVD::Init(), and DenseMatrixInverse::Mult().
void Vector::GetSubVector | ( | const Array< int > & | dofs, |
double * | elem_data | ||
) | const |
Definition at line 392 of file vector.cpp.
References data, and Array< T >::Size().
Definition at line 379 of file vector.cpp.
References data, SetSize(), and Array< T >::Size().
Referenced by GridFunction::GetBdrValuesFrom(), GridFunction::GetDivergence(), GridFunction::GetElementAverages(), GridFunction::GetGradients(), GridFunction::GetNodalValues(), GridFunction::GetValue(), GridFunction::GetValuesFrom(), GridFunction::GetVectorGradientHat(), GridFunction::GetVectorValue(), GridFunction::GetVectorValues(), NURBSExtension::LoadBE(), NURBSExtension::LoadFE(), and NURBSExtension::MergeGridFunctions().
void Vector::Load | ( | istream & | in, |
int | Size | ||
) |
Load a vector from an input stream.
Definition at line 55 of file vector.cpp.
void Vector::Load | ( | istream ** | in, |
int | np, | ||
int * | dim | ||
) |
Reads a vector from multpile files.
Definition at line 39 of file vector.cpp.
References data, and SetSize().
Referenced by GridFunction::GridFunction(), KnotVector::KnotVector(), and NURBSExtension::NURBSExtension().
void Vector::Load | ( | istream & | in | ) | [inline] |
Load a vector from an input stream.
Definition at line 49 of file vector.hpp.
References Load().
Referenced by Load().
void Vector::MakeDataOwner | ( | ) | [inline] |
Definition at line 59 of file vector.hpp.
References allocsize.
double Vector::Max | ( | ) |
Returns the maximal element of the vector.
Definition at line 531 of file vector.cpp.
double Vector::Min | ( | ) |
Returns the minimal element of the vector.
Definition at line 542 of file vector.cpp.
void Vector::Neg | ( | ) |
double Vector::Norml1 | ( | ) |
Returns the l_1 norm of the vector.
Definition at line 521 of file vector.cpp.
Referenced by GridFunction::ComputeW11Error().
double Vector::Norml2 | ( | ) |
Returns the l2 norm of the vector.
Definition at line 505 of file vector.cpp.
double Vector::Normlinf | ( | ) |
Returns the l_infinity norm of the vector.
Definition at line 510 of file vector.cpp.
Referenced by GridFunction::ComputeMaxError().
Vector::operator const double * | ( | ) | const [inline] |
Definition at line 73 of file vector.hpp.
References data.
Vector::operator double * | ( | ) | [inline] |
Definition at line 71 of file vector.hpp.
References data.
double & Vector::operator() | ( | int | i | ) | [inline] |
Sets value in vector. Index i = 0 .. size-1.
Definition at line 221 of file vector.hpp.
References data, mfem_error(), and size.
Referenced by Elem().
const double & Vector::operator() | ( | int | i | ) | const [inline] |
Sets value in vector. Index i = 0 .. size-1.
Definition at line 231 of file vector.hpp.
References data, mfem_error(), and size.
double Vector::operator* | ( | const double * | v | ) | const |
Definition at line 73 of file vector.cpp.
double Vector::operator* | ( | const Vector & | v | ) | const |
Return the inner-product.
Definition at line 86 of file vector.cpp.
References data, mfem_error(), operator*(), and size.
Referenced by operator*().
Vector & Vector::operator*= | ( | double | c | ) |
Definition at line 113 of file vector.cpp.
Definition at line 146 of file vector.cpp.
References data, mfem_error(), and size.
Vector & Vector::operator-= | ( | double | c | ) |
Definition at line 128 of file vector.cpp.
Definition at line 135 of file vector.cpp.
References data, mfem_error(), and size.
Vector & Vector::operator/= | ( | double | c | ) |
Definition at line 120 of file vector.cpp.
Redefine '=' for vector = vector.
Reimplemented in GridFunction, and ParGridFunction.
Definition at line 96 of file vector.cpp.
References data, SetSize(), size, and Size().
Referenced by LinearForm::Assemble().
Vector & Vector::operator= | ( | double | value | ) |
Redefine '=' for vector = constant.
Reimplemented in GridFunction, ParGridFunction, and HypreParVector.
Definition at line 104 of file vector.cpp.
void Vector::Print | ( | ostream & | out = cout , |
int | width = 8 |
||
) | const |
Prints vector to stream out.
Definition at line 459 of file vector.cpp.
Referenced by PCG(), NURBSExtension::Print(), KnotVector::Print(), and GridFunction::Save().
void Vector::Print_HYPRE | ( | ostream & | out | ) | const |
Prints vector to stream out in HYPRE_Vector format.
Definition at line 475 of file vector.cpp.
void Vector::Randomize | ( | int | seed = 0 | ) |
Set random values in the vector.
Reimplemented in HypreParVector.
Definition at line 490 of file vector.cpp.
(*this) = a * x
Definition at line 171 of file vector.cpp.
References data, mfem_error(), and size.
Referenced by add().
void Vector::SetData | ( | double * | d | ) | [inline] |
Reimplemented in HypreParVector.
Definition at line 54 of file vector.hpp.
References data.
Referenced by L2_SegmentElement::CalcDShape(), DenseMatrixEigensystem::Eigenvector(), Revolve3D(), NURBSPatch::Rotate3D(), and Mesh::Transform().
void Vector::SetDataAndSize | ( | double * | d, |
int | s | ||
) | [inline] |
Definition at line 56 of file vector.hpp.
References allocsize, data, and size.
Referenced by DenseMatrixEigensystem::DenseMatrixEigensystem(), DenseMatrix::GetColumnReference(), L2_SegmentElement::L2_SegmentElement(), and GridFunction::Update().
void Vector::SetSize | ( | int | s | ) | [inline] |
Resizes the vector if the new size is different.
Definition at line 198 of file vector.hpp.
References allocsize, data, and size.
Referenced by ElasticityIntegrator::AssembleElementMatrix(), DivDivIntegrator::AssembleElementMatrix(), ConvectionIntegrator::AssembleElementMatrix(), VectorDivergenceIntegrator::AssembleElementMatrix2(), VectorFEMassIntegrator::AssembleElementMatrix2(), DerivativeIntegrator::AssembleElementMatrix2(), VectorFEDivergenceIntegrator::AssembleElementMatrix2(), MassIntegrator::AssembleElementMatrix2(), VectorFEBoundaryFluxLFIntegrator::AssembleRHSElementVect(), VectorBoundaryFluxLFIntegrator::AssembleRHSElementVect(), VectorFEDomainLFIntegrator::AssembleRHSElementVect(), VectorBoundaryLFIntegrator::AssembleRHSElementVect(), VectorDomainLFIntegrator::AssembleRHSElementVect(), BoundaryLFIntegrator::AssembleRHSElementVect(), DomainLFIntegrator::AssembleRHSElementVect(), Poly_1D::Basis::Basis(), DiffusionIntegrator::ComputeElementFlux(), GridFunction::ComputeH1Error(), GridFunction::ComputeL1Error(), GridFunction::ComputeL2Error(), GridFunction::ComputeMaxError(), GridFunction::ComputeW11Error(), DenseMatrixEigensystem::DenseMatrixEigensystem(), DetOfLinComb(), KnotVector::Difference(), dsyev_Eigensystem(), dsyevr_Eigensystem(), VectorRestrictedCoefficient::Eval(), VectorArrayCoefficient::Eval(), VectorFunctionCoefficient::Eval(), GridFunction::GetBdrValuesFrom(), DenseMatrix::GetColumn(), GridFunction::GetDerivative(), GridFunction::GetElementAverages(), GridFunction::GetNodalValues(), GetSubVector(), GridFunction::GetValues(), GridFunction::GetValuesFrom(), GridFunction::GetVectorFieldNodalValues(), GridFunction::GetVectorValue(), Mesh::GetVertices(), GridFunction::GridFunction(), H1_HexahedronElement::H1_HexahedronElement(), H1_QuadrilateralElement::H1_QuadrilateralElement(), H1_SegmentElement::H1_SegmentElement(), H1_TetrahedronElement::H1_TetrahedronElement(), H1_TriangleElement::H1_TriangleElement(), FiniteElementSpace::H2L_GlobalRestrictionMatrix(), DenseMatrixSVD::Init(), KnotVector::KnotVector(), L2_HexahedronElement::L2_HexahedronElement(), L2_QuadrilateralElement::L2_QuadrilateralElement(), L2_SegmentElement::L2_SegmentElement(), L2_TetrahedronElement::L2_TetrahedronElement(), L2_TriangleElement::L2_TriangleElement(), Lagrange1DFiniteElement::Lagrange1DFiniteElement(), LagrangeHexFiniteElement::LagrangeHexFiniteElement(), Load(), Mesh::Load(), ND_HexahedronElement::ND_HexahedronElement(), ND_QuadrilateralElement::ND_QuadrilateralElement(), ND_TetrahedronElement::ND_TetrahedronElement(), ND_TriangleElement::ND_TriangleElement(), NURBSExtension::NURBSExtension(), NURBSFiniteElement::NURBSFiniteElement(), operator=(), Mesh::PrintCharacteristics(), GridFunction::ProjectBdrCoefficientNormal(), GridFunction::ProjectBdrCoefficientTangent(), GridFunction::ProjectCoefficient(), PWConstCoefficient::PWConstCoefficient(), PWConstCoefficient::Read(), RT_HexahedronElement::RT_HexahedronElement(), RT_QuadrilateralElement::RT_QuadrilateralElement(), RT_TetrahedronElement::RT_TetrahedronElement(), RT_TriangleElement::RT_TriangleElement(), NURBSExtension::Set2DSolutionVector(), NURBSExtension::Set3DSolutionVector(), DenseMatrix::SingularValues(), IsoparametricTransformation::Transform(), KnotVector::UniformRefinement(), LinearForm::Update(), GridFunction::Update(), and ZZErrorEstimator().
Definition at line 403 of file vector.cpp.
References data, and Array< T >::Size().
Referenced by GridFunction::GetBdrValuesFrom(), GridFunction::GetValuesFrom(), NURBSExtension::MergeGridFunctions(), GridFunction::ProjectBdrCoefficientNormal(), GridFunction::ProjectBdrCoefficientTangent(), and GridFunction::ProjectCoefficient().
void Vector::SetSubVector | ( | const Array< int > & | dofs, |
double * | elem_data | ||
) |
Definition at line 414 of file vector.cpp.
References data, and Array< T >::Size().
void Vector::SetVector | ( | const Vector & | v, |
int | offset | ||
) |
Definition at line 182 of file vector.cpp.
References data, mfem_error(), size, and Size().
int Vector::Size | ( | ) | const [inline] |
Returns the size of the vector.
Definition at line 65 of file vector.hpp.
References size.
Referenced by SparseMatrix::AddMult(), DenseMatrix::AddMult(), AddMult_a_VVt(), SparseMatrix::AddMultTranspose(), AddMultVWt(), CG(), ComputeFlux(), KnotVector::DegreeElevate(), SparseMatrix::EliminateRowColMultipleRHS(), Poly_1D::Basis::Eval(), F_exact(), FindRoots(), KnotVector::Flip(), GridFunction::GetElementAverages(), PWConstCoefficient::GetNConst(), DenseMatrix::GradToDiv(), IntegrationRule::GrundmannMollerTetrahedronRule(), FiniteElementSpace::H2L_GlobalRestrictionMatrix(), NURBSPatch::KnotInsert(), Mesh::Load(), DSmoother::Mult(), DenseMatrix::Mult(), DenseMatrix::MultTranspose(), MultVVt(), MultVWt(), operator=(), PCG(), KnotVector::Print(), GridFunction::ProjectCoefficient(), PWConstCoefficient::PWConstCoefficient(), GridFunction::SaveSTL(), GridFunction::SaveVTK(), SetVector(), KnotVector::Size(), SLI(), KnotVector::UniformRefinement(), Update(), Vector(), and ZZErrorEstimator().
void Vector::StealData | ( | double ** | p | ) | [inline] |
Changes the ownership of the the data.
Definition at line 76 of file vector.hpp.
Do v = v1 + v2.
Definition at line 216 of file vector.cpp.
z = a * (x + y)
Definition at line 257 of file vector.cpp.
void add | ( | const double | a, |
const Vector & | x, | ||
const double | b, | ||
const Vector & | y, | ||
Vector & | z | ||
) | [friend] |
z = a * x + b * y
Definition at line 287 of file vector.cpp.
Do v = v1 + alpha * v2.
Definition at line 230 of file vector.cpp.
Do v = v1 - v2.
Definition at line 330 of file vector.cpp.
z = a * (x - y)
Definition at line 348 of file vector.cpp.
Swap v1 and v2.
Definition at line 202 of file vector.cpp.
int Vector::allocsize [protected] |
Definition at line 25 of file vector.hpp.
Referenced by Destroy(), MakeDataOwner(), SetDataAndSize(), SetSize(), swap(), Vector(), and ~Vector().
double* Vector::data [protected] |
Definition at line 26 of file vector.hpp.
Referenced by add(), Add(), AddElementVector(), Destroy(), DistanceTo(), GetData(), GridFunction::GetDerivative(), GetSubVector(), GridFunction::GetValues(), GridFunction::GetVectorFieldValues(), GridFunction::GridFunction(), Load(), Max(), Min(), Neg(), Norml1(), Normlinf(), operator const double *(), operator double *(), operator()(), operator*(), operator*=(), operator+=(), operator-=(), operator/=(), operator=(), GridFunction::operator=(), Print(), Print_HYPRE(), Randomize(), GridFunction::ReorderByNodes(), Set(), SetData(), SetDataAndSize(), SetSize(), SetSubVector(), SetVector(), StealData(), subtract(), swap(), Vector(), and ~Vector().
int Vector::size [protected] |
Definition at line 25 of file vector.hpp.
Referenced by add(), Add(), Destroy(), DistanceTo(), Load(), Max(), Min(), Neg(), Norml1(), Normlinf(), operator()(), operator*(), operator*=(), operator+=(), operator-=(), operator/=(), operator=(), GridFunction::operator=(), Print(), Print_HYPRE(), Randomize(), GridFunction::ReorderByNodes(), Set(), SetDataAndSize(), SetSize(), SetVector(), Size(), StealData(), subtract(), swap(), and Vector().