29 #include "libmesh/dof_map.h" 38 _indicator (indicator) {
59 libMesh::DofMap& dof_map = nonlin_sys.get_dof_map();
61 libMesh::MeshBase::const_element_iterator el =
62 nonlin_sys.get_mesh().active_local_elements_begin();
63 const libMesh::MeshBase::const_element_iterator end_el =
64 nonlin_sys.get_mesh().active_local_elements_end();
67 std::vector<libMesh::dof_id_type>
69 std::set<libMesh::dof_id_type>
71 constrained_dof_indices;
75 constrain_elem =
true;
79 vec = RealVectorX::Zero(1);
86 for ( ; el != end_el; ++el) {
88 const libMesh::Elem* elem = *el;
90 nonlin_sys.get_mesh().max_elem_id(),
91 nonlin_sys.get_mesh().max_node_id());
93 nd_vals.setZero(elem->n_nodes());
94 for (
unsigned int i=0; i<elem->n_nodes(); i++) {
95 _indicator(elem->node_ref(i), nonlin_sys.time, vec);
104 if (nd_vals.maxCoeff() > tol)
105 constrain_elem =
false;
107 constrain_elem =
true;
116 exclude_elem =
false;
121 if (constrain_elem || exclude_elem) {
124 dof_map.dof_indices(elem, dof_indices);
127 for (
unsigned int i=0; i<dof_indices.size(); i++)
128 constrained_dof_indices.insert(dof_indices[i]);
131 for (
unsigned int i=0; i<dof_indices.size(); i++)
132 exclude_dof_indices.insert(dof_indices[i]);
142 std::set<libMesh::dof_id_type>::const_iterator
143 dof_it = constrained_dof_indices.begin(),
144 dof_end = constrained_dof_indices.end();
146 for ( ; dof_it != dof_end; dof_it++) {
150 if (!dof_map.is_constrained_dof(*dof_it) &&
151 !exclude_dof_indices.count(*dof_it)) {
153 libMesh::DofConstraintRow c_row;
154 dof_map.add_constraint_row(*dof_it, c_row,
true);
MAST::SystemInitialization & _sys
MAST::FieldFunction< Real > & _level_set
MAST::NonlinearSystem & system()
constrains the dofs based on level set function.
This class implements a system for solution of nonlinear systems.
void init(const MAST::FieldFunction< Real > &phi, const libMesh::Elem &e, const Real t, unsigned int max_elem_id, unsigned int max_node_id)
virtual void constrain()
provides implementation of the libMesh::System::Constraint::constrain() virtual method ...
MAST::FieldFunction< RealVectorX > & _indicator
MAST::LevelSetIntersection * _intersection
Matrix< Real, Dynamic, 1 > RealVectorX
bool if_elem_has_boundary() const
IndicatorFunctionConstrainDofs(MAST::SystemInitialization &sys, MAST::FieldFunction< Real > &level_set, MAST::FieldFunction< RealVectorX > &indicator)
virtual void constrain()
provides implementation of the libMesh::System::Constraint::constrain() virtual method ...
void clear()
clears the data structures
virtual ~IndicatorFunctionConstrainDofs()