MFEM v2.0
Public Member Functions | Protected Member Functions | Protected Attributes
GridFunction Class Reference

Class for grid function - Vector with asociated FE space. More...

#include <gridfunc.hpp>

Inheritance diagram for GridFunction:
Inheritance graph
[legend]
Collaboration diagram for GridFunction:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 GridFunction ()
 GridFunction (FiniteElementSpace *f)
 Creates grid function associated with *f.
 GridFunction (Mesh *m, istream &input)
 GridFunction (Mesh *m, GridFunction *gf_array[], int num_pieces)
void MakeOwner (FiniteElementCollection *_fec)
 Make the GridFunction the owner of 'fec' and 'fes'.
FiniteElementCollectionOwnFEC ()
int VectorDim () const
void GetNodalValues (int i, Array< double > &nval, int vdim=1) const
 Returns the values in the vertices of i'th element for dimension vdim.
double GetValue (int i, const IntegrationPoint &ip, int vdim=1) const
void GetVectorValue (int i, const IntegrationPoint &ip, Vector &val) const
void GetValues (int i, const IntegrationRule &ir, Vector &vals, DenseMatrix &tr, int vdim=1) const
int GetFaceValues (int i, int side, const IntegrationRule &ir, Vector &vals, DenseMatrix &tr, int vdim=1) const
void GetVectorValues (int i, const IntegrationRule &ir, DenseMatrix &vals, DenseMatrix &tr) const
int GetFaceVectorValues (int i, int side, const IntegrationRule &ir, DenseMatrix &vals, DenseMatrix &tr) const
void GetValuesFrom (GridFunction &)
void GetBdrValuesFrom (GridFunction &)
void GetVectorFieldValues (int i, const IntegrationRule &ir, DenseMatrix &vals, DenseMatrix &tr, int comp=0) const
void ReorderByNodes ()
 For a vector grid function, makes sure that the ordering is byNODES.
void GetNodalValues (Vector &nval, int vdim=1) const
 Return the values as a vector on mesh vertices for dimension vdim.
void GetVectorFieldNodalValues (Vector &val, int comp) const
void ProjectVectorFieldOn (GridFunction &vec_field, int comp=0)
void GetDerivative (int comp, int der_comp, GridFunction &der)
double GetDivergence (ElementTransformation &tr)
void GetGradient (ElementTransformation &tr, Vector &grad)
void GetGradients (const int elem, const IntegrationRule &ir, DenseMatrix &grad)
void GetVectorGradient (ElementTransformation &tr, DenseMatrix &grad)
void GetElementAverages (GridFunction &avgs)
void ProjectCoefficient (Coefficient &coeff)
void ProjectCoefficient (Coefficient &coeff, Array< int > &dofs, int vd=0)
void ProjectCoefficient (VectorCoefficient &vcoeff)
void ProjectCoefficient (Coefficient *coeff[])
void ProjectBdrCoefficient (Coefficient &coeff, Array< int > &attr)
void ProjectBdrCoefficient (Coefficient *coeff[], Array< int > &attr)
void ProjectBdrCoefficientNormal (VectorCoefficient &vcoeff, Array< int > &bdr_attr)
void ProjectBdrCoefficientTangent (VectorCoefficient &vcoeff, Array< int > &bdr_attr)
double ComputeL2Error (Coefficient &exsol, const IntegrationRule *irs[]=NULL) const
double ComputeL2Error (Coefficient *exsol[], const IntegrationRule *irs[]=NULL) const
double ComputeL2Error (VectorCoefficient &exsol, const IntegrationRule *irs[]=NULL, Array< int > *elems=NULL) const
double ComputeH1Error (Coefficient *exsol, VectorCoefficient *exgrad, Coefficient *ell_coef, double Nu, int norm_type) const
double ComputeMaxError (Coefficient *exsol[], const IntegrationRule *irs[]=NULL) const
double ComputeMaxError (VectorCoefficient &exsol, const IntegrationRule *irs[]=NULL) const
double ComputeW11Error (Coefficient *exsol, VectorCoefficient *exgrad, int norm_type, Array< int > *elems=NULL, const IntegrationRule *irs[]=NULL) const
double ComputeL1Error (VectorCoefficient &exsol, const IntegrationRule *irs[]=NULL) const
GridFunctionoperator= (double value)
 Redefine '=' for GridFunction = constant.
GridFunctionoperator= (const Vector &v)
 Redefine '=' for vector = vector.
GridFunctionoperator= (const GridFunction &v)
FiniteElementSpaceFESpace ()
void Update ()
void Update (FiniteElementSpace *f)
void Update (FiniteElementSpace *f, Vector &v, int v_offset)
virtual void Save (ostream &out)
 Save the GridFunction to an output stream.
void SaveVTK (ostream &out, const string &field_name, int ref)
void SaveSTL (ostream &out, int TimesToRefine=1)
virtual ~GridFunction ()
 Destroys grid function.

Protected Member Functions

void SaveSTLTri (ostream &out, double p1[], double p2[], double p3[])
void GetVectorGradientHat (ElementTransformation &T, DenseMatrix &gh)

