My Project
Opm::Elasticity::ASMHandler< GridType > Class Template Reference

Class handling finite element assembly. More...

#include <asmhandler.hpp>

Public Types

typedef GridType::LeafGridView::IndexSet LeafIndexSet
 A set of indices.
 
typedef GridType::LeafGridView::template Codim< 0 >::Iterator LeafIterator
 An iterator over grid cells.
 
typedef Dune::FieldVector< double, dim > NodeValue
 A vectorial node value.
 

Public Member Functions

 ASMHandler (const GridType &gv_)
 The default constructor. More...
 
 ~ASMHandler ()
 Destructor.
 
size_t getEqns () const
 Get the number of equations in the system. More...
 
int getEquationForDof (int node, int dof)
 Get the equation number for a given dof on a given node. More...
 
Matrix & getOperator ()
 Obtain a reference to the linear operator. More...
 
Vector & getLoadVector ()
 Obtain a reference to the load vector. More...
 
void initForAssembly ()
 This function needs to be called before starting the element assembly. More...
 
template<int esize>
void addElement (const Dune::FieldMatrix< double, esize, esize > *K, const Dune::FieldVector< double, esize > *S, const LeafIterator &cell, Vector *b=NULL)
 Add an element matrix/vector to the system. More...
 
template<int comp>
void extractValues (Dune::FieldVector< double, comp > &v, const Vector &u, const LeafIterator &it)
 Extract values corresponding to cell. More...
 
void expandSolution (Vector &result, const Vector &u)
 Expand a system vector to a solution vector.
 
void addMPC (MPC *mpc)
 Add a MPC. More...
 
MPC * getMPC (int node, int dof)
 Look for and return a MPC for a specified node+dof. More...
 
void updateFixedNode (int node, const std::pair< Direction, NodeValue > &entry)
 Update/add a fixed node. More...
 
bool isFixed (int node)
 Check if a node is marked as fixed (in any direction) More...
 
void printOperator () const
 Print the current operator.
 
void printLoadVector () const
 Print the current load vector.
 
AdjacencyPattern & getAdjacencyPattern ()
 Access current adjacency pattern. More...
 

Static Public Attributes

static const int dim = GridType::dimension
 The dimension of the grid.
 

Protected Types

typedef std::pair< Direction, NodeValue > fixEntry
 Fixed nodes.
 
typedef std::map< int, fixEntry > fixMap
 A mapping from dof to fix value info.
 
typedef fixMap::iterator fixIt
 Iterator over a fixmap.
 

Protected Member Functions

void resolveMPCChains ()
 Resolve chained MPCs.
 
void resolveMPCChain (MPC *mpc)
 Internal function. More...
 
void preprocess ()
 Internal function. Generate meqn for registered MPC/fixed nodes.
 
void nodeAdjacency (const LeafIterator &it, int vertexsize, int row)
 Internal function. More...
 
void determineAdjacencyPattern ()
 Internal function. Calculate adjacency pattern.
 
template<int esize>
void addDOF (int row, int erow, const Dune::FieldMatrix< double, esize, esize > *K, const Dune::FieldVector< double, esize > *S, const LeafIndexSet &set, const LeafIterator &cell, Vector *b, double scale=1.f)
 Internal function. More...
 

Protected Attributes

MPCMap mpcs
 The set of MPC.
 
std::vector< int > meqn
 Vector of (interleaved) dof<->eqn mapping.
 
fixMap fixedNodes
 The map holding information about our fixed nodes.
 
AdjacencyPattern adjacencyPattern
 Holds the adjacency pattern of the sparse matrix.
 
Matrix A
 The linear operator.
 
Vector b
 The load vector.
 
const GridType & gv
 A reference to the grid in use.
 
size_t maxeqn
 The number of equations in the system.
 

Detailed Description

template<class GridType>
class Opm::Elasticity::ASMHandler< GridType >

Class handling finite element assembly.

Constructor & Destructor Documentation

◆ ASMHandler()

template<class GridType >
Opm::Elasticity::ASMHandler< GridType >::ASMHandler ( const GridType &  gv_)
inline

The default constructor.

Parameters
[in]gv_The grid the operator is assembled over

Member Function Documentation

◆ addDOF()

template<class GridType >
template<int esize>
void Opm::Elasticity::ASMHandler< GridType >::addDOF ( int  row,
int  erow,
const Dune::FieldMatrix< double, esize, esize > *  K,
const Dune::FieldVector< double, esize > *  S,
const LeafIndexSet &  set,
const LeafIterator &  cell,
Vector *  b,
double  scale = 1.f 
)
protected

Internal function.

Assemble entries for a single DOF

Parameters
[in]rowThe row in the global matrix
[in]erowThe row in the element matrix
[in]KPointer to the element matrix. Can be NULL
[in]SPointer to the element load vector. Can be NULL
[in]setThe index set
[in]cellAn iterator pointing to the cell we're assembling for
[in]bVector to add contributions to
[in]scaleScale for elements. Used with MPC couplings

◆ addElement()

template<class GridType >
template<int esize>
void Opm::Elasticity::ASMHandler< GridType >::addElement ( const Dune::FieldMatrix< double, esize, esize > *  K,
const Dune::FieldVector< double, esize > *  S,
const LeafIterator &  cell,
Vector *  b = NULL 
)

Add an element matrix/vector to the system.

Parameters
[in]KPointer to the element matrix. Can be NULL
[in]SPointer to the element load vector. Can be NULL
[in]cellAn iterator pointing to the cell we're assembling for
[in]bVector to add contributions to. If not given, we use the internal vector

◆ addMPC()

template<class GridType >
void Opm::Elasticity::ASMHandler< GridType >::addMPC ( MPC *  mpc)

Add a MPC.

Parameters
[in]mpcPointer to the MPC to add.
Note
This class handles destruction

◆ extractValues()

template<class GridType >
template<int comp>
void Opm::Elasticity::ASMHandler< GridType >::extractValues ( Dune::FieldVector< double, comp > &  v,
const Vector &  u,
const LeafIterator &  it 
)

Extract values corresponding to cell.

Parameters
[in]uThe global load vector
[in]itAn iterator to the cell we want to extract values for
[out]vVector holding the values requested

◆ getAdjacencyPattern()

template<class GridType >
AdjacencyPattern& Opm::Elasticity::ASMHandler< GridType >::getAdjacencyPattern ( )
inline

Access current adjacency pattern.

Can be used to add extra entries, such as other blocks

◆ getEqns()

template<class GridType >
size_t Opm::Elasticity::ASMHandler< GridType >::getEqns ( ) const
inline

Get the number of equations in the system.

Returns
The number of equations in the system

◆ getEquationForDof()

template<class GridType >
int Opm::Elasticity::ASMHandler< GridType >::getEquationForDof ( int  node,
int  dof 
)
inline

Get the equation number for a given dof on a given node.

Parameters
[in]nodeThe node number
[in]dofThe DOF
Returns
The equation number if active, -1 otherwise

◆ getLoadVector()

template<class GridType >
Vector& Opm::Elasticity::ASMHandler< GridType >::getLoadVector ( )
inline

Obtain a reference to the load vector.

Returns
Reference to load vector

◆ getMPC()

template<class GridType >
MPC * Opm::Elasticity::ASMHandler< GridType >::getMPC ( int  node,
int  dof 
)

Look for and return a MPC for a specified node+dof.

Parameters
[in]nodeThe requested node
[in]dofThe requested DOF at given node
Returns
The MPC for the node/dof if found, else NULL

◆ getOperator()

template<class GridType >
Matrix& Opm::Elasticity::ASMHandler< GridType >::getOperator ( )
inline

Obtain a reference to the linear operator.

Returns
Reference to linear operator

◆ initForAssembly()

template<class GridType >
void Opm::Elasticity::ASMHandler< GridType >::initForAssembly

This function needs to be called before starting the element assembly.


◆ isFixed()

template<class GridType >
bool Opm::Elasticity::ASMHandler< GridType >::isFixed ( int  node)
inline

Check if a node is marked as fixed (in any direction)

Parameters
[in]nodeThe node to query for

◆ nodeAdjacency()

template<class GridType >
void Opm::Elasticity::ASMHandler< GridType >::nodeAdjacency ( const LeafIterator &  it,
int  vertexsize,
int  row 
)
protected

Internal function.

Generate adjacency pattern for a given node

Parameters
[in]itIterator pointing to the cell in of the node
[in]vertexsizeNumber of vertices in the cell
[in]rowThe equation number/row in matrix

◆ resolveMPCChain()

template<class GridType >
void Opm::Elasticity::ASMHandler< GridType >::resolveMPCChain ( MPC *  mpc)
protected

Internal function.

Handles a single MPC

Parameters
[in]mpcPointer to the MPC to resolve

◆ updateFixedNode()

template<class GridType >
void Opm::Elasticity::ASMHandler< GridType >::updateFixedNode ( int  node,
const std::pair< Direction, NodeValue > &  entry 
)

Update/add a fixed node.

Parameters
[in]nodeThe node number
[in]entryThe fixed values

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