PRISMS-PF  v2.1
computeLHS.cc
Go to the documentation of this file.
1 //vmult() and getLHS() method for MatrixFreePDE class
2 
3 #include "../../include/matrixFreePDE.h"
4 
5 //vmult operation for LHS
6 template <int dim, int degree>
8  //log time
9  computing_timer.enter_section("matrixFreePDE: computeLHS");
10 
11  //create temporary copy of src vector as src2, as vector src is marked const and cannot be changed
12  dealii::parallel::distributed::Vector<double> src2;
13  matrixFreeObject.initialize_dof_vector(src2, currentFieldIndex);
14  src2=src;
15 
16  //call cell_loop
17  dst=0.0;
18  if (!generatingInitialGuess){
19  matrixFreeObject.cell_loop (&MatrixFreePDE<dim,degree>::getLHS, this, dst, src2);
20  }
21  else {
22  matrixFreeObject.cell_loop (&MatrixFreePDE<dim,degree>::getLaplaceLHS, this, dst, src2);
23  }
24 
25  //Account for Dirichlet BC's (essentially copy dirichlet DOF values present in src to dst, although it is unclear why the constraints can't just be distributed here)
26  for (std::map<types::global_dof_index, double>::const_iterator it=valuesDirichletSet[currentFieldIndex]->begin(); it!=valuesDirichletSet[currentFieldIndex]->end(); ++it){
27  if (dst.in_local_range(it->first)){
28  dst(it->first) = src(it->first); //*jacobianDiagonal(it->first);
29  }
30  }
31 
32  //end log
33  computing_timer.exit_section("matrixFreePDE: computeLHS");
34 }
35 
36 template <int dim, int degree>
37 void MatrixFreePDE<dim,degree>::getLHS(const MatrixFree<dim,double> &data,
38  vectorType &dst,
39  const vectorType &src,
40  const std::pair<unsigned int,unsigned int> &cell_range) const{
41 
42  variableContainer<dim,degree,dealii::VectorizedArray<double> > variable_list(data,userInputs.varInfoListLHS,userInputs.varChangeInfoListLHS);
43 
44  //loop over cells
45  for (unsigned int cell=cell_range.first; cell<cell_range.second; ++cell){
46 
47  // Initialize, read DOFs, and set evaulation flags for each variable
48  //variable_list.reinit_and_eval_LHS(src,solutionSet,cell,currentFieldIndex);
49  variable_list.reinit_and_eval(solutionSet,cell);
50  variable_list.reinit_and_eval_change_in_solution(src,cell,currentFieldIndex);
51 
52  unsigned int num_q_points = variable_list.get_num_q_points();
53 
54  //loop over quadrature points
55  for (unsigned int q=0; q<num_q_points; ++q){
56  variable_list.q_point = q;
57 
58  dealii::Point<dim, dealii::VectorizedArray<double> > q_point_loc = variable_list.get_q_point_location();
59 
60  // Calculate the residuals
61  equationLHS(variable_list,q_point_loc);
62 
63  }
64 
65  // Integrate the residuals and distribute from local to global
66  variable_list.integrate_and_distribute_change_in_solution_LHS(dst,currentFieldIndex);
67 
68  }
69 }
70 
71 #include "../../include/matrixFreePDE_template_instantiations.h"
void reinit_and_eval_change_in_solution(const vectorType &src, unsigned int cell, unsigned int var_being_solved)
void vmult(vectorType &dst, const vectorType &src) const
Definition: computeLHS.cc:7
void integrate_and_distribute_change_in_solution_LHS(vectorType &dst, const unsigned int var_being_solved)
unsigned int q_point
dealii::parallel::distributed::Vector< double > vectorType
Definition: FloodFiller.h:15
void reinit_and_eval(const std::vector< vectorType *> &src, unsigned int cell)
unsigned int get_num_q_points()
dealii::Point< dim, T > get_q_point_location()
void getLHS(const MatrixFree< dim, double > &data, vectorType &dst, const vectorType &src, const std::pair< unsigned int, unsigned int > &cell_range) const
Definition: computeLHS.cc:37