Protected Attributes

FiniteElementSpacefes
 FE space on which grid function lives.
FiniteElementCollectionfec
 Used when the grid function is read from a file.

Detailed Description

Class for grid function - Vector with asociated FE space.

Definition at line 16 of file gridfunc.hpp.


Constructor & Destructor Documentation

GridFunction::GridFunction ( ) [inline]

Definition at line 31 of file gridfunc.hpp.

References fec, and fes.

GridFunction::GridFunction ( FiniteElementSpace f) [inline]

Creates grid function associated with *f.

Definition at line 34 of file gridfunc.hpp.

References fec, and fes.

GridFunction::GridFunction ( Mesh m,
istream &  input 
)
GridFunction::GridFunction ( Mesh m,
GridFunction gf_array[],
int  num_pieces 
)
GridFunction::~GridFunction ( ) [virtual]

Destroys grid function.

Definition at line 119 of file gridfunc.cpp.

References fec, and fes.


Member Function Documentation

double GridFunction::ComputeH1Error ( Coefficient exsol,
VectorCoefficient exgrad,
Coefficient ell_coef,
double  Nu,
int  norm_type 
) const
double GridFunction::ComputeL1Error ( VectorCoefficient exsol,
const IntegrationRule irs[] = NULL 
) const
double GridFunction::ComputeL2Error ( Coefficient exsol[],
const IntegrationRule irs[] = NULL 
) const
double GridFunction::ComputeL2Error ( VectorCoefficient exsol,
const IntegrationRule irs[] = NULL,
Array< int > *  elems = NULL 
) const
double GridFunction::ComputeL2Error ( Coefficient exsol,
const IntegrationRule irs[] = NULL 
) const [inline]

Definition at line 131 of file gridfunc.hpp.

Referenced by main().

double GridFunction::ComputeMaxError ( Coefficient exsol[],
const IntegrationRule irs[] = NULL 
) const
double GridFunction::ComputeMaxError ( VectorCoefficient exsol,
const IntegrationRule irs[] = NULL 
) const
double GridFunction::ComputeW11Error ( Coefficient exsol,
VectorCoefficient exgrad,
int  norm_type,
Array< int > *  elems = NULL,
const IntegrationRule irs[] = NULL 
) const
FiniteElementSpace* GridFunction::FESpace ( ) [inline]
void GridFunction::GetBdrValuesFrom ( GridFunction orig_func)
void GridFunction::GetDerivative ( int  comp,
int  der_comp,
GridFunction der 
)
double GridFunction::GetDivergence ( ElementTransformation tr)
void GridFunction::GetElementAverages ( GridFunction avgs)

Compute $ (\int_{\Omega} (*this) \psi_i)/(\int_{\Omega} \psi_i) $, where $ \psi_i $ are the basis functions for the FE space of avgs. Both FE spaces should be scalar and on the same mesh.

Definition at line 738 of file gridfunc.cpp.

References MassIntegrator::AssembleElementMatrix2(), fes, FiniteElementSpace::GetElementDofs(), FiniteElementSpace::GetElementTransformation(), FiniteElementSpace::GetFE(), FiniteElementSpace::GetNE(), Vector::GetSubVector(), DenseMatrix::Mult, Vector::SetSize(), Array< T >::Size(), and Vector::Size().

int GridFunction::GetFaceValues ( int  i,
int  side,
const IntegrationRule ir,
Vector vals,
DenseMatrix tr,
int  vdim = 1 
) const
int GridFunction::GetFaceVectorValues ( int  i,
int  side,
const IntegrationRule ir,
DenseMatrix vals,
DenseMatrix tr 
) const
void GridFunction::GetGradient ( ElementTransformation tr,
Vector grad 
)

Definition at line 698 of file gridfunc.cpp.

References mfem_error().

void GridFunction::GetGradients ( const int  elem,
const IntegrationRule ir,
DenseMatrix grad 
)
void GridFunction::GetNodalValues ( Vector nval,
int  vdim = 1 
) const

Return the values as a vector on mesh vertices for dimension vdim.

Definition at line 766 of file gridfunc.cpp.

References fes, FiniteElementSpace::GetElementVertices(), FiniteElementSpace::GetNE(), GetNodalValues(), FiniteElementSpace::GetNV(), Vector::SetSize(), and Array< T >::Size().

void GridFunction::GetNodalValues ( int  i,
Array< double > &  nval,
int  vdim = 1 
) const
double GridFunction::GetValue ( int  i,
const IntegrationPoint ip,
int  vdim = 1 
) const
void GridFunction::GetValues ( int  i,
const IntegrationRule ir,
Vector vals,
DenseMatrix tr,
int  vdim = 1 
) const
void GridFunction::GetValuesFrom ( GridFunction orig_func)
void GridFunction::GetVectorFieldNodalValues ( Vector val,
int  comp 
) const
void GridFunction::GetVectorFieldValues ( int  i,
const IntegrationRule ir,
DenseMatrix vals,
DenseMatrix tr,
int  comp = 0 
) const
void GridFunction::GetVectorGradient ( ElementTransformation tr,
DenseMatrix grad 
)
void GridFunction::GetVectorGradientHat ( ElementTransformation T,
DenseMatrix gh 
) [protected]
void GridFunction::GetVectorValue ( int  i,
const IntegrationPoint ip,
Vector val 
) const
void GridFunction::GetVectorValues ( int  i,
const IntegrationRule ir,
DenseMatrix vals,
DenseMatrix tr 
) const
void GridFunction::MakeOwner ( FiniteElementCollection _fec) [inline]

