typedef map<unsigned char,Function<dim>* > DirichletBC;
/**
- * Constructor. Use this triangulation and
+ * Constructor.
+ */
+ ProblemBase ();
+
+ /**
+ * Use this triangulation and
* degree of freedom object during the
* lifetime of this object. The dof
* object must refer to the given
* triangulation.
*/
- ProblemBase (Triangulation<dim> *tria,
- DoFHandler<dim> *dof_handler);
+ void set_tria_and_dof (Triangulation<dim> *tria,
+ DoFHandler<dim> *dof_handler);
/**
* Destructor. Declare this only to have
* Exception
*/
DeclException0 (ExcInvalidBoundaryIndicator);
+ /**
+ * Exception
+ */
+ DeclException0 (ExcNoTriaSelected);
protected:
/**
template <int dim>
-ProblemBase<dim>::ProblemBase (Triangulation<dim> *tria,
- DoFHandler<dim> *dof) :
- tria(tria),
- dof_handler(dof),
+ProblemBase<dim>::ProblemBase () :
+ tria(0),
+ dof_handler(0),
system_sparsity(1,1,1), // dummy initialisation, is later reinit'd
system_matrix() // dummy initialisation, is later reinit'd
-{
- Assert (tria == &dof->get_tria(), ExcDofAndTriaDontMatch());
+{};
+
+
+
+template <int dim>
+void ProblemBase<dim>::set_tria_and_dof (Triangulation<dim> *t,
+ DoFHandler<dim> *d) {
+ tria = t;
+ dof_handler = d;
+
+ Assert ((tria!=0) && (dof_handler!=0), ExcNoTriaSelected());
+ Assert (tria == &dof_handler->get_tria(), ExcDofAndTriaDontMatch());
};
const FiniteElement<dim> &fe,
const FEValues<dim>::UpdateStruct &update_flags,
const DirichletBC &dirichlet_bc) {
+ Assert ((tria!=0) && (dof_handler!=0), ExcNoTriaSelected());
+
system_sparsity.reinit (dof_handler->n_dofs(),
dof_handler->n_dofs(),
dof_handler->max_couplings_between_dofs());
template <int dim>
void ProblemBase<dim>::solve () {
+ Assert ((tria!=0) && (dof_handler!=0), ExcNoTriaSelected());
+
int max_iter = 4000;
double tolerance = 1.e-16;
const Quadrature<dim> &q,
const FiniteElement<dim> &fe,
const NormType &norm) const {
+ Assert ((tria!=0) && (dof_handler!=0), ExcNoTriaSelected());
Assert (fe == dof_handler->get_selected_fe(), ExcInvalidFE());
difference.erase (difference.begin(), difference.end());
template <int dim>
void ProblemBase<dim>::fill_data (DataOut<dim> &out) const {
+ Assert ((tria!=0) && (dof_handler!=0), ExcNoTriaSelected());
+
out.clear_data_vectors ();
out.attach_dof_handler (*dof_handler);
dVector &solution,
dVector &right_hand_side,
const DirichletBC &dirichlet_bc) {
+ Assert ((tria!=0) && (dof_handler!=0), ExcNoTriaSelected());
Assert (dirichlet_bc.find(255) == dirichlet_bc.end(),
ExcInvalidBoundaryIndicator());
void
ProblemBase<1>::make_boundary_value_list (const DirichletBC &,
map<int,double> &) const {
+ Assert ((tria!=0) && (dof_handler!=0), ExcNoTriaSelected());
Assert (false, ExcNotImplemented());
};
void
ProblemBase<dim>::make_boundary_value_list (const DirichletBC &dirichlet_bc,
map<int,double> &boundary_values) const {
+ Assert ((tria!=0) && (dof_handler!=0), ExcNoTriaSelected());
+
DoFHandler<dim>::active_face_iterator face = dof_handler->begin_active_face(),
endf = dof_handler->end_face();
DirichletBC::const_iterator function_ptr;
face->get_dof_indices (face_dofs);
//physical location
- Assert (false, ExcNotImplemented());
-
+// Assert (false, ExcNotImplemented());
+ dof_locations.insert (dof_locations.begin(),
+ face_dofs.size(), Point<dim>());
+
(*function_ptr).second->value_list (dof_locations, dof_values);
// enter into list
- for (unsigned int i=0; i<face_dofs.size(); ++i)
+ for (unsigned int i=0; i<face_dofs.size(); ++i)
boundary_values[face_dofs[i]] = dof_values[i];
};
};