Sierra Toolkit  Version of the Day
stk_classic::linsys::DofMapper Class Reference

#include <DofMapper.hpp>

Public Member Functions

 DofMapper (MPI_Comm comm, bool create_reverse_mappings=true)
 
virtual ~DofMapper ()
 
void add_dof_mappings (const stk_classic::mesh::BulkData &mesh_bulk, const stk_classic::mesh::Selector &selector, stk_classic::mesh::EntityRank ent_type, const stk_classic::mesh::FieldBase &field)
 
void finalize ()
 
bool reverse_mappings_enabled () const
 
int get_field_id (const stk_classic::mesh::FieldBase &field) const
 
int get_global_index (stk_classic::mesh::EntityRank ent_type, stk_classic::mesh::EntityId ent_id, stk_classic::mesh::FieldBase &field, int offset_into_field=0)
 
void get_dof (int global_index, stk_classic::mesh::EntityRank &ent_type, stk_classic::mesh::EntityId &ent_id, const stk_classic::mesh::FieldBase *&field, int &offset_into_field) const
 
const fei::SharedPtr< fei::VectorSpace > get_fei_VectorSpace () const
 
fei::SharedPtr< fei::VectorSpace > get_fei_VectorSpace ()
 
const FieldIdMap & get_FieldIdMap () const
 
FieldIdMap & get_FieldIdMap ()
 

Detailed Description

Perform mappings between degrees-of-freedom and equation-indices.

A degree-of-freedom is specified by four things: (entity-type,entity-id,field,offset-into-field)

An equation-index is a member of a globally contiguous, zero-based index space.

A DOF-mapping allows the caller to provide a degree-of-freedom and obtain an equation-index. A reverse DOF-mapping allows the caller to provide an equation-index and obtain a degree-of-freedom.

By default this DofMapper class provides DOF-mappings and reverse-DOF-mappings. Providing reverse DOF-mappings consumes extra memory since it requires constructing an additional FEI object to do the reverse lookups. If this is not desired, reverse-mappings can be disabled using DofMapper's second constructor argument.

The FEI library is utilized for accumulating and storing the mappings. (fei::VectorSpace provides DOF-mappings, and fei::ReverseMapper provides reverse-DOF-mappings.)

Since the FEI works entirely with primitive data types (e.g., int) and has no knowledge of stk_classic::mesh types, this DofMapper class essentially acts as a translation bridge between stk_classic::mesh and the FEI library.

Definition at line 52 of file DofMapper.hpp.

Constructor & Destructor Documentation

◆ DofMapper()

stk_classic::linsys::DofMapper::DofMapper ( MPI_Comm  comm,
bool  create_reverse_mappings = true 
)

Constructor that internally creates an fei::VectorSpace object.

Definition at line 24 of file DofMapper.cpp.

◆ ~DofMapper()

stk_classic::linsys::DofMapper::~DofMapper ( )
virtual

Constructor that accepts an existing fei::VectorSpace object. Destructor

Definition at line 32 of file DofMapper.cpp.

Member Function Documentation

◆ add_dof_mappings()

void stk_classic::linsys::DofMapper::add_dof_mappings ( const stk_classic::mesh::BulkData &  mesh_bulk,
const stk_classic::mesh::Selector &  selector,
stk_classic::mesh::EntityRank  ent_type,
const stk_classic::mesh::FieldBase &  field 
)

Given a mesh, an entity-type and a field, store the resulting DOF mappings. This method iterates the buckets for the specified entity-type, and for each bucket that has the given field and is selected by the specified selector. DOF-mappings are stored for each entity-id in the bucket.

This method may be called repeatedly, to add dof mappings for different parts, different entity-types, different fields, etc.

Definition at line 50 of file DofMapper.cpp.

◆ finalize()

void stk_classic::linsys::DofMapper::finalize ( )

This method internally calls fei::VectorSpace::initComplete(), which finalizes and synchronizes the DOF-mappings (ensures that indices for shared-entities are consistent, etc.). Also, if reverse-mappings are not disabled, this method creates the reverse-mappings object. (The get_dof() method is not available until after this has happened.)

This is a collective method, must be called on all processors.

Definition at line 124 of file DofMapper.cpp.

◆ reverse_mappings_enabled()

bool stk_classic::linsys::DofMapper::reverse_mappings_enabled ( ) const
inline

Query whether reverse-DOF-mappings are enabled. (See second constructor argument above.)

Definition at line 89 of file DofMapper.hpp.

◆ get_field_id()

int stk_classic::linsys::DofMapper::get_field_id ( const stk_classic::mesh::FieldBase &  field) const

Return the integer id that the specified field is mapped to. The integer id is the FEI's representation of the field.

Definition at line 136 of file DofMapper.cpp.

◆ get_global_index()

int stk_classic::linsys::DofMapper::get_global_index ( stk_classic::mesh::EntityRank  ent_type,
stk_classic::mesh::EntityId  ent_id,
stk_classic::mesh::FieldBase &  field,
int  offset_into_field = 0 
)

Return a global equation index for the specified entity type/id pair and field.

Note: this method should be const, but it calls an fei query that is not const. When the fei method is corrected, this method will be made const.

Note2: this method may not work correctly until after 'finalize()' has been called.

Definition at line 142 of file DofMapper.cpp.

◆ get_dof()

void stk_classic::linsys::DofMapper::get_dof ( int  global_index,
stk_classic::mesh::EntityRank &  ent_type,
stk_classic::mesh::EntityId &  ent_id,
const stk_classic::mesh::FieldBase *&  field,
int &  offset_into_field 
) const

Given a global_index, return the specification for the DOF that it corresponds to. Throw an exception if the global_index is not found, or if DofMapper::finalize() has not been called. Note: this method will be const after the corresponding fei query is corrected for constness.

Definition at line 169 of file DofMapper.cpp.

◆ get_fei_VectorSpace() [1/2]

const fei::SharedPtr<fei::VectorSpace> stk_classic::linsys::DofMapper::get_fei_VectorSpace ( ) const
inline

Return the underlying fei::VectorSpace object.

Definition at line 121 of file DofMapper.hpp.

◆ get_fei_VectorSpace() [2/2]

fei::SharedPtr<fei::VectorSpace> stk_classic::linsys::DofMapper::get_fei_VectorSpace ( )
inline

Return the underlying fei::VectorSpace object.

Definition at line 125 of file DofMapper.hpp.


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