Public Member Functions | Private Member Functions | Private Attributes | List of all members
oomph::AddedMainNumberingLookup Class Reference

Class to store bi-directional lookup between added matrix row/col numbers to main matrix (SumOfMatrix) row/col numbers. More...

#include <sum_of_matrices.h>

Public Member Functions

 AddedMainNumberingLookup ()
 Default constructor. More...
 
 AddedMainNumberingLookup (const Mesh *mesh_pt, const unsigned &dof_index)
 Real constructor: construct lookup from node numbers in mesh and global equation numbers. Useful for the case when the main matrix is a Jacobian and the added matrix is a contribution only on a certain mesh. More...
 
 AddedMainNumberingLookup (const int *lookup_array, const unsigned &length)
 Construct lookup schemes from int array (HLib's format for this data). More...
 
 ~AddedMainNumberingLookup ()
 Destructor. More...
 
unsigned main_to_added (const int &main) const
 Given a main matrix row/col number get the equivalent row/col in the added matrix. Throw an error if not found. More...
 
int unsafe_main_to_added (const int &main) const
 Given a main matrix row/col number get the equivalent row/col in the added matrix. Return -1 if not found. More...
 
unsigned added_to_main (const unsigned &added) const
 Given a row/col number in the added matrix return the equivalent row/col number in the main matrix. More...
 
void build (const Mesh *mesh_pt, const unsigned &dof_index)
 Construct the lookup schemes given a mesh and the degree of freedom to lookup main equation numbers for. More...
 
void build (const int *lookup_array, const unsigned &length)
 Construct lookup schemes from int array (HLib's format for this data). More...
 
void build (const Vector< const Node * > &bem_lookup, const unsigned &dof_index)
 Construct lookup using node vector. More...
 
void build_identity_map (const unsigned &n)
 Construct an identity map (mostly for testing). More...
 
const Vector< unsigned > * added_to_main_mapping_pt () const
 Const access function for mapping. More...
 
const std::map< unsigned, unsigned > * main_to_added_mapping_pt () const
 Const access function for mapping. More...
 

Private Member Functions

void construct_added_to_main_mapping (const Mesh *mesh_pt, const unsigned &dof_index)
 Set up the lookup from added matrix row/col to main matrix. More...
 
void construct_reverse_mapping ()
 Set up the main to added mapping using the added to main mapping. More...
 
 AddedMainNumberingLookup (const AddedMainNumberingLookup &dummy)=delete
 Inaccessible copy constructor. More...
 
void operator= (const AddedMainNumberingLookup &dummy)=delete
 Inaccessible assignment operator. More...
 

Private Attributes

Vector< unsigned > Added_to_main_mapping
 Mapping from added matrix row/col numbers to main matrix row/col numbers. More...
 
std::map< unsigned, unsigned > Main_to_added_mapping
 Mapping from main matrix row/col numbers to added matrix row/col numbers. Note that we cannot use a vector here because the main matrix rows/cols mapped onto are probably not contiguous. Access times are O(log N) so if you need to iterate over all elements then use the pointer access functions and use stl iterators properly. More...
 

Detailed Description

Class to store bi-directional lookup between added matrix row/col numbers to main matrix (SumOfMatrix) row/col numbers.

Definition at line 46 of file sum_of_matrices.h.

Constructor & Destructor Documentation

◆ AddedMainNumberingLookup() [1/4]

oomph::AddedMainNumberingLookup::AddedMainNumberingLookup ( )
inline

Default constructor.

Definition at line 50 of file sum_of_matrices.h.

◆ AddedMainNumberingLookup() [2/4]

oomph::AddedMainNumberingLookup::AddedMainNumberingLookup ( const Mesh mesh_pt,
const unsigned &  dof_index 
)
inline

Real constructor: construct lookup from node numbers in mesh and global equation numbers. Useful for the case when the main matrix is a Jacobian and the added matrix is a contribution only on a certain mesh.

Definition at line 56 of file sum_of_matrices.h.

References build().

◆ AddedMainNumberingLookup() [3/4]

oomph::AddedMainNumberingLookup::AddedMainNumberingLookup ( const int *  lookup_array,
const unsigned &  length 
)
inline

Construct lookup schemes from int array (HLib's format for this data).

Definition at line 63 of file sum_of_matrices.h.

References build().

◆ ~AddedMainNumberingLookup()

oomph::AddedMainNumberingLookup::~AddedMainNumberingLookup ( )
inline

Destructor.

Definition at line 69 of file sum_of_matrices.h.

◆ AddedMainNumberingLookup() [4/4]

oomph::AddedMainNumberingLookup::AddedMainNumberingLookup ( const AddedMainNumberingLookup dummy)
privatedelete

Inaccessible copy constructor.

Member Function Documentation

◆ added_to_main()

unsigned oomph::AddedMainNumberingLookup::added_to_main ( const unsigned &  added) const
inline

Given a row/col number in the added matrix return the equivalent row/col number in the main matrix.

Definition at line 118 of file sum_of_matrices.h.

References Added_to_main_mapping.

◆ added_to_main_mapping_pt()

const Vector< unsigned > * oomph::AddedMainNumberingLookup::added_to_main_mapping_pt ( ) const
inline

Const access function for mapping.

Definition at line 184 of file sum_of_matrices.h.

References Added_to_main_mapping.

Referenced by oomph::SumOfMatrices::add_matrix().

◆ build() [1/3]

void oomph::AddedMainNumberingLookup::build ( const int *  lookup_array,
const unsigned &  length 
)
inline

Construct lookup schemes from int array (HLib's format for this data).

Definition at line 133 of file sum_of_matrices.h.

References Added_to_main_mapping, construct_reverse_mapping(), and oomph::Global_string_for_annotation::string().

◆ build() [2/3]

void oomph::AddedMainNumberingLookup::build ( const Mesh mesh_pt,
const unsigned &  dof_index 
)
inline

Construct the lookup schemes given a mesh and the degree of freedom to lookup main equation numbers for.

Definition at line 125 of file sum_of_matrices.h.

References construct_added_to_main_mapping(), and construct_reverse_mapping().

Referenced by AddedMainNumberingLookup().

◆ build() [3/3]

void oomph::AddedMainNumberingLookup::build ( const Vector< const Node * > &  bem_lookup,
const unsigned &  dof_index 
)
inline

Construct lookup using node vector.

Definition at line 155 of file sum_of_matrices.h.

References Added_to_main_mapping, construct_reverse_mapping(), and i.

◆ build_identity_map()

void oomph::AddedMainNumberingLookup::build_identity_map ( const unsigned &  n)
inline

Construct an identity map (mostly for testing).

Definition at line 169 of file sum_of_matrices.h.

References Added_to_main_mapping, and construct_reverse_mapping().

◆ construct_added_to_main_mapping()

void oomph::AddedMainNumberingLookup::construct_added_to_main_mapping ( const Mesh mesh_pt,
const unsigned &  dof_index 
)
inlineprivate

Set up the lookup from added matrix row/col to main matrix.

Definition at line 197 of file sum_of_matrices.h.

References Added_to_main_mapping, oomph::Data::eqn_number(), oomph::Mesh::nnode(), and oomph::Mesh::node_pt().

Referenced by build().

◆ construct_reverse_mapping()

void oomph::AddedMainNumberingLookup::construct_reverse_mapping ( )
inlineprivate

Set up the main to added mapping using the added to main mapping.

Definition at line 209 of file sum_of_matrices.h.

References Added_to_main_mapping, and Main_to_added_mapping.

Referenced by build(), and build_identity_map().

◆ main_to_added()

unsigned oomph::AddedMainNumberingLookup::main_to_added ( const int &  main) const
inline

Given a main matrix row/col number get the equivalent row/col in the added matrix. Throw an error if not found.

Definition at line 73 of file sum_of_matrices.h.

References oomph::Global_string_for_annotation::string(), oomph::StringConversion::to_string(), and unsafe_main_to_added().

◆ main_to_added_mapping_pt()

const std::map< unsigned, unsigned > * oomph::AddedMainNumberingLookup::main_to_added_mapping_pt ( ) const
inline

Const access function for mapping.

Definition at line 190 of file sum_of_matrices.h.

References Main_to_added_mapping.

Referenced by oomph::SumOfMatrices::add_matrix(), and unsafe_main_to_added().

◆ operator=()

void oomph::AddedMainNumberingLookup::operator= ( const AddedMainNumberingLookup dummy)
privatedelete

Inaccessible assignment operator.

◆ unsafe_main_to_added()

int oomph::AddedMainNumberingLookup::unsafe_main_to_added ( const int &  main) const
inline

Given a main matrix row/col number get the equivalent row/col in the added matrix. Return -1 if not found.

Definition at line 99 of file sum_of_matrices.h.

References Main_to_added_mapping, and main_to_added_mapping_pt().

Referenced by main_to_added().

Member Data Documentation

◆ Added_to_main_mapping

Vector<unsigned> oomph::AddedMainNumberingLookup::Added_to_main_mapping
private

Mapping from added matrix row/col numbers to main matrix row/col numbers.

Definition at line 234 of file sum_of_matrices.h.

Referenced by added_to_main(), added_to_main_mapping_pt(), build(), build_identity_map(), construct_added_to_main_mapping(), and construct_reverse_mapping().

◆ Main_to_added_mapping

std::map<unsigned, unsigned> oomph::AddedMainNumberingLookup::Main_to_added_mapping
private

Mapping from main matrix row/col numbers to added matrix row/col numbers. Note that we cannot use a vector here because the main matrix rows/cols mapped onto are probably not contiguous. Access times are O(log N) so if you need to iterate over all elements then use the pointer access functions and use stl iterators properly.

Definition at line 241 of file sum_of_matrices.h.

Referenced by construct_reverse_mapping(), main_to_added_mapping_pt(), and unsafe_main_to_added().


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