MAST3
Multidisciplinary-design Adaptation and Sensitivity Toolkit (MAST)
MAST::Numerics::libMeshWrapper Namespace Reference

Functions

template<typename P1 , int P2, typename P3 >
void init_sparse_matrix (const libMesh::DofMap &dof_map, Eigen::SparseMatrix< P1, P2, P3 > &m)
 
template<typename IntType >
void unconstrained_dofs (const libMesh::DofMap &dof_map, std::vector< IntType > &dofs)
 copies the unconstrained dofs for the dof_map in the vector dofs. More...
 

Function Documentation

◆ init_sparse_matrix()

template<typename P1 , int P2, typename P3 >
void MAST::Numerics::libMeshWrapper::init_sparse_matrix ( const libMesh::DofMap &  dof_map,
Eigen::SparseMatrix< P1, P2, P3 > &  m 
)

Definition at line 36 of file sparse_matrix_initialization.hpp.

37  {
38 
39  Assert1(dof_map.comm().size() == 1,
40  dof_map.comm().size(),
41  "Eigen matrix can only be used for MPI communicator with rank 1.");
42 
43  m.resize(dof_map.n_dofs(), dof_map.n_dofs());
44 
45  m.reserve(dof_map.get_n_nz());
46 }
#define Assert1(cond, v1, msg)
Definition: exceptions.hpp:143

◆ unconstrained_dofs()

template<typename IntType >
void MAST::Numerics::libMeshWrapper::unconstrained_dofs ( const libMesh::DofMap &  dof_map,
std::vector< IntType > &  dofs 
)

copies the unconstrained dofs for the dof_map in the vector dofs.

This is a collective operation and each rank will store only its own set of unconstrained dofs.

Definition at line 39 of file unconstrained_dofs.hpp.

40  {
41 
42  std::set<IntType>
43  local_non_condensed_dofs_set;
44 
45  for (IntType i=dof_map.first_dof(); i<dof_map.end_dof(); i++) {
46 
47  if (!dof_map.is_constrained_dof(i))
48  local_non_condensed_dofs_set.insert(i);
49  }
50 
51  typename std::set<IntType>::const_iterator
52  it = local_non_condensed_dofs_set.begin(),
53  end = local_non_condensed_dofs_set.end();
54 
55  dofs.clear();
56  dofs.reserve(local_non_condensed_dofs_set.size());
57 
58  for ( ; it != end; it++)
59  dofs.push_back(*it);
60 }