Make the GridFunction the owner of 'fec' and 'fes'.

Definition at line 42 of file gridfunc.hpp.

References fec.

Referenced by Mesh::Load().

GridFunction & GridFunction::operator= ( const Vector v)

Redefine '=' for vector = vector.

Reimplemented from Vector.

Reimplemented in ParGridFunction.

Definition at line 1515 of file gridfunc.cpp.

References Vector::data, and Vector::size.

GridFunction & GridFunction::operator= ( const GridFunction v)

Definition at line 1522 of file gridfunc.cpp.

References operator=().

GridFunction & GridFunction::operator= ( double  value)

Redefine '=' for GridFunction = constant.

Reimplemented from Vector.

Reimplemented in ParGridFunction.

Definition at line 1508 of file gridfunc.cpp.

References Vector::data, and Vector::size.

Referenced by operator=().

FiniteElementCollection* GridFunction::OwnFEC ( ) [inline]

Definition at line 45 of file gridfunc.hpp.

References fec.

Referenced by Mesh::DegreeElevate().

void GridFunction::ProjectBdrCoefficient ( Coefficient coeff[],
Array< int > &  attr 
)
void GridFunction::ProjectBdrCoefficient ( Coefficient coeff,
Array< int > &  attr 
) [inline]

Definition at line 111 of file gridfunc.hpp.

void GridFunction::ProjectBdrCoefficientNormal ( VectorCoefficient vcoeff,
Array< int > &  bdr_attr 
)
void GridFunction::ProjectBdrCoefficientTangent ( VectorCoefficient vcoeff,
Array< int > &  bdr_attr 
)

Project the tangential components of the given VectorCoefficient on the boundary. Only boundary attributes that are marked in 'bdr_attr' are projected. Assumes ND-type VectorFE GridFunction.

Definition at line 1061 of file gridfunc.cpp.

References fes, FiniteElementSpace::GetBdrAttribute(), FiniteElementSpace::GetBdrElementDofs(), FiniteElementSpace::GetBdrElementTransformation(), FiniteElementSpace::GetBE(), FiniteElement::GetDof(), FiniteElementSpace::GetNBE(), FiniteElement::Project(), Vector::SetSize(), and Vector::SetSubVector().

void GridFunction::ProjectCoefficient ( Coefficient coeff[])
void GridFunction::ProjectCoefficient ( Coefficient coeff,
Array< int > &  dofs,
int  vd = 0 
)
void GridFunction::ProjectCoefficient ( Coefficient coeff)
void GridFunction::ProjectCoefficient ( VectorCoefficient vcoeff)
void GridFunction::ProjectVectorFieldOn ( GridFunction vec_field,
int  comp = 0 
)
void GridFunction::ReorderByNodes ( )

For a vector grid function, makes sure that the ordering is byNODES.

Definition at line 507 of file gridfunc.cpp.

References Ordering::byNODES, Vector::data, fes, FiniteElementSpace::GetNDofs(), FiniteElementSpace::GetOrdering(), FiniteElementSpace::GetVDim(), and Vector::size.

void GridFunction::Save ( ostream &  out) [virtual]
void GridFunction::SaveSTL ( ostream &  out,
int  TimesToRefine = 1 
)
void GridFunction::SaveSTLTri ( ostream &  out,
double  p1[],
double  p2[],
double  p3[] 
) [protected]

Definition at line 1586 of file gridfunc.cpp.

Referenced by SaveSTL().

void GridFunction::SaveVTK ( ostream &  out,
const string &  field_name,
int  ref 
)
void GridFunction::Update ( ) [inline]

Definition at line 171 of file gridfunc.hpp.

References fes, FiniteElementSpace::GetVSize(), and Vector::SetSize().

Referenced by Mesh::UpdateNodes(), and Mesh::UpdateNURBS().

void GridFunction::Update ( FiniteElementSpace f,
Vector v,
int  v_offset 
)

Definition at line 140 of file gridfunc.cpp.

References fec, fes, FiniteElementSpace::GetVSize(), and Vector::SetDataAndSize().

void GridFunction::Update ( FiniteElementSpace f)

Definition at line 128 of file gridfunc.cpp.

References fec, fes, FiniteElementSpace::GetVSize(), and Vector::SetSize().

int GridFunction::VectorDim ( ) const

Member Data Documentation

Used when the grid function is read from a file.

Definition at line 23 of file gridfunc.hpp.

Referenced by GridFunction(), MakeOwner(), OwnFEC(), Update(), and ~GridFunction().


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines