FEOrthoSystem Class Reference

#include <feorthosystem.h>

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

List of all members.

Public Member Functions

 FEOrthoSystem (FEOrthoMesh &fe, unsigned multiplicity)
virtual void reinit (OrthoMesh &mesh)
virtual const VecIndexget_global_map (OrthoMesh::Cell_It &cell)
virtual unsigned n_fields ()
virtual Index local_dof_field (Index dof)
 ~FEOrthoSystem ()

Private Attributes

VecIndex _fe_dof_offsets
VecIndex _global_map
VecIndex _dof_field_map
std::vector< FEOrthoMesh * > _fes
unsigned _n_fields

Detailed Description

Implements a finite element that is actually a collection of other finite elements. It is used to solve system of differential equations where each variable (i.e component in terms of FEOrthoSystem finite element) can be descretized

Definition at line 12 of file feorthosystem.h.


Constructor & Destructor Documentation

FEOrthoSystem::FEOrthoSystem ( FEOrthoMesh fe,
unsigned  multiplicity 
)

Definition at line 4 of file feorthosystem.cpp.

00005   :_fes(multiplicity,&fe)
00006 {
00007   assert(multiplicity > 0);
00008   this->_fe_dof_offsets.resize(_fes.size());
00009 
00010 
00011   //_local_dof_offset[i] means the offset where the dofs
00012   //of the  element i in the
00013   //vector of finite element _fes begin to be counted.
00014   //If _local_dof_offset[2]=7 means that the 3 element in _fes
00015   //has its first dof counted starting from 7
00016   _fe_dof_offsets[0]=0;
00017   for (unsigned i=1;i<_fes.size();i++)
00018   {
00019     _fe_dof_offsets[i]=_fe_dof_offsets[i-1]+_fes[i-1]->n_local_dofs();
00020   }
00021 
00022   //Now get the number of local dofs in the FE System
00023   //and the number of fields
00024   unsigned total_dofs=0;
00025   _n_fields=0;
00026   for (unsigned i=0;i<_fes.size();i++)
00027   {
00028     _n_fields+=_fes[i]->n_fields();
00029     total_dofs+=_fes[i]->n_local_dofs();
00030   }
00031   //Reset the global_map vector with the total dofs in
00032   //the system
00033   _global_map.resize(total_dofs);
00034 
00035   //Create the dof to field number map
00036   _dof_field_map.resize(total_dofs);
00037   unsigned field_off=0;
00038   for (unsigned i=0;i<_fes.size();i++)
00039   {
00040     unsigned n_local_dofs = _fes[i]->n_local_dofs();
00041     for (unsigned dofs=0;dofs<n_local_dofs;dofs++)
00042     {
00043       _dof_field_map[field_off+dofs]=_fes[i]->local_dof_field(dofs);
00044     }
00045     field_off+=_fes[i]->n_fields();
00046   }
00047 }

FEOrthoSystem::~FEOrthoSystem (  ) 

Member Function Documentation

const VecIndex & FEOrthoSystem::get_global_map ( OrthoMesh::Cell_It cell  )  [virtual]

This function returns the mapping between the local degrees of freedom (dof) to global dof.

So the ith position of this vector contains the global numbering of the local dof i. In other words if v is the vector being returned, v[i] is the global numbering of the local dof i.

Implements FEOrthoMeshInterface.

Definition at line 70 of file feorthosystem.cpp.

00071 {
00072   VecIndex::iterator it = _global_map.begin();
00073   for (unsigned feI=0;feI<_fes.size();feI++)
00074   {
00075     const VecIndex &fe_global_map=_fes[feI]->get_global_map(cell);
00076     unsigned offset = _fe_dof_offsets[feI];
00077     for (unsigned i=0;i<fe_global_map.size();i++)
00078     {
00079       *it++=offset+fe_global_map[i];
00080     }
00081   }
00082   assert(it==_global_map.end());
00083   return _global_map;
00084 
00085 }

Index FEOrthoSystem::local_dof_field ( Index  local_dof  )  [virtual]

Taking a local dof in the reference domain returns the number of the field where this dof belongs to.

Implements FiniteElementInterface.

Definition at line 90 of file feorthosystem.cpp.

00091 {
00092   assert(dof < _dof_field_map.size());
00093   return _dof_field_map[dof];
00094   
00095 }

virtual unsigned FEOrthoSystem::n_fields (  )  [inline, virtual]

This function returns the number of fields (components) of the finite element.

Returns:

Implements FiniteElementInterface.

Definition at line 28 of file feorthosystem.h.

00028 {return _n_fields;}

void FEOrthoSystem::reinit ( OrthoMesh mesh  )  [virtual]

Reinit the finite element with the mesh.

Parameters:
mesh 
Returns:

Implements FEOrthoMeshInterface.

Definition at line 58 of file feorthosystem.cpp.

00059 {
00060   //Do reinit for all its finite elements
00061   std::vector<FEOrthoMesh*>::iterator it;
00062   for ( it= _fes.begin();it!=_fes.end();it++)
00063   {
00064     (*it)->reinit(mesh);
00065   }
00066 }


Member Data Documentation

To contain the local dof to field number map

Definition at line 17 of file feorthosystem.h.

Array containing the offsets where the local dofs of each element begin to be counted

Definition at line 15 of file feorthosystem.h.

std::vector<FEOrthoMesh*> FEOrthoSystem::_fes [private]

To contain the finite elements that compose the fe system

Definition at line 18 of file feorthosystem.h.

To contain the global map

Definition at line 16 of file feorthosystem.h.

unsigned FEOrthoSystem::_n_fields [private]

To contain the number of field in the system

Definition at line 19 of file feorthosystem.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Sun Apr 8 23:13:05 2012 for CO2INJECTION by  doxygen 1.6.3