28 const libMesh::Node& slave_node,
29 const std::set<const libMesh::Node*>& master_nodes,
30 bool constrain_rotations):
33 _masters (master_nodes),
34 _constrain_rotations (constrain_rotations) {
47 <libMesh::dof_id_type, libMesh::DofConstraintRow,
Real>>& constraints)
const {
54 std::vector<libMesh::dof_id_type>
58 std::map<const libMesh::Node*, std::pair<std::vector<libMesh::dof_id_type>,
Real>>
63 dof_map.dof_indices(
_slave, slave_dofs);
65 std::set<const libMesh::Node*>::const_iterator
71 std::map<const libMesh::Node*, Real> weights;
78 for ( ; n_it != n_end; n_it++ ) {
80 const libMesh::Node* nd = *n_it;
86 val = exp(-dx.norm());
95 for ( ; n_it != n_end; n_it++ ) {
97 const libMesh::Node* nd = *n_it;
99 std::pair<std::vector<libMesh::dof_id_type>,
Real> dofs_wt_pair;
100 dof_map.dof_indices(nd, dofs_wt_pair.first);
102 dofs_wt_pair.second = weights[nd]/sum;
104 master_node_data[nd] = dofs_wt_pair;
113 constraints.resize(dofs_to_constrain);
117 for (
unsigned int i=0; i<dofs_to_constrain; i++) {
120 std::get<0>(constraints[i]) = slave_dofs[i];
123 std::get<2>(constraints[i]) = 0.;
125 libMesh::DofConstraintRow&
126 c_row = std::get<1>(constraints[i]);
128 std::map<
const libMesh::Node*,
129 std::pair<std::vector<libMesh::dof_id_type>,
Real>>::const_iterator
130 master_nd_it = master_node_data.begin(),
131 master_nd_end = master_node_data.end();
133 for ( ; master_nd_it != master_nd_end; master_nd_it++) {
135 dx = *
_slave - *master_nd_it->first;
137 const std::vector<libMesh::dof_id_type>
138 &master_dofs = master_nd_it->second.first;
141 idx = master_dofs[i];
142 val = master_nd_it->second.second;
148 c_row[idx] = -val * -1.;
157 c_row[master_dofs[4]] = -dx(2) * val;
158 c_row[master_dofs[5]] = dx(1) * val;
164 c_row[master_dofs[3]] = -dx(2) * val;
165 c_row[master_dofs[5]] = dx(0) * val;
171 c_row[master_dofs[3]] = -dx(1) * val;
172 c_row[master_dofs[4]] = dx(0) * val;
MAST::NonlinearSystem & system()
const libMesh::Node * _slave
virtual ~KinematicCouplingConstraint()
KinematicCouplingConstraint(MAST::SystemInitialization &sys_init, const libMesh::Node &slave_node, const std::set< const libMesh::Node * > &master_nodes, bool constrain_rotations)
MAST::SystemInitialization & _sys_init
bool _constrain_rotations
void get_dof_constraint_row(std::vector< std::tuple< libMesh::dof_id_type, libMesh::DofConstraintRow, Real >> &constraints) const
initializes the vector of libMesh::DofConstraintRow objects and rhs values for this node ...
std::set< const libMesh::Node * > _masters