29 #include "libmesh/dof_map.h" 36 _constrain_all_negative_indices (false),
38 _level_set (level_set),
39 _intersection (nullptr) {
65 libMesh::DofMap& dof_map = nonlin_sys.get_dof_map();
67 libMesh::MeshBase::const_element_iterator el =
68 nonlin_sys.get_mesh().active_local_elements_begin();
69 const libMesh::MeshBase::const_element_iterator end_el =
70 nonlin_sys.get_mesh().active_local_elements_end();
73 std::vector<libMesh::dof_id_type>
75 std::set<libMesh::dof_id_type>
78 connected_dof_indices;
80 for ( ; el != end_el; ++el) {
82 const libMesh::Elem* elem = *el;
85 nonlin_sys.get_mesh().max_elem_id(),
86 nonlin_sys.get_mesh().max_node_id());
89 dof_map.dof_indices(elem, dof_indices);
94 for (
unsigned int i=0; i<dof_indices.size(); i++)
95 all_dof_indices.insert(dof_indices[i]);
102 for (
unsigned int i=0; i<dof_indices.size(); i++)
103 connected_dof_indices.insert(dof_indices[i]);
112 for (
unsigned int i=0; i<elem->n_nodes(); i++) {
114 const libMesh::Node* nd = elem->node_ptr(i);
118 dof_map.dof_indices(nd, dof_indices);
119 for (
unsigned int i=0; i<dof_indices.size(); i++)
120 negative_dof_indices.insert(dof_indices[i]);
131 dof_indices.reserve(all_dof_indices.size() - connected_dof_indices.size());
133 std::set_difference(all_dof_indices.begin(),
134 all_dof_indices.end(),
135 connected_dof_indices.begin(),
136 connected_dof_indices.end(),
137 std::inserter(dof_indices, dof_indices.begin()));
139 all_dof_indices.clear();
140 connected_dof_indices.clear();
143 std::vector<libMesh::dof_id_type>::const_iterator
144 dof_it = dof_indices.begin(),
145 dof_end = dof_indices.end();
147 for ( ; dof_it != dof_end; dof_it++) {
151 if (!dof_map.is_constrained_dof(*dof_it)) {
153 libMesh::DofConstraintRow c_row;
154 dof_map.add_constraint_row(*dof_it, c_row,
true);
162 std::set<libMesh::dof_id_type>::const_iterator
163 dof_it = negative_dof_indices.begin(),
164 dof_end = negative_dof_indices.end();
166 for ( ; dof_it != dof_end; dof_it++) {
170 if (!dof_map.is_constrained_dof(*dof_it)) {
172 libMesh::DofConstraintRow c_row;
173 dof_map.add_constraint_row(*dof_it, c_row,
true);
MAST::SystemInitialization & _sys
MAST::FieldFunction< Real > & _level_set
MAST::NonlinearSystem & system()
This class implements a system for solution of nonlinear systems.
LevelSetConstrainDofs(MAST::SystemInitialization &sys, MAST::FieldFunction< Real > &level_set)
virtual ~LevelSetConstrainDofs()
void init(const MAST::FieldFunction< Real > &phi, const libMesh::Elem &e, const Real t, unsigned int max_elem_id, unsigned int max_node_id)
Real get_node_phi_value(const libMesh::Node *n) const
MAST::LevelSetIntersection * _intersection
bool if_elem_has_positive_phi_region() const
bool if_elem_has_boundary() const
virtual void constrain()
provides implementation of the libMesh::System::Constraint::constrain() virtual method ...
MAST::LevelSetIntersection & get_intersection()
bool _constrain_all_negative_indices
void clear()
clears the data structures